From de7b87ee3a11e7b825fd9772457e677d52774f7e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 21 May 2015 12:45:30 +0530 Subject: [PATCH] [fix] operations and bom --- erpnext/manufacturing/doctype/bom/bom.js | 1 - .../production_order/production_order.js | 26 ++++++++++--------- .../production_order_operation.json | 4 +-- erpnext/patches.txt | 1 + .../stock/doctype/stock_entry/stock_entry.js | 4 +-- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js index 699b272f23..c6e5bf0a3e 100644 --- a/erpnext/manufacturing/doctype/bom/bom.js +++ b/erpnext/manufacturing/doctype/bom/bom.js @@ -35,7 +35,6 @@ cur_frm.cscript.hour_rate = function(doc, dt, dn) { } cur_frm.cscript.time_in_mins = cur_frm.cscript.hour_rate; -cur_frm.cscript.fixed_cycle_cost = cur_frm.cscript.hour_rate; cur_frm.cscript.item_code = function(doc, cdt, cdn) { get_bom_material_detail(doc, cdt, cdn); diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js index 3781450d36..17fbc5e235 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.js +++ b/erpnext/manufacturing/doctype/production_order/production_order.js @@ -35,18 +35,20 @@ frappe.ui.form.on("Production Order", "additional_operating_cost", function(frm) frappe.ui.form.on("Production Order Operation", "workstation", function(frm, cdt, cdn) { var d = locals[cdt][cdn]; - frappe.call({ - "method": "frappe.client.get", - args: { - doctype: "Workstation", - name: d.workstation - }, - callback: function (data) { - frappe.model.set_value(d.doctype, d.name, "hour_rate", data.message.hour_rate); - erpnext.production_order.calculate_cost(frm.doc); - erpnext.production_order.calculate_total_cost(frm); - } - }) + if (d.workstation) { + frappe.call({ + "method": "frappe.client.get", + args: { + doctype: "Workstation", + name: d.workstation + }, + callback: function (data) { + frappe.model.set_value(d.doctype, d.name, "hour_rate", data.message.hour_rate); + erpnext.production_order.calculate_cost(frm.doc); + erpnext.production_order.calculate_total_cost(frm); + } + }) + } }); frappe.ui.form.on("Production Order Operation", "time_in_mins", function(frm, cdt, cdn) { diff --git a/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json b/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json index 83134853e2..c57d848a4b 100644 --- a/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json +++ b/erpnext/manufacturing/doctype/production_order_operation/production_order_operation.json @@ -33,7 +33,7 @@ "print_hide": 0, "read_only": 1, "report_hide": 0, - "reqd": 1, + "reqd": 0, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -293,7 +293,7 @@ "is_submittable": 0, "issingle": 0, "istable": 1, - "modified": "2015-04-22 03:25:18.542350", + "modified": "2015-05-21 13:46:27.730392", "modified_by": "Administrator", "module": "Manufacturing", "name": "Production Order Operation", diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 2990ab0f1a..85adbee88f 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -156,3 +156,4 @@ erpnext.patches.v5_0.repost_requested_qty erpnext.patches.v5_0.fix_taxes_and_totals_in_party_currency erpnext.patches.v5_0.update_tax_amount_after_discount_in_purchase_cycle erpnext.patches.v5_0.rename_pos_setting +execute:frappe.db.sql("update `tabBOM Operation` set description=opn_description where ifnull(description, '') = ''") diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 4670ff81e0..c7810fd039 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -446,9 +446,9 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) { callback: function(r) { if(r.message) { $.each(r.message, function(k, v) { - frappe.model.set_value(cdt, cdn, k, v); + d[k] = v; }); - refresh_field('image_view', d.name, 'items'); + refresh_field('items'); } } });