[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

@@ -44,7 +44,7 @@ test_records = [
"order_type": "Sales",
"plc_conversion_rate": 1.0,
"price_list_currency": "INR",
"price_list_name": "_Test Price List",
"selling_price_list": "_Test Price List",
"territory": "_Test Territory",
"transaction_date": "2013-02-21",
"grand_total": 1000.0,

View File

@@ -32,7 +32,7 @@ class DocType:
det = webnotes.conn.sql("""select description, stock_uom from `tabItem`
where name = %s""", name)
rate = webnotes.conn.sql("""select ref_rate from `tabItem Price`
where price_list_name = %s and parent = %s
where price_list = %s and parent = %s
and ref_currency = %s""", (self.doc.price_list, name, self.doc.currency))
return {
'description' : det and det[0][0] or '',

View File

@@ -45,8 +45,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
});
}
if(this.frm.fields_dict.price_list_name) {
this.frm.set_query("price_list_name", function() {
if(this.frm.fields_dict.selling_price_list) {
this.frm.set_query("selling_price_list", function() {
return { filters: { buying_or_selling: "Selling" } };
});
@@ -54,7 +54,7 @@ erpnext.selling.SellingController = 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.selling_price_list,
buying_or_selling: "Selling"
}
};
@@ -126,15 +126,15 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
this.frm.set_value("customer", null);
msgprint(wn._("Please specify Company"));
} else {
var price_list_name = this.frm.doc.price_list_name;
var selling_price_list = this.frm.doc.selling_price_list;
return this.frm.call({
doc: this.frm.doc,
method: "set_customer_defaults",
freeze: true,
callback: function(r) {
if(!r.exc) {
(me.frm.doc.price_list_name !== price_list_name) ?
me.price_list_name() :
(me.frm.doc.selling_price_list !== selling_price_list) ?
me.selling_price_list() :
me.price_list_currency();
}
}
@@ -188,7 +188,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
customer: me.frm.doc.customer,
currency: me.frm.doc.currency,
conversion_rate: me.frm.doc.conversion_rate,
price_list_name: me.frm.doc.price_list_name,
selling_price_list: me.frm.doc.selling_price_list,
price_list_currency: me.frm.doc.price_list_currency,
plc_conversion_rate: me.frm.doc.plc_conversion_rate,
company: me.frm.doc.company,
@@ -206,8 +206,8 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
}
},
price_list_name: function() {
this._super("Selling");
selling_price_list: function() {
this.get_price_list_currency("Selling");
},
ref_rate: function(doc, cdt, cdn) {

View File

@@ -289,7 +289,7 @@ test_records = [
"delivery_date": "2013-02-23",
"plc_conversion_rate": 1.0,
"price_list_currency": "INR",
"price_list_name": "_Test Price List",
"selling_price_list": "_Test Price List",
"territory": "_Test Territory",
"transaction_date": "2013-02-21",
"grand_total": 1000.0,

View File

@@ -29,7 +29,7 @@ def get_item_details(args):
"warehouse": None,
"customer": "",
"conversion_rate": 1.0,
"price_list_name": None,
"selling_price_list": None,
"price_list_currency": None,
"plc_conversion_rate": 1.0
}
@@ -57,7 +57,7 @@ def get_item_details(args):
if meta.get_field("currency"):
out.base_ref_rate = out.basic_rate = out.ref_rate = out.export_rate = 0.0
if args.price_list_name and args.price_list_currency:
if args.selling_price_list and args.price_list_currency:
out.update(_get_price_list_rate(args, item_bean, meta))
out.update(_get_item_discount(out.item_group, args.customer))
@@ -129,7 +129,7 @@ def _get_basic_details(args, item_bean, warehouse_fieldname):
def _get_price_list_rate(args, item_bean, meta):
base_ref_rate = item_bean.doclist.get({
"parentfield": "ref_rate_details",
"price_list_name": args.price_list_name,
"price_list": args.selling_price_list,
"ref_currency": args.price_list_currency,
"buying_or_selling": "Selling"})