[IMP] account: net profit and net loss with translatable

bzr revid: mra@mra-laptop-20101025102625-6ss4h9vmxi4zuumf
This commit is contained in:
Mustufa Rangwala 2010-10-25 15:56:25 +05:30
parent 3ea865c72a
commit 443bbac2a3
2 changed files with 12 additions and 10 deletions

View File

@ -26,6 +26,7 @@ import rml_parse
from report import report_sxw
from account.report import account_profit_loss
from common_report_header import common_report_header
from tools.translate import _
class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
def __init__(self, cr, uid, name, context=None):
@ -61,12 +62,12 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
self.context = context
def sum_dr(self):
if self.res_bl['type'] == 'Net Profit':
if self.res_bl['type'] == _('Net Profit'):
self.result_sum_dr += self.res_bl['balance']*-1
return self.result_sum_dr
def sum_cr(self):
if self.res_bl['type'] == 'Net Loss':
if self.res_bl['type'] == _('Net Loss'):
self.result_sum_cr += self.res_bl['balance']
return self.result_sum_cr
@ -105,13 +106,13 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header):
accounts = account_pool.browse(cr, uid, account_ids, context=ctx)
if not self.res_bl:
self.res_bl['type'] = 'Net Profit'
self.res_bl['type'] = _('Net Profit')
self.res_bl['balance'] = 0.0
if self.res_bl['type'] == 'Net Profit':
self.res_bl['type'] = 'Net Profit'
if self.res_bl['type'] == _('Net Profit'):
self.res_bl['type'] = _('Net Profit')
else:
self.res_bl['type'] = 'Net Loss'
self.res_bl['type'] = _('Net Loss')
pl_dict = {
'code': self.res_bl['type'],
'name': self.res_bl['type'],

View File

@ -24,6 +24,7 @@ import pooler
import rml_parse
from report import report_sxw
from common_report_header import common_report_header
from tools.translate import _
class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header):
@ -62,12 +63,12 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header):
return self.res_pl
def sum_dr(self):
if self.res_pl['type'] == 'Net Profit':
if self.res_pl['type'] == _('Net Profit'):
self.result_sum_dr += self.res_pl['balance']
return self.result_sum_dr
def sum_cr(self):
if self.res_pl['type'] == 'Net Loss':
if self.res_pl['type'] == _('Net Loss'):
self.result_sum_cr += self.res_pl['balance']
return self.result_sum_cr
@ -114,10 +115,10 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header):
else:
accounts_temp.append(account)
if self.result_sum_dr > self.result_sum_cr:
self.res_pl['type'] = 'Net Loss'
self.res_pl['type'] = _('Net Loss')
self.res_pl['balance'] = (self.result_sum_dr - self.result_sum_cr)
else:
self.res_pl['type'] = 'Net Profit'
self.res_pl['type'] = _('Net Profit')
self.res_pl['balance'] = (self.result_sum_cr - self.result_sum_dr)
self.result[typ] = accounts_temp
cal_list[typ] = self.result[typ]