Skip to content
Snippets Groups Projects
Commit 710714cd authored by Julien Van Roy's avatar Julien Van Roy
Browse files

[FIX] account_edi_ubl_cii: create partner at import if vat


When importing an electronic invoice, we only want to create the partner
when the vat and the name were retrieved.

closes odoo/odoo#114900

Signed-off-by: default avatarLaurent Smet <las@odoo.com>
parent 29d69132
Branches
Tags
No related merge requests found
......@@ -319,10 +319,10 @@ class AccountEdiCommon(models.AbstractModel):
return invoice
def _import_retrieve_and_fill_partner(self, invoice, name, phone, mail, vat):
""" Retrieve the partner, if no matching partner is found, create it
""" Retrieve the partner, if no matching partner is found, create it (only if he has a vat and a name)
"""
invoice.partner_id = self.env['account.edi.format']._retrieve_partner(name=name, phone=phone, mail=mail, vat=vat)
if not invoice.partner_id and name:
if not invoice.partner_id and name and vat:
invoice.partner_id = self.env['res.partner'].create({'name': name, 'email': mail, 'phone': phone})
# an invalid VAT will throw a ValidationError (see 'check_vat' in base_vat)
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment