Skip to content

[19.0][ADD] base_report_to_printer_websocket#448

Open
DavidJForgeFlow wants to merge 5 commits intoOCA:19.0from
ForgeFlow:19.0-add-base_report_to_printer_websocket
Open

[19.0][ADD] base_report_to_printer_websocket#448
DavidJForgeFlow wants to merge 5 commits intoOCA:19.0from
ForgeFlow:19.0-add-base_report_to_printer_websocket

Conversation

@DavidJForgeFlow
Copy link
Copy Markdown

This module extends base_report_to_printer to send print jobs through the Odoo Bus (WebSocket) instead of a traditional print server like CUPS.

Depends on fix #447

@etobella

@DavidJForgeFlow DavidJForgeFlow force-pushed the 19.0-add-base_report_to_printer_websocket branch 4 times, most recently from 74d0f3d to 67c0781 Compare March 12, 2026 10:25
Copy link
Copy Markdown
Member

@etobella etobella left a comment

Choose a reason for hiding this comment

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

Please, do the assignation through channels by using specific users. You might do something like: user id in the system, this way it is cleaner. (if you want several systems, you might one user for each system)

"base_report_to_printer.printing_group_user"
)
if not is_printing_user:
channels = [ch for ch in channels if ch not in ws_channels]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

you should attach the channels and use the printers

.mapped("websocket_channel")
)
is_printing_user = self.env.uid and self.env.user.has_group(
"base_report_to_printer.printing_group_user"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you have 2 users with this group, everything will be crazy.

selection_add=[("websocket", "WebSocket")],
ondelete={"websocket": "cascade"},
)
websocket_channel = fields.Char(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

don't force channels this way... it is better to assign users

Copy link
Copy Markdown
Member

@etobella etobella left a comment

Choose a reason for hiding this comment

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

some minor comments

In general looks good 😄

"file_type": doc_format,
}
self.env["bus.bus"]._sendone(self, "print_job", payload)
_logger.info("Print job sent via WebSocket to printer '%s'", self.name)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

_logger.debug?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done!

@@ -0,0 +1,16 @@
1. Install and configure *base_report_to_printer* as usual.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that installing module is not necessary part of the configuration steps, isn't it? 😆

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done!

3. Set the **System Name** to the name of the target printer as known by
the client-side listener (e.g. ``MFC-L3750CDW``). Leave it empty to
use the default system printer.
4. Assign the printer as the default globally, per user, or per report
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should change it to include the user configuration here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done!

@pedrobaeza pedrobaeza added this to the 19.0 milestone Mar 16, 2026
@DavidJForgeFlow DavidJForgeFlow force-pushed the 19.0-add-base_report_to_printer_websocket branch 2 times, most recently from 0c78713 to 7f467dd Compare March 18, 2026 09:19
@DavidJForgeFlow DavidJForgeFlow force-pushed the 19.0-add-base_report_to_printer_websocket branch from 7f467dd to b97a3a1 Compare March 18, 2026 09:27
@DavidJForgeFlow
Copy link
Copy Markdown
Author

@etobella The tests and the README have been updated

"password": "qwerty",
}
)
cls.demo_user = cls.env.ref("base.user_admin")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why are you changing this?

ppd_contents = self.build_ppd(input_slots)
with open(file_name, "w") as fp:
fp.write(ppd_contents)
if file_name:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants