mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-19 04:59:18 +00:00
Default currency for company fixed
This commit is contained in:
@@ -15,9 +15,9 @@ in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
|
||||
class DocType:
|
||||
class DocType(TransactionBase):
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
@@ -97,5 +97,6 @@ class DocType:
|
||||
for d in getlist(self.doclist,'form_16A_tax_details'):
|
||||
tot=flt(tot)+flt(d.total_tax_deposited)
|
||||
|
||||
self.doc.total_amount = flt(tot)
|
||||
self.doc.in_words = get_obj('Sales Common').get_total_in_words(get_defaults()['currency'], self.doc.total_amount)
|
||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||
self.doc.total_amount = flt(tot)
|
||||
self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.total_amount)
|
||||
|
||||
@@ -15,7 +15,7 @@ in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType:
|
||||
def __init__(self,d,dl):
|
||||
@@ -34,9 +34,9 @@ class DocType:
|
||||
# pl[r[0]] = flt(flt(inc) - flt(exp))
|
||||
return {'cl':[r[0] for r in ret]}#, 'pl':pl}
|
||||
|
||||
def get_company_currency(self,arg=''):
|
||||
ret = sql("select default_currency from tabCompany where name=%s and docstatus != 2", arg)
|
||||
return ret[0]
|
||||
def get_company_currency(self,arg=''):
|
||||
dcc = TransactionBase().get_company_currency(arg)
|
||||
return dcc
|
||||
|
||||
# Get current balance
|
||||
# --------------------
|
||||
|
||||
@@ -15,7 +15,7 @@ in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType:
|
||||
def __init__(self,d,dl):
|
||||
@@ -238,7 +238,7 @@ class DocType:
|
||||
if self.doc.total_debit > 0:
|
||||
self.get_tds_category_account()
|
||||
if self.doc.supplier_account and self.doc.tds_category:
|
||||
get_obj('TDS Control').get_tds_amount(self)
|
||||
get_obj('TDS Control').get_tds_amount(self)
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------------------------------------
|
||||
@@ -333,6 +333,7 @@ class DocType:
|
||||
# ------------------------
|
||||
def set_print_format_fields(self):
|
||||
for d in getlist(self.doclist, 'entries'):
|
||||
#msgprint(self.doc.company)
|
||||
chk_type = sql("select master_type, account_type from `tabAccount` where name='%s'" % d.account)
|
||||
master_type, acc_type = chk_type and cstr(chk_type[0][0]) or '', chk_type and cstr(chk_type[0][1]) or ''
|
||||
if master_type in ['Supplier', 'Customer']:
|
||||
@@ -340,9 +341,10 @@ class DocType:
|
||||
self.doc.pay_to_recd_from = get_value(master_type, ' - '.join(d.account.split(' - ')[:-1]), master_type == 'Customer' and 'customer_name' or 'supplier_name')
|
||||
|
||||
if acc_type == 'Bank or Cash':
|
||||
amt = cint(d.debit) and d.debit or d.credit
|
||||
self.doc.total_amount = get_defaults()['currency']+'. '+ cstr(amt)
|
||||
self.doc.total_amount_in_words = get_obj('Sales Common').get_total_in_words(get_defaults()['currency'], cstr(amt))
|
||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||
amt = cint(d.debit) and d.debit or d.credit
|
||||
self.doc.total_amount = dcc +' '+ cstr(amt)
|
||||
self.doc.total_amount_in_words = get_obj('Sales Common').get_total_in_words(dcc, cstr(amt))
|
||||
|
||||
|
||||
# --------------------------------
|
||||
|
||||
@@ -311,7 +311,8 @@ class DocType(TransactionBase):
|
||||
# Set totals in words
|
||||
#--------------------
|
||||
def set_in_words(self):
|
||||
self.doc.in_words = get_obj('Sales Common').get_total_in_words(get_defaults()['currency'], self.doc.rounded_total)
|
||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||
self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.rounded_total)
|
||||
self.doc.in_words_export = get_obj('Sales Common').get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
||||
|
||||
# Clear Advances
|
||||
|
||||
@@ -210,7 +210,7 @@ pscript.set_ac_head = function(parent_account, r,type) {
|
||||
}
|
||||
$c_obj('GL Control', 'get_company_currency', pscript.ab_company_sel.value, callback);
|
||||
|
||||
d.balance.innerHTML = (dcc ? dcc : sys_defaults.currency)+ ' ' + (r.balance ? fmt_money(r.balance) :'0.00');
|
||||
d.balance.innerHTML = (dcc)+ ' ' + (r.balance ? fmt_money(r.balance) :'0.00');
|
||||
}
|
||||
//cost center group/ledger area
|
||||
else{
|
||||
|
||||
Reference in New Issue
Block a user