My code looks like :
# -*- encoding: utf-8 -*-
from openerp import models,fields, api
class ResPartner(models.Model):
_name = 'res.partner'
_inherit = 'res.partner'
city_id = fields.Many2one('res.city','Ville',stored = True
,ondelete='restrict')
class ResCity(models.Model):
_name = "res.city"
_description = "Ville"
name = fields.Char(u"Nom",required = True)
state_id = fields.Many2one("res.country.state", 'Zone',ondelete='restrict')
so after i've add the view in xml but my request is that i need to change the actual field without adding a new one the old : city = fields.char the new should look like : city = fields.many2one
Just override the old API defined city
field in old API:
from openerp import models,fields, api
from openerp.osv import fields as ofields
class ResPartner(models.Model):
_inherit = 'res.partner'
_columns = {
'city': ofields.many2one('res.city', 'Ville', ondelete='restrict'),
}
Have in mind, that lot of views won't work anymore, for example the partner kanban view.