fix: warehouse naming when suffix is present (#30621)
This commit is contained in:
parent
a6e26cce87
commit
be04eaf723
@ -38,6 +38,16 @@ class TestWarehouse(FrappeTestCase):
|
||||
self.assertEqual(p_warehouse.name, child_warehouse.parent_warehouse)
|
||||
self.assertEqual(child_warehouse.is_group, 0)
|
||||
|
||||
def test_naming(self):
|
||||
company = "Wind Power LLC"
|
||||
warehouse_name = "Named Warehouse - WP"
|
||||
wh = frappe.get_doc(doctype="Warehouse", warehouse_name=warehouse_name, company=company).insert()
|
||||
self.assertEqual(wh.name, warehouse_name)
|
||||
|
||||
warehouse_name = "Unnamed Warehouse"
|
||||
wh = frappe.get_doc(doctype="Warehouse", warehouse_name=warehouse_name, company=company).insert()
|
||||
self.assertIn(warehouse_name, wh.name)
|
||||
|
||||
def test_unlinking_warehouse_from_item_defaults(self):
|
||||
company = "_Test Company"
|
||||
|
||||
|
@ -21,8 +21,9 @@ class Warehouse(NestedSet):
|
||||
suffix = " - " + frappe.get_cached_value("Company", self.company, "abbr")
|
||||
if not self.warehouse_name.endswith(suffix):
|
||||
self.name = self.warehouse_name + suffix
|
||||
else:
|
||||
self.name = self.warehouse_name
|
||||
return
|
||||
|
||||
self.name = self.warehouse_name
|
||||
|
||||
def onload(self):
|
||||
"""load account name for General Ledger Report"""
|
||||
|
Loading…
Reference in New Issue
Block a user