fix: duplicate name error while making variant

(cherry picked from commit d7e6b83e6432a6c46ce6e374252d25c0438c2205)
This commit is contained in:
Rohit Waghchaure 2024-01-17 20:52:16 +05:30 committed by Mergify
parent 6509548474
commit b649c50ecc

View File

@ -56,7 +56,11 @@ def make_variant_based_on_manufacturer(template, manufacturer, manufacturer_part
copy_attributes_to_variant(template, variant) copy_attributes_to_variant(template, variant)
variant.item_code = append_number_if_name_exists("Item", template.name) variant_name = f"{template.name} - {manufacturer}"
if manufacturer_part_no:
variant_name += f" - {manufacturer_part_no}"
variant.item_code = append_number_if_name_exists("Item", variant_name)
variant.flags.ignore_mandatory = True variant.flags.ignore_mandatory = True
variant.save() variant.save()