From 7dfd6dded0b70c36cf19782997270f70c43d7750 Mon Sep 17 00:00:00 2001
From: benjamin <benjamin@le-filament.com>
Date: Mon, 21 Apr 2025 19:03:45 +0200
Subject: [PATCH] [WIP] update views

---
 README.rst      |  6 +++---
 __manifest__.py |  4 ++--
 models/crm.py   | 13 ++++++++-----
 views/crm.xml   | 34 ++++++++++++++++++++--------------
 4 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/README.rst b/README.rst
index 158fa65..c0f2d04 100644
--- a/README.rst
+++ b/README.rst
@@ -3,9 +3,9 @@
    :alt: License: AGPL-3
 
 
-=================================
-Mutuelle des Scop et des Scic - crm
-=================================
+===================================
+Mutuelle des Scop et des Scic - CRM
+===================================
 
 Description
 ===========
diff --git a/__manifest__.py b/__manifest__.py
index d3605a3..0310056 100644
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -1,11 +1,11 @@
 {
-    "name": "Mutuelle des Scop et des Scic - crm",
+    "name": "Mutuelle des Scop et des Scic - CRM",
     "summary": "Description du module",
     "author": "Le Filament",
     "website": "https://le-filament.com",
     "version": "18.0.1.0.0",
     "license": "AGPL-3",
-    "depends": ["mucs_partner", "crm"],
+    "depends": ["crm", "mucs_partner"],
     "data": [
         "security/ir.model.access.csv",
         # datas
diff --git a/models/crm.py b/models/crm.py
index 1f76f85..d341876 100644
--- a/models/crm.py
+++ b/models/crm.py
@@ -7,9 +7,12 @@ from odoo import models, fields
 class Lead(models.Model):
     _inherit = "crm.lead"
 
-    mucs_type = fields.Selection(string="Proposition / Avenant",
-                                 selection=[('proposition', 'Proposition'),
-                                            ('avenant', 'Avenant')],
-                                 required=True)
-
+    mucs_type = fields.Selection(
+        selection=[
+            ('proposition', 'Proposition'),
+            ('avenant', 'Avenant')
+        ],
+        string="Proposition / Avenant",
+        required=True
+    )
     meeting_ids = fields.One2many(related="partner_id.meeting_ids")
diff --git a/views/crm.xml b/views/crm.xml
index 0c7bcca..6f558f4 100644
--- a/views/crm.xml
+++ b/views/crm.xml
@@ -11,7 +11,7 @@
         <field name="arch" type="xml">
             <xpath expr="//sheet//h1" position="after">
                 <group>
-                    <field name="mucs_type"/>
+                    <field name="mucs_type" widget="radio" />
                 </group>
             </xpath>
             <xpath expr="//sheet//label[@for='expected_revenue']/.."
@@ -45,9 +45,11 @@
         <field name="inherit_id" ref="crm.crm_case_kanban_view_leads"/>
         <field name="arch" type="xml">
             <xpath expr="//kanban//progressbar" position="replace"/>
-            <xpath expr="//kanban//field[@name='expected_revenue']"
-                   position="attributes">
-                <attribute name="invisible">True</attribute>
+            <xpath
+                expr="//kanban//field[@name='expected_revenue']"
+                position="attributes"
+            >
+                <attribute name="invisible">1</attribute>
             </xpath>
         </field>
     </record>
@@ -58,8 +60,10 @@
         <field name="model">crm.lead</field>
         <field name="inherit_id" ref="crm.crm_case_tree_view_oppor"/>
         <field name="arch" type="xml">
-            <xpath expr="//list//field[@name='expected_revenue']"
-                   position="attributes">
+            <xpath
+                expr="//list//field[@name='expected_revenue']"
+                position="attributes"
+            >
                 <attribute name="optional">hide</attribute>
             </xpath>
             <xpath expr="//list//field[@name='probability']"
@@ -79,15 +83,17 @@
         <field name="model">crm.lead</field>
         <field name="inherit_id" ref="crm.quick_create_opportunity_form"/>
         <field name="arch" type="xml">
-            <xpath expr="//form//field[@name='expected_revenue']"
-                   position="attributes">
-                <attribute name="invisible">True</attribute>
+            <xpath
+                expr="//form//field[@name='expected_revenue']"
+                position="attributes"
+            >
+                <attribute name="invisible">1</attribute>
             </xpath>
-            <xpath expr="//form//field[@name='expected_revenue']"
-                   position="after">
-                <group>
-                    <field name="mucs_type"/>
-                </group>
+            <xpath
+                expr="//form//field[@name='name']"
+                position="after"
+            >
+                <field name="mucs_type" widget="radio" />
             </xpath>
         </field>
     </record>
-- 
GitLab