[FIX] stock_account: wrong label after invoice modification

Usecase to reproduce:
-2 products setup as Periodic valuation
- Create a PO to buy both products
- Receipt and create the bill
- Modify the price unit on both invoice line to create correction layers

The label on the journal items have the same label relative to only one
of the products. It should keep the same label than before the
confirmation.

closes odoo/odoo#114792

X-original-commit: 226ae25b5f93164f14c1e68ed8bc2ea8a48b4e27
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
Arnold Moyaux
2023-03-09 17:02:04 +01:00
parent 2b50079ae5
commit 7f4e274c03
@@ -78,6 +78,8 @@ class AccountMove(models.Model):
for layer in stock_valuation_layers:
description = f"{layer.account_move_line_id.move_id.display_name} - {layer.product_id.display_name}"
layer.description = description
if layer.product_id.valuation != 'real_time':
continue
layer.account_move_id.ref = description
layer.account_move_id.line_ids.write({'name': description})