[FIX] stock_account: always return a value

4612d50bae fixed 9eac6c6377 as _run_valuation did not returned any result
4612d50bae 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) <sig@openerp.com>
This commit is contained in:
Carlos Lopez
2019-04-05 09:43:47 +00:00
committed by Martin Trigaux
parent 37378592db
commit f1d0f2ada5
+2 -1
View File
@@ -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()