From e693f794f59895b1dfe87c28d02f6a0f8478fb31 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 3 Mar 2015 15:50:03 +0530 Subject: [PATCH] [subcontract] refactor, make stock entry from PO --- .../purchase_invoice/purchase_invoice.json | 10 +- .../doctype/sales_invoice/sales_invoice.json | 6 +- .../doctype/purchase_order/purchase_order.js | 37 ++++- .../purchase_order/purchase_order.json | 79 +++++----- .../doctype/purchase_order/purchase_order.py | 18 +++ .../purchase_order_item_supplied.json | 55 +++---- erpnext/controllers/buying_controller.py | 8 +- .../stock/doctype/item_price/item_price.json | 12 +- .../purchase_receipt/purchase_receipt.js | 3 + .../purchase_receipt/purchase_receipt.json | 138 +++++++++--------- .../stock/doctype/stock_entry/stock_entry.js | 22 +-- .../doctype/stock_entry/stock_entry.json | 31 +++- .../stock/doctype/stock_entry/stock_entry.py | 41 ++++-- 13 files changed, 275 insertions(+), 185 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 71c2287bbe..820d830f97 100755 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -8,7 +8,7 @@ { "fieldname": "supplier_section", "fieldtype": "Section Break", - "label": "Supplier", + "label": "", "options": "icon-user", "permlevel": 0 }, @@ -315,7 +315,7 @@ { "fieldname": "taxes_section", "fieldtype": "Section Break", - "label": "Taxes and Charges", + "label": "", "oldfieldtype": "Section Break", "options": "icon-money", "permlevel": 0, @@ -655,7 +655,7 @@ { "fieldname": "terms_section_break", "fieldtype": "Section Break", - "label": "Terms and Conditions", + "label": "", "options": "icon-legal", "permlevel": 0 }, @@ -710,7 +710,7 @@ { "fieldname": "more_info", "fieldtype": "Section Break", - "label": "More Info", + "label": "", "oldfieldtype": "Section Break", "options": "icon-file-text", "permlevel": 0, @@ -963,7 +963,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2015-02-24 15:59:49.908324", + "modified": "2015-03-03 02:46:30.118418", "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index b909cb438c..10aac98b5f 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -749,7 +749,7 @@ { "fieldname": "terms_section_break", "fieldtype": "Section Break", - "label": "Terms and Conditions", + "label": "", "oldfieldtype": "Section Break", "options": "icon-legal", "permlevel": 0, @@ -780,7 +780,7 @@ "fieldname": "contact_section", "fieldtype": "Section Break", "hidden": 0, - "label": "Contact Info", + "label": "", "options": "icon-bullhorn", "permlevel": 0, "read_only": 0 @@ -1244,7 +1244,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2015-02-24 15:23:28.554373", + "modified": "2015-03-03 02:47:05.467179", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.js b/erpnext/buying/doctype/purchase_order/purchase_order.js index 5da7ac91ed..c4c28e4f04 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.js +++ b/erpnext/buying/doctype/purchase_order/purchase_order.js @@ -7,6 +7,7 @@ frappe.provide("erpnext.buying"); erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend({ refresh: function(doc, cdt, cdn) { + var me = this; this._super(); // this.frm.dashboard.reset(); @@ -16,9 +17,14 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( // cur_frm.dashboard.add_progress(cint(doc.per_billed) + __("% Billed"), // doc.per_billed); - if(flt(doc.per_received, 2) < 100) + if(flt(doc.per_received, 2) < 100) { cur_frm.add_custom_button(__('Make Purchase Receipt'), - this.make_purchase_receipt, frappe.boot.doctype_icons["Purchase Receipt"]); + this.make_purchase_receipt); + if(doc.is_subcontracted==="Yes") { + cur_frm.add_custom_button(__('Transfer Material to Supplier'), + function() { me.make_stock_entry() }); + } + } if(flt(doc.per_billed, 2) < 100) cur_frm.add_custom_button(__('Make Invoice'), this.make_purchase_invoice, frappe.boot.doctype_icons["Purchase Invoice"]); @@ -35,6 +41,33 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend( cur_frm.cscript['Unstop Purchase Order'], "icon-check"); }, + make_stock_entry: function() { + var items = $.map(cur_frm.doc.items, function(d) { return d.bom ? d.item_code : false; }), + me = this; + if(items.length===1) { + me._make_stock_entry(items[0]); + return; + } + frappe.prompt({fieldname:"item", options: items, fieldtype:"Select", + label: __("Select Item for Transfer"), reqd: 1}, function(data) { + me._make_stock_entry(data.item); + }, __("Select Item"), __("Make")); + }, + + _make_stock_entry: function(item) { + frappe.call({ + method:"erpnext.buying.doctype.purchase_order.purchase_order.make_stock_entry", + args: { + purchase_order: cur_frm.doc.name, + item_code: item + }, + callback: function(r) { + var doclist = frappe.model.sync(r.message); + frappe.set_route("Form", doclist[0].doctype, doclist[0].name); + } + }); + }, + make_purchase_receipt: function() { frappe.model.open_mapped_doc({ method: "erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 6188fbc87d..8df47c8283 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -9,7 +9,7 @@ { "fieldname": "supplier_section", "fieldtype": "Section Break", - "label": "Supplier", + "label": "", "options": "icon-user", "permlevel": 0 }, @@ -39,6 +39,15 @@ "reqd": 1, "search_index": 1 }, + { + "default": "No", + "fieldname": "is_subcontracted", + "fieldtype": "Select", + "label": "Supply Raw Materials", + "options": "No\nYes", + "permlevel": 0, + "print_hide": 1 + }, { "fieldname": "supplier_name", "fieldtype": "Data", @@ -290,7 +299,7 @@ { "fieldname": "taxes_section", "fieldtype": "Section Break", - "label": "Taxes and Charges", + "label": "", "oldfieldtype": "Section Break", "options": "icon-money", "permlevel": 0, @@ -540,7 +549,7 @@ { "fieldname": "terms_section_break", "fieldtype": "Section Break", - "label": "Terms and Conditions", + "label": "", "oldfieldtype": "Section Break", "options": "icon-legal", "permlevel": 0 @@ -567,7 +576,7 @@ "depends_on": "supplier", "fieldname": "contact_section", "fieldtype": "Section Break", - "label": "Contact Info", + "label": "", "options": "icon-bullhorn", "permlevel": 0 }, @@ -597,7 +606,7 @@ { "fieldname": "more_info", "fieldtype": "Section Break", - "label": "More Info", + "label": "", "oldfieldtype": "Section Break", "permlevel": 0 }, @@ -617,13 +626,18 @@ "search_index": 1 }, { - "default": "No", - "fieldname": "is_subcontracted", - "fieldtype": "Select", - "label": "Is Subcontracted", - "options": "\nYes\nNo", + "fieldname": "fiscal_year", + "fieldtype": "Link", + "in_filter": 1, + "label": "Fiscal Year", + "no_copy": 0, + "oldfieldname": "fiscal_year", + "oldfieldtype": "Select", + "options": "Fiscal Year", "permlevel": 0, - "print_hide": 1 + "print_hide": 1, + "reqd": 1, + "search_index": 1 }, { "fieldname": "ref_sq", @@ -637,6 +651,15 @@ "print_hide": 1, "read_only": 1 }, + { + "fieldname": "column_break5", + "fieldtype": "Column Break", + "oldfieldtype": "Column Break", + "permlevel": 0, + "print_hide": 1, + "print_width": "50%", + "width": "50%" + }, { "allow_on_submit": 1, "fieldname": "letter_head", @@ -648,20 +671,6 @@ "permlevel": 0, "print_hide": 1 }, - { - "fieldname": "fiscal_year", - "fieldtype": "Link", - "in_filter": 1, - "label": "Fiscal Year", - "no_copy": 0, - "oldfieldname": "fiscal_year", - "oldfieldtype": "Select", - "options": "Fiscal Year", - "permlevel": 0, - "print_hide": 1, - "reqd": 1, - "search_index": 1 - }, { "allow_on_submit": 1, "fieldname": "select_print_heading", @@ -676,13 +685,11 @@ "report_hide": 1 }, { - "fieldname": "column_break5", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", + "fieldname": "sub_contracting", + "fieldtype": "Section Break", + "label": "", "permlevel": 0, - "print_hide": 1, - "print_width": "50%", - "width": "50%" + "precision": "" }, { "depends_on": "eval:!doc.__islocal", @@ -698,6 +705,12 @@ "print_hide": 1, "read_only": 1 }, + { + "fieldname": "column_break_74", + "fieldtype": "Column Break", + "permlevel": 0, + "precision": "" + }, { "depends_on": "eval:!doc.__islocal", "description": "% of materials billed against this Purchase Order.", @@ -738,7 +751,7 @@ { "fieldname": "recurring_order", "fieldtype": "Section Break", - "label": "Recurring Order", + "label": "Recurring", "options": "icon-time", "permlevel": 0 }, @@ -857,7 +870,7 @@ "icon": "icon-file-text", "idx": 1, "is_submittable": 1, - "modified": "2015-02-24 16:00:36.892356", + "modified": "2015-03-03 01:58:41.152545", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py index 758318d881..9e2d34e6e9 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.py +++ b/erpnext/buying/doctype/purchase_order/purchase_order.py @@ -291,3 +291,21 @@ def make_purchase_invoice(source_name, target_doc=None): }, target_doc, postprocess) return doc + +@frappe.whitelist() +def make_stock_entry(purchase_order, item_code): + purchase_order = frappe.get_doc("Purchase Order", purchase_order) + + stock_entry = frappe.new_doc("Stock Entry") + stock_entry.purpose = "Subcontract" + stock_entry.purchase_order = purchase_order.name + stock_entry.supplier = purchase_order.supplier + stock_entry.supplier_name = purchase_order.supplier_name + stock_entry.supplier_address = purchase_order.address_display + stock_entry.company = purchase_order.company + stock_entry.from_bom = 1 + po_item = [d for d in purchase_order.items if d.item_code == item_code][0] + stock_entry.fg_completed_qty = po_item.qty + stock_entry.bom_no = po_item.bom + stock_entry.get_items() + return stock_entry.as_dict() diff --git a/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.json b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.json index df947e644b..1482b630d3 100644 --- a/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.json +++ b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.json @@ -1,31 +1,8 @@ { - "creation": "2013-02-22 01:27:42.000000", + "creation": "2013-02-22 01:27:42", "docstatus": 0, "doctype": "DocType", "fields": [ - { - "fieldname": "reference_name", - "fieldtype": "Data", - "hidden": 0, - "in_filter": 0, - "in_list_view": 1, - "label": "Reference Name", - "oldfieldname": "reference_name", - "oldfieldtype": "Data", - "permlevel": 0, - "read_only": 1, - "search_index": 0 - }, - { - "fieldname": "bom_detail_no", - "fieldtype": "Data", - "in_list_view": 1, - "label": "BOM Detail No", - "oldfieldname": "bom_detail_no", - "oldfieldtype": "Data", - "permlevel": 0, - "read_only": 1 - }, { "fieldname": "main_item_code", "fieldtype": "Data", @@ -50,7 +27,7 @@ "fieldname": "required_qty", "fieldtype": "Float", "in_list_view": 1, - "label": "Required Qty", + "label": "Supplied Qty", "oldfieldname": "required_qty", "oldfieldtype": "Currency", "permlevel": 0, @@ -76,6 +53,29 @@ "permlevel": 0, "read_only": 1 }, + { + "fieldname": "bom_detail_no", + "fieldtype": "Data", + "in_list_view": 1, + "label": "BOM Detail No", + "oldfieldname": "bom_detail_no", + "oldfieldtype": "Data", + "permlevel": 0, + "read_only": 1 + }, + { + "fieldname": "reference_name", + "fieldtype": "Data", + "hidden": 0, + "in_filter": 0, + "in_list_view": 1, + "label": "Reference Name", + "oldfieldname": "reference_name", + "oldfieldtype": "Data", + "permlevel": 0, + "read_only": 1, + "search_index": 0 + }, { "fieldname": "conversion_factor", "fieldtype": "Float", @@ -100,9 +100,10 @@ "hide_toolbar": 1, "idx": 1, "istable": 1, - "modified": "2013-12-20 19:23:33.000000", + "modified": "2015-03-03 03:40:45.982762", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order Item Supplied", - "owner": "dhanalekshmi@webnotestech.com" + "owner": "dhanalekshmi@webnotestech.com", + "permissions": [] } \ No newline at end of file diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index 95318bed76..9b1ab7a8cf 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -149,12 +149,11 @@ class BuyingController(StockController): def create_raw_materials_supplied(self, raw_material_table): if self.is_subcontracted=="Yes": parent_items = [] - rm_supplied_idx = 0 for item in self.get("items"): if self.doctype == "Purchase Receipt": item.rm_supp_cost = 0.0 if item.item_code in self.sub_contracted_items: - self.update_raw_materials_supplied(item, raw_material_table, rm_supplied_idx) + self.update_raw_materials_supplied(item, raw_material_table) if [item.item_code, item.name] not in parent_items: parent_items.append([item.item_code, item.name]) @@ -165,7 +164,7 @@ class BuyingController(StockController): for item in self.get("items"): item.rm_supp_cost = 0.0 - def update_raw_materials_supplied(self, item, raw_material_table, rm_supplied_idx): + def update_raw_materials_supplied(self, item, raw_material_table): bom_items = self.get_items_from_bom(item.item_code, item.bom) raw_materials_cost = 0 @@ -190,7 +189,6 @@ class BuyingController(StockController): rm.required_qty = required_qty rm.conversion_factor = item.conversion_factor - rm.idx = rm_supplied_idx if self.doctype == "Purchase Receipt": rm.consumed_qty = required_qty @@ -198,8 +196,6 @@ class BuyingController(StockController): if item.batch_no and not rm.batch_no: rm.batch_no = item.batch_no - rm_supplied_idx += 1 - # get raw materials rate if self.doctype == "Purchase Receipt": from erpnext.stock.utils import get_incoming_rate diff --git a/erpnext/stock/doctype/item_price/item_price.json b/erpnext/stock/doctype/item_price/item_price.json index 73c967a239..b8194d9cac 100644 --- a/erpnext/stock/doctype/item_price/item_price.json +++ b/erpnext/stock/doctype/item_price/item_price.json @@ -18,6 +18,7 @@ "fieldname": "price_list", "fieldtype": "Link", "in_filter": 1, + "in_list_view": 1, "label": "Price List", "options": "Price List", "permlevel": 0, @@ -26,7 +27,7 @@ { "fieldname": "buying", "fieldtype": "Check", - "in_list_view": 1, + "in_list_view": 0, "label": "Buying", "permlevel": 0, "read_only": 1 @@ -34,7 +35,7 @@ { "fieldname": "selling", "fieldtype": "Check", - "in_list_view": 1, + "in_list_view": 0, "label": "Selling", "permlevel": 0, "read_only": 1 @@ -50,7 +51,7 @@ "fieldname": "item_code", "fieldtype": "Link", "in_filter": 1, - "in_list_view": 1, + "in_list_view": 0, "label": "Item Code", "oldfieldname": "price_list_name", "oldfieldtype": "Select", @@ -105,7 +106,7 @@ "idx": 1, "in_create": 0, "istable": 0, - "modified": "2015-02-20 05:04:11.609416", + "modified": "2015-03-03 01:05:09.876025", "modified_by": "Administrator", "module": "Stock", "name": "Item Price", @@ -138,5 +139,6 @@ "write": 1 } ], - "read_only": 0 + "read_only": 0, + "title_field": "item_code" } \ No newline at end of file diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js index 9acf38c44e..a2d5be5223 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.js @@ -32,6 +32,8 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend }) }, "icon-download", "btn-default"); } + + this.frm.toggle_reqd("supplier_warehouse", this.frm.doc.is_subcontracted==="Yes"); }, received_qty: function(doc, cdt, cdn) { @@ -178,4 +180,5 @@ frappe.ui.form.on("Purchase Receipt", "is_subcontracted", function(frm) { if (frm.doc.is_subcontracted === "Yes") { erpnext.buying.get_default_bom(frm); } + frm.toggle_reqd("supplier_warehouse", frm.doc.is_subcontracted==="Yes"); }); diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json index fb279dbd92..8aeb4ac701 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json @@ -8,7 +8,7 @@ { "fieldname": "supplier_section", "fieldtype": "Section Break", - "label": "Supplier", + "label": "", "options": "icon-user", "permlevel": 0 }, @@ -292,7 +292,7 @@ "description": "Add / Edit Taxes and Charges", "fieldname": "taxes_section", "fieldtype": "Section Break", - "label": "Taxes and Charges", + "label": "", "oldfieldtype": "Section Break", "options": "icon-money", "permlevel": 0 @@ -464,7 +464,7 @@ "read_only": 1 }, { - "description": "In Words will be visible once you save the Purchase Receipt.", + "description": "", "fieldname": "base_in_words", "fieldtype": "Data", "label": "In Words (Company Currency)", @@ -521,7 +521,7 @@ { "fieldname": "terms_section_break", "fieldtype": "Section Break", - "label": "Terms and Conditions", + "label": "", "oldfieldtype": "Section Break", "options": "icon-legal", "permlevel": 0 @@ -548,7 +548,7 @@ "depends_on": "supplier", "fieldname": "contact_section", "fieldtype": "Section Break", - "label": "Contact Info", + "label": "", "options": "icon-bullhorn", "permlevel": 0 }, @@ -560,11 +560,6 @@ "permlevel": 0, "print_hide": 1 }, - { - "fieldname": "column_break_57", - "fieldtype": "Column Break", - "permlevel": 0 - }, { "fieldname": "contact_person", "fieldtype": "Link", @@ -573,10 +568,61 @@ "permlevel": 0, "print_hide": 1 }, + { + "fieldname": "column_break_57", + "fieldtype": "Column Break", + "permlevel": 0 + }, + { + "default": "No", + "description": "", + "fieldname": "is_subcontracted", + "fieldtype": "Select", + "label": "Raw Materials Supplied", + "oldfieldname": "is_subcontracted", + "oldfieldtype": "Select", + "options": "No\nYes", + "permlevel": 0, + "print_hide": 1 + }, + { + "description": "", + "fieldname": "supplier_warehouse", + "fieldtype": "Link", + "label": "Supplier Warehouse", + "no_copy": 1, + "oldfieldname": "supplier_warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", + "permlevel": 0, + "print_hide": 1, + "print_width": "50px", + "width": "50px" + }, + { + "fieldname": "bill_no", + "fieldtype": "Data", + "hidden": 1, + "label": "Bill No", + "oldfieldname": "bill_no", + "oldfieldtype": "Data", + "permlevel": 0, + "print_hide": 1 + }, + { + "fieldname": "bill_date", + "fieldtype": "Date", + "hidden": 1, + "label": "Bill Date", + "oldfieldname": "bill_date", + "oldfieldtype": "Date", + "permlevel": 0, + "print_hide": 1 + }, { "fieldname": "more_info", "fieldtype": "Section Break", - "label": "More Info", + "label": "", "oldfieldtype": "Section Break", "options": "icon-file-text", "permlevel": 0 @@ -599,16 +645,17 @@ "width": "150px" }, { - "default": "No", - "description": "Select \"Yes\" for sub - contracting items", - "fieldname": "is_subcontracted", - "fieldtype": "Select", - "label": "Is Subcontracted", - "oldfieldname": "is_subcontracted", - "oldfieldtype": "Select", - "options": "\nYes\nNo", + "description": "Warehouse where you are maintaining stock of rejected items", + "fieldname": "rejected_warehouse", + "fieldtype": "Link", + "label": "Rejected Warehouse", + "no_copy": 1, + "oldfieldname": "rejected_warehouse", + "oldfieldtype": "Link", + "options": "Warehouse", "permlevel": 0, - "print_hide": 1 + "print_hide": 1, + "reqd": 0 }, { "fieldname": "amended_from", @@ -636,26 +683,6 @@ "permlevel": 0, "print_hide": 1 }, - { - "fieldname": "bill_no", - "fieldtype": "Data", - "hidden": 1, - "label": "Bill No", - "oldfieldname": "bill_no", - "oldfieldtype": "Data", - "permlevel": 0, - "print_hide": 1 - }, - { - "fieldname": "bill_date", - "fieldtype": "Date", - "hidden": 1, - "label": "Bill Date", - "oldfieldname": "bill_date", - "oldfieldtype": "Date", - "permlevel": 0, - "print_hide": 1 - }, { "allow_on_submit": 1, "fieldname": "letter_head", @@ -733,33 +760,6 @@ "reqd": 0, "width": "30%" }, - { - "description": "Warehouse where you are maintaining stock of rejected items", - "fieldname": "rejected_warehouse", - "fieldtype": "Link", - "label": "Rejected Warehouse", - "no_copy": 1, - "oldfieldname": "rejected_warehouse", - "oldfieldtype": "Link", - "options": "Warehouse", - "permlevel": 0, - "print_hide": 1, - "reqd": 0 - }, - { - "description": "Supplier warehouse where you have issued raw materials for sub - contracting", - "fieldname": "supplier_warehouse", - "fieldtype": "Link", - "label": "Supplier Warehouse", - "no_copy": 1, - "oldfieldname": "supplier_warehouse", - "oldfieldtype": "Link", - "options": "Warehouse", - "permlevel": 0, - "print_hide": 1, - "print_width": "50px", - "width": "50px" - }, { "fieldname": "instructions", "fieldtype": "Small Text", @@ -824,7 +824,7 @@ "width": "50%" }, { - "description": "Following table will show values if items are sub - contracted. These values will be fetched from the master of \"Bill of Materials\" of sub - contracted items.", + "description": "Automatically updated from BOM table", "fieldname": "raw_material_details", "fieldtype": "Section Break", "label": "Raw Materials Supplied", @@ -850,7 +850,7 @@ "icon": "icon-truck", "idx": 1, "is_submittable": 1, - "modified": "2015-02-24 16:00:11.869752", + "modified": "2015-03-03 05:12:46.199024", "modified_by": "Administrator", "module": "Stock", "name": "Purchase Receipt", diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index aa4cedbb37..34f0ecbe71 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -245,23 +245,23 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ from_warehouse: function(doc) { var me = this; - this.set_warehouse_if_missing("s_warehouse", doc.from_warehouse, function(row) { + this.set_warehouse_if_different("s_warehouse", doc.from_warehouse, function(row) { return me.source_mandatory.indexOf(me.frm.doc.purpose)!==-1; }); }, to_warehouse: function(doc) { var me = this; - this.set_warehouse_if_missing("t_warehouse", doc.to_warehouse, function(row) { + this.set_warehouse_if_different("t_warehouse", doc.to_warehouse, function(row) { return me.target_mandatory.indexOf(me.frm.doc.purpose)!==-1; }); }, - set_warehouse_if_missing: function(fieldname, value, condition) { + set_warehouse_if_different: function(fieldname, value, condition) { var changed = false; for (var i=0, l=(this.frm.doc.items || []).length; i total_allowed: + frappe.throw(_("Not allowed to tranfer more {0} than {1} against Purchase Order {2}").format(se_item.item_code, + total_allowed, self.purchase_order)) + def validate_bom(self): for d in self.get('items'): if d.bom_no: