This question has been flagged
3 Replies
7000 Views

i hve one many to one field 'hr.employee', in that i want to list some particular employee data. is this possible in odoo v8?

Avatar
Discard

You mean you want list only employees satisfying a criteria?

Author

yes based on condition i want to list particular employee in many2one field.

Best Answer

Hi Ramanan,

It is possible in v8. You can use domain attribute in that many2one field, for giving the criteria

For example:

class Session(models.Model):
    _name = 'model.name'
    employee_id = fields.Many2one('hr.employee', string="Employee", domain=[('field_name','=',value)])

Avatar
Discard
Author

works.

Best Answer

you can use domain for that:

<field name="your_many2one_field" domain="[('employee_id','=',employee_id)/>

Avatar
Discard
Author

thnks it's works.

Best Answer

class Session(models.Model):
    _name = 'model.name'
    employee_id = fields.Many2one('hr.employee', string="Employee",

domain=[('field_name','=',True)])

Avatar
Discard