Odoo Help

6
1 Answer
2
Avatar

Nehal

--Nehal--

2131
| 5 2 8
Ahmadabad, India
--Nehal--
Nehal
4/23/14, 3:25 AM

You can try something like below: In custom object of your .py file:

def _get_emp_type_domain(self, cr, uid, ids, field_name, arg, context=None):
    if ids:
        record_id = ids[0] 
        emp_type_list = self.pool.get('many2many_table').browse(cr, uid, ids, context=context)
        list = []
        for id in emp_type_list:
            list.append(id.name.id)
        return {ids[0]: [('id','in',list)]}    

_columns = {
    'emp_type': fields.many2one('hr.job', 'Employee Group'),
    'domain_field': fields.function(_get_emp_type_domain, type='char', size=255, method=True, string="Domain"),

In xml file:

<field name="domain_field" invisible="1"/> 
<field name="emp_type" domain="domain_field"/>

Hope this may help you.

1 Comment
Jamshid Chungath
4/28/14, 5:57 AM

Thanks Nehal

Ask a Question
Keep Informed
0 follower(s)
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.

Register
Odoo Training Center

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

Test it now