Odoo Help

Welcome!

This community 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.

0

Domain Function Odoo v8

By
maximize
on 4/13/15, 11:54 PM 1,765 views

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

0
maximize
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'


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

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}



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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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