[FIX] account: Fix _compute_linked_attachment_id

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) <wan@odoo.com>
This commit is contained in:
Laurent Smet
2023-05-12 08:17:04 +02:00
parent 63d7e39a09
commit 09af1764a8
+1 -1
View File
@@ -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