Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMP add an explicit notification message (printer name for example) #318

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
mourad-ehm marked this conversation as resolved.
Show resolved Hide resolved
):
"""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";
mourad-ehm marked this conversation as resolved.
Show resolved Hide resolved
if (act.params.args && act.params.args[2] !== undefined) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use kwargs ?

Copy link
Member Author

@mourad-ehm mourad-ehm Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is any problem to use args ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really human readable / friendly

btw, why the !== check ? what values do you expect if act.params.args[2] is "" or false ?

msg = act.params.args[2];
}
env.services.notification.add(msg, {
type: "info",
});
$.ajax({
Expand Down
Loading