[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

@@ -55,10 +55,11 @@ class AccountsController(TransactionBase):
def set_price_list_currency(self, buying_or_selling):
company_currency = get_company_currency(self.doc.company)
fieldname = buying_or_selling.lower() + "_price_list"
# TODO - change this, since price list now has only one currency allowed
if self.meta.get_field("price_list_name") and self.doc.price_list_name and \
if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname) and \
not self.doc.price_list_currency:
self.doc.fields.update(get_price_list_currency(self.doc.price_list_name))
self.doc.fields.update(get_price_list_currency(self.doc.fields.get(fieldname)))
if self.doc.price_list_currency:
if not self.doc.plc_conversion_rate:
@@ -73,11 +74,14 @@ class AccountsController(TransactionBase):
self.doc.currency = self.doc.price_list_currency
self.doc.conversion_rate = self.doc.plc_conversion_rate
if self.meta.get_field("currency") and self.doc.currency != company_currency and \
not self.doc.conversion_rate:
exchange = self.doc.currency + "-" + company_currency
self.doc.conversion_rate = flt(webnotes.conn.get_value("Currency Exchange",
exchange, "exchange_rate"))
if self.meta.get_field("currency"):
if self.doc.currency != company_currency:
if not self.doc.conversion_rate:
exchange = self.doc.currency + "-" + company_currency
self.doc.conversion_rate = flt(webnotes.conn.get_value("Currency Exchange",
exchange, "exchange_rate"))
else:
self.doc.conversion_rate = 1
def set_missing_item_details(self, get_item_details):
"""set missing item values"""

View File

@@ -187,10 +187,10 @@ def get_project_name(doctype, txt, searchfield, start, page_len, filters):
def get_price_list_currency(doctype, txt, searchfield, start, page_len, filters):
return webnotes.conn.sql("""select ref_currency from `tabItem Price`
where price_list_name = %s and buying_or_selling = %s
where price_list = %s and buying_or_selling = %s
and `%s` like %s order by ref_currency asc limit %s, %s""" %
("%s", "%s", searchfield, "%s", "%s", "%s"),
(filters["price_list_name"], filters['buying_or_selling'], "%%%s%%" % txt,
(filters["price_list"], filters['buying_or_selling'], "%%%s%%" % txt,
start, page_len))
def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters):