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]);
});

View File

@ -148,6 +148,39 @@
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.production_item",
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Name",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
@ -1675,7 +1708,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-12-13 15:33:12.490710",
"modified": "2019-02-05 03:02:39.126868",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Work Order",

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()