Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
5462 Vizualizări

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

Imagine profil
Abandonează
Autor Cel mai bun răspuns

Hello @Ajeng Shilvie, 

thanks for your reply, but it does not work

Error : 

ProgrammingError: can't adapt type 'model_name'


Imagine profil
Abandonează
Cel mai bun răspuns

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}



Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
iun. 22
3331
1
ian. 21
17122
2
mar. 15
4745
1
nov. 24
2380
1
nov. 22
3532