[FIX] l10n_be_invoice_bba: Duplicating an existing in_invoice with BBA structured message

Steps to reproduce the bug:

- Create a partner P with communication type set to BBA

- Create an in_invoice I for P with a BBA structured communication

- Validate I and try to duplicate it

Bug:

A UserError was raised "Empty BBA Structured Communication!"

opw:1883982

closes odoo/odoo#27331
This commit is contained in:
Goffin Simon
2018-10-01 09:21:18 +00:00
parent a9a556178d
commit 1c6a7a1e58
@@ -181,4 +181,6 @@ class AccountInvoice(models.Model):
default['reference_type'] = reference_type
if reference_type == 'bba':
default['reference'] = self.generate_bbacomm(self.type, reference_type, self.partner_id.id, '')['value']['reference']
elif self.type in ['in_invoice']:
self.reference_type = 'none'
return super(AccountInvoice, self).copy(default)