Odoo Help


Domain Function Odoo v8

on 4/13/15, 11:54 PM 1,883 views

hello guys, i just wanted to ask if it is possible to create a domain function for a m2* function?.


def get_domain(self):


return [('id', '=', domain)]

field_a = fields.Many2one('model', domain='get_domain')

it seems it is not working for me :( 

On 4/14/15, 3:07 AM

Hello @Ajeng Shilvie, 

thanks for your reply, but it does not work

Error : 

ProgrammingError: can't adapt type 'model_name'

Ajeng Shilvie
On 4/14/15, 12:58 AM

hi maximize :

try this, you don't have to insert domain in your field :

    def fiel_change(self):
        dom['field_a'] = [(*)] #* type your domain 
        return {'domain':dom}

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/13/15, 11:54 PM
Seen: 1883 times
Last updated: 4/14/15, 3:41 AM