跳至内容
菜单
此问题已终结
2 回复
5454 查看

hello guys, i just wanted to ask if it is possible to create a domain function for a m2* function?.

ex: 

def get_domain(self):

....

return [('id', '=', domain)]

field_a = fields.Many2one('model', domain='get_domain')


it seems it is not working for me :( 

形象
丢弃
编写者 最佳答案

Hello @Ajeng Shilvie, 

thanks for your reply, but it does not work

Error : 

ProgrammingError: can't adapt type 'model_name'


形象
丢弃
最佳答案

hi maximize :

try this, you don't have to insert domain in your field :

    @api.onchange('field_a')
    def fiel_change(self):
        dom['field_a'] = [(*)] #* type your domain 
        return {'domain':dom}



形象
丢弃
相关帖文 回复 查看 活动
0
6月 22
3330
1
1月 21
17117
2
3月 15
4740
1
11月 24
2378
1
11月 22
3530