← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~avanzosc/ocb-addons/6.1 into lp:ocb-addons/6.1

 

Daniel Campos (Avanzosc) has proposed merging lp:~avanzosc/ocb-addons/6.1 into lp:ocb-addons/6.1.

Requested reviews:
  OpenERP Community Backports Team (ocb)

For more details, see:
https://code.launchpad.net/~avanzosc/ocb-addons/6.1/+merge/202622

Fix proposed for Bug #948876 - Invoice tasks creates new tasks to invoice
-- 
https://code.launchpad.net/~avanzosc/ocb-addons/6.1/+merge/202622
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~avanzosc/ocb-addons/6.1 into lp:ocb-addons/6.1.
=== modified file 'hr_timesheet_invoice/hr_timesheet_invoice.py'
--- hr_timesheet_invoice/hr_timesheet_invoice.py	2012-01-03 12:33:39 +0000
+++ hr_timesheet_invoice/hr_timesheet_invoice.py	2014-01-22 09:16:40 +0000
@@ -191,12 +191,14 @@
 
     def create_analytic_lines(self, cr, uid, ids, context=None):
         res = super(account_move_line, self).create_analytic_lines(cr, uid, ids,context=context)
-        analytic_line_obj = self.pool.get('account.analytic.line')
+        analytic_line_obj = self.pool.get('account.analytic.line')        
         for move_line in self.browse(cr, uid, ids, context=context):
+            invoice_id = move_line.invoice and move_line.invoice.type in ('out_invoice','out_refund') and move_line.invoice.id or False
             for line in move_line.analytic_lines:
-                toinv = line.account_id.to_invoice.id
-                if toinv:
-                    analytic_line_obj.write(cr, uid, line.id, {'to_invoice': toinv})
+                analytic_line_obj.write(cr, uid, line.id, {
+                                                           'invoice_id': invoice_id,
+                                                           'to_invoice': line.account_id.to_invoice and line.account_id.to_invoice.id or False
+                                                           }, context=context)
         return res
 
 account_move_line()


Follow ups