Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Anand Doshi 2013-07-29 12:29:01 +05:30
commit 354d0bdca8
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.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);

View File

@ -144,8 +144,12 @@ class DocType:
'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`