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.