bom - button added to update item desc.
This commit is contained in:
parent
938ed1a57d
commit
f1f0a8ac19
@ -9,6 +9,9 @@ cur_frm.cscript.refresh = function(doc,dt,dn){
|
||||
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 Item"), cur_frm.cscript.update_item_desc,
|
||||
"icon-tag", "btn-default");
|
||||
}
|
||||
|
||||
cur_frm.cscript.with_operations(doc);
|
||||
@ -25,6 +28,16 @@ cur_frm.cscript.update_cost = function() {
|
||||
})
|
||||
}
|
||||
|
||||
cur_frm.cscript.update_item_desc = function() {
|
||||
return frappe.call({
|
||||
doc: cur_frm.doc,
|
||||
method: "update_item_desc",
|
||||
callback: function(r) {
|
||||
if(!r.exc) cur_frm.refresh_fields();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
cur_frm.cscript.with_operations = function(doc) {
|
||||
cur_frm.fields_dict["items"].grid.set_column_disp("operation", doc.with_operations);
|
||||
cur_frm.fields_dict["items"].grid.toggle_reqd("operation", doc.with_operations);
|
||||
|
@ -132,6 +132,16 @@ class BOM(Document):
|
||||
self.ignore_validate_update_after_submit = True
|
||||
self.calculate_cost()
|
||||
self.save()
|
||||
|
||||
def update_item_desc(self):
|
||||
if self.docstatus == 1:
|
||||
self.ignore_validate_update_after_submit = True
|
||||
self.description = frappe.db.get_value("Item", self.item, "description")
|
||||
for d in self.get("items"):
|
||||
d.description = frappe.db.get_value("Item", d.item_code, "description")
|
||||
for d in self.get("exploded_items"):
|
||||
d.description = frappe.db.get_value("Item", d.item_code, "description")
|
||||
self.save()
|
||||
|
||||
def get_bom_unitcost(self, bom_no):
|
||||
bom = frappe.db.sql("""select name, total_cost/quantity as unit_cost from `tabBOM`
|
||||
|
Loading…
Reference in New Issue
Block a user