[ux] bom fixes #3072

This commit is contained in:
Rushabh Mehta 2015-04-14 14:24:21 +05:30
parent de9bd108d0
commit 5e7f8fd156
2 changed files with 7 additions and 5 deletions

View File

@ -8,8 +8,7 @@ cur_frm.cscript.refresh = function(doc,dt,dn){
toggle_operations(cur_frm);
if (!doc.__islocal && doc.docstatus<2) {
cur_frm.add_custom_button(__("Update Cost"), cur_frm.cscript.update_cost,
"icon-money", "btn-default");
cur_frm.add_custom_button(__("Update Cost"), cur_frm.cscript.update_cost);
}
}
@ -17,6 +16,7 @@ cur_frm.cscript.update_cost = function() {
return frappe.call({
doc: cur_frm.doc,
method: "update_cost",
freeze: true,
callback: function(r) {
if(!r.exc) cur_frm.refresh_fields();
}

View File

@ -141,6 +141,8 @@ class BOM(Document):
self.calculate_cost()
self.save()
frappe.msgprint(_("Cost Updated"))
def get_bom_unitcost(self, bom_no):
bom = frappe.db.sql("""select name, total_cost/quantity as unit_cost from `tabBOM`
where is_active = 1 and name = %s""", bom_no, as_dict=1)