Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
5474 Visualizzazioni

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
Abbandona
Autore Risposta migliore

Hello @Ajeng Shilvie, 

thanks for your reply, but it does not work

Error : 

ProgrammingError: can't adapt type 'model_name'


Avatar
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
giu 22
3342
1
gen 21
17135
2
mar 15
4746
1
nov 24
2388
1
nov 22
3537