[FIX] account: fix the profit loss report so it will not show Net Profit or Net loss when the balance is zero

bzr revid: psi@tinyerp.co.in-20110615102959-usfvt7vdwr5z3dgp
This commit is contained in:
psi (Open ERP) 2011-06-15 15:59:59 +05:30
parent 94e35b57f5
commit 1c7e364d21
1 changed files with 5 additions and 1 deletions

View File

@ -101,6 +101,7 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
cal_list = {}
account_id = data['form'].get('chart_account_id', False)
company_currency = account_pool.browse(self.cr, self.uid, account_id).company_id.currency_id
account_ids = account_pool._get_children_and_consol(cr, uid, account_id, context=ctx)
accounts = account_pool.browse(cr, uid, account_ids, context=ctx)
@ -121,7 +122,10 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
accounts_temp.append(account)
else:
accounts_temp.append(account)
if self.result_sum_dr > self.result_sum_cr:
if self.result_sum_cr == self.result_sum_dr and currency_pool.is_zero(self.cr, self.uid, company_currency, (self.result_sum_dr-self.result_sum_cr)):
self.res_pl['type'] = None
self.res_pl['balance'] = 0.0
elif self.result_sum_dr > self.result_sum_cr:
self.res_pl['type'] = _('Net Loss')
self.res_pl['balance'] = (self.result_sum_dr - self.result_sum_cr)
else: