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

add a domain on res.groups

By
smorele
on 7/18/16, 5:49 AM 208 views

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


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: 7/18/16, 5:49 AM
Seen: 208 times
Last updated: 7/18/16, 7:55 AM