Odoo Help

1

How to limit the crm phone call records to user's company?

By
Sage
on 2/27/13, 11:06 AM 2,065 views

I have tried to add some domain force to some osv objects. All of them are working fine except crm.phonecall object. Here is the code i have added to restrict the access.

<record id="crm_phonecall_comp_rule" model="ir.rule">
<field name="name">CRM Phone Call MutliCompany</field>
<field model="ir.model" name="model_id" ref="crm.model_crm_phonecall"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>

These code don't work... Is there anything wrong in my code or is this a known issue in V7 against crm.phonecall object?

Is there anything to do with the view part of crm phonecall?

Sage
on 2/27/13, 9:40 PM
2
Sage
On 3/2/13, 12:27 AM

I solved the problem. In case any one face the same issue, here shares my solution. By default, in the file crm_security.xml, there is one rule controlling the crm phone call access.

<record id="crm_rule_all_phones" model="ir.rule">
    <field name="name">All Phones</field>
    <field ref="model_crm_phonecall" name="model_id"/>
    <field name="domain_force">[(1,'=',1)]</field>
    <field name="groups" eval="[(4, ref('base.group_sale_salesman_all_leads'))]"/>
</record>

It allows the phone call records to be viewed by all the users no matter he is in this company or not. So in order to fix the issue, you could change the rule to the following:

<record id="crm_rule_all_phones" model="ir.rule">
    <field name="name">All Phones</field>
    <field ref="model_crm_phonecall" name="model_id"/>
    <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>

That will protect the records to be viewed by the members out of this company.

Regards Sage

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)

Stats

Asked: 2/27/13, 11:06 AM
Seen: 2065 times
Last updated: 3/16/15, 8:10 AM