From c55eea97144be66c6851f21b1d84f40a01221557 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Tue, 20 Apr 2021 17:28:12 +0200 Subject: [PATCH] [MIG] report_label: Migration to 14.0 --- report_label/README.rst | 23 +++++++------- report_label/__manifest__.py | 3 +- report_label/models/ir_actions_server.py | 20 ++++++------ report_label/readme/CONTRIBUTORS.rst | 3 +- report_label/security/ir.model.access.csv | 4 ++- report_label/static/description/index.html | 31 ++++++++++--------- report_label/tests/test_report_label.py | 13 +++++--- report_label/views/ir_actions_server.xml | 1 - .../views/report_paperformat_label.xml | 5 ++- report_label/wizards/report_label_wizard.py | 1 + 10 files changed, 58 insertions(+), 46 deletions(-) diff --git a/report_label/README.rst b/report_label/README.rst index 44755e42d..bc494c7e6 100644 --- a/report_label/README.rst +++ b/report_label/README.rst @@ -14,13 +14,13 @@ Report Labels :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github - :target: https://github.com/OCA/reporting-engine/tree/12.0/report_label + :target: https://github.com/OCA/reporting-engine/tree/14.0/report_label :alt: OCA/reporting-engine .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/reporting-engine-12-0/reporting-engine-12-0-report_label + :target: https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-0-report_label :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/143/12.0 + :target: https://runbot.odoo-community.org/runbot/143/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -38,13 +38,13 @@ Configuration Go to **Settings > Technical > Analysis > Label Paper Format** and create your self-adhesive label paper formats. -.. image:: https://raw.githubusercontent.com/OCA/reporting-engine/12.0/report_label/static/description/configure_paperformat.png +.. image:: https://raw.githubusercontent.com/OCA/reporting-engine/14.0/report_label/static/description/configure_paperformat.png Go to **Settings > Technical > Analysis > Label Report** and create your label report, and its context action. You'll also need to create or reuse a QWeb template for you label. -.. image:: https://raw.githubusercontent.com/OCA/reporting-engine/12.0/report_label/static/description/configure_report_label.png +.. image:: https://raw.githubusercontent.com/OCA/reporting-engine/14.0/report_label/static/description/configure_report_label.png Usage ===== @@ -53,13 +53,13 @@ Usage 2. Click *Action* and your label report action name. 3. Select the number of labels per record to print, and click Print. -.. image:: https://raw.githubusercontent.com/OCA/reporting-engine/12.0/report_label/static/description/label_wizard.png +.. image:: https://raw.githubusercontent.com/OCA/reporting-engine/14.0/report_label/static/description/label_wizard.png Known issues / Roadmap ====================== -* `wkhtmltopdf` doesn't always respect dpi, and mm measures don't match. For - this matter, it's recommended to use this module along with +* `wkhtmltopdf` doesn't always respect dpi, and mm measures don't match. For + this matter, it's recommended to use this module along with `report_wkhtmltopdf_param` and enable `--disable-smart-shrinking`. Bug Tracker @@ -68,7 +68,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -85,11 +85,12 @@ Contributors ~~~~~~~~~~~~ * Iván Todorovich - * `Moka Tourisme `_: + * Grégory Schreiner * Sylvain LE GAL +* Stefan Rijnhart Maintainers ~~~~~~~~~~~ @@ -112,6 +113,6 @@ Current `maintainer `__: |maintainer-ivantodorovich| -This module is part of the `OCA/reporting-engine `_ project on GitHub. +This module is part of the `OCA/reporting-engine `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/report_label/__manifest__.py b/report_label/__manifest__.py index c3c5cbd2e..b8ff7a758 100644 --- a/report_label/__manifest__.py +++ b/report_label/__manifest__.py @@ -1,6 +1,7 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Report Labels", - "version": "12.0.1.0.0", + "version": "14.0.1.0.0", "summary": "Print configurable self-adhesive labels reports", "author": "Iván Todorovich, Moka Tourisme, Odoo Community Association (OCA)", "website": "https://github.com/OCA/reporting-engine", diff --git a/report_label/models/ir_actions_server.py b/report_label/models/ir_actions_server.py index 0d3d1dcd8..ff030fa98 100644 --- a/report_label/models/ir_actions_server.py +++ b/report_label/models/ir_actions_server.py @@ -1,11 +1,13 @@ -from odoo import api, fields, models +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import fields, models class IrActionsServer(models.Model): _inherit = "ir.actions.server" state = fields.Selection( - selection_add=[("report_label", "Print self-adhesive labels")] + selection_add=[("report_label", "Print self-adhesive labels")], + ondelete={"report_label": "cascade"}, ) label_template = fields.Char( "Label QWeb Template", @@ -18,7 +20,6 @@ class IrActionsServer(models.Model): states={"report_label": [("required", True)]}, ) - @api.multi def report_label_associated_view(self): """View the associated qweb templates""" self.ensure_one() @@ -34,22 +35,21 @@ class IrActionsServer(models.Model): ] return res - @api.model - def run_action_report_label_multi(self, action, eval_context=None): + def _run_action_report_label_multi(self, eval_context=None): """Show report label wizard""" context = dict(self.env.context) context.update( { - "label_template": action.label_template, - "label_paperformat_id": action.label_paperformat_id.id, - "res_model_id": action.model_id.id, + "label_template": self.label_template, + "label_paperformat_id": self.label_paperformat_id.id, + "res_model_id": self.model_id.id, } ) return { - "name": action.name, + "name": self.name, "type": "ir.actions.act_window", "res_model": "report.label.wizard", - "context": str(context), + "context": context, "view_mode": "form", "target": "new", } diff --git a/report_label/readme/CONTRIBUTORS.rst b/report_label/readme/CONTRIBUTORS.rst index 678fbcb70..efa1e4243 100644 --- a/report_label/readme/CONTRIBUTORS.rst +++ b/report_label/readme/CONTRIBUTORS.rst @@ -1,6 +1,7 @@ * Iván Todorovich - * `Moka Tourisme `_: + * Grégory Schreiner * Sylvain LE GAL +* Stefan Rijnhart diff --git a/report_label/security/ir.model.access.csv b/report_label/security/ir.model.access.csv index 08ec46c19..d63204cff 100644 --- a/report_label/security/ir.model.access.csv +++ b/report_label/security/ir.model.access.csv @@ -1,3 +1,5 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_report_paperformat_label_all,report.paperformat.label all,model_report_paperformat_label,,1,,, +access_report_paperformat_label_all,report.paperformat.label all,model_report_paperformat_label,base.group_user,1,0,0,0 access_report_label_layout_admin,report.paperformat.label admin,model_report_paperformat_label,base.group_system,1,1,1,1 +access_report_label_wizard,report.label.wizard,model_report_label_wizard,base.group_user,1,1,1,1 +access_report_label_wizard_line,report.label.wizard.line,model_report_label_wizard_line,base.group_user,1,1,1,1 diff --git a/report_label/static/description/index.html b/report_label/static/description/index.html index 4b62c2c46..a229f5848 100644 --- a/report_label/static/description/index.html +++ b/report_label/static/description/index.html @@ -3,7 +3,7 @@ - + Report Labels