fix(work_order): Change Work Order title to show item name instead of item code

This commit is contained in:
Rohan Bansal 2019-02-04 17:52:51 +05:30
parent 2221151132
commit b4745ec668
5 changed files with 1674 additions and 1627 deletions

View File

@ -303,8 +303,9 @@ frappe.ui.form.on("Work Order", {
frm.set_value('sales_order', "");
frm.trigger('set_sales_order');
erpnext.in_production_item_onchange = true;
$.each(["description", "stock_uom", "project", "bom_no",
"allow_alternative_item", "transfer_material_against"], function(i, field) {
$.each(["description", "stock_uom", "project", "bom_no", "allow_alternative_item",
"transfer_material_against", "item_name"], function(i, field) {
frm.set_value(field, r.message[field]);
});

File diff suppressed because it is too large Load Diff

View File

@ -568,11 +568,10 @@ def get_item_details(item, project = None):
frappe.throw(_("Default BOM for {0} not found").format(item))
bom_data = frappe.db.get_value('BOM', res['bom_no'],
['project', 'allow_alternative_item', 'transfer_material_against'], as_dict=1)
['project', 'allow_alternative_item', 'transfer_material_against', 'item_name'], as_dict=1)
res['project'] = project or bom_data.project
res['allow_alternative_item'] = bom_data.allow_alternative_item
res['transfer_material_against'] = bom_data.transfer_material_against
res['project'] = project or bom_data.pop("project")
res.update(bom_data)
res.update(check_if_scrap_warehouse_mandatory(res["bom_no"]))
return res

1
erpnext/patches.txt Normal file → Executable file
View File

@ -586,3 +586,4 @@ erpnext.patches.v11_0.remove_barcodes_field_from_copy_fields_to_variants
erpnext.patches.v12_0.set_task_status
erpnext.patches.v10_0.item_barcode_childtable_migrate # 16-02-2019
erpnext.patches.v11_0.make_italian_localization_fields # 01-03-2019
erpnext.patches.v12_0.add_item_name_in_work_orders

View File

@ -0,0 +1,13 @@
import frappe
def execute():
frappe.reload_doc("manufacturing", "doctype", "work_order")
for wo in frappe.get_all("Work Order"):
item_code = frappe.db.get_value("Work Order", wo.name, "production_item")
item_name = frappe.db.get_value("Item", item_code, "item_name")
frappe.db.set_value("Work Order", wo.name, "item_name", item_name, update_modified=False)
frappe.db.commit()