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

Allow managers to acess their own projects

By
Aneesh
on 5/20/13, 6:30 AM 975 views

I have created a new module for consumption.That is consumption details about a project will save here.I have created two roles users and managers(members of the projects).Users will create consumption details they can see their own consumption.In case of manager he want to see all consumption details of his project.We will set one user as manager it may be project memeber or project manager.Anyway he need to see all consumption details related to his projects.How to write the record rule for this scenario. (Example Project 'A' has three members a1,a2,a3 a3 is set as the manager of our module(he may or maynot be the project manager of this project) a1 and a2 will prepare consumption chart related to this project, a3 wants to all consumption chart created by a1 and a2 related to the project 'A') I have tried this

<record id="property_rule_mat_mgmt_officer" model="ir.rule">
            <field name="name">Material Manage Rule1</field>
            <field model="ir.model" name="model_id" ref="project.model_project_project"/>
            <field name="domain_force">['|',('project_id.members','=',user.id),('project_id.user_id','=',user.id)]</field>
            <field name="groups" eval="[(4,ref('group_mat_mgmt_officer')), (4,ref('group_mat_mgmt_manager'))]"/>
        </record>

But got an error

ValueError: Invalid field 'project_id.members' in domain expression

is there any members field defined in relation to project_id? and what is the defenition given for project_id. The domain is not getting any field named members thats why its giving error

Pravitha
on 5/21/13, 5:00 AM
0
Mind And Go
On 5/14/14, 5:11 PM

Hy,

I think the you're working directly on project so my experience would be this :

  1. Create a new many2many field in res.users and call it projects_ids then simply try :
    ['|',('project_id.user_id','=',user.id),('id','in',[p.id from p in user.projects_ids])]

Hope it could help

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: 5/20/13, 6:30 AM
Seen: 975 times
Last updated: 3/16/15, 8:10 AM