From b6843f20876a951cc437dcf0ed5d501c1a2fe2c2 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 4 Jun 2014 13:10:41 +0530 Subject: [PATCH] added multiple item select and allow non purchase items in Material Request of type transfer --- erpnext/accounts/doctype/journal_voucher/journal_voucher.js | 4 ++++ erpnext/buying/doctype/purchase_common/purchase_common.py | 5 +++-- erpnext/public/js/transaction.js | 3 +++ erpnext/selling/doctype/quotation/quotation.js | 5 +++++ erpnext/selling/sales_common.js | 4 ++++ erpnext/stock/doctype/stock_entry/stock_entry.js | 1 + 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js index bc0108eba0..ccd5acee5c 100644 --- a/erpnext/accounts/doctype/journal_voucher/journal_voucher.js +++ b/erpnext/accounts/doctype/journal_voucher/journal_voucher.js @@ -9,6 +9,10 @@ erpnext.accounts.JournalVoucher = frappe.ui.form.Controller.extend({ this.setup_queries(); }, + onload_post_render: function() { + cur_frm.get_field("entries").grid.set_multiple_add("account"); + }, + load_defaults: function() { if(this.frm.doc.__islocal && this.frm.doc.company) { frappe.model.set_default_values(this.frm.doc); diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py index 94e8ea367c..68a6e93e68 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.py +++ b/erpnext/buying/doctype/purchase_common/purchase_common.py @@ -94,8 +94,9 @@ class PurchaseCommon(BuyingController): frappe.throw(_("Warehouse is mandatory for stock Item {0} in row {1}").format(d.item_code, d.idx)) # validate purchase item - if item[0][1] != 'Yes' and item[0][2] != 'Yes': - frappe.throw(_("{0} must be a Purchased or Sub-Contracted Item in row {1}").format(d.item_code, d.idx)) + if not (obj.doctype=="Material Request" and getattr(obj, "material_request_type", None)=="Transfer"): + if item[0][1] != 'Yes' and item[0][2] != 'Yes': + frappe.throw(_("{0} must be a Purchased or Sub-Contracted Item in row {1}").format(d.item_code, d.idx)) # list criteria that should not repeat if item is stock item e = [getattr(d, "schedule_date", None), d.item_code, d.description, d.warehouse, d.uom, diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js index 6d30ef0999..c086aedcf5 100644 --- a/erpnext/public/js/transaction.js +++ b/erpnext/public/js/transaction.js @@ -41,6 +41,9 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ if(this.frm.doc.__islocal && this.frm.doc.company && !this.frm.doc.is_pos) { this.calculate_taxes_and_totals(); } + if(frappe.meta.get_docfield(this.tname, "item_code")) { + cur_frm.get_field(this.fname).grid.set_multiple_add("item_code"); + } }, refresh: function() { diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index ee140923f5..fa63975e42 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -13,6 +13,10 @@ cur_frm.cscript.sales_team_fname = "sales_team"; {% include 'utilities/doctype/sms_control/sms_control.js' %} {% include 'accounts/doctype/sales_invoice/pos.js' %} +frappe.ui.form.on("Quotation", "onload_post_render", function(frm) { + frm.get_field("quotation_details").grid.set_multiple_add("item_code"); +}); + erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ onload: function(doc, dt, dn) { var me = this; @@ -21,6 +25,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({ doc.quotation_to = "Customer"; else if(doc.lead && !doc.quotation_to) doc.quotation_to = "Lead"; + }, refresh: function(doc, dt, dn) { this._super(doc, dt, dn); diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js index 260fbe5ab9..1cc643eb40 100644 --- a/erpnext/selling/sales_common.js +++ b/erpnext/selling/sales_common.js @@ -21,6 +21,10 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.toggle_editable_price_list_rate(); }, + onload_post_render: function() { + cur_frm.get_field(this.fname).grid.set_multiple_add("item_code"); + }, + setup_queries: function() { var me = this; diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 840c55da55..553b25c491 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -56,6 +56,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({ }, onload_post_render: function() { + cur_frm.get_field(this.fname).grid.set_multiple_add("item_code"); this.set_default_account(); },