Skip to content

Commit

Permalink
[FIX] purchase_discount: Use sudo in purchase lines
Browse files Browse the repository at this point in the history
  • Loading branch information
nicomacr authored and OCA-git-bot committed Jun 21, 2019
1 parent 1cc580d commit 9d6044d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion purchase_discount/models/stock_move.py
Expand Up @@ -13,7 +13,10 @@ def _get_price_unit(self):
maximum inheritability.
"""
price_unit = False
po_line = self.purchase_line_id
# We do it with sudo to avoid permission errors in case
# the user validates the order and does not have permission to
# modifiy purchase lines
po_line = self.purchase_line_id.sudo()
if po_line and self.product_id == po_line.product_id:
price = po_line._get_discounted_price_unit()
if price != po_line.price_unit:
Expand Down

0 comments on commit 9d6044d

Please sign in to comment.