diff --git a/proxy_action/models/helper.py b/proxy_action/models/helper.py index 1f58cd510..63d976714 100644 --- a/proxy_action/models/helper.py +++ b/proxy_action/models/helper.py @@ -21,8 +21,9 @@ def get_print_data_action( to_encode64=False, copies=1, host="https://localhost", + msg="", ): - """Prepare a PyWebdriver.print action""" + """Prepare a PyWebdriver. print action""" if to_encode64: data = base64.b64encode(data) kwargs = {"options": {}} @@ -32,12 +33,12 @@ def get_print_data_action( kwargs["options"]["raw"] = True return { "url": "%s/cups/printData" % host, - "params": {"args": [printer_name, data], "kwargs": kwargs}, + "params": {"args": [printer_name, data, msg], "kwargs": kwargs}, } @api.model def get_print_xml_receipt_action(self, receipt, host="https://localhost"): - """Prepare a PyWebdriver.print action""" + """Prepare a PyWebdriver. print action""" return { "url": "%s/hw_proxy/print_xml_receipt" % host, diff --git a/proxy_action/static/src/js/proxy_view.esm.js b/proxy_action/static/src/js/proxy_view.esm.js index 0acd275f4..92e5b5a8a 100644 --- a/proxy_action/static/src/js/proxy_view.esm.js +++ b/proxy_action/static/src/js/proxy_view.esm.js @@ -4,7 +4,18 @@ import {registry} from "@web/core/registry"; async function executeProxyAction({env, action}) { action.action_list.map(function (act) { - env.services.notification.add(env._t("Your action is being executed"), { + let msg = env._t("Your action is being executed"); + // The arg act.params.args[2] can contain a custom message to display for user + // (ex used printer name) + if ( + act.params.args && + act.params.args.length >= 2 && + act.params.args[2] && + act.params.args[2].length + ) { + msg = act.params.args[2]; + } + env.services.notification.add(msg, { type: "info", }); $.ajax({