diff options
| author | jem-odoo <jem@openerp.com> | 2018-04-30 15:15:07 +0200 |
|---|---|---|
| committer | jem-odoo <jem@openerp.com> | 2018-05-04 13:22:11 +0200 |
| commit | 37dab1bc07c81bc98a48e98e52d7ec718c9dbbb4 (patch) | |
| tree | 10986640a57116637a88eb5b8c5d7fa066dab4e3 | |
| parent | a3372ffa33b3b90d9c293dbfb45b4062feac2865 (diff) | |
[FIX] sale_timesheet: access error during onchange
`compute_sudo=True` execute the compute method as super
user, to avoid access error. This also allow to trigger
other computation in cascade without being stopped by
access right error if the system has job to do.
However, during a onchange, the method is not executed
as super user, so access error can raise. An explicit
`sudo()`in the compute method is required, in addition
to the 'compute_sudo` on the field (usefull when storing
value).
This commit avoid the problem when a user (that is no
timesheet user) try to add a SO line the delivered qty
is based on its related timesheets (analytic lines).
| -rw-r--r-- | addons/sale_timesheet/models/sale_order.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/sale_timesheet/models/sale_order.py b/addons/sale_timesheet/models/sale_order.py index cbaab9e9fa7..ffe78b9dd41 100644 --- a/addons/sale_timesheet/models/sale_order.py +++ b/addons/sale_timesheet/models/sale_order.py @@ -151,7 +151,7 @@ class SaleOrderLine(models.Model): lines_by_timesheet = self.filtered(lambda sol: sol.qty_delivered_method == 'timesheet') domain = lines_by_timesheet._timesheet_compute_delivered_quantity_domain() - mapping = lines_by_timesheet._get_delivered_quantity_by_analytic(domain) + mapping = lines_by_timesheet.sudo()._get_delivered_quantity_by_analytic(domain) for line in lines_by_timesheet: line.qty_delivered = mapping.get(line.id, 0.0) |
