class Egypt(models.Model):
_name = 'egypt'
_rec_name = 'id'
id = fields.Integer()
name = fields.Char()
class Germany(models.Model):
_name = 'germany'
_rec_name = 'id'
id = fields.Integer()
name = fields.Char()
class MyModule(models.Model):
_name = 'my.module'
country = fields.Selection([('1', 'Egypt'),
('2', 'Germany'),
], default='1')
egypt_towns = fields.Many2one('egypt.name')
geramny_towns = fields.Many2one('geramny.name')
towns = fields.Many2one()
in XML Code
<field name="country"/>
<field name="towns"/>
1 -
if country is egypt, towns field = egypt_towns
and if country us germany, towns = geramny_towns
How ?
2- (egypt.name) is't work , how to solve ?
Note : don't use name_get this will change it in whole system which i don't want
thanks in advance