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
=== modified file 'sale_payment_method/sale.py'
--- sale_payment_method/sale.py 2014-01-14 12:49:52 +0000
+++ sale_payment_method/sale.py 2014-01-15 08:47:13 +0000
@@ -265,9 +265,12 @@
265 mod_obj = self.pool.get('ir.model.data')265 mod_obj = self.pool.get('ir.model.data')
266 act_obj = self.pool.get('ir.actions.act_window')266 act_obj = self.pool.get('ir.actions.act_window')
267267
268 payment_ids = []268 move_ids = set()
269 for so in self.browse(cr, uid, ids, context=context):269 for so in self.browse(cr, uid, ids, context=context):
270 payment_ids += [move.id for move in so.payment_ids]270 # payment_ids are move lines, we want to display the moves
271 move_ids |= set([move_line.move_id.id for move_line
272 in so.payment_ids])
273 move_ids = list(move_ids)
271274
272 ref = mod_obj.get_object_reference(cr, uid, 'account',275 ref = mod_obj.get_object_reference(cr, uid, 'account',
273 'action_move_journal_line')276 'action_move_journal_line')
@@ -277,13 +280,13 @@
277 action = act_obj.read(cr, uid, [action_id], context=context)[0]280 action = act_obj.read(cr, uid, [action_id], context=context)[0]
278281
279 # choose the view_mode accordingly282 # choose the view_mode accordingly
280 if len(payment_ids) > 1:283 if len(move_ids) > 1:
281 action['domain'] = str([('id', 'in', payment_ids)])284 action['domain'] = str([('id', 'in', move_ids)])
282 else:285 else:
283 ref = mod_obj.get_object_reference(cr, uid, 'account',286 ref = mod_obj.get_object_reference(cr, uid, 'account',
284 'view_move_form')287 'view_move_form')
285 action['views'] = [(ref[1] if ref else False, 'form')]288 action['views'] = [(ref[1] if ref else False, 'form')]
286 action['res_id'] = payment_ids[0] if payment_ids else False289 action['res_id'] = move_ids[0] if move_ids else False
287 return action290 return action
288291
289 def action_cancel(self, cr, uid, ids, context=None):292 def action_cancel(self, cr, uid, ids, context=None):

Subscribers

People subscribed via source and target branches