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

[UPD]Display/hide title depending numer contracts

parent 4725b2a3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -217,6 +217,7 @@ class OperationsService(Component):
domain_c += [
("type", "!=", "convention"),
("type", "!=", "all"),
("type", "!=", "pmo"),
("type", "!=", False),
]
if role.get("isPmo"):
......@@ -228,6 +229,11 @@ class OperationsService(Component):
])
acc_contract_ids = self.env["acc.contract"].search(domain_c)
acc_contract_ids += acc_contract_all
acc_contract_pmo = self.env["acc.contract"].search([
("acc_operation_id", "=", _id), ("type", "=", "pmo"),
])
acc_contract_ids += acc_contract_pmo
contract_exist = False
if acc_contract_ids:
contract_exist = True
......@@ -279,6 +285,20 @@ class OperationsService(Component):
if acc_contract_ids
else []
)
datas["contracts_pmo"] = (
acc_contract_pmo.mapped(
lambda n: {
"id": n.id,
"name": n.name,
"start_date": n.start_date,
"end_date": n.end_date,
"type": n.type,
"url": base_url + n.get_portal_url(),
}
)
if acc_contract_pmo
else []
)
datas["contract_exist"] = contract_exist
datas["invoice_exist"] = invoice_exist
return datas
......@@ -777,6 +797,21 @@ class OperationsService(Component):
},
},
},
"contracts_pmo": {
"nullable": True,
"type": "list",
"schema": {
"type": "dict",
"schema": {
"id": {"type": "integer"},
"name": {"type": "string"},
"type": {"type": "string", "nullable": True},
"url": {"type": "string", "nullable": True},
"seller": {"type": "string", "nullable": True},
"buyer": {"type": "string", "nullable": True},
},
},
},
}
def _validator_get_pmo(self):
......
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