Skip to content

Commit

Permalink
IMP add an explicit notification message (printer name for example)
Browse files Browse the repository at this point in the history
  • Loading branch information
mourad-ehm committed Nov 5, 2024
1 parent 85123da commit 9a09076
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions proxy_action/models/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {}}
Expand All @@ -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,
Expand Down
6 changes: 5 additions & 1 deletion proxy_action/static/src/js/proxy_view.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 9a09076

Please sign in to comment.