From f1d0f2ada5e261a4f995f30da4cc0ba1cb4f2215 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Wed, 3 Apr 2019 20:27:22 +0000 Subject: [PATCH] [FIX] stock_account: always return a value 4612d50bae8a fixed 9eac6c63773 as _run_valuation did not returned any result 4612d50bae8a was however returning a value only in one case Move the return statement to alaways return value_to_return, whatever the state of the move closes odoo/odoo#32401 Signed-off-by: Simon Goffin (sig) --- addons/stock_account/models/stock.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/stock_account/models/stock.py b/addons/stock_account/models/stock.py index 7204e532c7e..a5178e9f9da 100644 --- a/addons/stock_account/models/stock.py +++ b/addons/stock_account/models/stock.py @@ -321,6 +321,7 @@ class StockMove(models.Model): def _run_valuation(self, quantity=None): self.ensure_one() + value_to_return = 0 if self._is_in(): valued_move_lines = self.move_line_ids.filtered(lambda ml: not ml.location_id._should_be_valued() and ml.location_dest_id._should_be_valued() and not ml.owner_id) valued_quantity = 0 @@ -378,7 +379,7 @@ class StockMove(models.Model): 'value': value_to_return, 'price_unit': price_unit if self._is_dropshipped() else -price_unit, }) - return value_to_return + return value_to_return def _action_done(self): self.product_price_update_before_done()