From 720a01a6f604ef4bde1940e4d4afa7bee448d065 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 26 Jul 2013 11:32:02 +0530 Subject: [PATCH] [selling] changed fieldtype of Price List to link --- accounts/doctype/pos_setting/pos_setting.js | 4 +++- accounts/doctype/pos_setting/pos_setting.txt | 6 +++--- accounts/doctype/sales_invoice/sales_invoice.txt | 6 +++--- selling/doctype/quotation/quotation.txt | 6 +++--- selling/doctype/sales_common/sales_common.js | 16 ++++++++++++++++ selling/doctype/sales_order/sales_order.txt | 6 +++--- setup/doctype/price_list/price_list.txt | 4 +++- stock/doctype/delivery_note/delivery_note.txt | 6 +++--- 8 files changed, 37 insertions(+), 17 deletions(-) diff --git a/accounts/doctype/pos_setting/pos_setting.js b/accounts/doctype/pos_setting/pos_setting.js index 62549bb2ce..653b6318cd 100755 --- a/accounts/doctype/pos_setting/pos_setting.js +++ b/accounts/doctype/pos_setting/pos_setting.js @@ -18,8 +18,10 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){ $c_obj(make_doclist(cdt,cdn),'get_series','',function(r,rt){ if(r.message) set_field_options('naming_series', r.message); }); - + cur_frm.set_query("price_list_name", function() { + return { filters: { buying_or_selling: "Selling" } }; + }); } //cash bank account diff --git a/accounts/doctype/pos_setting/pos_setting.txt b/accounts/doctype/pos_setting/pos_setting.txt index 44549737e2..d82749011a 100755 --- a/accounts/doctype/pos_setting/pos_setting.txt +++ b/accounts/doctype/pos_setting/pos_setting.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 12:15:51", "docstatus": 0, - "modified": "2013-07-05 14:50:33", + "modified": "2013-07-26 11:16:53", "modified_by": "Administrator", "owner": "Administrator" }, @@ -94,11 +94,11 @@ { "doctype": "DocField", "fieldname": "price_list_name", - "fieldtype": "Select", + "fieldtype": "Link", "label": "Price List", "oldfieldname": "price_list_name", "oldfieldtype": "Select", - "options": "link:Price List", + "options": "Price List", "read_only": 0, "reqd": 1 }, diff --git a/accounts/doctype/sales_invoice/sales_invoice.txt b/accounts/doctype/sales_invoice/sales_invoice.txt index 625d2c9c1c..acc9ebee1d 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.txt +++ b/accounts/doctype/sales_invoice/sales_invoice.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:05", "docstatus": 0, - "modified": "2013-07-25 16:08:10", + "modified": "2013-07-26 11:16:58", "modified_by": "Administrator", "owner": "Administrator" }, @@ -247,11 +247,11 @@ { "doctype": "DocField", "fieldname": "price_list_name", - "fieldtype": "Select", + "fieldtype": "Link", "label": "Price List", "oldfieldname": "price_list_name", "oldfieldtype": "Select", - "options": "link:Price List", + "options": "Price List", "print_hide": 1, "read_only": 0, "reqd": 1 diff --git a/selling/doctype/quotation/quotation.txt b/selling/doctype/quotation/quotation.txt index 7f16466fb4..7949c0393f 100644 --- a/selling/doctype/quotation/quotation.txt +++ b/selling/doctype/quotation/quotation.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:08", "docstatus": 0, - "modified": "2013-07-23 15:27:53", + "modified": "2013-07-26 11:16:53", "modified_by": "Administrator", "owner": "Administrator" }, @@ -281,12 +281,12 @@ "description": "Select the price list as entered in \"Price List\" master. This will pull the reference rates of items against this price list as specified in \"Item\" master.", "doctype": "DocField", "fieldname": "price_list_name", - "fieldtype": "Select", + "fieldtype": "Link", "in_filter": 1, "label": "Price List", "oldfieldname": "price_list_name", "oldfieldtype": "Select", - "options": "link:Price List", + "options": "Price List", "print_hide": 1, "read_only": 0, "reqd": 1, diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js index 246d4a1ad3..dbd0a1aace 100644 --- a/selling/doctype/sales_common/sales_common.js +++ b/selling/doctype/sales_common/sales_common.js @@ -70,6 +70,22 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({ this.frm.fields_dict.lead && this.frm.set_query("lead", function(doc,cdt,cdn) { return{ query:"controllers.queries.lead_query" } }); + if(this.frm.fields_dict.price_list_name) { + this.frm.set_query("price_list_name", function() { + return { filters: { buying_or_selling: "Selling" } }; + }); + + this.frm.set_query("price_list_currency", function() { + return { + query: "controllers.queries.get_price_list_currency", + filters: { + price_list_name: me.frm.doc.price_list_name, + buying_or_selling: "Selling" + } + }; + }); + } + if(!this.fname) { return; } diff --git a/selling/doctype/sales_order/sales_order.txt b/selling/doctype/sales_order/sales_order.txt index 3e6cbe4ac7..8c27b60568 100644 --- a/selling/doctype/sales_order/sales_order.txt +++ b/selling/doctype/sales_order/sales_order.txt @@ -2,7 +2,7 @@ { "creation": "2013-06-18 12:39:59", "docstatus": 0, - "modified": "2013-07-23 15:27:39", + "modified": "2013-07-26 11:16:55", "modified_by": "Administrator", "owner": "Administrator" }, @@ -294,11 +294,11 @@ "description": "Select the price list as entered in \"Price List\" master. This will pull the reference rates of items against this price list as specified in \"Item\" master.", "doctype": "DocField", "fieldname": "price_list_name", - "fieldtype": "Select", + "fieldtype": "Link", "label": "Price List", "oldfieldname": "price_list_name", "oldfieldtype": "Select", - "options": "link:Price List", + "options": "Price List", "print_hide": 1, "reqd": 1, "width": "100px" diff --git a/setup/doctype/price_list/price_list.txt b/setup/doctype/price_list/price_list.txt index 1af2e1ba80..febf47180f 100644 --- a/setup/doctype/price_list/price_list.txt +++ b/setup/doctype/price_list/price_list.txt @@ -2,7 +2,7 @@ { "creation": "2013-01-25 11:35:09", "docstatus": 0, - "modified": "2013-07-23 12:03:25", + "modified": "2013-07-26 11:19:06", "modified_by": "Administrator", "owner": "Administrator" }, @@ -55,6 +55,7 @@ "doctype": "DocField", "fieldname": "currency", "fieldtype": "Link", + "in_list_view": 1, "label": "Currency", "options": "Currency", "reqd": 1 @@ -64,6 +65,7 @@ "doctype": "DocField", "fieldname": "buying_or_selling", "fieldtype": "Select", + "in_list_view": 1, "label": "Valid for Buying or Selling?", "options": "Buying\nSelling", "reqd": 1 diff --git a/stock/doctype/delivery_note/delivery_note.txt b/stock/doctype/delivery_note/delivery_note.txt index aa9530fa9a..3008b799cb 100644 --- a/stock/doctype/delivery_note/delivery_note.txt +++ b/stock/doctype/delivery_note/delivery_note.txt @@ -2,7 +2,7 @@ { "creation": "2013-05-24 19:29:09", "docstatus": 0, - "modified": "2013-07-23 15:28:18", + "modified": "2013-07-26 11:16:57", "modified_by": "Administrator", "owner": "Administrator" }, @@ -286,11 +286,11 @@ "description": "Select the price list as entered in \"Price List\" master. This will pull the reference rates of items against this price list as specified in \"Item\" master.", "doctype": "DocField", "fieldname": "price_list_name", - "fieldtype": "Select", + "fieldtype": "Link", "label": "Price List", "oldfieldname": "price_list_name", "oldfieldtype": "Select", - "options": "link:Price List", + "options": "Price List", "print_hide": 1, "read_only": 0, "reqd": 1