[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#117264 X-original-commit: ddfb7076f9f114ce4b29f50ae22c8663592cb4f4 Signed-off-by: Laurent Smet <las@odoo.com> Signed-off-by: Julien Van Roy <juvr@odoo.com>
This commit is contained in:
@@ -328,10 +328,10 @@ class AccountEdiCommon(models.AbstractModel):
|
||||
return True
|
||||
|
||||
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['res.partner']._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})
|
||||
country_code = invoice.partner_id.commercial_partner_id.country_code
|
||||
if vat and self.env['res.partner']._run_vat_test(vat, country_code, invoice.partner_id.is_company):
|
||||
|
||||
Reference in New Issue
Block a user