summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2019-08-12 13:27:25 +0000
committerGoffin Simon <sig@odoo.com>2019-08-12 13:50:43 +0000
commita53ca4f949a7b5f2c44678eeedb6db912bc21ada (patch)
tree96abaf567d90a2167205cf46fce707ec87dd23c6
parent392f6f2b2bbb49a8a55b94510d51fa789b20a127 (diff)
[FIX] sale_timesheet: Sales user not allowed to create invoice linked to timesheets
Steps to reproduce: - Create a service product P with invoicing policy = Timesheets on tasks, Service Tracking = Create a task in a new project and Re-Invoice Policy = No. - Create a SO with P and confirm it - Go to the task created for the SO and assign an employee on it. - Valide the related analytic line in the timesheet module - Create a user U with the following rights: Sales: 'User: all documents', Project: 'Manager' and no right in Employee. - Log as U and try to invoice the SO Bug: An access rights error was raised opw:2044659 closes odoo/odoo#35656 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
-rw-r--r--addons/sale_timesheet/models/account_invoice.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/sale_timesheet/models/account_invoice.py b/addons/sale_timesheet/models/account_invoice.py
index 12a18f5524b..dbae7d52522 100644
--- a/addons/sale_timesheet/models/account_invoice.py
+++ b/addons/sale_timesheet/models/account_invoice.py
@@ -61,7 +61,7 @@ class AccountInvoiceLine(models.Model):
sale_line_delivery = invoice_line.sale_line_ids.filtered(lambda sol: sol.product_id.invoice_policy == 'delivery' and sol.product_id.service_type == 'timesheet')
if sale_line_delivery:
domain = self._timesheet_domain_get_invoiced_lines(sale_line_delivery)
- timesheets = self.env['account.analytic.line'].search(domain)
+ timesheets = self.env['account.analytic.line'].search(domain).sudo()
timesheets.write({
'timesheet_invoice_id': invoice_line.invoice_id.id,
})