Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
7768 Widoki

I'm trying to add a rule to manage the following behaviour:

Users which belong to the base.group_sale_salesman group must only see the partners which are from the same state of them.

I added the next rule: 

<?xml version="1.0" encoding="utf-8"?>

<openerp>

   <data noupdate="0">

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

         <field name="name">res_partner: read only partners from your state</field>

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

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

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

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

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

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

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

      </record>

   </data>

</openerp> 

But it's getting the next error:

ParseError: "new row for relation "ir_rule" violates check constraint "ir_rule_no_access_rights"

I was googling that error but I din't find anything which was able to help me.

This is the first ir.rule I do, may be there are several mistakes I can't notice.

Can anyone help me, please? Thank you in advance.    


Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

you need to make some changes as like below.


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

<field name="name">res_partner: read only partners from your state</field>

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

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

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

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

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

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

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

</record>

You have to give True value in any one of the rights. (read, write, unlink or create).

Awatar
Odrzuć
Autor

Excellent @Emipro Technologies Pvt. Ltd.! Thank you very much!

Powiązane posty Odpowiedzi Widoki Czynność
1
gru 19
4965
2
sie 23
2808
3
gru 20
9913
0
kwi 15
4859
1
mar 25
2566