From 0c1d497c628bffe3a218ad98b4e1f4bf557b1077 Mon Sep 17 00:00:00 2001 From: "Rifakat (OpenERP)" <> Date: Wed, 28 Nov 2012 17:59:40 +0530 Subject: [PATCH] [FIX]hr_timesheet_invoice: Fix issue Invoice tasks creates new tasks to invoice lp bug: https://launchpad.net/bugs/948876 fixed bzr revid: mma@tinyerp.com-20121128122940-96pwz3ot6j5zgym6 --- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index 161ac761aec..0de33f5690c 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -368,10 +368,13 @@ class account_move_line(osv.osv): res = super(account_move_line, self).create_analytic_lines(cr, uid, ids,context=context) analytic_line_obj = self.pool.get('account.analytic.line') for move_line in self.browse(cr, uid, ids, context=context): + #For customer invoice, link analytic line to the invoice so it is not proposed for invoicing in Bill Tasks Work + 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()