Price List and Item Price : Validfor Buying and Selling as separate check box
diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js
index 9661f6e..14b8279 100644
--- a/buying/doctype/purchase_common/purchase_common.js
+++ b/buying/doctype/purchase_common/purchase_common.js
@@ -22,7 +22,7 @@
if(this.frm.fields_dict.buying_price_list) {
this.frm.set_query("buying_price_list", function() {
return{
- filters: { 'buying_or_selling': "Buying" }
+ filters: { 'buying': 1 }
}
});
}
diff --git a/buying/doctype/supplier/supplier.js b/buying/doctype/supplier/supplier.js
index 0618616..ec4d3e6 100644
--- a/buying/doctype/supplier/supplier.js
+++ b/buying/doctype/supplier/supplier.js
@@ -95,6 +95,6 @@
cur_frm.fields_dict['default_price_list'].get_query = function(doc,cdt,cdn) {
return{
- filters:{'buying_or_selling': "Buying"}
+ filters:{'buying': 1}
}
}
\ No newline at end of file
diff --git a/buying/utils.py b/buying/utils.py
index 0d9c8fa..35d89c5 100644
--- a/buying/utils.py
+++ b/buying/utils.py
@@ -3,7 +3,7 @@
from __future__ import unicode_literals
import webnotes
-from webnotes import msgprint, _
+from webnotes import msgprint, _, throw
from webnotes.utils import getdate, flt, add_days, cstr
import json
@@ -90,7 +90,7 @@
# try fetching from price list
if args.buying_price_list and args.price_list_currency:
price_list_rate = webnotes.conn.sql("""select ref_rate from `tabItem Price`
- where price_list=%s and item_code=%s and buying_or_selling='Buying'""",
+ where price_list=%s and item_code=%s and buying=1""",
(args.buying_price_list, args.item_code), as_dict=1)
if price_list_rate:
@@ -122,14 +122,12 @@
# validate if purchase item or subcontracted item
if item.is_purchase_item != "Yes":
- msgprint(_("Item") + (" %s: " % item.name) + _("not a purchase item"),
- raise_exception=True)
+ throw(_("Item") + (" %s: " % item.name) + _("not a purchase item"))
if args.is_subcontracted == "Yes" and item.is_sub_contracted_item != "Yes":
- msgprint(_("Item") + (" %s: " % item.name) +
+ throw(_("Item") + (" %s: " % item.name) +
_("not a sub-contracted item.") +
- _("Please select a sub-contracted item or do not sub-contract the transaction."),
- raise_exception=True)
+ _("Please select a sub-contracted item or do not sub-contract the transaction."))
def get_last_purchase_details(item_code, doc_name=None, conversion_rate=1.0):
"""returns last purchase details in stock uom"""