[IMP] used is_zero funtion of res.currency in account reports

bzr revid: psi@tinyerp.co.in-20101220094933-k93t4h87d985s20w
This commit is contained in:
psi (Open ERP) 2010-12-20 15:19:33 +05:30
parent 024bb524f6
commit 5a1f918d35
3 changed files with 13 additions and 9 deletions

View File

@ -70,6 +70,9 @@ class account_balance(report_sxw.rml_parse, common_report_header):
def lines(self, form, ids=[], done=None):#, level=1):
def _process_child(accounts, disp_acc, parent):
account_rec = [acct for acct in accounts if acct['id']==parent][0]
currency_obj = self.pool.get('res.currency')
acc_id = self.pool.get('account.account').browse(self.cr, self.uid, account_rec['id'])
currency = acc_id.currency_id and acc_id.currency_id or acc_id.company_id.currency_id
res = {
'id': account_rec['id'],
'type': account_rec['type'],
@ -84,12 +87,11 @@ class account_balance(report_sxw.rml_parse, common_report_header):
}
self.sum_debit += account_rec['debit']
self.sum_credit += account_rec['credit']
acc_digit = self.pool.get('decimal.precision').precision_get(self.cr, 1, 'Account')
if disp_acc == 'bal_movement':
if round(res['credit'], acc_digit) > 0 or round(res['debit'], acc_digit) > 0 or round(res['balance'], acc_digit) != 0:
if currency_obj.is_zero(self.cr, self.uid, currency, res['credit']) > 0 or currency_obj.is_zero(self.cr, self.uid, currency, res['debit']) > 0 or currency_obj.is_zero(self.cr, self.uid, currency, res['balance']) != 0:
self.result_acc.append(res)
elif disp_acc == 'bal_solde':
if round(res['balance'], acc_digit) != 0:
if currency_obj.is_zero(self.cr, self.uid, currency, res['debit']) != 0:
self.result_acc.append(res)
else:
self.result_acc.append(res)

View File

@ -89,6 +89,7 @@ class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header)
self.res_bl = self.obj_pl.final_result()
account_pool = db_pool.get('account.account')
currency_pool = db_pool.get('res.currency')
types = [
'liability',
@ -136,16 +137,16 @@ class report_balancesheet_horizontal(report_sxw.rml_parse, common_report_header)
'level': account.level,
'balance':account.balance,
}
acc_digit = self.pool.get('decimal.precision').precision_get(self.cr, 1, 'Account')
currency = account.currency_id and account.currency_id or account.company_id.currency_id
if typ == 'liability' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_dr += account.balance
if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_cr += account.balance
if data['form']['display_account'] == 'bal_movement':
if round(account.credit, acc_digit) > 0 or round(account.debit, acc_digit) > 0 or round(account.balance, acc_digit) != 0:
if currency_pool.is_zero(self.cr, self.uid, currency, account.credit) > 0 or currency_pool.is_zero(self.cr, self.uid, currency, account.debit) > 0 or currency_pool.is_zero(self.cr, self.uid, currency, account.balance) != 0:
accounts_temp.append(account_dict)
elif data['form']['display_account'] == 'bal_solde':
if round(account.balance, acc_digit) != 0:
if currency_pool.is_zero(self.cr, self.uid, currency, account.balance) != 0:
accounts_temp.append(account_dict)
else:
accounts_temp.append(account_dict)

View File

@ -82,6 +82,7 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
db_pool = pooler.get_pool(self.cr.dbname)
account_pool = db_pool.get('account.account')
currency_pool = db_pool.get('res.currency')
types = [
'expense',
@ -106,16 +107,16 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
accounts_temp = []
for account in accounts:
if (account.user_type.report_type) and (account.user_type.report_type == typ):
acc_digit = self.pool.get('decimal.precision').precision_get(self.cr, 1, 'Account')
currency = account.currency_id and account.currency_id or account.company_id.currency_id
if typ == 'expense' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_dr += abs(account.debit - account.credit)
if typ == 'income' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_cr += abs(account.debit - account.credit)
if data['form']['display_account'] == 'bal_movement':
if round(account.credit, acc_digit) > 0 or round(account.debit, acc_digit) > 0 or round(account.balance, acc_digit) != 0:
if currency_pool.is_zero(self.cr, self.uid, currency, account.credit) > 0 or currency_pool.is_zero(self.cr, self.uid, currency, account.debit) > 0 or currency_pool.is_zero(self.cr, self.uid, currency, account.balance) != 0:
accounts_temp.append(account)
elif data['form']['display_account'] == 'bal_solde':
if round(account.balance, acc_digit) != 0:
if currency_pool.is_zero(self.cr, self.uid, currency, account.balance) != 0:
accounts_temp.append(account)
else:
accounts_temp.append(account)