From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- .../web/static/src/js/services/report_service.js | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 addons/web/static/src/js/services/report_service.js (limited to 'addons/web/static/src/js/services/report_service.js') diff --git a/addons/web/static/src/js/services/report_service.js b/addons/web/static/src/js/services/report_service.js new file mode 100644 index 00000000..ed4907a6 --- /dev/null +++ b/addons/web/static/src/js/services/report_service.js @@ -0,0 +1,35 @@ +odoo.define('web.ReportService', function (require) { +"use strict"; + +/** + * This file defines the service for the report generation in Odoo. + */ + +var AbstractService = require('web.AbstractService'); +var core = require('web.core'); + +var ReportService = AbstractService.extend({ + dependencies: ['ajax'], + + /** + * Checks the state of the installation of wkhtmltopdf on the server. + * Implements an internal cache to do the request only once. + * + * @returns {Promise} resolved with the state of wkhtmltopdf on the server + * (possible values are 'ok', 'broken', 'install', 'upgrade', 'workers'). + */ + checkWkhtmltopdf: function () { + if (!this.wkhtmltopdfState) { + this.wkhtmltopdfState = this._rpc({ + route:'/report/check_wkhtmltopdf' + }); + } + return this.wkhtmltopdfState; + }, +}); + +core.serviceRegistry.add('report', ReportService); + +return ReportService; + +}); -- cgit v1.2.3