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

File of Record Rule

By
aci aisha
on 2/11/15, 11:14 PM 573 views

Friends,

Usually i write record rules from settings>Security in odoo.

Can we write it directly in any files like we write access writes for a group?

Thanks..

1

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
3918
| 5 3 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 2/11/15, 11:55 PM

Yes.

To create a rule, you need to set this record at MODULE_NAME/security/security.xml.
        <record id="portal_read_own_res_partner" model="ir.rule">
            <field name="name">res_partner: read access on my partner</field>
            <field name="model_id" ref="base.model_res_partner"/>
            <field name="domain_force">[('user_ids', 'in', user.id)]</field>
            <field name="groups" eval="[(4, ref('group_portal')), (4, ref('group_anonymous'))]"/>
            <field name="perm_create" eval="False"/>
            <field name="perm_unlink" eval="False"/>
            <field name="perm_write" eval="False"/>

            <field name="global" eval="True"/>       <!-- To set a rule as global -->
        </record>

Note:
Mostly record rules are defined inside <data noupdate="1">, so as to not update the rule if modified from Odoo Web-UI.

I did it..but rules didnt generated..which file i upgrade after change(I upgrade my module & base)..and make noupdate="0"

aci aisha
on 2/12/15, 12:44 AM

did you add the security.xml in __openerp__.py file? Then restart your server and upgrade your module

Atchuthan - Technical Consultant, Sodexis Inc
on 2/12/15, 12:48 AM

Yes..I added the rules in my file_details_security.xml..the restart..then upgrade..bt no changes

aci aisha
on 2/12/15, 1:00 AM

Sorry Friend,It was a mistake from my side.I chage a file and upgrade another(Both looks similer)..Thank you(1 vote & 1 tick)..

aci aisha
on 2/12/15, 1:21 AM

How can we set it a global(No group)

aci aisha
on 2/12/15, 1:24 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: 2/11/15, 11:14 PM
Seen: 573 times
Last updated: 3/16/15, 8:10 AM