From 8e13d2b1540d539dce3a2f3aa8a2aa3b5646e848 Mon Sep 17 00:00:00 2001 From: Lukas Tran Date: Thu, 24 Oct 2024 17:31:03 +0700 Subject: [PATCH] [MIG] migrate report_wkhtmltopdf_param to 18.0 --- report_wkhtmltopdf_param/README.rst | 23 ++++++++++--------- report_wkhtmltopdf_param/__manifest__.py | 2 +- .../models/report_paperformat.py | 8 +++---- .../readme/CONTRIBUTORS.md | 1 + .../security/ir.model.access.csv | 2 +- .../static/description/index.html | 18 +++++++++------ .../tests/test_report_paperformat.py | 7 +++++- .../views/paperformat.xml | 4 ++-- 8 files changed, 38 insertions(+), 27 deletions(-) diff --git a/report_wkhtmltopdf_param/README.rst b/report_wkhtmltopdf_param/README.rst index 8dc8010ff..10a19053f 100644 --- a/report_wkhtmltopdf_param/README.rst +++ b/report_wkhtmltopdf_param/README.rst @@ -17,13 +17,13 @@ Report Wkhtmltopdf Param :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/17.0/report_wkhtmltopdf_param + :target: https://github.com/OCA/reporting-engine/tree/18.0/report_wkhtmltopdf_param :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-17-0/reporting-engine-17-0-report_wkhtmltopdf_param + :target: https://translation.odoo-community.org/projects/reporting-engine-18-0/reporting-engine-18-0-report_wkhtmltopdf_param :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=17.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -59,7 +59,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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -75,13 +75,14 @@ Authors Contributors ------------ -- Miku Laitinen -- Jordi Ballester -- Saran Lim. -- Foram Shah -- `Trobz `__: +- Miku Laitinen +- Jordi Ballester +- Saran Lim. +- Foram Shah +- `Trobz `__: - - Tris Doan + - Tris Doan + - Nhan Tran Other credits ------------- @@ -102,6 +103,6 @@ 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/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_wkhtmltopdf_param/__manifest__.py b/report_wkhtmltopdf_param/__manifest__.py index b0dada3f2..093e61dfe 100644 --- a/report_wkhtmltopdf_param/__manifest__.py +++ b/report_wkhtmltopdf_param/__manifest__.py @@ -4,7 +4,7 @@ # noinspection PyStatementEffect { "name": "Report Wkhtmltopdf Param", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "license": "AGPL-3", "summary": """ Add new parameters for a paper format to be used by wkhtmltopdf diff --git a/report_wkhtmltopdf_param/models/report_paperformat.py b/report_wkhtmltopdf_param/models/report_paperformat.py index 774e9ddb1..0d74ce72f 100644 --- a/report_wkhtmltopdf_param/models/report_paperformat.py +++ b/report_wkhtmltopdf_param/models/report_paperformat.py @@ -4,7 +4,7 @@ import logging -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import ValidationError _logger = logging.getLogger(__name__) @@ -21,7 +21,7 @@ class Paper(models.Model): ) @api.constrains("custom_params") - def _check_recursion(self): + def _check_recursion_custom_params(self): for paperformat in self: sample_html = """ @@ -36,8 +36,8 @@ class Paper(models.Model): report = self.env["ir.actions.report"].new( {"paperformat_id": paperformat.id} ) - content = report._run_wkhtmltopdf(sample_html) + content = report._run_wkhtmltopdf([sample_html]) if not content: raise ValidationError( - _("Failed to create a PDF using the provided parameters.") + self.env._("Failed to create a PDF using the provided parameters.") ) diff --git a/report_wkhtmltopdf_param/readme/CONTRIBUTORS.md b/report_wkhtmltopdf_param/readme/CONTRIBUTORS.md index 39e05f143..b299d03fd 100644 --- a/report_wkhtmltopdf_param/readme/CONTRIBUTORS.md +++ b/report_wkhtmltopdf_param/readme/CONTRIBUTORS.md @@ -4,3 +4,4 @@ - Foram Shah \<\> - [Trobz](https://www.trobz.com): - Tris Doan \<\> + - Nhan Tran \<\> diff --git a/report_wkhtmltopdf_param/security/ir.model.access.csv b/report_wkhtmltopdf_param/security/ir.model.access.csv index 63fd8f7cb..e93cc48e6 100644 --- a/report_wkhtmltopdf_param/security/ir.model.access.csv +++ b/report_wkhtmltopdf_param/security/ir.model.access.csv @@ -1,4 +1,4 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" "paperformat_parameter_access_portal","ir_actions_report_paperformat_parameter group_portal","model_report_paperformat_parameter","base.group_portal",1,0,0,0 -"paperformat_parameter_access_employee","ir_actions_report_paperformat_parameter group_hr_user","model_report_paperformat_parameter",,1,0,1,0 +"paperformat_parameter_access_employee","ir_actions_report_paperformat_parameter group_hr_user","model_report_paperformat_parameter",base.group_user,1,0,1,0 "paperformat_parameter_access_administration","ir_actions_report_paperformat_parameter group_system","model_report_paperformat_parameter","base.group_system",1,1,1,1 diff --git a/report_wkhtmltopdf_param/static/description/index.html b/report_wkhtmltopdf_param/static/description/index.html index 5ffe9e5b3..b06073a6b 100644 --- a/report_wkhtmltopdf_param/static/description/index.html +++ b/report_wkhtmltopdf_param/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code { margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.option { span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -368,7 +369,7 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:59a736539b5a1aed58f6c0a874c94500c4974f286fbb5cb3d45eddcc2e2865f5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runboat

This module allows you to add new parameters for a paper format which are then forwarded to wkhtmltopdf command as arguments. To display the arguments that wkhtmltopdf accepts go to your command line and type @@ -407,7 +408,7 @@ assets)’

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 to smash it by providing a detailed and welcomed -feedback.

+feedback.

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

@@ -428,6 +429,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
  • Foram Shah <foramshah@initos.com>
  • Trobz:
  • @@ -440,11 +442,13 @@ by Camptocamp

    Maintainers

    This module is maintained by the OCA.

    -Odoo Community Association + +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/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_wkhtmltopdf_param/tests/test_report_paperformat.py b/report_wkhtmltopdf_param/tests/test_report_paperformat.py index 1c749b132..1a10f3be2 100644 --- a/report_wkhtmltopdf_param/tests/test_report_paperformat.py +++ b/report_wkhtmltopdf_param/tests/test_report_paperformat.py @@ -2,6 +2,8 @@ # Copyright 2017 Eficent Business and IT Consulting Services, S.L. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import logging + import odoo.tests from odoo.exceptions import ValidationError from odoo.tests.common import tagged @@ -11,7 +13,10 @@ from odoo.tests.common import tagged class TestWkhtmltopdf(odoo.tests.TransactionCase): def test_wkhtmltopdf_incorrect_parameter(self): for report_paperformat in self.env["report.paperformat"].search([]): - with self.assertRaises(ValidationError): + with ( + self.assertRaises(ValidationError), + self.assertLogs(level=logging.WARNING), + ): report_paperformat.update( {"custom_params": [(0, 0, {"name": "bad-parameter"})]} ) diff --git a/report_wkhtmltopdf_param/views/paperformat.xml b/report_wkhtmltopdf_param/views/paperformat.xml index 9a185055f..aba19705a 100644 --- a/report_wkhtmltopdf_param/views/paperformat.xml +++ b/report_wkhtmltopdf_param/views/paperformat.xml @@ -8,10 +8,10 @@ - + - +