# Write Access rules to group depending on a field

**URL:** https://discuss.tryton.org/t/write-access-rules-to-group-depending-on-a-field/4016
**Category:** Developer
**Created:** [April 7, 2021, 1:49pm UTC](https://discuss.tryton.org/t/write-access-rules-to-group-depending-on-a-field/4016 "2021-04-07T13:49:59Z")
**Posts on this page:** 1
**Showing post:** 11

<div class="post-metadata">

### Author: ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)
#### Post date: [April 8, 2021, 1:38pm UTC](https://discuss.tryton.org/t/write-access-rules-to-group-depending-on-a-field/4016/11 "2021-04-08T13:38:40Z")

</div>

I think i found a solution 🙂  
Thanks to all! Don’t hesitate to comment if this could be improved.

I seems working with this code:

```auto
...
        <record model="ir.rule.group" id="rule_group_product_not_validated">
           <field name="name">Product Not Validated</field>
		   <field name="model" search="[('model', '=', 'product.template')]"/>
		   <field name="global_p" eval="False"/>
		   <field name="default_p" eval="False"/>
		   <field name="perm_read" eval="False"/>
		   <field name="perm_write" eval="True"/>
		   <field name="perm_delete" eval="True"/>
       </record>
       <record model="ir.rule" id="rule_product_not_validated">
           <field name="domain" eval="[('validated', '=', False)]" pyson="1"/>
           <field name="rule_group" ref="rule_group_product_not_validated"/>
       </record>
       <record model="ir.rule.group-res.group"
           id="rule_group_product_not_validated_group_product_management">
           <field name="rule_group" ref="rule_group_product_not_validated"/>
           <field name="group" ref="group_product_management"/>
       </record>

        <record model="ir.rule.group" id="rule_group_product_admin_all_perm">
           <field name="name">Product All Perm Admin</field>
           <field name="model" search="[('model', '=', 'product.template')]"/>
	       <field name="global_p" eval="False"/>
	       <field name="default_p" eval="False"/>
           <field name="perm_read" eval="True"/>
           <field name="perm_write" eval="True"/>
           <field name="perm_create" eval="True"/>
           <field name="perm_delete" eval="True"/>
        </record>
       <record model="ir.rule.group-res.group"
           id="rule_group_product_admin_all_perm_group_product_admin">
           <field name="rule_group" ref="rule_group_product_admin_all_perm"/>
           <field name="group" ref="product.group_product_admin"/>
       </record>
...

```

---

_[View the full topic](https://discuss.tryton.org/t/write-access-rules-to-group-depending-on-a-field/4016)._
