How list States of a Country in ODOO v8 -
i'm trying list states of country. in openerp v7, suppose work:
_columns = { 'country_id': fields.many2one('res.country', 'country'), 'state_id': fields.related('country_id', 'state_id', type="many2one", relation="res.country.state", string="state"), }
how can in odoo-v8? tried:
country_id = fields.many2one('res.country', 'country') state_id = fields.related('country_id', 'state_id', type="many2one", relation="res.country.state", string="state")
but got,in 'module' not defined 'related'
the official documentation relational fields not clear.
i think maybe need onchange method:
@api.onchange('country_id') def: _onchange_country(self): #i don’t how list states, inside method
do have solution?
in odoo 8.0 new api field use related attribute in fields. hear there have no facility add separate field related
just this..
country_id = fields.many2one('res.country', 'country') state_id=fields.many2one(related='country_id.state_id.id', store=true)
i hope should helpful .. :)
Comments
Post a Comment