From a3dbd47b1f271ff084a78fd753a64f6c2d4ec801 Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Mon, 30 Jan 2023 13:45:58 +0000 Subject: [PATCH] [FIX] account_edi: allow to post an invoice w/ existing edi documents Following odoo/odoo@44a4cdb, `attachment_id` is restricted, so force updating it's value as sudo() when posting an invoice having existing EDI documents. closes odoo/odoo#111426 X-original-commit: 6b101d5ff0ad78b9ae2ad312f362c2224e7af457 Signed-off-by: Laurent Smet Signed-off-by: Xavier Alt (xal) --- addons/account_edi/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_edi/models/account_move.py b/addons/account_edi/models/account_move.py index 2d6995c2fe2..c7dcc27e5eb 100644 --- a/addons/account_edi/models/account_move.py +++ b/addons/account_edi/models/account_move.py @@ -312,7 +312,7 @@ class AccountMove(models.Model): existing_edi_document = move.edi_document_ids.filtered(lambda x: x.edi_format_id == edi_format) if existing_edi_document: - existing_edi_document.write({ + existing_edi_document.sudo().write({ 'state': 'to_send', 'attachment_id': False, })