← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~therp-nl/account-invoicing/7.0-lp1294623-invoic_id_on_analytic_line into lp:account-invoicing

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/account-invoicing/7.0-lp1294623-invoic_id_on_analytic_line into lp:account-invoicing.

Requested reviews:
  Lara (Therp) (lfreeke): test
  Account Core Editors (account-core-editors)
Related bugs:
  Bug #1294623 in Account - Invoicing: "Error when merge invoice (account_analytic_line)"
  https://bugs.launchpad.net/account-invoicing/+bug/1294623

For more details, see:
https://code.launchpad.net/~therp-nl/account-invoicing/7.0-lp1294623-invoic_id_on_analytic_line/+merge/211708
-- 
https://code.launchpad.net/~therp-nl/account-invoicing/7.0-lp1294623-invoic_id_on_analytic_line/+merge/211708
Your team Account Core Editors is requested to review the proposed merge of lp:~therp-nl/account-invoicing/7.0-lp1294623-invoic_id_on_analytic_line into lp:account-invoicing.
=== modified file 'account_invoice_merge/invoice.py'
--- account_invoice_merge/invoice.py	2014-02-07 23:16:16 +0000
+++ account_invoice_merge/invoice.py	2014-03-19 12:18:32 +0000
@@ -184,9 +184,15 @@
 
         # recreate link (if any) between original analytic account line (invoice time sheet for example) and this new invoice
         anal_line_obj = self.pool.get('account.analytic.line')
-        for new_invoice_id in invoices_info:
-            todo_ids = anal_line_obj.search(cr, uid, [('invoice_id', 'in', invoices_info[new_invoice_id])], context=context)
-            anal_line_obj.write(cr, uid, todo_ids, {'invoice_id': new_invoice_id}, context=context)
+        if 'invoice_id' in anal_line_obj._columns:
+            for new_invoice_id in invoices_info:
+                todo_ids = anal_line_obj.search(
+                    cr, uid,
+                    [('invoice_id', 'in', invoices_info[new_invoice_id])],
+                    context=context)
+                anal_line_obj.write(
+                    cr, uid, todo_ids, {'invoice_id': new_invoice_id},
+                    context=context)
 
         return invoices_info
 


References