Default currency for company fixed
This commit is contained in:
parent
2380eabb32
commit
5708da5a9f
@ -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,d,dl):
|
def __init__(self,d,dl):
|
||||||
self.doc, self.doclist = d, dl
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
@ -97,5 +97,6 @@ class DocType:
|
|||||||
for d in getlist(self.doclist,'form_16A_tax_details'):
|
for d in getlist(self.doclist,'form_16A_tax_details'):
|
||||||
tot=flt(tot)+flt(d.total_tax_deposited)
|
tot=flt(tot)+flt(d.total_tax_deposited)
|
||||||
|
|
||||||
|
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||||
self.doc.total_amount = flt(tot)
|
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)
|
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
|
convert_to_lists = webnotes.conn.convert_to_lists
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------
|
||||||
|
from utilities.transaction_base import TransactionBase
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self,d,dl):
|
def __init__(self,d,dl):
|
||||||
@ -35,8 +35,8 @@ class DocType:
|
|||||||
return {'cl':[r[0] for r in ret]}#, 'pl':pl}
|
return {'cl':[r[0] for r in ret]}#, 'pl':pl}
|
||||||
|
|
||||||
def get_company_currency(self,arg=''):
|
def get_company_currency(self,arg=''):
|
||||||
ret = sql("select default_currency from tabCompany where name=%s and docstatus != 2", arg)
|
dcc = TransactionBase().get_company_currency(arg)
|
||||||
return ret[0]
|
return dcc
|
||||||
|
|
||||||
# Get current balance
|
# Get current balance
|
||||||
# --------------------
|
# --------------------
|
||||||
|
@ -15,7 +15,7 @@ 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:
|
class DocType:
|
||||||
def __init__(self,d,dl):
|
def __init__(self,d,dl):
|
||||||
@ -333,6 +333,7 @@ class DocType:
|
|||||||
# ------------------------
|
# ------------------------
|
||||||
def set_print_format_fields(self):
|
def set_print_format_fields(self):
|
||||||
for d in getlist(self.doclist, 'entries'):
|
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)
|
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 ''
|
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']:
|
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')
|
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':
|
if acc_type == 'Bank or Cash':
|
||||||
|
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||||
amt = cint(d.debit) and d.debit or d.credit
|
amt = cint(d.debit) and d.debit or d.credit
|
||||||
self.doc.total_amount = get_defaults()['currency']+'. '+ cstr(amt)
|
self.doc.total_amount = dcc +' '+ cstr(amt)
|
||||||
self.doc.total_amount_in_words = get_obj('Sales Common').get_total_in_words(get_defaults()['currency'], 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
|
# Set totals in words
|
||||||
#--------------------
|
#--------------------
|
||||||
def set_in_words(self):
|
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)
|
self.doc.in_words_export = get_obj('Sales Common').get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
||||||
|
|
||||||
# Clear Advances
|
# 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);
|
$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
|
//cost center group/ledger area
|
||||||
else{
|
else{
|
||||||
|
@ -207,7 +207,8 @@ class DocType(TransactionBase):
|
|||||||
sales_com_obj.check_conversion_rate(self)
|
sales_com_obj.check_conversion_rate(self)
|
||||||
|
|
||||||
# Get total in words
|
# Get total in words
|
||||||
self.doc.in_words = sales_com_obj.get_total_in_words(get_defaults()['currency'], self.doc.rounded_total)
|
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||||
|
self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
|
||||||
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
||||||
|
|
||||||
def on_update(self):
|
def on_update(self):
|
||||||
|
@ -305,7 +305,8 @@ class DocType(TransactionBase):
|
|||||||
sales_com_obj.make_packing_list(self,'sales_order_details')
|
sales_com_obj.make_packing_list(self,'sales_order_details')
|
||||||
|
|
||||||
# get total in words
|
# get total in words
|
||||||
self.doc.in_words = sales_com_obj.get_total_in_words(get_defaults()['currency'], self.doc.rounded_total)
|
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||||
|
self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
|
||||||
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
||||||
|
|
||||||
# set SO status
|
# set SO status
|
||||||
|
@ -175,7 +175,8 @@ class DocType(TransactionBase):
|
|||||||
sales_com_obj.get_allocated_sum(self) # this is to verify that the allocated % of sales persons is 100%
|
sales_com_obj.get_allocated_sum(self) # this is to verify that the allocated % of sales persons is 100%
|
||||||
sales_com_obj.check_conversion_rate(self)
|
sales_com_obj.check_conversion_rate(self)
|
||||||
# ::::::: Get total in Words ::::::::
|
# ::::::: Get total in Words ::::::::
|
||||||
self.doc.in_words = sales_com_obj.get_total_in_words(get_defaults()['currency'], self.doc.rounded_total)
|
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||||
|
self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
|
||||||
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
||||||
|
|
||||||
# ::::::: Set actual qty for each item in selected warehouse :::::::
|
# ::::::: Set actual qty for each item in selected warehouse :::::::
|
||||||
|
@ -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
|
||||||
@ -118,7 +118,8 @@ class DocType:
|
|||||||
#=======================================================
|
#=======================================================
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.check_existing()
|
self.check_existing()
|
||||||
self.doc.total_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.total_in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.rounded_total)
|
||||||
|
|
||||||
# ON SUBMIT
|
# ON SUBMIT
|
||||||
#=======================================================
|
#=======================================================
|
||||||
|
@ -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, d, dl):
|
def __init__(self, d, dl):
|
||||||
self.doc, self.doclist = d, dl
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
@ -42,7 +42,8 @@ class DocType:
|
|||||||
if not has_common(appr_roles, webnotes.user.get_roles()) and not has_common(appr_users, session['user']):
|
if not has_common(appr_roles, webnotes.user.get_roles()) and not has_common(appr_users, session['user']):
|
||||||
msg, add_msg = '',''
|
msg, add_msg = '',''
|
||||||
if max_amount:
|
if max_amount:
|
||||||
if based_on == 'Grand Total': msg = "since Grand Total exceeds %s. %s" % (get_defaults()['currency'], flt(max_amount))
|
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||||
|
if based_on == 'Grand Total': msg = "since Grand Total exceeds %s. %s" % (dcc, flt(max_amount))
|
||||||
elif based_on == 'Itemwise Discount': msg = "since Discount exceeds %s for Item Code : %s" % (cstr(max_amount)+'%', item)
|
elif based_on == 'Itemwise Discount': msg = "since Discount exceeds %s for Item Code : %s" % (cstr(max_amount)+'%', item)
|
||||||
elif based_on == 'Average Discount' or based_on == 'Customerwise Discount': msg = "since Discount exceeds %s" % (cstr(max_amount)+'%')
|
elif based_on == 'Average Discount' or based_on == 'Customerwise Discount': msg = "since Discount exceeds %s" % (cstr(max_amount)+'%')
|
||||||
|
|
||||||
|
@ -133,7 +133,8 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
|
|
||||||
# get total in words
|
# get total in words
|
||||||
self.doc.in_words = pc_obj.get_total_in_words(get_defaults().get('currency') and get_defaults()['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 bin
|
# update bin
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import webnotes
|
import webnotes
|
||||||
from webnotes.utils import load_json, cint, cstr, flt
|
from webnotes.utils import load_json, cint, cstr, flt, get_defaults
|
||||||
from webnotes.model.doc import Document, addchild, removechild, getchildren
|
from webnotes.model.doc import Document, addchild, removechild, getchildren
|
||||||
from webnotes.model.doclist import getlist, copy_doclist
|
from webnotes.model.doclist import getlist, copy_doclist
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
@ -202,3 +202,10 @@ class TransactionBase:
|
|||||||
ch.incentives = d and flt(d[3]) or 0
|
ch.incentives = d and flt(d[3]) or 0
|
||||||
ch.idx = idx
|
ch.idx = idx
|
||||||
idx += 1
|
idx += 1
|
||||||
|
|
||||||
|
# Get Company Specific Default Currency
|
||||||
|
# -------------------------------------
|
||||||
|
def get_company_currency(self, name):
|
||||||
|
ret = sql("select default_currency from tabCompany where name = '%s'" %(name))
|
||||||
|
dcc = ret and ret[0][0] or get_defaults()['currency']
|
||||||
|
return dcc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user