[price list] Separated Default Price List for Selling and Buying and changed fieldnames

This commit is contained in:
Rushabh Mehta
2013-08-09 18:11:35 +05:30
parent 0b9954059c
commit 4a404e9299
36 changed files with 234 additions and 201 deletions

View File

@@ -18,8 +18,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
setup_queries: function() {
var me = this;
if(this.frm.fields_dict.price_list_name) {
this.frm.set_query("price_list_name", function() {
if(this.frm.fields_dict.buying_price_list) {
this.frm.set_query("buying_price_list", function() {
return{
filters: { 'buying_or_selling': "Buying" }
}
@@ -29,7 +29,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
return{
query: "controllers.queries.get_price_list_currency",
filters: {
'price_list_name': me.frm.doc.price_list_name,
'price_list': me.frm.doc.buying_price_list,
'buying_or_selling': "Buying"
}
}
@@ -77,7 +77,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
msgprint(wn._("Please specify Company"));
} else {
var me = this;
var price_list_name = this.frm.doc.price_list_name;
var buying_price_list = this.frm.doc.buying_price_list;
return this.frm.call({
doc: this.frm.doc,
@@ -85,7 +85,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
freeze: true,
callback: function(r) {
if(!r.exc) {
if(me.frm.doc.price_list_name !== price_list_name) me.price_list_name();
if(me.frm.doc.buying_price_list !== buying_price_list) me.buying_price_list();
}
}
});
@@ -132,7 +132,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
docname: me.frm.doc.name,
supplier: me.frm.doc.supplier,
conversion_rate: me.frm.doc.conversion_rate,
price_list_name: me.frm.doc.price_list_name,
buying_price_list: me.frm.doc.buying_price_list,
price_list_currency: me.frm.doc.price_list_currency,
plc_conversion_rate: me.frm.doc.plc_conversion_rate,
is_subcontracted: me.frm.doc.is_subcontracted,
@@ -151,8 +151,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
}
},
price_list_name: function() {
this._super("buying");
buying_price_list: function() {
this.get_price_list_currency("buying");
},
import_ref_rate: function(doc, cdt, cdn) {

View File

@@ -218,7 +218,7 @@
"print_hide": 1
},
{
"depends_on": "price_list_name",
"depends_on": "buying_price_list",
"doctype": "DocField",
"fieldname": "price_list_currency",
"fieldtype": "Link",
@@ -228,7 +228,7 @@
"read_only": 1
},
{
"depends_on": "price_list_name",
"depends_on": "buying_price_list",
"doctype": "DocField",
"fieldname": "plc_conversion_rate",
"fieldtype": "Float",

View File

@@ -10,7 +10,7 @@ class DocType(BuyingController):
def __init__(self, doc, doclist=None):
self.doc, self.doclist = doc, doclist or []
self.tname, self.fname = "Supplier Quotation Item", "quotation_items"
def validate(self):
super(DocType, self).validate()

View File

@@ -215,7 +215,7 @@
"print_hide": 1
},
{
"depends_on": "price_list_name",
"depends_on": "buying_price_list",
"doctype": "DocField",
"fieldname": "price_list_currency",
"fieldtype": "Link",
@@ -225,7 +225,7 @@
"read_only": 1
},
{
"depends_on": "price_list_name",
"depends_on": "buying_price_list",
"doctype": "DocField",
"fieldname": "plc_conversion_rate",
"fieldtype": "Float",

View File

@@ -18,7 +18,7 @@ def get_item_details(args):
"supplier": None,
"transaction_date": None,
"conversion_rate": 1.0,
"price_list_name": None,
"buying_price_list": None,
"price_list_currency": None,
"plc_conversion_rate": 1.0,
"is_subcontracted": "Yes" / "No"
@@ -88,10 +88,10 @@ def _get_price_list_rate(args, item_bean, meta):
out = webnotes._dict()
# try fetching from price list
if args.price_list_name and args.price_list_currency:
if args.buying_price_list and args.price_list_currency:
price_list_rate = item_bean.doclist.get({
"parentfield": "ref_rate_details",
"price_list_name": args.price_list_name,
"price_list": args.buying_price_list,
"ref_currency": args.price_list_currency,
"buying_or_selling": "Buying"})
if price_list_rate: