From b5a74c9d36f7d9f82ccb3d7f8abb15812762856a Mon Sep 17 00:00:00 2001 From: Juliana <juliana@le-filament.com> Date: Wed, 4 Jan 2023 12:55:33 +0100 Subject: [PATCH] [UPD]Change process adhesion when pass to statut follow --- models/res_partner.py | 5 +++- views/scop_adhesion_file.xml | 24 ++++++++++++++++++- wizard/scop_compulsory_fields_suivi_wizard.py | 6 +++++ .../scop_compulsory_fields_suivi_wizard.xml | 11 +++++++-- 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/models/res_partner.py b/models/res_partner.py index cef4e32..6f289fc 100644 --- a/models/res_partner.py +++ b/models/res_partner.py @@ -497,6 +497,7 @@ class ScopPartner(models.Model): errors += ( "<hr/><strong>Documents manquants :</strong><ul>" + errors_str + "</ul>" ) + # Si des erreurs remplir les logs avec la liste des documents manquants if errors: local_tz = timezone("Europe/Paris") utc_tz = timezone("UTC") @@ -505,9 +506,11 @@ class ScopPartner(models.Model): + utc_tz.localize(fields.Datetime.now()) .astimezone(local_tz) .strftime("%d/%m/%Y - %-H:%M") - + "</strong> - Impossible de soumettre le dossier à la CG Scop" + + "</strong> - Impossible de passer en statut Suivi" + errors ) + else: + self.list_logs = False def scop_suivi_non_adhesion(self): """ diff --git a/views/scop_adhesion_file.xml b/views/scop_adhesion_file.xml index e68eaf4..1035b60 100644 --- a/views/scop_adhesion_file.xml +++ b/views/scop_adhesion_file.xml @@ -3,7 +3,28 @@ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> <odoo> <data> - <!-- Questionnaire Type --> + + <record id="scop_adhesion_file_search" model="ir.ui.view"> + <field name="name">scop.adhesion.file.search</field> + <field name="model">scop.adhesion.file</field> + <field name="arch" type="xml"> + <search string="Recherche Documents"> + <field name="name"/> + <filter + string="Projets de création" + name="project" + domain="[('type_process','=', 'project')]" + /> + <filter + string="Adhésion" + name="adh" + domain="[('type_process','=', 'adhesion')]" + /> + </search> + </field> + </record> + + <!-- Documents --> <record id="scop_adhesion_file_tree" model="ir.ui.view"> <field name="name">scop.adhesion.file.tree</field> <field name="model">scop.adhesion.file</field> @@ -21,6 +42,7 @@ <field name="name">Documents</field> <field name="res_model">scop.adhesion.file</field> <field name="view_mode">tree</field> + <field name="search_view_id" ref="scop_adhesion_file_search" /> <field name="help" >Liste des documents pour l'adhésion et les projets de création</field> diff --git a/wizard/scop_compulsory_fields_suivi_wizard.py b/wizard/scop_compulsory_fields_suivi_wizard.py index 63db618..d5cf46c 100644 --- a/wizard/scop_compulsory_fields_suivi_wizard.py +++ b/wizard/scop_compulsory_fields_suivi_wizard.py @@ -37,3 +37,9 @@ class ScopCompulsoryFieldsSuiviWizard(models.TransientModel): if self.with_adhesion: self.partner_id.write({"membership_status": "adhesion"}) return {"type": "ir.actions.act_window_close"} + + def save_data(self): + """ + Sauvegarder les données même avec erreurs + """ + return {"type": "ir.actions.act_window_close"} diff --git a/wizard/scop_compulsory_fields_suivi_wizard.xml b/wizard/scop_compulsory_fields_suivi_wizard.xml index 881ceff..74335e2 100644 --- a/wizard/scop_compulsory_fields_suivi_wizard.xml +++ b/wizard/scop_compulsory_fields_suivi_wizard.xml @@ -48,14 +48,21 @@ type="object" string="Valider sans adhésion" class="oe_highlight" - attrs="{'invisible':['|', ('with_adhesion','=',True),('list_logs', '=', False)]}" + attrs="{'invisible':['|', ('with_adhesion','=',True),('list_logs', '!=', False)]}" /> <button name="confirm" type="object" string="Valider avec adhésion" class="oe_highlight" - attrs="{'invisible':['|', ('with_adhesion','=',False), ('list_logs', '=', False)]}" + attrs="{'invisible':['|', ('with_adhesion','=',False), ('list_logs', '!=', False)]}" + /> + <button + name="save_data" + type="object" + string="Sauvegarder" + class="oe_highlight" + attrs="{'invisible':[('list_logs', '=', False)]}" /> <button special="cancel" string="Annuler" /> </footer> -- GitLab