summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/stock_account/models/stock_move.py2
-rw-r--r--addons/stock_account/tests/test_stockvaluation.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/addons/stock_account/models/stock_move.py b/addons/stock_account/models/stock_move.py
index 5b30e804a0e..4057e88a1dc 100644
--- a/addons/stock_account/models/stock_move.py
+++ b/addons/stock_account/models/stock_move.py
@@ -31,7 +31,7 @@ class StockMove(models.Model):
price_unit = self.price_unit
# If the move is a return, use the original move's price unit.
if self.origin_returned_move_id and self.origin_returned_move_id.sudo().stock_valuation_layer_ids:
- price_unit = self.origin_returned_move_id.stock_valuation_layer_ids[-1].unit_cost
+ price_unit = self.origin_returned_move_id.sudo().stock_valuation_layer_ids[-1].unit_cost
return not self.company_id.currency_id.is_zero(price_unit) and price_unit or self.product_id.standard_price
@api.model
diff --git a/addons/stock_account/tests/test_stockvaluation.py b/addons/stock_account/tests/test_stockvaluation.py
index e0b5332d2d7..2d0d6036eca 100644
--- a/addons/stock_account/tests/test_stockvaluation.py
+++ b/addons/stock_account/tests/test_stockvaluation.py
@@ -953,7 +953,7 @@ class TestStockValuation(SavepointCase):
stock_return_picking_action = stock_return_picking.create_returns()
return_pick = self.env['stock.picking'].browse(stock_return_picking_action['res_id'])
return_pick.move_lines[0].move_line_ids[0].qty_done = 1.0
- return_pick._action_done()
+ return_pick.with_user(self.inventory_user)._action_done()
self.assertEqual(self.product1.standard_price, 16)