1
0
forked from Mapan/odoo17e
odoo17e-kedaikipas58/addons/l10n_ar_edi/controllers/main.py
2024-12-10 09:04:09 +07:00

15 lines
723 B
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import http
class DownloadCertificateRequst(http.Controller):
@http.route('/l10n_ar_edi/download_csr/<int:company_id>', type='http', auth="user")
def download_csr(self, company_id, **kw):
""" Download the certificate request file to upload in AFIP """
company = http.request.env['res.company'].sudo().browse(company_id)
content = company._l10n_ar_create_certificate_request()
if not content:
return http.request.not_found()
return http.request.make_response(content, headers=[('Content-Type', 'text/plain'), ('Content-Disposition', http.content_disposition('request.csr'))])