Hi,
I need to manage teachers in my app, then I did:
class CustomTeacher(models.Model):
"""Model to manage teachers"""
_name = 'res.users'
_inherit = 'res.users'
instrument_ids = fields.Many2many(
string='Instruments',
comodel_name='custom.instrument',
relation='custom_instrument_teacher_rel',
column1='user_id',
column2='instrument_id'
)
Now, to show teachers in a TreeView:
<record id="view_custom_teacher_tree" model="ir.ui.view">
<field name="name">custom.teacher.tree</field>
<field name="model">res.users</field>
<field name="priority" eval="8" />
<field name="arch" type="xml">
<tree string="teacher">
<field name="name"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window.view" id="act_open_custom_teacher_view_tree">
<field name="act_window_id" ref="act_open_custom_teacher_view" />
<field name="sequence" eval="10" />
<field name="domain" eval="[('groups_id', 'in', ref('custom_teacher_group'))]" />
<field name="view_mode">tree</field>
<field name="view_id" ref="view_maifrance_teacher_tree" />
</record>
I do not understand why users are not filtered, I still have all users instead of teachers only.
Ant idea ?
Thanks