[minor] [bom] allow updating cost even after submit
diff --git a/manufacturing/doctype/bom/bom.js b/manufacturing/doctype/bom/bom.js
index ce246d9..87bc4aa 100644
--- a/manufacturing/doctype/bom/bom.js
+++ b/manufacturing/doctype/bom/bom.js
@@ -18,10 +18,9 @@
cur_frm.cscript.refresh = function(doc,dt,dn){
cur_frm.toggle_enable("item", doc.__islocal);
- if (!doc.__islocal && doc.docstatus==0) {
- cur_frm.set_intro("Submit the BOM to use it for manufacturing or repacking.");
+ if (!doc.__islocal && doc.docstatus<2) {
cur_frm.add_custom_button("Update Cost", cur_frm.cscript.update_cost);
- } else cur_frm.set_intro("");
+ }
cur_frm.cscript.with_operations(doc);
set_operation_no(doc);
diff --git a/manufacturing/doctype/bom/bom.py b/manufacturing/doctype/bom/bom.py
index e4c81ff..15f59ec 100644
--- a/manufacturing/doctype/bom/bom.py
+++ b/manufacturing/doctype/bom/bom.py
@@ -144,8 +144,12 @@
'qty': d.qty
})["rate"]
- self.on_update()
-
+ if self.doc.docstatus == 0:
+ webnotes.bean(self.doclist).save()
+ elif self.doc.docstatus == 1:
+ self.calculate_cost()
+ self.update_exploded_items()
+ webnotes.bean(self.doclist).update_after_submit()
def get_bom_unitcost(self, bom_no):
bom = sql("""select name, total_cost/quantity as unit_cost from `tabBOM`