You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Users that only have Stock access rights, with no Purchase access rights, cannot validate Receipt pickings, due to calculation in price_unit.
Problem is related to purchase_discount module's hack in price unit calculation method for stock.move. This hack tries to write on purchase order lines temporarily, but standard inventory user does not have any "write" permission on Purchase Order Line. It is also not viable to set these users as Purchase users, just to bypass this problem.
def _get_price_unit(self):
"""Get correct price with discount replacing current price_unit
value before calling super and restoring it later for assuring
maximum inheritability.
HACK: This is needed while https://github.com/odoo/odoo/pull/29983
is not merged.
"""
price_unit = False
po_line = self.purchase_line_id
if po_line and self.product_id == po_line.product_id:
price = po_line._get_discounted_price_unit()
if price != po_line.price_unit:
# Only change value if it's different
price_unit = po_line.price_unit
po_line.price_unit = price # LINE CAUSING PROBLEM
res = super()._get_price_unit()
if price_unit:
po_line.price_unit = price_unit # LINE CAUSING PROBLEM
return res
The text was updated successfully, but these errors were encountered:
Users that only have Stock access rights, with no Purchase access rights, cannot validate Receipt pickings, due to calculation in price_unit.
Problem is related to purchase_discount module's hack in price unit calculation method for stock.move. This hack tries to write on purchase order lines temporarily, but standard inventory user does not have any "write" permission on Purchase Order Line. It is also not viable to set these users as Purchase users, just to bypass this problem.
The text was updated successfully, but these errors were encountered: