From 9dc8e3ad02a38dc1a62a6e0dbf3794f1b72d0732 Mon Sep 17 00:00:00 2001 From: Jacques-Etienne Baudoux Date: Wed, 21 Jun 2023 10:04:06 +0200 Subject: [PATCH] [ADD] printing_auto_label_printer --- printing_auto_label_printer/README.rst | 77 ++++ printing_auto_label_printer/__init__.py | 1 + printing_auto_label_printer/__manifest__.py | 20 + .../models/__init__.py | 1 + .../models/printing_auto.py | 16 + .../readme/CONTRIBUTORS.rst | 4 + .../readme/DESCRIPTION.rst | 1 + .../static/description/index.html | 423 ++++++++++++++++++ printing_auto_label_printer/tests/__init__.py | 1 + .../tests/test_printing_auto_label_printer.py | 13 + .../views/printing_auto.xml | 23 + .../odoo/addons/printing_auto_label_printer | 1 + setup/printing_auto_label_printer/setup.py | 6 + 13 files changed, 587 insertions(+) create mode 100644 printing_auto_label_printer/README.rst create mode 100644 printing_auto_label_printer/__init__.py create mode 100644 printing_auto_label_printer/__manifest__.py create mode 100644 printing_auto_label_printer/models/__init__.py create mode 100644 printing_auto_label_printer/models/printing_auto.py create mode 100644 printing_auto_label_printer/readme/CONTRIBUTORS.rst create mode 100644 printing_auto_label_printer/readme/DESCRIPTION.rst create mode 100644 printing_auto_label_printer/static/description/index.html create mode 100644 printing_auto_label_printer/tests/__init__.py create mode 100644 printing_auto_label_printer/tests/test_printing_auto_label_printer.py create mode 100644 printing_auto_label_printer/views/printing_auto.xml create mode 120000 setup/printing_auto_label_printer/odoo/addons/printing_auto_label_printer create mode 100644 setup/printing_auto_label_printer/setup.py diff --git a/printing_auto_label_printer/README.rst b/printing_auto_label_printer/README.rst new file mode 100644 index 0000000..b878cdd --- /dev/null +++ b/printing_auto_label_printer/README.rst @@ -0,0 +1,77 @@ +=========================== +printing_auto_label_printer +=========================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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%2Freport--print--send-lightgray.png?logo=github + :target: https://github.com/OCA/report-print-send/tree/14.0/printing_auto_label_printer + :alt: OCA/report-print-send +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/report-print-send-14-0/report-print-send-14-0-printing_auto_label_printer + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/report-print-send&target_branch=14.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Base module to support automatic priting of a report or attachments on a label printer. + +**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 +======= + +Authors +~~~~~~~ + +* BCIM +* MT Software + +Contributors +~~~~~~~~~~~~ + +* Jacques-Etienne Baudoux (BCIM) +* Michael Tietz (MT Software) +* Camptocamp +* Christopher Hansen + +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/report-print-send `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/printing_auto_label_printer/__init__.py b/printing_auto_label_printer/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/printing_auto_label_printer/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/printing_auto_label_printer/__manifest__.py b/printing_auto_label_printer/__manifest__.py new file mode 100644 index 0000000..d61e528 --- /dev/null +++ b/printing_auto_label_printer/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2022 Jacques-Etienne Baudoux (BCIM) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Printing Auto Label Printer", + "author": "BCIM, MT Software, Odoo Community Association (OCA)", + "maintainers": ["jbaudoux"], + "category": "Warehouse Management", + "data": [ + "views/printing_auto.xml", + ], + "depends": [ + "base_report_to_label_printer", + "printing_auto_base", + ], + "auto_install": True, + "license": "AGPL-3", + "version": "14.0.1.0.0", + "website": "https://github.com/OCA/report-print-send", +} diff --git a/printing_auto_label_printer/models/__init__.py b/printing_auto_label_printer/models/__init__.py new file mode 100644 index 0000000..ad80a1b --- /dev/null +++ b/printing_auto_label_printer/models/__init__.py @@ -0,0 +1 @@ +from . import printing_auto diff --git a/printing_auto_label_printer/models/printing_auto.py b/printing_auto_label_printer/models/printing_auto.py new file mode 100644 index 0000000..2c20c97 --- /dev/null +++ b/printing_auto_label_printer/models/printing_auto.py @@ -0,0 +1,16 @@ +# Copyright 2022 Jacques-Etienne Baudoux (BCIM) +# Copyright 2022 Michael Tietz (MT Software) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class PrintingAuto(models.Model): + _inherit = "printing.auto" + + is_label = fields.Boolean("Is Label") + + def _get_behaviour(self): + if self.is_label and not self.printer_id: + return {"printer": self.env.user.default_label_printer_id} + return super()._get_behaviour() diff --git a/printing_auto_label_printer/readme/CONTRIBUTORS.rst b/printing_auto_label_printer/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..6a130e8 --- /dev/null +++ b/printing_auto_label_printer/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Jacques-Etienne Baudoux (BCIM) +* Michael Tietz (MT Software) +* Camptocamp +* Christopher Hansen diff --git a/printing_auto_label_printer/readme/DESCRIPTION.rst b/printing_auto_label_printer/readme/DESCRIPTION.rst new file mode 100644 index 0000000..a354dac --- /dev/null +++ b/printing_auto_label_printer/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Base module to support automatic priting of a report or attachments on a label printer. diff --git a/printing_auto_label_printer/static/description/index.html b/printing_auto_label_printer/static/description/index.html new file mode 100644 index 0000000..0dc5be5 --- /dev/null +++ b/printing_auto_label_printer/static/description/index.html @@ -0,0 +1,423 @@ + + + + + + +printing_auto_label_printer + + + +
+

printing_auto_label_printer

+ + +

Beta License: AGPL-3 OCA/report-print-send Translate me on Weblate Try me on Runboat

+

Base module to support automatic priting of a report or attachments on a label printer.

+

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

+
+

Authors

+
    +
  • BCIM
  • +
  • MT Software
  • +
+
+
+

Contributors

+ +
+
+

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/report-print-send project on GitHub.

+

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

+
+
+
+ + diff --git a/printing_auto_label_printer/tests/__init__.py b/printing_auto_label_printer/tests/__init__.py new file mode 100644 index 0000000..4bd0e6a --- /dev/null +++ b/printing_auto_label_printer/tests/__init__.py @@ -0,0 +1 @@ +from . import test_printing_auto_label_printer diff --git a/printing_auto_label_printer/tests/test_printing_auto_label_printer.py b/printing_auto_label_printer/tests/test_printing_auto_label_printer.py new file mode 100644 index 0000000..19ad069 --- /dev/null +++ b/printing_auto_label_printer/tests/test_printing_auto_label_printer.py @@ -0,0 +1,13 @@ +# Copyright 2022 Jacques-Etienne Baudoux (BCIM) +# Copyright 2022 Michael Tietz (MT Software) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.addons.printing_auto_base.tests.common import TestPrintingAutoCommon + + +class TestPrintingAutoBase(TestPrintingAutoCommon): + def test_behaviour_label(self): + self.env.user.default_label_printer_id = self.printer_2 + expected = {"printer": self.printer_2} + printing_auto = self._create_printing_auto_attachment({"is_label": True}) + self.assertEqual(expected, printing_auto._get_behaviour()) diff --git a/printing_auto_label_printer/views/printing_auto.xml b/printing_auto_label_printer/views/printing_auto.xml new file mode 100644 index 0000000..dca737c --- /dev/null +++ b/printing_auto_label_printer/views/printing_auto.xml @@ -0,0 +1,23 @@ + + + printing.auto.label.printer + printing.auto + + + + + + + + + + printing.auto.label.printer + printing.auto + + + + + + + + diff --git a/setup/printing_auto_label_printer/odoo/addons/printing_auto_label_printer b/setup/printing_auto_label_printer/odoo/addons/printing_auto_label_printer new file mode 120000 index 0000000..391a7dc --- /dev/null +++ b/setup/printing_auto_label_printer/odoo/addons/printing_auto_label_printer @@ -0,0 +1 @@ +../../../../printing_auto_label_printer \ No newline at end of file diff --git a/setup/printing_auto_label_printer/setup.py b/setup/printing_auto_label_printer/setup.py new file mode 100644 index 0000000..28c57bb --- /dev/null +++ b/setup/printing_auto_label_printer/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)