[Fix] BOM update tool, too many writes in one request. Please send smaller requests (#15432)
This commit is contained in:
parent
fe1e4a41e6
commit
fafc277666
@ -506,7 +506,7 @@ def save_invoice(doc, name, name_list):
|
||||
frappe.db.commit()
|
||||
name_list.append(name)
|
||||
except Exception:
|
||||
frappe.log_error(frappe.get_traceback())
|
||||
frappe.db.rollback()
|
||||
frappe.log_error(frappe.get_traceback())
|
||||
|
||||
return name_list
|
||||
|
@ -16,7 +16,9 @@ class BOMUpdateTool(Document):
|
||||
self.update_new_bom()
|
||||
bom_list = self.get_parent_boms(self.new_bom)
|
||||
updated_bom = []
|
||||
|
||||
for bom in bom_list:
|
||||
try:
|
||||
bom_obj = frappe.get_doc("BOM", bom)
|
||||
bom_obj.get_doc_before_save()
|
||||
updated_bom = bom_obj.update_cost_and_exploded_items(updated_bom)
|
||||
@ -27,6 +29,11 @@ class BOMUpdateTool(Document):
|
||||
and bom_obj._doc_before_save and not bom_obj.flags.ignore_version):
|
||||
bom_obj.save_version()
|
||||
|
||||
frappe.db.commit()
|
||||
except Exception:
|
||||
frappe.db.rollback()
|
||||
frappe.log_error(frappe.get_traceback())
|
||||
|
||||
def validate_bom(self):
|
||||
if cstr(self.current_bom) == cstr(self.new_bom):
|
||||
frappe.throw(_("Current BOM and New BOM can not be same"))
|
||||
|
Loading…
Reference in New Issue
Block a user