[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
This commit is contained in:
Oscar Ulises Garza Cordova
2018-05-02 15:40:01 +02:00
committed by Nicolas Martinelli
parent 320b631c81
commit cfe094acee
+3 -1
View File
@@ -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