0
2 答案
0
最佳答案
see how to return dynamic domains from python side: https://www.youtube.com/watch?v=dq5Vtj_pwuI&t=197s
0
最佳答案
Hi,
Please try the below:
from odoo import fields, models,api
class HrEmployee(models.Model):
_inherit = 'hr.employee'
model1_id = fields.Many2one('model1')
model2_id = fields.Many2one('model2')
@api.onchange('model1_id')
def onchange_model1_id(self):
for rec in self:
return {'domain': {'model2_id': [('model1_id', '=', rec.model1_id.id)]}}
Regards