company default currency fix
This commit is contained in:
parent
e079a6eb26
commit
6c174a6e35
@ -179,9 +179,9 @@ class DocType(TransactionBase):
|
|||||||
# Check Conversion Rate
|
# Check Conversion Rate
|
||||||
# ----------------------
|
# ----------------------
|
||||||
def check_conversion_rate(self):
|
def check_conversion_rate(self):
|
||||||
default_currency = get_obj('Manage Account').doc.default_currency
|
default_currency = TransactionBase().get_company_currency(self.doc.company)
|
||||||
if not default_currency:
|
if not default_currency:
|
||||||
msgprint('Message: Please enter default currency in Manage Account')
|
msgprint('Message: Please enter default currency in Company Master')
|
||||||
raise Exception
|
raise Exception
|
||||||
if (self.doc.currency == default_currency and flt(self.doc.conversion_rate) != 1.00) or not self.doc.conversion_rate or (self.doc.currency != default_currency and flt(self.doc.conversion_rate) == 1.00):
|
if (self.doc.currency == default_currency and flt(self.doc.conversion_rate) != 1.00) or not self.doc.conversion_rate or (self.doc.currency != default_currency and flt(self.doc.conversion_rate) == 1.00):
|
||||||
msgprint("Message: Please Enter Appropriate Conversion Rate.")
|
msgprint("Message: Please Enter Appropriate Conversion Rate.")
|
||||||
|
@ -15,9 +15,9 @@ in_transaction = webnotes.conn.in_transaction
|
|||||||
convert_to_lists = webnotes.conn.convert_to_lists
|
convert_to_lists = webnotes.conn.convert_to_lists
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------
|
||||||
|
from utilities.transaction_base import TransactionBase
|
||||||
|
|
||||||
|
class DocType(TransactionBase):
|
||||||
class DocType:
|
|
||||||
def __init__(self, doc, doclist=[]):
|
def __init__(self, doc, doclist=[]):
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doclist = doclist
|
self.doclist = doclist
|
||||||
@ -268,14 +268,11 @@ class DocType:
|
|||||||
|
|
||||||
# validate conversion rate
|
# validate conversion rate
|
||||||
def validate_conversion_rate(self, obj):
|
def validate_conversion_rate(self, obj):
|
||||||
default_currency = get_obj('Manage Account').doc.default_currency
|
default_currency = TransactionBase().get_company_currency(obj.doc.company)
|
||||||
if not default_currency:
|
if not default_currency:
|
||||||
msgprint('Message: Please enter default currency in Global Defaults')
|
msgprint('Message: Please enter default currency in Company Master')
|
||||||
raise Exception
|
raise Exception
|
||||||
|
if (obj.doc.currency == default_currency and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != default_currency and flt(obj.doc.conversion_rate) == 1.00):
|
||||||
company_currency = sql("select default_currency from `tabCompany` where name = '%s'" % obj.doc.company)
|
|
||||||
curr = company_currency and cstr(company_currency[0][0]) or default_currency
|
|
||||||
if (obj.doc.currency == curr and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != curr and flt(obj.doc.conversion_rate) == 1.00):
|
|
||||||
msgprint("Message: Please Enter Appropriate Conversion Rate.")
|
msgprint("Message: Please Enter Appropriate Conversion Rate.")
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
|
@ -15,8 +15,9 @@ convert_to_lists = webnotes.conn.convert_to_lists
|
|||||||
|
|
||||||
# -----------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
from utilities.transaction_base import TransactionBase
|
||||||
|
|
||||||
class DocType:
|
class DocType(TransactionBase):
|
||||||
def __init__(self,d,dl):
|
def __init__(self,d,dl):
|
||||||
self.doc, self.doclist = d,dl
|
self.doc, self.doclist = d,dl
|
||||||
|
|
||||||
@ -262,10 +263,11 @@ class DocType:
|
|||||||
# Check Conversion Rate (i.e. it will not allow conversion rate to be 1 for Currency other than default currency set in Global Defaults)
|
# Check Conversion Rate (i.e. it will not allow conversion rate to be 1 for Currency other than default currency set in Global Defaults)
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
def check_conversion_rate(self, obj):
|
def check_conversion_rate(self, obj):
|
||||||
default_currency = get_obj('Manage Account').doc.default_currency
|
default_currency = TransactionBase().get_company_currency(obj.doc.company)
|
||||||
company_currency = sql("select default_currency from `tabCompany` where name = '%s'" % obj.doc.company)
|
if not default_currency:
|
||||||
curr = company_currency and cstr(company_currency[0][0]) or default_currency
|
msgprint('Message: Please enter default currency in Company Master')
|
||||||
if (obj.doc.currency == curr and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != curr and flt(obj.doc.conversion_rate) == 1.00):
|
raise Exception
|
||||||
|
if (obj.doc.currency == default_currency and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != default_currency and flt(obj.doc.conversion_rate) == 1.00):
|
||||||
msgprint("Please Enter Appropriate Conversion Rate.")
|
msgprint("Please Enter Appropriate Conversion Rate.")
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
|
@ -140,7 +140,8 @@ class DocType(TransactionBase):
|
|||||||
self.check_for_stopped_status(pc_obj)
|
self.check_for_stopped_status(pc_obj)
|
||||||
|
|
||||||
# get total in words
|
# get total in words
|
||||||
self.doc.in_words = pc_obj.get_total_in_words(get_defaults().get('currency') or 'INR', self.doc.grand_total)
|
dcc = TransactionBase().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)
|
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