From fe5ca1744de63e98357c1a2f247479184bb374e9 Mon Sep 17 00:00:00 2001 From: Anna Janiszewska Date: Mon, 17 Jun 2024 10:41:07 +0200 Subject: [PATCH] [IMP] product_import, product_import_ubl: add sale_delay --- product_import/tests/test_product_import.py | 5 +++++ product_import/wizard/product_import.py | 2 ++ product_import_ubl/wizard/product_import.py | 3 +++ 3 files changed, 10 insertions(+) diff --git a/product_import/tests/test_product_import.py b/product_import/tests/test_product_import.py index 408780a716..953850796b 100644 --- a/product_import/tests/test_product_import.py +++ b/product_import/tests/test_product_import.py @@ -30,6 +30,7 @@ "price": 12.55, "product_code": "MNTR011", "uom": {"unece_code": False}, + "sale_delay": 3, }, { # Archived product @@ -45,6 +46,7 @@ "product_code": "MNTR012", "uom": {"unece_code": "C62"}, "active": False, + "sale_delay": 1, }, ], "ref": "1387", @@ -136,6 +138,9 @@ def test_product_import(self): self.assertEqual(p_values, expected) self.assertEqual(pt_values, expected) self.assertEqual(product.seller_ids, product_tmpl.seller_ids) + self.assertEqual( + product.seller_ids.mapped("delay")[0], parsed.get("sale_delay", 0) + ), def test_import_button(self): form = self.wiz_form diff --git a/product_import/wizard/product_import.py b/product_import/wizard/product_import.py index ef89714b4c..cbf1c13002 100644 --- a/product_import/wizard/product_import.py +++ b/product_import/wizard/product_import.py @@ -139,6 +139,7 @@ def _prepare_supplierinfo(self, seller_info, product): and s_info.price == seller_info["price"] and s_info.currency_id.id == seller_info["currency_id"] and s_info.company_id.id == seller_info["company_id"] + and s_info.delay == seller_info["delay"] ): seller_id = s_info.id else: @@ -187,6 +188,7 @@ def _prepare_product(self, parsed_product, chatter_msg, seller=None): "currency_id": currency.id, "min_qty": parsed_product["min_qty"], "company_id": product_company_id, + "delay": parsed_product.get("sale_delay", 0), } product_vals["seller_ids"] = self._prepare_supplierinfo(seller_info, product) if product: diff --git a/product_import_ubl/wizard/product_import.py b/product_import_ubl/wizard/product_import.py index 9efce24940..246536ff93 100644 --- a/product_import_ubl/wizard/product_import.py +++ b/product_import_ubl/wizard/product_import.py @@ -90,6 +90,9 @@ def parse_ubl_catalogue_line(self, line, ns): "price": float(ele_price.text or 0), "currency": {"iso": currency} if currency else False, "min_qty": min_qty, + "sale_delay": xline.text( + "cac:RequiredItemLocationQuantity/cbc:LeadTimeMeasure" + ), } ) return product_vals