Fixes in merge functions
This commit is contained in:
parent
a888e29b0a
commit
4b5ced03ec
@ -211,6 +211,9 @@ class DocType:
|
|||||||
|
|
||||||
# Validate properties before merging
|
# Validate properties before merging
|
||||||
if merge:
|
if merge:
|
||||||
|
if not webnotes.conn.exists("Account", new):
|
||||||
|
webnotes.throw(_("Account ") + new +_(" does not exists"))
|
||||||
|
|
||||||
val = list(webnotes.conn.get_value("Account", new_account,
|
val = list(webnotes.conn.get_value("Account", new_account,
|
||||||
["group_or_ledger", "debit_or_credit", "is_pl_account"]))
|
["group_or_ledger", "debit_or_credit", "is_pl_account"]))
|
||||||
|
|
||||||
|
@ -246,6 +246,9 @@ class DocType(DocListController, WebsiteGenerator):
|
|||||||
def before_rename(self, olddn, newdn, merge=False):
|
def before_rename(self, olddn, newdn, merge=False):
|
||||||
if merge:
|
if merge:
|
||||||
# Validate properties before merging
|
# Validate properties before merging
|
||||||
|
if not webnotes.conn.exists("Item", newdn):
|
||||||
|
webnotes.throw(_("Item ") + newdn +_(" does not exists"))
|
||||||
|
|
||||||
field_list = ["stock_uom", "is_stock_item", "has_serial_no", "has_batch_no"]
|
field_list = ["stock_uom", "is_stock_item", "has_serial_no", "has_batch_no"]
|
||||||
new_properties = [cstr(d) for d in webnotes.conn.get_value("Item", newdn, field_list)]
|
new_properties = [cstr(d) for d in webnotes.conn.get_value("Item", newdn, field_list)]
|
||||||
if new_properties != [cstr(self.doc.fields[fld]) for fld in field_list]:
|
if new_properties != [cstr(self.doc.fields[fld]) for fld in field_list]:
|
||||||
|
@ -84,6 +84,9 @@ class DocType:
|
|||||||
new_warehouse = get_name_with_abbr(newdn, self.doc.company)
|
new_warehouse = get_name_with_abbr(newdn, self.doc.company)
|
||||||
|
|
||||||
if merge:
|
if merge:
|
||||||
|
if not webnotes.conn.exists("Warehouse", newdn):
|
||||||
|
webnotes.throw(_("Warehouse ") + newdn +_(" does not exists"))
|
||||||
|
|
||||||
if self.doc.company != webnotes.conn.get_value("Warehouse", new_warehouse, "company"):
|
if self.doc.company != webnotes.conn.get_value("Warehouse", new_warehouse, "company"):
|
||||||
webnotes.throw(_("Both Warehouse must belong to same Company"))
|
webnotes.throw(_("Both Warehouse must belong to same Company"))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user