From 98bc8bf129e933eef0c5cc9adb1f929c121ad7de Mon Sep 17 00:00:00 2001 From: aliya Date: Tue, 23 May 2023 11:33:04 +0000 Subject: [PATCH] [FIX] account_edi_ubl_cii: fix checkbox_ubl_cii_label In Send and Print wizard (`account_move_send`): 1. Choose a company, eligible for ubl 2. Create two invoices for different partners: one that can receive ubl and one that cannot 3. Select both invoices in the list view and try to send them A traceback occurs because one of the partners has `ubl_cii_format` and the other one doesn't. So we try to get `code_to_label[False]` and it breaks. The ubl xml file will be generated only for the valid invoice anyway, so this fix should not cause any side effects. closes odoo/odoo#122253 X-original-commit: 67ffc0f7762f685ad68d9c873800140918b38ca1 Signed-off-by: Laurent Smet Signed-off-by: Aliya Tastemirova (alta) --- addons/account_edi_ubl_cii/models/account_move_send.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_edi_ubl_cii/models/account_move_send.py b/addons/account_edi_ubl_cii/models/account_move_send.py index 98cc234a255..0bb050d2e42 100644 --- a/addons/account_edi_ubl_cii/models/account_move_send.py +++ b/addons/account_edi_ubl_cii/models/account_move_send.py @@ -34,7 +34,7 @@ class AccountMoveSend(models.Model): code_to_label = dict(wizard.move_ids.partner_id._fields['ubl_cii_format'].selection) codes = wizard.move_ids.partner_id.mapped('ubl_cii_format') if any(codes): - wizard.checkbox_ubl_cii_label = ", ".join(code_to_label[c] for c in codes) + wizard.checkbox_ubl_cii_label = ", ".join(code_to_label[c] for c in set(codes) if c) else: wizard.checkbox_ubl_cii_label = False