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

Revert "[WIP] tentative de pre inscription"

parent 317a5bc2
Branches 14-RV-20250129
Aucune étiquette associée trouvée
1 requête de fusion!1Revert "[WIP] tentative de pre inscription"
# Copyright 2019-2022 Le Filament (<https://le-filament.com>) # Copyright 2019-2022 Le Filament (<https://le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models, api from odoo import fields, models
class SurveyUserInput(models.Model): class SurveyUserInput(models.Model):
...@@ -16,9 +16,7 @@ class SurveyUserInput(models.Model): ...@@ -16,9 +16,7 @@ class SurveyUserInput(models.Model):
comodel_name="training.training", comodel_name="training.training",
string="Formation", string="Formation",
ondelete="cascade", ondelete="cascade",
compute="_compute_training_id"
) )
training_survey_type = fields.Selection( training_survey_type = fields.Selection(
string="Type de questionnaire formation", string="Type de questionnaire formation",
related="survey_id.training_survey_type", related="survey_id.training_survey_type",
...@@ -31,50 +29,10 @@ class SurveyUserInput(models.Model): ...@@ -31,50 +29,10 @@ class SurveyUserInput(models.Model):
# ------------------------------------------------------ # ------------------------------------------------------
# Override ORM # Override ORM
# ------------------------------------------------------ # ------------------------------------------------------
def _mark_done(self):
"""
Hérite la fonction parente pour gérer les inscriptions aux formations au moment
de la validation du questionnaire
"""
super()._mark_done()
student_model = self.env["training.student"].sudo()
student_id = student_model.create(
{
"partner_id": self.partner_id.id,
"training_id": self.training_id,
"student_company": self.company,
}
)
# Création de la réponse au sondage
answer_id = self.create(
{
"partner_id": self.partner_id.id,
"email": self.partner_id.email,
"nickname": self.partner_id.lastname,
"firstname": self.partner_id.firstname,
"company": self.company,
"survey_id": self.training_id.registration_survey_id.id,
"student_id": student_id.id,
"training_id": self.training_id.id,
}
)
# ------------------------------------------------------ # ------------------------------------------------------
# Compute # Compute
# ------------------------------------------------------ # ------------------------------------------------------
@api.depends("survey_id")
def _compute_training_id(self):
for user_input in self:
user_input.training_id = self.env['training.training'].search(
[
('registration_survey_id', '=', user_input.survey_id.id),
('partner_id', '=', user_input.partner_id.id)
]
)
# ------------------------------------------------------ # ------------------------------------------------------
# Buttons # Buttons
......
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