diff --git a/__manifest__.py b/__manifest__.py index 273ef71e53213348d9a00d5af2f17ca2dfb31b53..e138ce411d47cf8821741304765cd9e58a3be464 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 5cc67e799b512e9ba7b38a816addb252e714abd0..f1619d178c8ec7961a5cbeec96c4856d906bcb2b 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 Binary files /dev/null and b/static/src/js/._basic_fields.js differ diff --git a/static/src/js/basic_fields.js b/static/src/js/basic_fields.js new file mode 100644 index 0000000000000000000000000000000000000000..60c4990b3af138f1155b94b68cb0aa4b24cca86b --- /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 0000000000000000000000000000000000000000..6458ceac2bca6b3d6156670b852683216a5b012f --- /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 353abf918b14d3e4753bc455815ab5940335dca4..ea9021fa70060665e542e7d90b10f43b3e74d5d3 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"/>