[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 <las@odoo.com>
Signed-off-by: Aliya Tastemirova (alta) <alta@odoo.com>
This commit is contained in:
aliya
2023-05-24 14:28:17 +02:00
parent e2fbff5511
commit 98bc8bf129
@@ -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