From 9a090763f5e79ffdceb8549b52f86154ccc53d8e Mon Sep 17 00:00:00 2001 From: Mourad Date: Tue, 5 Nov 2024 16:37:45 +0100 Subject: [PATCH 1/2] IMP add an explicit notification message (printer name for example) --- proxy_action/models/helper.py | 7 ++++--- proxy_action/static/src/js/proxy_view.esm.js | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/proxy_action/models/helper.py b/proxy_action/models/helper.py index 1f58cd510..a642647af 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="Your action is being executed", ): - """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..ed8dfdf61 100644 --- a/proxy_action/static/src/js/proxy_view.esm.js +++ b/proxy_action/static/src/js/proxy_view.esm.js @@ -4,7 +4,11 @@ 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 = "Your action is being executed"; + if (act.params.args && act.params.args[2] !== undefined) { + msg = act.params.args[2]; + } + env.services.notification.add(msg, { type: "info", }); $.ajax({ From d37576f133f12c4a2fa7d8536eb7b5b1f3857bf2 Mon Sep 17 00:00:00 2001 From: Mourad Date: Thu, 14 Nov 2024 11:19:21 +0100 Subject: [PATCH 2/2] Remove twice definition of default message and translate it --- proxy_action/models/helper.py | 2 +- proxy_action/static/src/js/proxy_view.esm.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy_action/models/helper.py b/proxy_action/models/helper.py index a642647af..63d976714 100644 --- a/proxy_action/models/helper.py +++ b/proxy_action/models/helper.py @@ -21,7 +21,7 @@ def get_print_data_action( to_encode64=False, copies=1, host="https://localhost", - msg="Your action is being executed", + msg="", ): """Prepare a PyWebdriver. print action""" if to_encode64: diff --git a/proxy_action/static/src/js/proxy_view.esm.js b/proxy_action/static/src/js/proxy_view.esm.js index ed8dfdf61..e5a4de3d4 100644 --- a/proxy_action/static/src/js/proxy_view.esm.js +++ b/proxy_action/static/src/js/proxy_view.esm.js @@ -4,7 +4,7 @@ import {registry} from "@web/core/registry"; async function executeProxyAction({env, action}) { action.action_list.map(function (act) { - let msg = "Your action is being executed"; + let msg = env._t("Your action is being executed"); if (act.params.args && act.params.args[2] !== undefined) { msg = act.params.args[2]; }