Skip to Content
Menu
This question has been flagged
2 Replies
5458 Zobrazenia

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 :( 

Avatar
Zrušiť
Autor Best Answer

Hello @Ajeng Shilvie, 

thanks for your reply, but it does not work

Error : 

ProgrammingError: can't adapt type 'model_name'


Avatar
Zrušiť
Best Answer

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}



Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
0
jún 22
3330
1
jan 21
17117
2
mar 15
4741
1
nov 24
2379
1
nov 22
3530