Merge pull request #2594 from neilLasrado/bom-item-update
bom - button added to update item desc.
This commit is contained in:
commit
4b4598e5cb
@ -9,6 +9,9 @@ cur_frm.cscript.refresh = function(doc,dt,dn){
|
|||||||
if (!doc.__islocal && doc.docstatus<2) {
|
if (!doc.__islocal && doc.docstatus<2) {
|
||||||
cur_frm.add_custom_button(__("Update Cost"), cur_frm.cscript.update_cost,
|
cur_frm.add_custom_button(__("Update Cost"), cur_frm.cscript.update_cost,
|
||||||
"icon-money", "btn-default");
|
"icon-money", "btn-default");
|
||||||
|
|
||||||
|
cur_frm.add_custom_button(__("Update Item Description"), cur_frm.cscript.update_item_desc,
|
||||||
|
"icon-tag", "btn-default");
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.with_operations(doc);
|
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.cscript.with_operations = function(doc) {
|
||||||
cur_frm.fields_dict["items"].grid.set_column_disp("operation", doc.with_operations);
|
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);
|
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.ignore_validate_update_after_submit = True
|
||||||
self.calculate_cost()
|
self.calculate_cost()
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
|
def update_item_desc(self):
|
||||||
|
if self.docstatus < 2:
|
||||||
|
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):
|
def get_bom_unitcost(self, bom_no):
|
||||||
bom = frappe.db.sql("""select name, total_cost/quantity as unit_cost from `tabBOM`
|
bom = frappe.db.sql("""select name, total_cost/quantity as unit_cost from `tabBOM`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user