Skip to content

Commit

Permalink
Merge pull request #39436 from rohitwaghchaure/fixed-duplicate-name-e…
Browse files Browse the repository at this point in the history
…rror-for-variant-creation

fix: duplicate name error while making variant
  • Loading branch information
rohitwaghchaure authored Jan 18, 2024
2 parents daf9540 + d7e6b83 commit 45aea56
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion erpnext/controllers/item_variant.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ def make_variant_based_on_manufacturer(template, manufacturer, manufacturer_part

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.save()

Expand Down

0 comments on commit 45aea56

Please sign in to comment.