From 09af1764a82aafa647cfc077bdd46bf9243ff803 Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Thu, 11 May 2023 13:49:15 +0000 Subject: [PATCH] [FIX] account: Fix _compute_linked_attachment_id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the record is a draft record (with a NewId), the attachment is not retrieved correctly. Indeed, `move_vals` contains the real ids. closes odoo/odoo#121224 X-original-commit: 34ff1d66d5352f36d8d982d868e0b01c929c3c88 Signed-off-by: William André (wan) --- addons/account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index fcdade3e8eb..77a2b02c7c9 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1528,7 +1528,7 @@ class AccountMove(models.Model): ]) move_vals = {att.res_id: att for att in attachments} for move in self: - move[attachment_field] = move_vals.get(move.id, False) + move[attachment_field] = move_vals.get(move._origin.id, False) # ------------------------------------------------------------------------- # INVERSE METHODS