From 1fefa363ccc7975bd16e36e107d59368012b4da5 Mon Sep 17 00:00:00 2001
From: jordan <jordan@le-filament.com>
Date: Tue, 19 Jan 2021 16:52:47 +0100
Subject: [PATCH] [add] add security rule for cotisation access per company

---
 __manifest__.py             |  1 +
 security/security_rules.xml | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 security/security_rules.xml

diff --git a/__manifest__.py b/__manifest__.py
index 1b4807b..ae601e0 100755
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -12,6 +12,7 @@
         "cgscop_cotisation",
     ],
     "data": [
+        "security/security_rules.xml",
         "security/ir.model.access.csv",
         "views/res_config_settings.xml",
         "views/scop_cotisation.xml",
diff --git a/security/security_rules.xml b/security/security_rules.xml
new file mode 100644
index 0000000..bdda16b
--- /dev/null
+++ b/security/security_rules.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2020 Le Filament
+     License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
+
+<odoo>
+    <data noupdate="0">
+
+        <record id="cg_cotisation_cg_rule" model="ir.rule">
+            <field name="name">Cotisations consultables que pour sa société</field>
+            <field name="model_id" ref="cgscop_cotisation_cg.model_scop_cotisation"/>
+            <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
+            <field name="perm_read" eval="True"/>
+            <field name="perm_write" eval="True"/>
+            <field name="perm_create" eval="True"/>
+            <field name="perm_unlink" eval="True"/>
+        </record>
+
+    </data>
+</odoo>
\ No newline at end of file
-- 
GitLab