From ecc1bc950fccbcce678f4aa0cbb1fd6628d4146b Mon Sep 17 00:00:00 2001
From: Juliana <juliana@le-filament.com>
Date: Fri, 15 Nov 2019 15:25:00 +0100
Subject: [PATCH] Retours recettes + Mails 10/11 et 12/11

---
 __manifest__.py                 |   1 +
 models/res_partner.py           |   4 +--
 static/src/js/._basic_fields.js | Bin 0 -> 4096 bytes
 static/src/js/basic_fields.js   |  49 ++++++++++++++++++++++++++++++++
 views/assets.xml                |  13 +++++++++
 views/res_partner.xml           |  21 ++++++++------
 6 files changed, 77 insertions(+), 11 deletions(-)
 create mode 100644 static/src/js/._basic_fields.js
 create mode 100644 static/src/js/basic_fields.js
 create mode 100644 views/assets.xml

diff --git a/__manifest__.py b/__manifest__.py
index 273ef71..e138ce4 100644
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -13,6 +13,7 @@
     ],
     "data": [
         "security/ir.model.access.csv",
+        "views/assets.xml",
         "views/res_partner.xml",
     ]
 }
diff --git a/models/res_partner.py b/models/res_partner.py
index 5cc67e7..f1619d1 100644
--- a/models/res_partner.py
+++ b/models/res_partner.py
@@ -27,7 +27,7 @@ class ScopPartner(models.Model):
     staff_planned = fields.Integer("Effectif prévu")
     adhesion_comments = fields.Text("Commentaires Adhésion")
 
-    feasibility_study = fields.Boolean("Etude de faisabilité signée")
+    feasibility_study = fields.Boolean("Etude de faisabilité signée / validée")
     amount_feasibility_study = fields.Integer(
         "Montant de l’étude de faisabilité")
     date_convention = fields.Date("Date de signature de la convention")
@@ -36,7 +36,7 @@ class ScopPartner(models.Model):
     date_transmission_cg = fields.Date(
         "Date de transmission du dossier à la CG")
 
-    # Dossier EU
+    # Dossier UE
     file_fse_open = fields.Boolean("Dossier FSE ouvert Oui/Non")
     date_return_file = fields.Date("Date de retour du dossier")
     fse_full = fields.Boolean("FSE Complet")
diff --git a/static/src/js/._basic_fields.js b/static/src/js/._basic_fields.js
new file mode 100644
index 0000000000000000000000000000000000000000..614b19d9e4a264edadc9f9d2a7eb6b25b5a53bdf
GIT binary patch
literal 4096
zcmZQz6=P>$Vqox1Ojhs@R)|o50+1L3Cj$e65d#C?1_lNYpYIU^1EU-RLEsn?62!p!
zuZ@8Lq=R7v0|SE=nkGgD2AH@?a(=E}VnIPps$OntNn%Q3NupJJwy%q4NosCracWUW
zVtO$HLsCIbW^svu!2%A5NsJ&9Kuj17VuLWq%^-RdkA}c#2#kinXb6mkz-S1JhQMeD
zjE2By2#kinXb6nB5CC-%K^W|DxsZ&^VuhmA;{4L0<Wz;U{Gx1y%)FA+ypqiPyu_TG
mN`;)%v=W7+oW#6r1qB7Lo*_<v{0_okZy@^bG7NJ6{{sLikuORB

literal 0
HcmV?d00001

diff --git a/static/src/js/basic_fields.js b/static/src/js/basic_fields.js
new file mode 100644
index 0000000..60c4990
--- /dev/null
+++ b/static/src/js/basic_fields.js
@@ -0,0 +1,49 @@
+odoo.define('cgscop_adhesion.basic_fields', function (require) {
+"use strict";
+
+var AbstractField = require('web.AbstractField');
+var fieldRegistry = require('web.field_registry');
+
+var PriorityWidgetCG = AbstractField.extend({
+    className: "o_priority",
+    events: {
+        'click > a': '_onClick',
+    },
+    supportedFieldTypes: ['selection'],
+
+    isSet: function () {
+        return true;
+    },
+
+    _render: function () {
+        var self = this;
+        var index_value = this.value ? _.findIndex(this.field.selection, function (v) {
+            return v[0] === self.value;
+        }) : 0;
+        this.$el.empty();
+        this.empty_value = this.field.selection[0][0];
+        _.each(this.field.selection.slice(1), function (choice, index) {
+            self.$el.append(self._renderStar('<a href="#">', index_value >= index+1, index+1, choice[1]));
+        });
+    },
+
+    _renderStar: function (tag, isFull, index, tip) {
+        return $(tag)
+            .attr('title', tip)
+            .attr('aria-label', tip)
+            .attr('data-index', index)
+            .addClass('o_priority_star fa')
+            .toggleClass('fa-star', isFull)
+            .toggleClass('fa-star-o', !isFull);
+    },
+
+    _onClick: function (event) {
+        event.preventDefault();
+        event.stopPropagation();
+    },
+
+});
+
+fieldRegistry.add('prioritycg', PriorityWidgetCG);
+
+});
diff --git a/views/assets.xml b/views/assets.xml
new file mode 100644
index 0000000..6458cea
--- /dev/null
+++ b/views/assets.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!-- Copyright 2019 Le Filament
+     License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
+
+<odoo>
+
+	<template id="cgscop_assets_backend" name="account assets" inherit_id="web.assets_backend">
+        <xpath expr="." position="inside">
+            <script type="text/javascript" src="/cgscop_adhesion/static/src/js/basic_fields.js"/>
+      	</xpath>
+    </template>
+
+</odoo>
\ No newline at end of file
diff --git a/views/res_partner.xml b/views/res_partner.xml
index 353abf9..ea9021f 100644
--- a/views/res_partner.xml
+++ b/views/res_partner.xml
@@ -13,7 +13,10 @@
                     <field name="percent_realisation"/>
                 </xpath>
                 <xpath expr="//div[hasclass('oe_kanban_partner_links')]" position="after">
-                    <field name="percent_realisation" widget="priority"/>
+                    <div>
+                        <!-- <label for='percent_realisation' class="oe_edit_only"/> -->
+                        <field name="percent_realisation" widget="prioritycg" readonly="1"/>
+                    </div>
                 </xpath>
             </field>
         </record>
@@ -28,11 +31,11 @@
                     <page name="adhesion_processus1" string="Processus d'Adhésion" attrs="{'invisible': [('project_status','=','6_suivi')]}">
                         <group col="3">
                             <group string="Général">
-                                <field name="percent_realisation" widget="priority"/>
+                                <field name="percent_realisation" widget="priority" />
                                 <field name="date_realisation"/>
-                                <field name="prescriber_canal_id" widget="res_partner_many2one" options="{'no_create': True}"/>
+                                <field name="prescriber_canal_id" widget="res_partner_many2one" options="{'no_create': True, 'no_open': True}"/>
                             </group>
-                            <group string="Dossier EU">
+                            <group string="Dossier UE">
                                 <field name="file_fse_open" widget="boolean_toggle"/>
                                 <field name="date_return_file"/>
                                 <field name="fse_full" widget="boolean_toggle"/>
@@ -48,7 +51,7 @@
                                 <field name="feasibility_study" widget="boolean_toggle"/>
                                 <field name="amount_feasibility_study" widget="monetary"/>
                             </group>
-                            <group string="Phase d'accompagnement"  attrs="{'invisible':[('project_status','in',('1_information','2_pre-diagnostic'))]}">
+                            <group string="Phase d'accompagnement projet"  attrs="{'invisible':[('project_status','in',('1_information','2_pre-diagnostic'))]}">
                                 <field name="date_convention"/>
                                 <field name="amount_convention" widget="monetary"/>
                             </group>
@@ -65,11 +68,11 @@
                             <group string="Général">
                                 <field name="percent_realisation" widget="priority"/>
                                 <field name="date_realisation"/>
-                                <field name="prescriber_canal_id" widget="res_partner_many2one" options="{'no_create': True}"/>
+                                <field name="prescriber_canal_id" widget="res_partner_many2one" options="{'no_create': True, 'no_open': True}"/>
                                 <field name="creation_delegate_id" widget="res_partner_many2one"
                                     attrs="{'required':[('project_status','in',('3_accompagnement','4_adhesion', '5_cg'))]}" options="{'no_create': True}" domain="[('ur_id', '=', ur_id)]"/>
                             </group>
-                            <group string="Dossier EU">
+                            <group string="Dossier UE">
                                 <field name="file_fse_open" widget="boolean_toggle"/>
                                 <field name="date_return_file"/>
                                 <field name="fse_full" widget="boolean_toggle"/>
@@ -85,7 +88,7 @@
                                 <field name="feasibility_study" widget="boolean_toggle"/>
                                 <field name="amount_feasibility_study" widget="monetary"/>
                             </group>
-                            <group string="Phase d'accompagnement"  attrs="{'invisible':[('project_status','in',('1_information','2_pre-diagnostic'))]}">
+                            <group string="Phase d'accompagnement projet"  attrs="{'invisible':[('project_status','in',('1_information','2_pre-diagnostic'))]}">
                                 <field name="date_convention"/>
                                 <field name="amount_convention" widget="monetary"/>
                             </group>
@@ -139,7 +142,7 @@
             <field name="inherit_id" ref="base.view_partner_form"/>
             <field name="arch" type="xml">
                 <xpath expr='//notebook' position="inside">
-                    <page name="eu_file" string="Dossier EU" attrs="{'invisible': ['|', ('is_company', '=', True), ('type','!=','contact')]}">
+                    <page name="eu_file" string="Dossier UE" attrs="{'invisible': ['|', ('is_company', '=', True), ('type','!=','contact')]}">
                         <group>
                             <field name="file_fse_open" widget="boolean_toggle"/>
                             <field name="date_return_file"/>
-- 
GitLab