Skip to content
Extraits de code Groupes Projets
Valider 15472183 rédigé par Juliana's avatar Juliana
Parcourir les fichiers

[ADD]Add page contact PRM

parent 47b12c06
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -540,6 +540,32 @@ class OperationsService(Component): ...@@ -540,6 +540,32 @@ class OperationsService(Component):
} }
return datas return datas
@restapi.method(
[(["/<int:id>/contact"], "GET")],
output_param=restapi.CerberusValidator("_validator_return_get_contact"),
cors="*",
crsf=False,
)
def get_contact(self, _id):
"""
Retourne les données de l'opération
dans laquelle l'utilisateur ou sa société sont engagés
"""
operation = self.env["acc.operation"].browse(_id)
role = self._get_role(operation)
if not role.get("isIn"):
return AccessError()
datas = {
"role": role,
"id": operation.id,
"name": operation.name,
"email": operation.pmo_id.email
}
return datas
# ------------------------------------------------------ # ------------------------------------------------------
# Validators # Validators
# ------------------------------------------------------ # ------------------------------------------------------
...@@ -625,6 +651,25 @@ class OperationsService(Component): ...@@ -625,6 +651,25 @@ class OperationsService(Component):
}, },
} }
def _validator_return_get_contact(self):
return {
"role": {
"type": "dict",
"schema": {
"id": {"type": "integer"},
"name": {"type": "string"},
"description": {"type": "string"},
"isIn": {"type": "boolean"},
"isPmo": {"type": "boolean"},
"isConsumer": {"type": "boolean"},
"isProductor": {"type": "boolean"},
},
},
"id": {"type": "integer"},
"name": {"type": "string"},
"email": {"type": "string"},
}
def _validator_get_doc(self): def _validator_get_doc(self):
return { return {
"id": {"type": "integer"}, "id": {"type": "integer"},
......
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