[minor] [bom] allow updating cost even after submit

This commit is contained in:
Nabin Hait 2013-07-29 12:18:32 +05:30
parent 173e874610
commit 9166335649
2 changed files with 8 additions and 5 deletions

View File

@ -18,10 +18,9 @@
cur_frm.cscript.refresh = function(doc,dt,dn){ cur_frm.cscript.refresh = function(doc,dt,dn){
cur_frm.toggle_enable("item", doc.__islocal); cur_frm.toggle_enable("item", doc.__islocal);
if (!doc.__islocal && doc.docstatus==0) { if (!doc.__islocal && doc.docstatus<2) {
cur_frm.set_intro("Submit the BOM to use it for manufacturing or repacking.");
cur_frm.add_custom_button("Update Cost", cur_frm.cscript.update_cost); cur_frm.add_custom_button("Update Cost", cur_frm.cscript.update_cost);
} else cur_frm.set_intro(""); }
cur_frm.cscript.with_operations(doc); cur_frm.cscript.with_operations(doc);
set_operation_no(doc); set_operation_no(doc);

View File

@ -144,8 +144,12 @@ class DocType:
'qty': d.qty 'qty': d.qty
})["rate"] })["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): def get_bom_unitcost(self, bom_no):
bom = sql("""select name, total_cost/quantity as unit_cost from `tabBOM` bom = sql("""select name, total_cost/quantity as unit_cost from `tabBOM`