Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
1141 Vistas

I have the following two models:


class MyAddress(models.Model):

    _name = 'my.address'

    street = fields.Char('Street')

    zipcode = fields.Char('Zipcode')

    _sql_constraints = [

        ('address_uniq', 'unique(street, zipcode)', 'Error message'')

    ]


class MyProvider(models.Model):

    _name = 'my.provider'

    name = 'Name'

    phone = fields.Char('Phone')

    address = fields.Many2one('my.address', 'Address')


I have a csv file with provider data, street and zipcode for each provider. What I do first is to import the addresses, and there is no problem with the two constrained fields.


The problem is when I try to import the providers, because I can't specify correctly the unique fields of that Address registry, because I can't see some import field option like 'Address / Street' or 'Address / zipcode', if only I could see those two options I think the import would be succesful.

Avatar
Descartar
Mejor respuesta

The module named "VKS Import Excel" can help you solve this problem easily: https://apps.odoo.com/apps/modules/16.0/vks_import_excel.  Please contact me via email anhtuan.acoi@gmail.com  if you need further assistance.

Avatar
Descartar