Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] product_import, product_import_ubl: add sale_delay #1001

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions product_import/tests/test_product_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"price": 12.55,
"product_code": "MNTR011",
"uom": {"unece_code": False},
"sale_delay": 3,
},
{
# Archived product
Expand All @@ -45,6 +46,7 @@
"product_code": "MNTR012",
"uom": {"unece_code": "C62"},
"active": False,
"sale_delay": 1,
},
],
"ref": "1387",
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions product_import/wizard/product_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions product_import_ubl/wizard/product_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading