Skip to content
Snippets Groups Projects
Commit 26b851e5 authored by Yannick Tivisse's avatar Yannick Tivisse
Browse files

[IMP] sale_timesheet: Move timesheet_revenue computation in a separate method

Will be used in migration scripts to saas~16 to compute this value for all the invoices that have been validated
parent 2febb877
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,10 @@ class AccountInvoice(models.Model):
@api.multi
def invoice_validate(self):
result = super(AccountInvoice, self).invoice_validate()
self._compute_timesheet_revenue()
return result
def _compute_timesheet_revenue(self):
for invoice in self:
for invoice_line in invoice.invoice_line_ids.filtered(lambda line: line.product_id.type == 'service'):
uninvoiced_timesheet_lines = self.env['account.analytic.line'].sudo().search([
......@@ -104,5 +107,3 @@ class AccountInvoice(models.Model):
'timesheet_invoice_id': invoice.id,
'timesheet_revenue': float_round(line_revenue, precision),
})
return result
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment