Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
5361 Widoki

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

Awatar
Odrzuć
Autor Najlepsza odpowiedź

Hello @Ajeng Shilvie, 

thanks for your reply, but it does not work

Error : 

ProgrammingError: can't adapt type 'model_name'


Awatar
Odrzuć
Najlepsza odpowiedź

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}



Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
cze 22
3197
1
sty 21
16890
2
mar 15
4557
1
lis 24
2074
1
lis 22
3350