我有一个包含关于某种服务信息的形式(出院日期,离开日期,公司的名字......)的模块,但我需要添加像res.partner
包含字段和自动填充地址(街道,城市,STATE_ID,COUNTRY_ID )。我如何继承和我的自定义模块上添加这些领域?
country1_id = fields.Many2one('res.partner', string='Country')
country_id = fields.Many2one(related='country1_id.country_id', string='Country' )
state_id = fields.Many2one(related='country1_id.state_id', string='State')
你可以继承像这样在你的Python文件
views/.xml file:
你好@大卫马丁,你可以添加res.partner对象的第一场Many2one
partner_id = fields.Many2one('res.partner', string="Partner")
country_id = fields.Many2one('res.country', related='partner_id.country_id', string="Country")
street,street2,state.. so on
并且在视图文件中添加这些字段。所以每当你选择PARTNER_ID现场你将得到国家,街道和居住在你的领域的街道汽车的任何合作伙伴。