From 05e833ccfa3efc4f3c716c4e632d0528574e5d91 Mon Sep 17 00:00:00 2001 From: "Kervel,PSO" <> Date: Thu, 7 Apr 2011 11:06:42 +0530 Subject: [PATCH 1/2] [FIX] hr_timesheet_invoice: Passed to_invocie while creating of analytic lines lp bug: https://launchpad.net/bugs/734497 fixed bzr revid: pso@tinyerp.com-20110407053642-ao3itgzmfg94oboy --- .../hr_timesheet_invoice/hr_timesheet_invoice.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index 215c98c02ac..2ffa628a12d 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -176,5 +176,20 @@ class account_invoice(osv.osv): account_invoice() +class account_move_line(osv.osv): + _inherit = "account.move.line" + + 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') + for move_line in self.pool.get('account.move.line').browse(cr, uid, ids, context=context): + 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}) + return res + +account_move_line() + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 996f3359650feb4782dffc75082195a602c20875 Mon Sep 17 00:00:00 2001 From: "pso (OpenERP)" Date: Thu, 7 Apr 2011 11:12:43 +0530 Subject: [PATCH 2/2] [IMP] hr_timesheet_invoice: Improved create_analytic_lines func bzr revid: pso@tinyerp.com-20110407054243-6rus1i8rcx0cj1qs --- addons/hr_timesheet_invoice/hr_timesheet_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index 2ffa628a12d..5c042c5c7e3 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -182,7 +182,7 @@ class account_move_line(osv.osv): 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') - for move_line in self.pool.get('account.move.line').browse(cr, uid, ids, context=context): + for move_line in self.browse(cr, uid, ids, context=context): for line in move_line.analytic_lines: toinv = line.account_id.to_invoice.id if toinv: