From 4da1525b4137795300838352471e6b936414278c Mon Sep 17 00:00:00 2001
From: Remi <remi@le-filament.com>
Date: Mon, 9 Dec 2019 15:31:15 +0100
Subject: [PATCH] Add no create/open options

---
 views/hr_timesheet.xml        |  6 +++---
 views/hr_timesheet_cgscop.xml | 15 +++++++--------
 views/ur_financial_system.xml |  4 ++--
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/views/hr_timesheet.xml b/views/hr_timesheet.xml
index b5d8a06..4d870b6 100644
--- a/views/hr_timesheet.xml
+++ b/views/hr_timesheet.xml
@@ -13,11 +13,11 @@
             <field name="arch" type="xml">
                 <field name="name" position="replace"/>
                 <field name="project_id" position="attributes" >
-                    <attribute name="options">{'no_create_edit': True}</attribute>
+                    <attribute name="options">{'no_open': True, 'no_create': True}</attribute>
                     <attribute name="string">Code activité UR</attribute>
                 </field>
                 <field name="project_id" position="after" >
-                    <field name="partner_id" domain="[('is_company', '=', True)]" required="True" class="td-ellipsis" />
+                    <field name="partner_id" domain="[('is_company', '=', True)]" required="True" class="td-ellipsis" options="{'no_open': True, 'no_create': True}" />
                     <field name="name" class="td-minwidth" />
                 </field>
                 <field name="task_id" position="attributes">
@@ -25,7 +25,7 @@
                 </field>
                 <field name="unit_amount" widget="timesheet_uom" sum="Total"/>
                 <field name="unit_amount" position="after">
-                    <field name="ur_financial_system_id" options="{'no_create_edit': True}"/>
+                    <field name="ur_financial_system_id" options="{'no_open': True, 'no_create': True}"/>
                 </field>
             </field>
         </record>
diff --git a/views/hr_timesheet_cgscop.xml b/views/hr_timesheet_cgscop.xml
index 567f559..67404a8 100644
--- a/views/hr_timesheet_cgscop.xml
+++ b/views/hr_timesheet_cgscop.xml
@@ -28,12 +28,12 @@
                         </div>
                         <group>
                             <group>
-                                <field name="partner_id" string="Contact par défaut" help="Contact par défaut auquel est rattaché cette activité. Ce contact sera sélectionné automatiquement dans les feuilles de temps"/>
-                                <field name="ur_id" string="Union Régionale" />
-                                <field name="company_id" groups="base.group_multi_company" string="Société" />
+                                <field name="partner_id" string="Contact par défaut" help="Contact par défaut auquel est rattaché cette activité. Ce contact sera sélectionné automatiquement dans les feuilles de temps" options="{'no_open': True, 'no_create': True}"/>
+                                <field name="ur_id" string="Union Régionale" options="{'no_open': True, 'no_create': True}" required="1" />
+                                <field name="company_id" groups="base.group_multi_company" options="{'no_open': True, 'no_create': True}" string="Société" invisible="1" />
                             </group>
                             <group>
-                                <field name="cgscop_timesheet_code_id" required="1" placeholder="Code activité National"/>
+                                <field name="cgscop_timesheet_code_id" required="1" placeholder="Code activité National" options="{'no_open': True, 'no_create': True}"/>
                                 <field name="privacy_visibility" invisible="1"/>
                                 <field name="allow_timesheets" invisible="1"/>
                             </group>
@@ -42,9 +42,8 @@
                         <group string="Configuration" name="project_config" groups="base.group_no_one">
                             <group>
                                 <field name="user_id" string="Project Manager"
-                                        attrs="{'readonly':[('active','=',False)]}"/>
+                                        attrs="{'readonly':[('active','=',False)]}" options="{'no_open': True, 'no_create': True}"/>
                                 <field name="sequence" groups="base.group_no_one"/>
-                                <field name="company_id" groups="base.group_multi_company"/>
                             </group>
                             <group >
                                 <field name="allow_timesheets" />
@@ -89,8 +88,8 @@
                     <field name="sequence" widget="handle"/>
                     <field name="active" invisible="1"/>
                     <field name="name" />
-                    <field name="cgscop_timesheet_code_id" />
-                    <field name="partner_id" string="Contact"/>
+                    <field name="cgscop_timesheet_code_id" options="{'no_open': True, 'no_create': True}"/>
+                    <field name="partner_id" string="Contact" options="{'no_open': True, 'no_create': True}"/>
                 </tree>
             </field>
         </record>
diff --git a/views/ur_financial_system.xml b/views/ur_financial_system.xml
index 18b0296..52d8861 100644
--- a/views/ur_financial_system.xml
+++ b/views/ur_financial_system.xml
@@ -10,8 +10,8 @@
             <field name="arch" type="xml">
                 <tree editable='top'>
                     <field name="name" />
-                    <field name="ur_id" />
-                    <field name="company_id" groups="base.group_no_one" />
+                    <field name="ur_id" options="{'no_open': True, 'no_create': True}"/>
+                    <field name="company_id" groups="base.group_no_one" options="{'no_open': True, 'no_create': True}"/>
                 </tree>
             </field>
         </record>
-- 
GitLab