fix: Check if both old and new items have bundles before merging
- If only one has bundle against it, they can be merged
This commit is contained in:
parent
857ac8c045
commit
a33f04ea41
@ -465,9 +465,11 @@ class Item(Document):
|
|||||||
|
|
||||||
def validate_duplicate_product_bundles_before_merge(self, old_name, new_name):
|
def validate_duplicate_product_bundles_before_merge(self, old_name, new_name):
|
||||||
"Block merge if both old and new items have product bundles."
|
"Block merge if both old and new items have product bundles."
|
||||||
bundle = frappe.get_value("Product Bundle",filters={"new_item_code": old_name})
|
old_bundle = frappe.get_value("Product Bundle",filters={"new_item_code": old_name})
|
||||||
if bundle:
|
new_bundle = frappe.get_value("Product Bundle",filters={"new_item_code": new_name})
|
||||||
bundle_link = get_link_to_form("Product Bundle", bundle)
|
|
||||||
|
if old_bundle and new_bundle:
|
||||||
|
bundle_link = get_link_to_form("Product Bundle", old_bundle)
|
||||||
old_name, new_name = frappe.bold(old_name), frappe.bold(new_name)
|
old_name, new_name = frappe.bold(old_name), frappe.bold(new_name)
|
||||||
|
|
||||||
msg = _("Please delete Product Bundle {0}, before merging {1} into {2}").format(
|
msg = _("Please delete Product Bundle {0}, before merging {1} into {2}").format(
|
||||||
|
@ -397,6 +397,7 @@ class TestItem(ERPNextTestCase):
|
|||||||
create_item("Test Item inside Bundle")
|
create_item("Test Item inside Bundle")
|
||||||
bundle_items = ["Test Item inside Bundle"]
|
bundle_items = ["Test Item inside Bundle"]
|
||||||
|
|
||||||
|
# make bundles for both items
|
||||||
bundle1 = make_product_bundle("Test Item Bundle Item 1", bundle_items, qty=2)
|
bundle1 = make_product_bundle("Test Item Bundle Item 1", bundle_items, qty=2)
|
||||||
make_product_bundle("Test Item Bundle Item 2", bundle_items, qty=2)
|
make_product_bundle("Test Item Bundle Item 2", bundle_items, qty=2)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user