fixes in total_in_words
This commit is contained in:
parent
1022198cc8
commit
d3b625035c
@ -366,15 +366,6 @@ class DocType(BuyingController):
|
|||||||
self.doc.posting_date,'Posting Date')
|
self.doc.posting_date,'Posting Date')
|
||||||
|
|
||||||
self.validate_write_off_account()
|
self.validate_write_off_account()
|
||||||
|
|
||||||
#get Purchase Common Obj
|
|
||||||
pc_obj = get_obj(dt='Purchase Common')
|
|
||||||
|
|
||||||
# get total in words
|
|
||||||
dcc = get_company_currency(self.doc.company)
|
|
||||||
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
|
||||||
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency,
|
|
||||||
self.doc.grand_total_import)
|
|
||||||
|
|
||||||
def check_prev_docstatus(self):
|
def check_prev_docstatus(self):
|
||||||
for d in getlist(self.doclist,'entries'):
|
for d in getlist(self.doclist,'entries'):
|
||||||
|
@ -456,14 +456,6 @@ class DocType(BuyingController):
|
|||||||
}
|
}
|
||||||
#msgprint(ret)
|
#msgprint(ret)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Get total in words
|
|
||||||
# ==================================================================
|
|
||||||
def get_total_in_words(self, currency, amount):
|
|
||||||
from webnotes.utils import money_in_words
|
|
||||||
return money_in_words(amount, currency)
|
|
||||||
|
|
||||||
# get against document date
|
# get against document date
|
||||||
#-----------------------------
|
#-----------------------------
|
||||||
|
@ -67,10 +67,6 @@ class DocType(BuyingController):
|
|||||||
# Check for stopped status
|
# Check for stopped status
|
||||||
self.check_for_stopped_status(pc_obj)
|
self.check_for_stopped_status(pc_obj)
|
||||||
|
|
||||||
# get total in words
|
|
||||||
dcc = get_company_currency(self.doc.company)
|
|
||||||
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
|
||||||
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
|
||||||
|
|
||||||
def get_default_schedule_date(self):
|
def get_default_schedule_date(self):
|
||||||
get_obj(dt = 'Purchase Common').get_default_schedule_date(self)
|
get_obj(dt = 'Purchase Common').get_default_schedule_date(self)
|
||||||
|
@ -37,7 +37,6 @@ class DocType(BuyingController):
|
|||||||
|
|
||||||
self.validate_fiscal_year()
|
self.validate_fiscal_year()
|
||||||
self.validate_common()
|
self.validate_common()
|
||||||
self.set_in_words()
|
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
purchase_controller = webnotes.get_obj("Purchase Common")
|
purchase_controller = webnotes.get_obj("Purchase Common")
|
||||||
@ -79,10 +78,4 @@ class DocType(BuyingController):
|
|||||||
pc.validate_mandatory(self)
|
pc.validate_mandatory(self)
|
||||||
pc.validate_for_items(self)
|
pc.validate_for_items(self)
|
||||||
pc.get_prevdoc_date(self)
|
pc.get_prevdoc_date(self)
|
||||||
pc.validate_reference_value(self)
|
pc.validate_reference_value(self)
|
||||||
|
|
||||||
def set_in_words(self):
|
|
||||||
pc = get_obj('Purchase Common')
|
|
||||||
company_currency = get_company_currency(self.doc.company)
|
|
||||||
self.doc.in_words = pc.get_total_in_words(company_currency, self.doc.grand_total)
|
|
||||||
self.doc.in_words_import = pc.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
|
@ -20,7 +20,7 @@ from webnotes import _, msgprint
|
|||||||
from webnotes.utils import flt
|
from webnotes.utils import flt
|
||||||
|
|
||||||
from buying.utils import get_item_details
|
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
|
from utilities.transaction_base import TransactionBase
|
||||||
class BuyingController(TransactionBase):
|
class BuyingController(TransactionBase):
|
||||||
@ -31,6 +31,10 @@ class BuyingController(TransactionBase):
|
|||||||
|
|
||||||
if self.doc.price_list_name and self.doc.price_list_currency:
|
if self.doc.price_list_name and self.doc.price_list_currency:
|
||||||
self.validate_conversion_rate("price_list_currency", "plc_conversion_rate")
|
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):
|
def update_item_details(self):
|
||||||
for item in self.doclist.get({"parentfield": self.fname}):
|
for item in self.doclist.get({"parentfield": self.fname}):
|
||||||
@ -68,3 +72,9 @@ class BuyingController(TransactionBase):
|
|||||||
msgprint(_('Please enter valid ') + conversion_rate_label + (': ')
|
msgprint(_('Please enter valid ') + conversion_rate_label + (': ')
|
||||||
+ ("1 %s = [?] %s" % (currency, self.company_currency)),
|
+ ("1 %s = [?] %s" % (currency, self.company_currency)),
|
||||||
raise_exception=True)
|
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)
|
@ -47,3 +47,9 @@ def get_price_list_currency(args):
|
|||||||
return {"price_list_currency": result[0][0]}
|
return {"price_list_currency": result[0][0]}
|
||||||
else:
|
else:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@webnotes.whitelist()
|
||||||
|
def get_total_in_words(amount, currency):
|
||||||
|
from webnotes.utils import money_in_words
|
||||||
|
fraction = webnotes.conn.get_value("Currency", currency, "fraction")
|
||||||
|
return money_in_words(amount, currency, fraction)
|
@ -17,12 +17,11 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import cstr, flt, get_defaults, getdate
|
from webnotes.utils import cstr, flt, get_defaults
|
||||||
from webnotes.model.doc import addchild
|
from webnotes.model.doc import addchild
|
||||||
from webnotes.model.wrapper import getlist
|
from webnotes.model.wrapper import getlist
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
from setup.utils import get_company_currency
|
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
@ -136,10 +135,6 @@ class DocType(BuyingController):
|
|||||||
pc_obj.validate_reference_value(self)
|
pc_obj.validate_reference_value(self)
|
||||||
self.check_for_stopped_status(pc_obj)
|
self.check_for_stopped_status(pc_obj)
|
||||||
|
|
||||||
# get total in words
|
|
||||||
dcc = get_company_currency(self.doc.company)
|
|
||||||
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
|
||||||
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
|
||||||
# update valuation rate
|
# update valuation rate
|
||||||
self.update_valuation_rate()
|
self.update_valuation_rate()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user