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

[UPD]Update contract download

parent 0bb79d72
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -203,6 +203,9 @@ class OperationsService(Component):
"name": n.name,
"start_date": n.start_date,
"end_date": n.end_date,
"type": n.type,
# "seller": n.seller_id.name,
# "buyer": n.buyer_id.name,
}
datas["contracts"].append(val)
......@@ -214,6 +217,8 @@ class OperationsService(Component):
crsf=False,
)
def my_invoice_detail(self, _id, **kw):
type = self.request.params.get("type", False)
if type == "invoice":
invoice_id = self.request.params.get("invoice_id", False)
invoice = self.env["acc.account"].browse(invoice_id)
if invoice:
......@@ -234,6 +239,19 @@ class OperationsService(Component):
filename = "Facture.pdf"
reporthttpheaders.append(("Content-Disposition", content_disposition(filename)))
return request.make_response(b64_pdf)
else:
contract_id = self.request.params.get("invoice_id", False)
contract = self.env["acc.contract"].browse(contract_id)
if contract:
contract_sudo = contract.with_user(SUPERUSER_ID).exists()
reporthttpheaders = [
("Content-Type", "application/pdf"),
("Content-Length", len(contract_sudo.document)),
]
filename = "Contrat.pdf"
reporthttpheaders.append(
("Content-Disposition", content_disposition(filename)))
return request.make_response(contract_sudo.document)
@restapi.method(
[(["/<int:id>/pmo"], "POST")],
......@@ -656,6 +674,19 @@ class OperationsService(Component):
},
},
},
"contracts": {
"type": "list",
"schema": {
"type": "dict",
"schema": {
"id": {"type": "integer"},
"name": {"type": "string"},
"type": {"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