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 write custom rule ?

By
Odoo
on 2/17/16, 9:52 PM 298 views

i have a model test.test ,its a custom group group_insurance_agency

class test_test(osv.Model):

_name = 'test.test'

-------------------------

<record id="group_insurance_agency" model="res.groups">

<field name="name">Agency/ Manager</field>

</record>


---------------------


scenario---------------


i am creating 2 users access this model

user1 and user2 with username and password

when user1 logged in and create a record also user2 lgged in and crete another record in test.test model

here the problem is I dont want to show user1 record to user2. How to restrict this case by ir.rule need a help,


----------------------------------------

How to rewrite below code ,or any other way need a help...

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

<field name="name">INS Rule</field>

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

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

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

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

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

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

</record>

0

Odoo

--Odoo --
1328
| 5 2 5
kerala, India
--Odoo --

Working as a Odoo Functional and Technical Expert

Odoo
On 2/17/16, 11:28 PM
Finlly find the answer.....


 <record model="ir.rule" id="ir_values_my_ins_rule"> <field name="name">INS Rule</field> <field name="model_id" ref="model_test_test"/> <field name="domain_force">[('create_uid','=',user.id)]</field> <field name="perm_read" eval="True"/> <field name="perm_write" eval="True"/> <field name="perm_unlink" eval="True"/> <field name="perm_create" eval="True"/></record>

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/17/16, 9:52 PM
Seen: 298 times
Last updated: 2/17/16, 11:29 PM