Antony Lesuisse (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-account-report-sign into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account-report-sign/+merge/76495
Add sign on usertype
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account-report-sign/+merge/76495
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-account-report-sign.
=== modified file 'account/account.py'
--- account/account.py 2011-09-19 14:12:51 +0000
+++ account/account.py 2011-09-21 22:40:29 +0000
@@ -139,7 +139,7 @@
'Balance' will generally be used for cash accounts.
'Detail' will copy each existing journal item of the previous year, even the reconciled ones.
'Unreconciled' will copy only the journal items that were unreconciled on the first day of the new fiscal year."""),
- 'sign': fields.selection([(-1, 'Negative'), (1, 'Positive')], 'Sign on Reports', required=True, help='Allows you to change the sign of the balance amount displayed in the reports, so that you can see positive figures instead of negative ones in expenses accounts.'),
+ 'sign': fields.selection([(-1, 'Reverse balance sign'), (1, 'Preserve balance sign')], 'Sign on Reports', required=True, help='For accounts that are typically more debited than credited and that you would like to print as negative amounts in your reports, you should reverse the sign of the balance; e.g.: Expense account. The same applies for accounts that are typically more credited than debited and that you would like to print as positive amounts in your reports; e.g.: Income account.'),
'report_type':fields.selection([
('none','/'),
('income','Profit & Loss (Income Accounts)'),
=== modified file 'account/account_view.xml'
--- account/account_view.xml 2011-09-19 15:01:46 +0000
+++ account/account_view.xml 2011-09-21 22:40:29 +0000
@@ -749,6 +749,7 @@
<group col="2" colspan="2">
<separator string="Reporting Configuration" colspan="4"/>
<field name="report_type" select="2"/>
+ <field name="sign" />
</group>
<group col="2" colspan="2">
<separator string="Closing Method" colspan="4"/>
=== modified file 'account/report/account_balance_sheet.py'
--- account/report/account_balance_sheet.py 2011-06-10 16:45:54 +0000
+++ account/report/account_balance_sheet.py 2011-09-21 22:40:29 +0000
@@ -136,7 +136,7 @@
'code': account.code,
'name': account.name,
'level': account.level,
- 'balance':account.balance,
+ 'balance': account.balance != 0 and account.balance * account.user_type.sign or account.balance,
'type': account.type,
}
currency = account.currency_id and account.currency_id or account.company_id.currency_id
=== modified file 'account/report/account_financial_report.py'
--- account/report/account_financial_report.py 2011-09-09 05:54:56 +0000
+++ account/report/account_financial_report.py 2011-09-21 22:40:29 +0000
@@ -70,7 +70,7 @@
flag = False
vals = {
'name': account.code + ' ' + account.name,
- 'balance': account.balance,
+ 'balance': account.balance != 0 and account.balance * account.user_type.sign or account.balance,
'type': 'account',
'level': 6,
'account_type': account.type,
=== modified file 'account/report/account_profit_loss.py'
--- account/report/account_profit_loss.py 2011-06-16 09:53:39 +0000
+++ account/report/account_profit_loss.py 2011-09-21 22:40:29 +0000
@@ -141,11 +141,15 @@
'code': cal_list['expense'][i].code,
'name': cal_list['expense'][i].name,
'level': cal_list['expense'][i].level,
- 'balance':cal_list['expense'][i].balance,
+ 'balance': cal_list['expense'][i].balance != 0 and \
+ cal_list['expense'][i].balance * cal_list['expense'][i].user_type.sign or \
+ cal_list['expense'][i].balance,
'code1': cal_list['income'][i].code,
'name1': cal_list['income'][i].name,
'level1': cal_list['income'][i].level,
- 'balance1':cal_list['income'][i].balance,
+ 'balance1': cal_list['income'][i].balance != 0 and \
+ cal_list['income'][i].balance * cal_list['income'][i].user_type.sign or \
+ cal_list['income'][i].balance,
}
self.result_temp.append(temp)
else:
@@ -158,7 +162,9 @@
'code1': cal_list['income'][i].code,
'name1': cal_list['income'][i].name,
'level1': cal_list['income'][i].level,
- 'balance1':cal_list['income'][i].balance,
+ 'balance1': cal_list['income'][i].balance != 0 and \
+ cal_list['income'][i].balance * cal_list['income'][i].user_type.sign \
+ or cal_list['income'][i].balance,
}
self.result_temp.append(temp)
if i < len(cal_list['expense']):
@@ -166,7 +172,9 @@
'code': cal_list['expense'][i].code,
'name': cal_list['expense'][i].name,
'level': cal_list['expense'][i].level,
- 'balance':cal_list['expense'][i].balance,
+ 'balance': cal_list['expense'][i].balance != 0 and \
+ cal_list['expense'][i].balance * cal_list['expense'][i].user_type.sign \
+ or cal_list['expense'][i].balance,
'code1': '',
'name1': '',
'level1': False,
=== modified file 'account/report/account_profit_loss.rml'
--- account/report/account_profit_loss.rml 2011-09-15 16:40:05 +0000
+++ account/report/account_profit_loss.rml 2011-09-21 22:40:29 +0000
@@ -228,8 +228,8 @@
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]]
<td><para style="terp_level_3_code">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]]<i>[[ a.code ]]</i></para></td>
<td><para style="terp_level_3_name">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]]</para></td>
- <td>[[ (a.level <>2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]]</para></td>
- <td>[[ a.level == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a.balance) ]] [[company.currency_id.symbol ]]</u></para></td>
+ <td>[[ (a.level <>2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance * a.user_type.sign) ]] [[company.currency_id.symbol ]]</para></td>
+ <td>[[ a.level == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a.balance * a.user_type.sign) ]] [[company.currency_id.symbol ]]</u></para></td>
</tr>
</blockTable>
<blockTable colWidths="100.0,326.0,113.0" style="Table_Net_Profit_Loss">
@@ -277,8 +277,8 @@
[[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]]
<td><para style="terp_level_3_code">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]]<i>[[ a.code ]]</i></para></td>
<td><para style="terp_level_3_name">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]]</para></td>
- <td>[[ (a.level <>2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance) ]] [[company.currency_id.symbol ]]</para></td>
- <td>[[ a.level == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a.balance) ]] [[company.currency_id.symbol ]]</u></para></td>
+ <td>[[ (a.level <>2) or removeParentNode('td') ]]<para style="terp_level_3_balance">[[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance * a.user_type.sign) ]] [[company.currency_id.symbol ]]</para></td>
+ <td>[[ a.level == 2 or removeParentNode('td') ]]<para style="terp_level_2_balance"><u>[[ formatLang(a.balance * a.user_type.sign) ]] [[company.currency_id.symbol ]]</u></para></td>
</tr>
</blockTable>
<blockTable colWidths="100.0,326.0,113.0" style="Table4">
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp