From 6363ef6deea0a4ba7444277ace06a25c225a04d7 Mon Sep 17 00:00:00 2001
From: Benjamin <benjamin@le-filament.com>
Date: Fri, 17 Apr 2020 18:20:39 +0200
Subject: [PATCH] [update] move calendar attributes in context

---
 models/calendar.py | 4 ----
 views/calendar.xml | 7 ++++++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/models/calendar.py b/models/calendar.py
index 093a44b..42787c3 100644
--- a/models/calendar.py
+++ b/models/calendar.py
@@ -330,8 +330,4 @@ class CGScopCalendar(models.Model):
                     'default_type': event.type,
                     'default_ur_financial_system_id': event.ur_financial_system_id.id,
                 },
-                'flags': {'form': {
-                    'action_buttons': False,
-                    'options': {
-                        'mode': 'edit'}}},
             }
diff --git a/views/calendar.xml b/views/calendar.xml
index d9123a0..b191957 100644
--- a/views/calendar.xml
+++ b/views/calendar.xml
@@ -190,7 +190,6 @@
                 <calendar position="attributes">
                     <attribute name="quick_add">False</attribute>
                     <attribute name="readonly_form_view_id">cgscop_calendar.view_calendar_cooperative_form_inherited</attribute>
-                    <attribute name="ur_sidebar_filter">True</attribute>
                 </calendar>
                 <field name="partner_ids" position="before">
                     <field name="project_id" invisible="1"/>
@@ -266,6 +265,12 @@
         <!-- ******************************
         ***    Actions
         ****************************** -->
+        <!-- Override Calendar Event action -->
+        <record id="calendar.action_calendar_event" model="ir.actions.act_window">
+            <field name="context">{ 'ur_sidebar_filter': True }</field>
+        </record>
+
+        <!-- Ressource Action -->
         <record id="action_calendar_scop" model="ir.actions.act_window">
             <field name="name">Agenda UR</field>
             <field name="res_model">calendar.event</field>
-- 
GitLab