Merge lp:~therp-nl/ocb-addons/7.0-aged_partner_balance_selection_of_partners into lp:ocb-addons

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 9475
Proposed branch: lp:~therp-nl/ocb-addons/7.0-aged_partner_balance_selection_of_partners
Merge into: lp:ocb-addons
Diff against target: 87 lines (+23/-4)
3 files modified
account/report/account_aged_partner_balance.py (+14/-2)
account/wizard/account_report_aged_partner_balance.py (+2/-2)
account/wizard/account_report_aged_partner_balance_view.xml (+7/-0)
To merge this branch: bzr merge lp:~therp-nl/ocb-addons/7.0-aged_partner_balance_selection_of_partners
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) code review Approve
Guewen Baconnier @ Camptocamp code review, no test Approve
Niels Huylebroeck (community) Approve
Review via email: mp+183608@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Niels Huylebroeck (red15) wrote :

pdb statement in account/report/account_partner_ledger.py

review: Needs Fixing
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Hi Niels, you're quick! I caught it myself too.

Revision history for this message
Niels Huylebroeck (red15) wrote :
Revision history for this message
Niels Huylebroeck (red15) wrote :

Looks ok now, isn't this report also included in the financial reporting by c2c (though in webkit?)

review: Approve
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

> Looks ok now, isn't this report also included in the financial reporting by
> c2c (though in webkit?)

No, there is no aged partner balance in our reports.

Code seems ok to me

review: Approve (code review, no test)
Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/report/account_aged_partner_balance.py'
2--- account/report/account_aged_partner_balance.py 2013-09-02 15:27:56 +0000
3+++ account/report/account_aged_partner_balance.py 2013-09-03 10:25:34 +0000
4@@ -57,6 +57,7 @@
5 self.ACCOUNT_TYPE = ['payable']
6 else:
7 self.ACCOUNT_TYPE = ['payable','receivable']
8+ self.partner_ids = ids if data.get('model') == 'res.partner' else False
9 return super(aged_trial_report, self).set_context(objects, data, ids, report_type=report_type)
10
11 def _get_lines(self, form):
12@@ -64,6 +65,15 @@
13 move_state = ['draft','posted']
14 if self.target_move == 'posted':
15 move_state = ['posted']
16+ query_params = [
17+ tuple(move_state), tuple(self.ACCOUNT_TYPE),
18+ self.date_from, self.date_from]
19+ if self.partner_ids:
20+ partner_query = ' AND res_partner.id IN %s '
21+ query_params.append(tuple(self.partner_ids))
22+ else:
23+ partner_query = ''
24+
25 self.cr.execute('SELECT DISTINCT res_partner.id AS id,\
26 res_partner.name AS name \
27 FROM res_partner,account_move_line AS l, account_account, account_move am\
28@@ -76,8 +86,8 @@
29 OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date >= %s::timestamp + \'1day\'::interval )))\
30 AND (l.partner_id=res_partner.id)\
31 AND (l.date <= %s)\
32- AND ' + self.query + ' \
33- ORDER BY res_partner.name', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,))
34+ AND ' + self.query + partner_query + ' \
35+ ORDER BY res_partner.name', tuple(query_params))
36 partners = self.cr.dictfetchall()
37 ## mise a 0 du total
38 for i in range(7):
39@@ -224,6 +234,8 @@
40 return res
41
42 def _get_lines_with_out_partner(self, form):
43+ if self.partner_ids:
44+ return []
45 res = []
46 move_state = ['draft','posted']
47 if self.target_move == 'posted':
48
49=== modified file 'account/wizard/account_report_aged_partner_balance.py'
50--- account/wizard/account_report_aged_partner_balance.py 2012-10-23 16:05:04 +0000
51+++ account/wizard/account_report_aged_partner_balance.py 2013-09-03 10:25:34 +0000
52@@ -49,6 +49,8 @@
53 context = {}
54
55 data = self.pre_print_report(cr, uid, ids, data, context=context)
56+ data['ids'] = context.get('active_ids', [])
57+ data['model'] = context.get('active_model', 'ir.ui.menu')
58 data['form'].update(self.read(cr, uid, ids, ['period_length', 'direction_selection'])[0])
59
60 period_length = data['form']['period_length']
61@@ -78,8 +80,6 @@
62 }
63 start = stop + relativedelta(days=1)
64 data['form'].update(res)
65- if data.get('form',False):
66- data['ids']=[data['form'].get('chart_account_id',False)]
67 return {
68 'type': 'ir.actions.report.xml',
69 'report_name': 'account.aged_trial_balance',
70
71=== modified file 'account/wizard/account_report_aged_partner_balance_view.xml'
72--- account/wizard/account_report_aged_partner_balance_view.xml 2012-10-23 16:05:04 +0000
73+++ account/wizard/account_report_aged_partner_balance_view.xml 2013-09-03 10:25:34 +0000
74@@ -41,6 +41,13 @@
75 <field name="target">new</field>
76 </record>
77
78+ <record model="ir.values" id="ir_values_account_aged_partner_balance">
79+ <field name="key2" eval="'client_print_multi'"/>
80+ <field name="model" eval="'res.partner'"/>
81+ <field name="name">Print Aged Partner Balance</field>
82+ <field name="value" eval="'ir.actions.act_window,%d'%action_account_aged_balance_view"/>
83+ </record>
84+
85 <menuitem icon="STOCK_PRINT"
86 name="Aged Partner Balance"
87 action="action_account_aged_balance_view"