From 471b69f1f547130db9b2c1dc7f10ff952d649a72 Mon Sep 17 00:00:00 2001 From: hichamlahlou Date: Tue, 18 Feb 2025 22:17:04 +0100 Subject: [PATCH] fix case with variants having the same code (only one is pulled) --- frepple/controllers/outbound.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/frepple/controllers/outbound.py b/frepple/controllers/outbound.py index 1534e60..8a8a1d3 100644 --- a/frepple/controllers/outbound.py +++ b/frepple/controllers/outbound.py @@ -1222,18 +1222,26 @@ def export_items(self): if i["product_tmpl_id"][0] not in self.product_templates: continue tmpl = self.product_templates[i["product_tmpl_id"][0]] - if i["code"]: + # generate variant name and description in frepple + if i["product_template_attribute_value_ids"]: + if use_short_names: + name = (i["code"])[:300] + description = i["name"][:500] + else: + name = ( + (("[%s] %s %s" % (i["code"], i["name"], i["id"]))[:300]) + if i["code"] + else "%s %s" % (i["name"], i["id"])[:300] + ) + description = None + # generate name and description for non-variant products + elif i["code"]: name = ( (("[%s] %s" % (i["code"], i["name"]))[:300]) if not use_short_names else i["code"][:300] ) description = i["name"][:500] if use_short_names else None - # product is a variant and has no internal reference - # we use the product id as code - elif i["product_template_attribute_value_ids"]: - name = ("[%s] %s" % (i["id"], i["name"]))[:300] - description = i["name"][:500] if use_short_names else None else: name = i["name"][:300] description = i["name"][:500] if use_short_names else None