diff --git a/addons/sale_timesheet/models/account.py b/addons/sale_timesheet/models/account.py index b933b65363f..c14767aacbf 100644 --- a/addons/sale_timesheet/models/account.py +++ b/addons/sale_timesheet/models/account.py @@ -121,6 +121,10 @@ class AccountAnalyticLine(models.Model): domain = super(AccountAnalyticLine, self)._timesheet_get_portal_domain() return expression.AND([domain, [('timesheet_invoice_type', 'in', ['billable_time', 'non_billable'])]]) + def _get_timesheets_to_merge(self): + res = super(AccountAnalyticLine, self)._get_timesheets_to_merge() + return res.filtered(lambda l: not l.timesheet_invoice_id or l.timesheet_invoice_id.state != 'posted') + def unlink(self): if any(line.timesheet_invoice_id and line.timesheet_invoice_id.state == 'posted' for line in self): raise UserError(_('You cannot remove a timesheet that has already been invoiced.'))