Merge lp:~sbi/openobject-addons/7.0-financial_report-hook into lp:openobject-addons/7.0

Proposed by Stéphane Bidoul (Acsone)
Status: Needs review
Proposed branch: lp:~sbi/openobject-addons/7.0-financial_report-hook
Merge into: lp:openobject-addons/7.0
Diff against target: 20 lines (+3/-0)
1 file modified
account/report/account_financial_report.py (+3/-0)
To merge this branch: bzr merge lp:~sbi/openobject-addons/7.0-financial_report-hook
Reviewer Review Type Date Requested Status
Xavier ALT Pending
OpenERP Core Team Pending
Review via email: mp+159789@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

This very small extension to the account_financial_report calculation algorithm would make it possible to reuse the algorithm to produce alternative reports.

The typical use case is the production of specific formats according to some state regulation: the data to produce is often computable using the financial report mechanism, but specific codes need to be added for instance.

This patch makes it possible to reuse the algorithm in useful ways.

Unmerged revisions

9041. By Stéphane Bidoul (Acsone)

[IMP] account_financial_report: add information in the data produced by report computation algorithm so alternative reports can be produced more easily by reusing the algorithm

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/report/account_financial_report.py'
2--- account/report/account_financial_report.py 2013-02-25 18:07:30 +0000
3+++ account/report/account_financial_report.py 2013-04-19 10:41:27 +0000
4@@ -55,6 +55,7 @@
5 ids2 = self.pool.get('account.financial.report')._get_children_by_order(self.cr, self.uid, [data['form']['account_report_id'][0]], context=data['form']['used_context'])
6 for report in self.pool.get('account.financial.report').browse(self.cr, self.uid, ids2, context=data['form']['used_context']):
7 vals = {
8+ 'report': report,
9 'name': report.name,
10 'balance': report.balance * report.sign or 0.0,
11 'type': 'report',
12@@ -84,6 +85,8 @@
13 continue
14 flag = False
15 vals = {
16+ 'report': report,
17+ 'account': account,
18 'name': account.code + ' ' + account.name,
19 'balance': account.balance != 0 and account.balance * report.sign or account.balance,
20 'type': 'account',