[fix] [minor] set price list currency and conversion rate

This commit is contained in:
Anand Doshi 2013-09-05 18:18:40 +05:30
parent c7fa9cc4f5
commit c6d17a6989

View File

@ -56,16 +56,16 @@ 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(fieldname) and self.doc.fields.get(fieldname) and \
not self.doc.price_list_currency:
if self.meta.get_field(fieldname) and self.doc.fields.get(fieldname):
if not self.doc.price_list_currency:
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:
if self.doc.price_list_currency == company_currency:
self.doc.plc_conversion_rate = 1.0
else:
elif not self.doc.plc_conversion_rate:
exchange = self.doc.price_list_currency + "-" + company_currency
self.doc.plc_conversion_rate = flt(webnotes.conn.get_value("Currency Exchange",
exchange, "exchange_rate"))