Enabled feature in Price List
diff --git a/selling/doctype/customer/customer.js b/selling/doctype/customer/customer.js
index 5d04690..fb5d887 100644
--- a/selling/doctype/customer/customer.js
+++ b/selling/doctype/customer/customer.js
@@ -18,7 +18,7 @@
cur_frm.add_fetch('lead_name', 'company_name', 'customer_name');
cur_frm.add_fetch('default_sales_partner','commission_rate','default_commission_rate');
-cur_frm.cscript.refresh = function(doc,dt,dn) {
+cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.cscript.setup_dashboard(doc);
erpnext.hide_naming_series();
@@ -107,20 +107,20 @@
}
-cur_frm.fields_dict['customer_group'].get_query = function(doc,dt,dn) {
+cur_frm.fields_dict['customer_group'].get_query = function(doc, dt, dn) {
return{
filters:{'is_group': 'No'}
}
}
-cur_frm.fields_dict.lead_name.get_query = function(doc,cdt,cdn) {
+cur_frm.fields_dict.lead_name.get_query = function(doc, cdt, cdn) {
return{
query:"controllers.queries.lead_query"
}
}
-cur_frm.fields_dict['default_price_list'].get_query = function(doc,cdt,cdn) {
+cur_frm.fields_dict['default_price_list'].get_query = function(doc, cdt, cdn) {
return{
filters:{'selling': 1}
}
diff --git a/selling/utils/__init__.py b/selling/utils/__init__.py
index f495f58..b71c9d4 100644
--- a/selling/utils/__init__.py
+++ b/selling/utils/__init__.py
@@ -150,8 +150,10 @@
return out
def _get_price_list_rate(args, item_bean, meta):
- ref_rate = webnotes.conn.sql("""select ref_rate from `tabItem Price`
- where price_list=%s and item_code=%s and selling=1""",
+ ref_rate = webnotes.conn.sql("""select ip.ref_rate from
+ `tabItem Price` ip, `tabPrice List` pl
+ where ip.price_list=pl.name and ip.price_list=%s and
+ ip.item_code=%s and ip.selling=1 and pl.enabled=1""",
(args.selling_price_list, args.item_code), as_dict=1)
if not ref_rate:
diff --git a/selling/utils/product.py b/selling/utils/product.py
index 32ff85a..22bb880 100644
--- a/selling/utils/product.py
+++ b/selling/utils/product.py
@@ -27,8 +27,9 @@
else:
in_stock = -1
- price = price_list and webnotes.conn.sql("""select ref_rate, currency from
- `tabItem Price` where item_code=%s and price_list=%s""",
+ price = price_list and webnotes.conn.sql("""select ip.ref_rate, ip.currency from
+ `tabItem Price` ip, `tabPrice List` pl where ip.price_list=pl.name and
+ ip.item_code=%s and ip.price_list=%s and pl.enabled=1""",
(item_code, price_list), as_dict=1) or []
price = price and price[0] or None