Merge lp:~romaindeheele/account-invoicing/account-invoicing-merge into lp:~laetitia-gangloff/account-invoicing/account_invoice_merge

Proposed by Romain Deheele - Camptocamp
Status: Merged
Merged at revision: 32
Proposed branch: lp:~romaindeheele/account-invoicing/account-invoicing-merge
Merge into: lp:~laetitia-gangloff/account-invoicing/account_invoice_merge
Diff against target: 22 lines (+6/-0)
1 file modified
account_invoice_merge/invoice.py (+6/-0)
To merge this branch: bzr merge lp:~romaindeheele/account-invoicing/account-invoicing-merge
Reviewer Review Type Date Requested Status
Laetitia Gangloff (Acsone) Pending
Review via email: mp+177796@code.launchpad.net

Description of the change

Hello,

invoice merge must linked order lines and new invoice lines (many2many : table sale_order_line_invoice_rel) : the field 'invoiced' on sale.order.line needs it to provide correct information

Romain

To post a comment you must log in.
Revision history for this message
Laetitia Gangloff (Acsone) (laetitia-gangloff) wrote :

Hello,

I merge your change.

Thank you for this improvement.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_invoice_merge/invoice.py'
2--- account_invoice_merge/invoice.py 2013-07-31 09:31:35 +0000
3+++ account_invoice_merge/invoice.py 2013-07-31 10:39:29 +0000
4@@ -165,12 +165,18 @@
5
6 # make link between original sale order or purchase order
7 so_obj = self.pool.get('sale.order') # None if sale is not installed
8+ order_line_obj = self.pool.get('sale.order.line')
9+ invoice_line_obj = self.pool.get('account.invoice.line')
10 po_obj = self.pool.get('purchase.order') # None if purchase is not installed
11 for new_invoice in invoices_info:
12 if so_obj is not None:
13 todo_ids = so_obj.search(cr, uid, [('invoice_ids', 'in', invoices_info[new_invoice])], context=context)
14 for org_invoice in so_obj.browse(cr, uid, todo_ids, context=context):
15 so_obj.write(cr, uid, [org_invoice.id], {'invoice_ids': [(4, new_invoice)]}, context)
16+ for so_line in org_invoice.order_line:
17+ invoice_line_ids = invoice_line_obj.search(cr, uid, [('product_id','=',so_line.product_id.id),('invoice_id','=',new_invoice)])
18+ if invoice_line_ids:
19+ order_line_obj.write(cr, uid, [so_line.id],{'invoice_lines': [(6, 0, invoice_line_ids)]}, context=context)
20 if po_obj is not None:
21 todo_ids = po_obj.search(cr, uid, [('invoice_ids', 'in', invoices_info[new_invoice])], context=context)
22 for org_invoice in po_obj.browse(cr, uid, todo_ids, context=context):

Subscribers

People subscribed via source and target branches