Skip to content

Commit 6545db8

Browse files
clbr-odoosvfu-odoo
authored andcommitted
[IMP] account_edi_ubl_cii: use code ZZZ instead of 30 if no bank account is set
Backport of commit 026743f . To generate a valid BIS3 format, if we put 30 - credit transfer as payment means, we need to have a bank account set. If it's not the case, it will raise an error. We improve the usability by changing that code to ZZZ - mutually defined if no bank account is provided to the invoice. This should improve the onboarding flow when no bank account is set yet. task-None closes odoo#232795 Signed-off-by: Claire Bretton (clbr) <clbr@odoo.com>
1 parent 38fad87 commit 6545db8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,14 @@ def _get_financial_account_vals(self, partner_bank):
156156
return vals
157157

158158
def _get_invoice_payment_means_vals_list(self, invoice):
159-
payment_means_code, payment_means_name = (30, 'credit transfer') if invoice.move_type == 'out_invoice' else (57, 'standing agreement')
159+
if invoice.move_type == 'out_invoice':
160+
if invoice.partner_bank_id:
161+
payment_means_code, payment_means_name = (30, 'credit transfer')
162+
else:
163+
payment_means_code, payment_means_name = ('ZZZ', 'mutually defined')
164+
else:
165+
payment_means_code, payment_means_name = (57, 'standing agreement')
166+
160167
# in Denmark payment code 30 is not allowed. we hardcode it to 1 ("unknown") for now
161168
# as we cannot deduce this information from the invoice
162169
if invoice.partner_id.country_code == 'DK':

0 commit comments

Comments
 (0)