Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
5471 Zobrazení

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šit
Autor Nejlepší odpověď

Hello @Ajeng Shilvie, 

thanks for your reply, but it does not work

Error : 

ProgrammingError: can't adapt type 'model_name'


Avatar
Zrušit
Nejlepší odpověď

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šit
Related Posts Odpovědi Zobrazení Aktivita
0
čvn 22
3333
1
led 21
17128
2
bře 15
4746
1
lis 24
2380
1
lis 22
3536