Merge lp:~camptocamp/e-commerce-addons/7.0-sale_automatic_workflow-reconcile-error into lp:~extra-addons-commiter/e-commerce-addons/7.0

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

Description of the change

Fixes lp:1269291

Code was just broken...
The automatic reconciliation was no longer possible.

"invoice.sale_ids[0].payment_ids" are move lines since http://bazaar.launchpad.net/~extra-addons-commiter/e-commerce-addons/7.0/revision/282.1.25.

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

It seems to me a conflict wasn't correctly resolved between
revid:<email address hidden>
and revid:<email address hidden>

This merge does the right changes

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

Hi Guewen

Regarding the fix you should change the line 10 with :

payment_move_lines = self._get_payment(cr, uid, invoice, context=context)

Note : the _get_payment method will retrieve the correct move_line (the aim is to be able to extend the reconciliation for purchase order too, a real case is for the incoming invoice, prepaid in checkmo before validating the purchase order)

After this change it will be ok for me

review: Needs Fixing (code review, no tests)
291. By Guewen Baconnier @ Camptocamp

use method to get the move lines

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

> Hi Guewen
>
> Regarding the fix you should change the line 10 with :
>
> payment_move_lines = self._get_payment(cr, uid, invoice, context=context)
>
> Note : the _get_payment method will retrieve the correct move_line (the aim is
> to be able to extend the reconciliation for purchase order too, a real case is
> for the incoming invoice, prepaid in checkmo before validating the purchase
> order)
>
> After this change it will be ok for me

Thanks for reviewing! Done

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'sale_automatic_workflow/invoice.py'
--- sale_automatic_workflow/invoice.py 2013-11-04 09:21:34 +0000
+++ sale_automatic_workflow/invoice.py 2014-01-16 07:59:53 +0000
@@ -119,12 +119,13 @@
119 use_currency = currency.id != company_currency_id119 use_currency = currency.id != company_currency_id
120 if self._can_be_reconciled(cr, uid, invoice, context=context):120 if self._can_be_reconciled(cr, uid, invoice, context=context):
121 payment_move_lines = []121 payment_move_lines = []
122 for payment in invoice.sale_ids[0].payment_ids:122 payment_move_lines = self._get_payment(cr, uid, invoice,
123 payment_move_lines += payment.line_id123 context=context)
124 res_payment = self._get_sum_payment_move_line(124 res_payment = self._get_sum_payment_move_line(
125 cr, uid, payment_move_lines, context=context)125 cr, uid, payment_move_lines, invoice.type, context=context)
126 res_invoice = self._get_sum_invoice_move_line(126 res_invoice = self._get_sum_invoice_move_line(
127 cr, uid, invoice.move_id.line_id, context=context)127 cr, uid, invoice.move_id.line_id,
128 invoice.type, context=context)
128 line_ids = res_invoice['line_ids'] + res_payment['line_ids']129 line_ids = res_invoice['line_ids'] + res_payment['line_ids']
129 if not use_currency:130 if not use_currency:
130 balance = abs(res_invoice['total_amount'] -131 balance = abs(res_invoice['total_amount'] -

Subscribers

People subscribed via source and target branches