From 45dce9ce003010ca3c1e7151b92b75bf08ffbfb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Gonz=C3=A1lez?= Date: Fri, 18 Sep 2020 00:26:39 +0000 Subject: [PATCH] [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) --- addons/sale/models/sale.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index d81e269be42..8a59e4c6136 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -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)