From aba57a79a32714fb53697a8a54dcef85ca208e4d Mon Sep 17 00:00:00 2001 From: Pierrick Brun Date: Tue, 22 Dec 2020 13:58:55 +0100 Subject: [PATCH 1/5] [ADD] pos_escpos_status module --- pos_escpos_status/README.rst | 72 +++ pos_escpos_status/__init__.py | 0 pos_escpos_status/__manifest__.py | 16 + pos_escpos_status/readme/DESCRIPTION.rst | 10 + .../static/description/index.html | 409 ++++++++++++++++++ .../static/src/js/ProxyStatus.js | 22 + pos_escpos_status/views/assets.xml | 13 + 7 files changed, 542 insertions(+) create mode 100644 pos_escpos_status/README.rst create mode 100644 pos_escpos_status/__init__.py create mode 100644 pos_escpos_status/__manifest__.py create mode 100644 pos_escpos_status/readme/DESCRIPTION.rst create mode 100644 pos_escpos_status/static/description/index.html create mode 100644 pos_escpos_status/static/src/js/ProxyStatus.js create mode 100644 pos_escpos_status/views/assets.xml diff --git a/pos_escpos_status/README.rst b/pos_escpos_status/README.rst new file mode 100644 index 000000000000..48da3ce88457 --- /dev/null +++ b/pos_escpos_status/README.rst @@ -0,0 +1,72 @@ +========================== +POS ESC/Pos printer Status +========================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/14.0/pos_escpos_status + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-14-0/pos-14-0-pos_escpos_status + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/184/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module makes odoo fetch printer status for the espos driver if enabled. + + +This allows retro-compatibility with the 12.0 printer status fetching method. + + +This module was created for pywebdriver (https://github.com/akretion/pywebdriver) + +Printing with pywebdriver will still work without this but the printer status +will be wrongly assumed as "disconnected". + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_escpos_status/__init__.py b/pos_escpos_status/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/pos_escpos_status/__manifest__.py b/pos_escpos_status/__manifest__.py new file mode 100644 index 000000000000..c19331480147 --- /dev/null +++ b/pos_escpos_status/__manifest__.py @@ -0,0 +1,16 @@ +# Copyright 2020 Akretion (https://www.akretion.com). +# @author Pierrick Brun +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "POS ESC/Pos printer Status", + "version": "14.0.1.0.0", + "category": "Point Of Sale", + "summary": "Point of sale: fetch status for 'escpos' driver", + "author": "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/pos", + "license": "AGPL-3", + "depends": ["point_of_sale"], + "data": ["views/assets.xml"], + "installable": True, +} diff --git a/pos_escpos_status/readme/DESCRIPTION.rst b/pos_escpos_status/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..ff89e629fabe --- /dev/null +++ b/pos_escpos_status/readme/DESCRIPTION.rst @@ -0,0 +1,10 @@ +This module makes odoo fetch printer status for the espos driver if enabled. + + +This allows retro-compatibility with the 12.0 printer status fetching method. + + +This module was created for pywebdriver (https://github.com/akretion/pywebdriver) + +Printing with pywebdriver will still work without this but the printer status +will be wrongly assumed as "disconnected". diff --git a/pos_escpos_status/static/description/index.html b/pos_escpos_status/static/description/index.html new file mode 100644 index 000000000000..628568ef65fd --- /dev/null +++ b/pos_escpos_status/static/description/index.html @@ -0,0 +1,409 @@ + + + + + + +POS ESC/Pos printer Status + + + +
+

POS ESC/Pos printer Status

+ + +

Beta License: AGPL-3 OCA/pos Translate me on Weblate Try me on Runbot

+

This module makes odoo fetch printer status for the espos driver if enabled.

+

This allows retro-compatibility with the 12.0 printer status fetching method.

+

This module was created for pywebdriver (https://github.com/akretion/pywebdriver)

+

Printing with pywebdriver will still work without this but the printer status +will be wrongly assumed as “disconnected”.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/pos project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/pos_escpos_status/static/src/js/ProxyStatus.js b/pos_escpos_status/static/src/js/ProxyStatus.js new file mode 100644 index 000000000000..2f05332f17e1 --- /dev/null +++ b/pos_escpos_status/static/src/js/ProxyStatus.js @@ -0,0 +1,22 @@ +/* Copyright (C) 2020-Today Akretion (https://www.akretion.com) + @author Pierrick Brun (https://www.akretion.com) + License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). +*/ + +odoo.define("pos_escpos_status.ProxyStatus", function (require) { + "use strict"; + var Registries = require("point_of_sale.Registries"); + var ProxyStatus = require("point_of_sale.ProxyStatus"); + + const EscposProxyStatus = (ProxyStatus) => + class EscposProxyStatus extends ProxyStatus { + _setStatus(newStatus) { + if (newStatus.drivers.escpos) { + newStatus.drivers.printer = newStatus.drivers.escpos; + } + super._setStatus(newStatus); + } + }; + + Registries.Component.extend(ProxyStatus, EscposProxyStatus); +}); diff --git a/pos_escpos_status/views/assets.xml b/pos_escpos_status/views/assets.xml new file mode 100644 index 000000000000..412a182d5b2c --- /dev/null +++ b/pos_escpos_status/views/assets.xml @@ -0,0 +1,13 @@ + + + +