From 4395a6b371d4169bfd181843a3934173035a8210 Mon Sep 17 00:00:00 2001 From: David Franco Date: Fri, 18 Aug 2023 06:39:26 +0000 Subject: [PATCH] Pull request #12: CAD-1153 correct some method to recover the information Merge in SITC/adobe-reports from CAD-1153-p1-find-in-the-active-assets-reports-the-new-columns to master Squashed commit of the following: commit d47c243f742952c9fd4c7109938ec3cce0f35f0b Author: David Franco Date: Fri Aug 18 08:33:53 2023 +0200 CAD-1153 correct some method to recover the information --- reports/requests/entrypoint.py | 4 +++- reports/utils.py | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/reports/requests/entrypoint.py b/reports/requests/entrypoint.py index b0f1cf6..694098b 100644 --- a/reports/requests/entrypoint.py +++ b/reports/requests/entrypoint.py @@ -93,7 +93,9 @@ def generate(client, parameters, progress_callback, renderer_type=None, extra_co def _get_delta_str(item): if (utils.get_basic_value(item, 'item_type') != 'PPU' - and utils.get_basic_value(item, 'quantity') != '0'): + and (utils.get_basic_value(item, 'quantity') != '0' + or utils.get_basic_value(item, 'old_quantity') != '0') + ): delta = 0 delta_str = '-' if len(item['quantity']) > 0 and len(item['old_quantity']) > 0: diff --git a/reports/utils.py b/reports/utils.py index 8b51977..d80376b 100644 --- a/reports/utils.py +++ b/reports/utils.py @@ -260,7 +260,10 @@ def get_base_currency_financials(financials_and_seats: dict, currency: dict) -> def get_financials_from_product_per_marketplace(client, marketplace_id, asset_id): listing = api_calls.request_listing(client, marketplace_id, asset_id) price_list_points = [] - if listing and listing['pricelist']: - price_list_version = api_calls.request_price_list(client, listing['pricelist']['id']) - price_list_points = api_calls.request_price_list_version_points(client, price_list_version['id']) + try: + if listing and listing['pricelist']: + price_list_version = api_calls.request_price_list(client, listing['pricelist']['id']) + price_list_points = api_calls.request_price_list_version_points(client, price_list_version['id']) + except: + return {} return get_financials_from_price_list(price_list_points)