Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
T
training_survey
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Le Filament
training
training_survey
Validations
d2613ed6
Valider
d2613ed6
rédigé
Il y a 11 mois
par
Julien - Le Filament
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
[WIP] tentative de pre inscription
parent
0c2d9dbc
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!2
[UPD] add student registration process
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
models/survey_user_input.py
+43
-1
43 ajouts, 1 suppression
models/survey_user_input.py
avec
43 ajouts
et
1 suppression
models/survey_user_input.py
+
43
−
1
Voir le fichier @
d2613ed6
# 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
from
odoo
import
fields
,
models
,
api
class
SurveyUserInput
(
models
.
Model
):
class
SurveyUserInput
(
models
.
Model
):
...
@@ -16,7 +16,9 @@ class SurveyUserInput(models.Model):
...
@@ -16,7 +16,9 @@ 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
"
,
...
@@ -29,10 +31,50 @@ class SurveyUserInput(models.Model):
...
@@ -29,10 +31,50 @@ 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
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter