From b10841acbe31fffb00bde4e2b4ee23a0d5042929 Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Wed, 4 Mar 2020 12:52:17 +0000 Subject: [PATCH] [FIX] delivery: access rights when computing price rules When a picking is validated with the delivery prices based on rules, you can face an error, if you are not inventory manager or sales manager. First, because you don't have access rights to see the sales orders used to compute the price. And then you don't don't have access rights on the delivery.price.rule object to apply the formulas. As the computation of the price of a delivery should not depends on access rights other than the ones that let the user validate the picking, as 'sudo' is called. OPW-2209148 closes odoo/odoo#46947 X-original-commit: b68139bf2fec8fd2a79e1a578d126f260891c4f6 Signed-off-by: pimodoo --- addons/delivery/models/delivery_grid.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/delivery/models/delivery_grid.py b/addons/delivery/models/delivery_grid.py index 3255166eb08..bbfc0560a9c 100644 --- a/addons/delivery/models/delivery_grid.py +++ b/addons/delivery/models/delivery_grid.py @@ -67,6 +67,8 @@ class ProviderGrid(models.Model): def _get_price_available(self, order): self.ensure_one() + self = self.sudo() + order = order.sudo() total = weight = volume = quantity = 0 total_delivery = 0.0 for line in order.order_line: