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

How to make a view show companies created only by the specific user in CRM using ir.rule for res.partner?

By
Simon
on 8/13/15, 5:13 AM 612 views

I am bilding an extension module of CRM. The problem is when a specific user is using the system to see only the Companies he has created. I am have tried a few things but still getting same access error (Document type: res.users, Operation: read)

The rule I have created is:

<record id="my_module_rule_personal_customers" model="ir.rule">

    <field name="name">Companies user had created</field>

    <field ref="model_res_partner" name="model_id"/>

    <field name="domain_force">[('user_id.id','=',user.id) ]</field>

    <field name="groups" eval="[(4, ref('base.group_sale_salesman'))]"/>

    <field name="perm_read" eval="True"/>

    <field name="perm_write" eval="True"/>

    <field name="perm_create" eval="True"/>

    <field name="perm_unlink" eval="False"/>

</record>

0
Simon
On 8/17/15, 7:35 AM

I was missing a few rules in ir.model.access.csv and a condition in the force_domain>

here is my code:

<record id="my_module_rule_personal_hosts" model="ir.rule">

<field name="name">Companies user had created</field>

<field ref="model_res_partner" name="model_id"/>

<field name="domain_force">[('user_id.id','=',user.id),('user_id', '=', False) ]</field>

<field name="groups" eval="[(4, ref('base.group_sale_salesman'))]"/>

<field name="perm_read" eval="True"/>

<field name="perm_write" eval="True"/>

<field name="perm_create" eval="True"/>

<field name="perm_unlink" eval="False"/>

</record>


id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink

lead,my.module.crm.lead,model_crm_lead,base.group_sale_salesman,1,1,1,0

mail_mailgate_thread_my_module,my.module.mail.thread,mail.model_mail_thread,base.group_sale_salesman,1,0,0,0

access_crm_payment_mode_user_my_module,my.module.crm.payment.mode,crm.model_crm_payment_mode,base.group_sale_salesman,1,0,0,0

access_crm_opportunity_report_user_my_module,my.module.crm.opportunity.report,crm.model_crm_opportunity_report,base.group_sale_salesman1,0,0,0

access_crm_tracking_campaign_user_my_moduleprinch.crm_tracking_campaign user,crm.model_crm_tracking_campaign,base.group_sale_salesman,1,0,0,0

access_res_partner_my_module,my.module.res.partner.crm.user,base.model_res_partner,base.group_sale_salesman1,1,1,0

access_res_partner_category_my_module,my.module.res.partner.category.crm.user,base.model_res_partner_category,base.group_sale_salesman,1,1,1,0

0

Drees Far

--Drees Far--
1130
| 5 2 6
Tunis, Tunisia
--Drees Far--
Drees Far
On 8/13/15, 5:27 AM

This example i have tried, shos you for one employee connected its own payslips.

Try it by your self for your example.

Hope this can help you.

Regards.

I shared an image but it doesnt appear :/

Drees Far
on 8/13/15, 5:29 AM

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: 8/13/15, 5:13 AM
Seen: 612 times
Last updated: 8/17/15, 9:54 AM