From feaafe19419262b3770854fc868649c2cbd51b5e Mon Sep 17 00:00:00 2001 From: bosd Date: Fri, 16 Sep 2022 09:29:09 +0200 Subject: [PATCH] Always add tax and product dict --- .../wizard/account_invoice_import.py | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/account_invoice_import_invoice2data/wizard/account_invoice_import.py b/account_invoice_import_invoice2data/wizard/account_invoice_import.py index 3b91f922630..c225ada76ab 100644 --- a/account_invoice_import_invoice2data/wizard/account_invoice_import.py +++ b/account_invoice_import_invoice2data/wizard/account_invoice_import.py @@ -96,30 +96,30 @@ def invoice2data_to_parsed_inv(self, invoice2data_res): for line in lines: # Manipulate line data to match with account_invoice_import line["price_unit"] = float(line.get("price_unit", 0)) - # qty 0 should be allowed to import notes, but nut supported by document_import + taxes = self.parse_invoice2data_taxes(line) + line["taxes"] = taxes # or global_taxes, + product_dict = { + "barcode": line.get("barcode"), + "code": line.get("code"), + } + line["product"] = product_dict + if line.get("date_start"): + line["date_start"] = line.get("date_start") + line["date_end"] = line.get("date_end") + if line.get("line_note"): + line["line_note"] = line.get("line_note") + line["sectionheader"] = line.get("sectionheader") + # qty 0 should be allowed to import notes, but not supported by document_import line["qty"] = float(line.get("qty", 1)) if line["qty"] > 0: - taxes = self.parse_invoice2data_taxes(line) - line["taxes"] = taxes # or global_taxes, - product_dict = { - "barcode": line.get("barcode"), - "code": line.get("code"), - } - line["product"] = product_dict uom_dict = { "unece_code": line.get("unece_code"), "name": line.get("uom"), } line["uom"] = uom_dict - if line.get("date_start"): - line["date_start"] = line.get("date_start") - line["date_end"] = line.get("date_end") line["discount"] = float(line.get("discount", 0.0)) if line.get("price_subtotal"): line["price_subtotal"] = line.get("price_subtotal") - if line.get("line_note"): - line["line_note"] = line.get("line_note") - line["sectionheader"] = line.get("sectionheader") parsed_inv = { "partner": {