Skip to content
Extraits de code Groupes Projets
Valider cb7d2dd1 rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[fix] errors registration

parent f86ad8e9
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -161,9 +161,23 @@ class ScopPartner(models.Model):
"target": "new",
}
def set_registration(self):
self.ensure_one()
wizard = self.env["scop.registration.wizard"].create(
{"partner_id": self.id,}
)
return {
"name": "Immatriculation",
"type": "ir.actions.act_window",
"view_mode": "form",
"res_model": "scop.registration.wizard",
"res_id": wizard.id,
"target": "new",
}
def scop_cancel_membership(self):
for partner in self:
partner.update({"member_status": "not_member"})
partner.update({"membership_status": "not_member"})
# ------------------------------------------------------
# Business methods
......
......@@ -67,7 +67,7 @@
<button
string="Immatriculation"
type="object"
name="scop_cancel_membership"
name="set_registration"
attrs="{'invisible': [('is_registration_in_progress', '!=', True)]}"
/>
</xpath>
......
......@@ -71,12 +71,12 @@ class ScopCompulsoryFieldsSuiviWizard(models.TransientModel):
{
"extranet_access": True,
"extranet_update_company": True,
"tag_ids": [
"category_id": [
(
4,
self.env.ref(
"__export__.res_partner_category_6_a5b5dca7"
),
).id,
0,
),
],
......@@ -93,19 +93,19 @@ class ScopCompulsoryFieldsSuiviWizard(models.TransientModel):
for director in self.partner_id.director_ids:
director.update(
{
"tag_ids": [
"category_id": [
(
4,
self.env.ref(
"__export__.res_partner_category_4_eb133182"
),
).id,
0,
),
(
4,
self.env.ref(
"__export__.res_partner_category_6_a5b5dca7"
),
).id,
0,
),
]
......
......@@ -24,5 +24,13 @@ class ScopRegistrationWizard(models.TransientModel):
"""
Passe la coop en statut "4_suivi"
"""
self.partner_id.sudo()._create_period(self.partner_id)
last_period = self.partner_id.scop_period_ids.filtered(lambda p: not p.end)
if last_period:
last_period.ensure_one()
last_period.update({
"end": self.registration_date,
"end_reason": "registration",
})
self.partner_id.sudo()._add_period(self.partner_id)
self.partner_id.update({"is_registration_in_progress": False})
return {"type": "ir.actions.act_window_close"}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter