xml - How to create domain filter for one2many field in odoo? -
i create state names , create few cities , assign state karnatak-bangalore karnatak-mangalore
karnatak-mysore
gujarat-ahemadabad, gujarat-gandhinagar
when select karntaka in 'pin_catg' class in tree view i.e 'pin_name' ,'city_n' should karnataka cities mangalore ,bangalore,mysore how add domain filter .i have xml file lot of data want written classes .domain filter
class state_catg(osv.model): _name="state.catg" _columns={ 'state_name':fields.char('state names',size=64,required=true), } class city_name(osv.model): _name="city.name" _rec_name='city_name' _description="define asset name" _columns={ 'city_name':fields.char('city name',size=64,required=true), 'state_name12':fields.many2one('state.catg','state',size=64,required=true), } class pin_catg(osv.model): _name="pin.catg" _columns={ 'state_name':fields.many2one('state.catg','state'), 'list123':fields.one2many('pin.name','list12'), } class pin_name(osv.model): _name="pin.name" _columns={ 'city_n':fields.many2one('city name',size=64,required=true), 'pin_code' : fields.char('pin code'), 'list12':fields.many2one('pin.catg','list123'), }
in easy way take 1 master
class res_city(models.model): _name = 'res.city' name = fields.char('name') state_id = fields.many2one('res.country.state', 'state') #and put onchange use state , city like: @api.onchange('state_id') def _onchange_state_id(self): if self.state_id: res = {'domain': {'city_id': [('state_id', '=', self.state_id.id)]}}
Comments
Post a Comment