From cfe094acee696d6ebbdb3c57354fe5c093046402 Mon Sep 17 00:00:00 2001 From: Oscar Ulises Garza Cordova Date: Fri, 20 Apr 2018 12:38:54 -0500 Subject: [PATCH] [FIX] stock_account: valuation value on out moves - Set the system parameter "stock.propagate_uom" to 1. - Create a Sale Order with a product (1 Dozen). - Confirm the Sale Order - Validate the stock picking with 1 Dozen of quantity done. - See the stock move form. The value of the stock move is the price unit and not the correct value because the amount is computed by the quantity_done (1) and not 12 Units. Closes #24352 opw-1838335 --- addons/stock_account/models/stock.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/stock_account/models/stock.py b/addons/stock_account/models/stock.py index 3d73e4d100e..113ff99b87a 100644 --- a/addons/stock_account/models/stock.py +++ b/addons/stock_account/models/stock.py @@ -312,7 +312,9 @@ class StockMove(models.Model): self.write(vals) elif self._is_out(): valued_move_lines = self.move_line_ids.filtered(lambda ml: ml.location_id._should_be_valued() and not ml.location_dest_id._should_be_valued() and not ml.owner_id) - valued_quantity = sum(valued_move_lines.mapped('qty_done')) + valued_quantity = 0 + for valued_move_line in valued_move_lines: + valued_quantity += valued_move_line.product_uom_id._compute_quantity(valued_move_line.qty_done, self.product_id.uom_id) self.env['stock.move']._run_fifo(self, quantity=quantity) if self.product_id.cost_method in ['standard', 'average']: curr_rounding = self.company_id.currency_id.rounding