Merge pull request #17337 from nabinhait/travis-fix-dev
fix: Load doc before save
This commit is contained in:
commit
5e0bc20ab8
@ -20,13 +20,12 @@ class BOMUpdateTool(Document):
|
|||||||
for bom in bom_list:
|
for bom in bom_list:
|
||||||
try:
|
try:
|
||||||
bom_obj = frappe.get_doc("BOM", bom)
|
bom_obj = frappe.get_doc("BOM", bom)
|
||||||
bom_obj.get_doc_before_save()
|
bom_obj.load_doc_before_save()
|
||||||
updated_bom = bom_obj.update_cost_and_exploded_items(updated_bom)
|
updated_bom = bom_obj.update_cost_and_exploded_items(updated_bom)
|
||||||
bom_obj.calculate_cost()
|
bom_obj.calculate_cost()
|
||||||
bom_obj.update_parent_cost()
|
bom_obj.update_parent_cost()
|
||||||
bom_obj.db_update()
|
bom_obj.db_update()
|
||||||
if (getattr(bom_obj.meta, 'track_changes', False)
|
if (getattr(bom_obj.meta, 'track_changes', False) and not bom_obj.flags.ignore_version):
|
||||||
and bom_obj._doc_before_save and not bom_obj.flags.ignore_version):
|
|
||||||
bom_obj.save_version()
|
bom_obj.save_version()
|
||||||
|
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
|||||||
@ -90,8 +90,6 @@ class Item(WebsiteGenerator):
|
|||||||
self.set_opening_stock()
|
self.set_opening_stock()
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.get_doc_before_save()
|
|
||||||
|
|
||||||
super(Item, self).validate()
|
super(Item, self).validate()
|
||||||
|
|
||||||
if not self.item_name:
|
if not self.item_name:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user