accountant_cn

This commit is contained in:
2026-11-17 17:57:08 +08:00
parent 9b924747c5
commit 5fc4382687
771 changed files with 18102 additions and 820280 deletions

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""JSON endpoint feeding the report client action (Odoo 20 uses type=jsonrpc)."""
import logging
from odoo import http
from odoo.http import request, route
_logger = logging.getLogger(__name__)
class DnFrController(http.Controller):
@route("/dn/fr/data", type="jsonrpc", auth="user")
def get_report_data(self, report_id=None, options=None, **kwargs):
try:
report = request.env["dn.fr"].browse(int(report_id or 0)).exists()
except (TypeError, ValueError):
report = request.env["dn.fr"]
if not report:
return {"ok": False, "error": "Report not found."}
options = dict(options or {})
options.setdefault("company_ids", request.env.company.ids)
try:
return {"ok": True, "data": report.get_report_data(options)}
except Exception as exc:
_logger.exception("DN report %s failed", report.code)
return {"ok": False, "error": str(exc)}