[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

@@ -111,7 +111,7 @@ test_records = [
"posting_date": "2013-02-21",
"posting_time": "9:00:00",
"price_list_currency": "INR",
"price_list_name": "_Test Price List",
"selling_price_list": "_Test Price List",
"status": "Draft",
"territory": "_Test Territory",
"net_total": 500.0,

View File

@@ -5,16 +5,16 @@ wn.provide("erpnext.stock");
erpnext.stock.Item = wn.ui.form.Controller.extend({
onload: function() {
this.frm.add_fetch("price_list_name", "currency", "ref_currency");
this.frm.add_fetch("price_list_name", "buying_or_selling", "buying_or_selling");
this.frm.add_fetch("price_list", "currency", "ref_currency");
this.frm.add_fetch("price_list", "buying_or_selling", "buying_or_selling");
},
ref_rate_details_add: function(doc, cdt, cdn) {
var row = wn.model.get_doc(cdt, cdn);
if(row.price_list_name && !row.ref_currency) {
if(row.price_list && !row.ref_currency) {
// execute fetch
var df = wn.meta.get_docfield(row.doctype, "price_list_name", row.parent);
this.frm.script_manager.validate_link_and_fetch(df, row.name, row.price_list_name);
var df = wn.meta.get_docfield(row.doctype, "price_list", row.parent);
this.frm.script_manager.validate_link_and_fetch(df, row.name, row.price_list);
}
}
});

View File

@@ -130,16 +130,16 @@ class DocType(DocListController):
def validate_price_lists(self):
price_lists=[]
for d in getlist(self.doclist,'ref_rate_details'):
if d.price_list_name in price_lists:
msgprint(_("Cannot have two prices for same Price List") + ": " + d.price_list_name,
if d.price_list in price_lists:
msgprint(_("Cannot have two prices for same Price List") + ": " + d.price_list,
raise_exception= webnotes.DuplicateEntryError)
else:
price_list_currency = webnotes.conn.get_value("Price List", d.price_list_name, "currency")
price_list_currency = webnotes.conn.get_value("Price List", d.price_list, "currency")
if price_list_currency and d.ref_currency != price_list_currency:
msgprint(_("Currency does not match Price List Currency for Price List") \
+ ": " + d.price_list_name, raise_exception=PriceListCurrencyMismatch)
+ ": " + d.price_list, raise_exception=PriceListCurrencyMismatch)
price_lists.append(d.price_list_name)
price_lists.append(d.price_list)
def fill_customer_code(self):

View File

@@ -61,7 +61,7 @@ test_records = [
}, {
"doctype": "Item Price",
"parentfield": "ref_rate_details",
"price_list_name": "_Test Price List",
"price_list": "_Test Price List",
"ref_rate": 100,
"ref_currency": "INR",
"buying_or_selling": "Selling"

View File

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

View File

@@ -58,7 +58,7 @@ def get_price_list():
rate = {}
price_list = webnotes.conn.sql("""select parent, selling, buying,
concat(price_list_name, " - ", ref_currency, " ", ref_rate) as price
concat(price_list, " - ", ref_currency, " ", ref_rate) as price
from `tabItem Price` where docstatus<2""", as_dict=1)
for j in price_list:

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 18:01:55",
"docstatus": 0,
"modified": "2013-05-07 11:50:46",
"modified": "2013-05-07 11:52:00",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -10,7 +10,7 @@
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
"query": "select\n item.name as \"ID:Link/Item:120\", \n item.item_name as \"Item Name::120\", \n item_price.price_list_name as \"Price List::80\",\n item_price.ref_currency as \"Currency::40\", \n item_price.ref_rate as \"Rate:Float:80\",\n item.description as \"Description::160\",\n item.item_group as \"Item Group:Link/Item Group:100\",\n item.brand as \"Brand::100\"\nfrom `tabItem` item, `tabItem Price` item_price\nwhere\n item_price.parent = item.name",
"query": "select\n item.name as \"ID:Link/Item:120\", \n item.item_name as \"Item Name::120\", \n item_price.price_list as \"Price List::80\",\n item_price.ref_currency as \"Currency::40\", \n item_price.ref_rate as \"Rate:Float:80\",\n item.description as \"Description::160\",\n item.item_group as \"Item Group:Link/Item Group:100\",\n item.brand as \"Brand::100\"\nfrom `tabItem` item, `tabItem Price` item_price\nwhere\n item_price.parent = item.name",
"ref_doctype": "Item",
"report_name": "Item-Wise Price List",
"report_type": "Query Report"