如何在页面加载时在字段中设置域?

时间:2018-02-12 08:44:07

标签: cross-domain onchange odoo-8 formview

我通过onchange一个字段在第二个字段中设置了域。但是在页面刷新之后,域会因onchane而丢失,我们需要更新第一个字段以获取第二个字段中的域。溶胶是什么?我正在使用Odoo-v8。

@api.multi
    def onchange_type(self, is_company):        
        if is_company:
            domain = {'title': [('domain', '=', 'partner')]}
        else:
            domain = {'title': [('domain', '=', 'contact')]}
        return {'domain': domain}

1 个答案:

答案 0 :(得分:0)

def _set_required_boolean(self):
    # your logic goes here for is_student
    if is_student:
        return True
    else:
        return False
required_boolean = fields.Boolean(default=_set_required_boolean)

而不是onchange使用默认

相关问题