[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 <pimodoo@users.noreply.github.com>
This commit is contained in:
Pierre Masereel
2020-03-05 09:57:32 +00:00
parent 2e02be7404
commit b10841acbe
+2
View File
@@ -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: