fixes in total_in_words

This commit is contained in:
Nabin Hait
2013-01-21 17:24:31 +05:30
parent 1022198cc8
commit d3b625035c
7 changed files with 19 additions and 36 deletions

View File

@@ -20,7 +20,7 @@ from webnotes import _, msgprint
from webnotes.utils import flt
from buying.utils import get_item_details
from setup.utils import get_company_currency
from setup.utils import get_company_currency, get_total_in_words
from utilities.transaction_base import TransactionBase
class BuyingController(TransactionBase):
@@ -31,6 +31,10 @@ class BuyingController(TransactionBase):
if self.doc.price_list_name and self.doc.price_list_currency:
self.validate_conversion_rate("price_list_currency", "plc_conversion_rate")
# set total in words
if self.meta.get_field("in_words") and self.meta.get_field("in_words_import"):
self.set_total_in_words()
def update_item_details(self):
for item in self.doclist.get({"parentfield": self.fname}):
@@ -68,3 +72,9 @@ class BuyingController(TransactionBase):
msgprint(_('Please enter valid ') + conversion_rate_label + (': ')
+ ("1 %s = [?] %s" % (currency, self.company_currency)),
raise_exception=True)
def set_total_in_words(self):
company_currency = get_company_currency(self.doc.company)
self.doc.in_words = get_total_in_words(self.doc.grand_total, company_currency)
self.doc.in_words_import = get_total_in_words(self.doc.grand_total_import,
self.doc.currency)