[FIX] stock_account: add a force_company to update the correct price in FIFO costing
Fine-tuning of commit: o50f77ba091189bd785d459c042a6cec04a125fdb When costing is in FIFO mode, product price can be updated whereas the current user doesn't have the right to modify the products. It therefore introduced a sudo() to make this computation; however since this is modifying a company-dependent field, a force_company was missing to update the correct one. Closes #28487 opw 1907377 closes odoo/odoo#28662
This commit is contained in:
@@ -268,7 +268,8 @@ class StockMove(models.Model):
|
||||
|
||||
# Update the standard price with the price of the last used candidate, if any.
|
||||
if new_standard_price and move.product_id.cost_method == 'fifo':
|
||||
move.product_id.sudo().standard_price = new_standard_price
|
||||
move.product_id.sudo().with_context(force_company=move.company_id.id) \
|
||||
.standard_price = new_standard_price
|
||||
|
||||
# If there's still quantity to value but we're out of candidates, we fall in the
|
||||
# negative stock use case. We chose to value the out move at the price of the
|
||||
|
||||
Reference in New Issue
Block a user