Merge lp:~camptocamp/e-commerce-addons/7.0-sale_payment_method-view_automatic_payment into lp:~extra-addons-commiter/e-commerce-addons/7.0

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Approved by: Yannick Vaucher @ Camptocamp
Approved revision: 290
Merged at revision: 291
Proposed branch: lp:~camptocamp/e-commerce-addons/7.0-sale_payment_method-view_automatic_payment
Merge into: lp:~extra-addons-commiter/e-commerce-addons/7.0
Diff against target: 35 lines (+8/-5)
1 file modified
sale_payment_method/sale.py (+8/-5)
To merge this branch: bzr merge lp:~camptocamp/e-commerce-addons/7.0-sale_payment_method-view_automatic_payment
Reviewer Review Type Date Requested Status
Sébastien BEAU - http://www.akretion.com code review, no tests Approve
Yannick Vaucher @ Camptocamp code review, no tests Approve
Review via email: mp+201729@code.launchpad.net

Description of the change

Fixes lp:1269294

Again, the payment_method_ids relation has been modified from account.move to account.move.line but not updated everywhere...

Here, we still want to display the moves so we get their ids from the move lines of 'payment_ids'.

To post a comment you must log in.
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM

review: Approve (code review, no tests)
Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

LGTM

review: Approve (code review, no tests)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale_payment_method/sale.py'
2--- sale_payment_method/sale.py 2014-01-14 12:49:52 +0000
3+++ sale_payment_method/sale.py 2014-01-15 08:47:13 +0000
4@@ -265,9 +265,12 @@
5 mod_obj = self.pool.get('ir.model.data')
6 act_obj = self.pool.get('ir.actions.act_window')
7
8- payment_ids = []
9+ move_ids = set()
10 for so in self.browse(cr, uid, ids, context=context):
11- payment_ids += [move.id for move in so.payment_ids]
12+ # payment_ids are move lines, we want to display the moves
13+ move_ids |= set([move_line.move_id.id for move_line
14+ in so.payment_ids])
15+ move_ids = list(move_ids)
16
17 ref = mod_obj.get_object_reference(cr, uid, 'account',
18 'action_move_journal_line')
19@@ -277,13 +280,13 @@
20 action = act_obj.read(cr, uid, [action_id], context=context)[0]
21
22 # choose the view_mode accordingly
23- if len(payment_ids) > 1:
24- action['domain'] = str([('id', 'in', payment_ids)])
25+ if len(move_ids) > 1:
26+ action['domain'] = str([('id', 'in', move_ids)])
27 else:
28 ref = mod_obj.get_object_reference(cr, uid, 'account',
29 'view_move_form')
30 action['views'] = [(ref[1] if ref else False, 'form')]
31- action['res_id'] = payment_ids[0] if payment_ids else False
32+ action['res_id'] = move_ids[0] if move_ids else False
33 return action
34
35 def action_cancel(self, cr, uid, ids, context=None):

Subscribers

People subscribed via source and target branches