[FIX] sale: Access error when user as accounting access but not sale

If an user that only has access to accounting but not to sale, tries to
validate an invoice created from a sale order, an access error will be
raised. That's because, when the invoice status changes, the invoiced
quantity on the related sale order is recomputed using the current user,
which may not have access to read sale order lines.

This commit fixes the above by ensuring the recomputation is performed
with superuser access rights.

closes odoo/odoo#58304

X-original-commit: 0bf30e1b5907997ae22d27cc420c3533940d634f
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Luis González
2020-09-23 09:39:38 +00:00
committed by Nicolas Martinelli
parent 39d32d8dd2
commit 45dce9ce00
+1
View File
@@ -1326,6 +1326,7 @@ class SaleOrderLine(models.Model):
digits='Product Unit of Measure')
qty_invoiced = fields.Float(
compute='_get_invoice_qty', string='Invoiced Quantity', store=True, readonly=True,
compute_sudo=True,
digits='Product Unit of Measure')
untaxed_amount_invoiced = fields.Monetary("Untaxed Invoiced Amount", compute='_compute_untaxed_amount_invoiced', compute_sudo=True, store=True)