diff --git a/__manifest__.py b/__manifest__.py index 4fb1fe5fe0a93cb397be7ee4616c7ff6d348caac..7e660652182e816d37ed3fb123d18d687be18b75 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -26,6 +26,7 @@ "wizard/scop_membership_liasse_wizard.xml", "wizard/scop_membership_staff_wizard.xml", "wizard/scop_membership_submit_wizard.xml", + "wizard/scop_registration_wizard.xml", # views "views/assets.xml", "views/res_config_settings.xml", diff --git a/models/res_partner.py b/models/res_partner.py index 1f87989d0b9d58d8338072b5ea09023f297e8590..92f2468bfadad2332470c23b3da3080252a87a06 100644 --- a/models/res_partner.py +++ b/models/res_partner.py @@ -161,6 +161,10 @@ class ScopPartner(models.Model): "target": "new", } + def scop_cancel_membership(self): + for partner in self: + partner.update({"member_status": "not_member"}) + # ------------------------------------------------------ # Business methods # ------------------------------------------------------ diff --git a/views/res_partner.xml b/views/res_partner.xml index 64648980194423355ad974f578eb3d2b7db991fc..5bd7b3de940732c02119dd7409b3dc455c9e438c 100644 --- a/views/res_partner.xml +++ b/views/res_partner.xml @@ -57,6 +57,19 @@ attrs="{'invisible': [('membership_status', '!=', 'soumis_cg')]}" groups="cgscop_partner.group_cg_administrator" /> + <button + string="Projet d'adhésion abandonné" + type="object" + name="scop_cancel_membership" + attrs="{'invisible': [('membership_status', '!=', 'adhesion')]}" + confirm="Valider l'abandon du projet d'adhésion ?" + /> + <button + string="Immatriculation" + type="object" + name="scop_cancel_membership" + attrs="{'invisible': [('is_registration_in_progress', '!=', True)]}" + /> </xpath> <!-- Alert pour les données du process d'adhésion --> diff --git a/wizard/__init__.py b/wizard/__init__.py index fb836cd6681973d7ce591fe1b6ed85bddde94c9f..05afc06b01d4d802c1e682b2da4b78cc9868fa1e 100644 --- a/wizard/__init__.py +++ b/wizard/__init__.py @@ -5,3 +5,4 @@ from . import scop_compulsory_fields_suivi_wizard from . import scop_membership_liasse_wizard from . import scop_membership_staff_wizard from . import scop_membership_submit_wizard +from . import scop_registration_wizard diff --git a/wizard/scop_registration_wizard.py b/wizard/scop_registration_wizard.py new file mode 100644 index 0000000000000000000000000000000000000000..5e2d337bb3a8ae4a34b4ee0765140fb0dbe5d9c6 --- /dev/null +++ b/wizard/scop_registration_wizard.py @@ -0,0 +1,29 @@ +# © 2021 Le Filament (<http://www.le-filament.com>) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import _, fields, models +from odoo.exceptions import UserError + + +class ScopCompulsoryFieldsSuiviWizard(models.TransientModel): + _name = "scop.compulsory.fields.suivi.wizard" + _description = "Wizard: Confirmer les champs obligatoires pour passage en suivi " + + partner_id = fields.Many2one( + comodel_name="res.partner", string="Coop", required=True + ) + naf_id = fields.Many2one(related="partner_id.naf_id", readonly=False) + registration_date = fields.Date( + related="partner_id.registration_date", readonly=False + ) + siret = fields.Char(related="partner_id.siret", readonly=False) + + # ------------------------------------------------------ + # Actions / Buttons + # ------------------------------------------------------ + def confirm_registration(self): + """ + Passe la coop en statut "4_suivi" + """ + self.partner_id.sudo()._create_period(self.partner_id) + return {"type": "ir.actions.act_window_close"} diff --git a/wizard/scop_registration_wizard.xml b/wizard/scop_registration_wizard.xml new file mode 100644 index 0000000000000000000000000000000000000000..23ea51692127cd99750e19c8ca8823f0d576ed86 --- /dev/null +++ b/wizard/scop_registration_wizard.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" ?> +<!-- Copyright 2021 Le Filament + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> +<odoo> + <data> + + <record + model="ir.ui.view" + id="scop_registration_wizard_form" + > + <field name="name">scop.registration.wizard.form</field> + <field name="model">scop.registration.wizard</field> + <field name="arch" type="xml"> + <form string="Immatriculation"> + <group> + <field + name="partner_id" + readonly="1" + options="{'no_create': True, 'no_edit': True}" + /> + <field name="registration_date" required="1" /> + <field name="siret" required="1" /> + <field name="naf_id" required="1" /> + </group> + <footer> + <button + name="confirm_registration" + type="object" + string="Valider" + class="oe_highlight" + /> + <button special="cancel" string="Annuler" /> + </footer> + </form> + </field> + </record> + + </data> +</odoo>