From 21310d51a724388e25a84e6fb91cdd5d8c9314ce Mon Sep 17 00:00:00 2001 From: Sakthivel Date: Fri, 10 May 2024 13:32:07 +0530 Subject: [PATCH] [IMP] report_async: pre-commit auto fixes --- report_async/README.rst | 79 ++++++++++++--------- report_async/__manifest__.py | 2 +- report_async/models/ir_report.py | 2 +- report_async/models/report_async.py | 4 +- report_async/pyproject.toml | 3 + report_async/readme/CONTRIBUTORS.md | 7 ++ report_async/readme/CONTRIBUTORS.rst | 10 --- report_async/readme/DESCRIPTION.md | 18 +++++ report_async/readme/DESCRIPTION.rst | 16 ----- report_async/readme/{USAGE.rst => USAGE.md} | 31 ++++---- report_async/static/description/index.html | 61 +++++++++------- report_async/tests/test_report_async.py | 4 +- 12 files changed, 133 insertions(+), 104 deletions(-) create mode 100644 report_async/pyproject.toml create mode 100644 report_async/readme/CONTRIBUTORS.md delete mode 100644 report_async/readme/CONTRIBUTORS.rst create mode 100644 report_async/readme/DESCRIPTION.md delete mode 100644 report_async/readme/DESCRIPTION.rst rename report_async/readme/{USAGE.rst => USAGE.md} (54%) diff --git a/report_async/README.rst b/report_async/README.rst index f97fb290f..6351b418f 100644 --- a/report_async/README.rst +++ b/report_async/README.rst @@ -17,33 +17,35 @@ Report Async :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/16.0/report_async + :target: https://github.com/OCA/reporting-engine/tree/17.0/report_async :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-16-0/reporting-engine-16-0-report_async + :target: https://translation.odoo-community.org/projects/reporting-engine-17-0/reporting-engine-17-0-report_async :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=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -The new menu "Report Center" is the central place to host your reports in one place. -From here, there are 2 ways to launch the report, +The new menu "Report Center" is the central place to host your reports +in one place. From here, there are 2 ways to launch the report, 1. Run Now - run report immediately as per normal. 2. Run Background - put the report execution to queue job. -By using the queue job, option 2 is great for long running report. -The report file will be saved for later use, with the option to send report +By using the queue job, option 2 is great for long running report. The +report file will be saved for later use, with the option to send report by email as soon as it is ready. Notes: -* Only user with Technical Feature rights can manage the report. -* Every internal user will have right to execute the report allowed for his/her groups. -* The files created are owned and viewable only by the person who run the report. -* Job queue manager can also see all jobs for each reports. +- Only user with Technical Feature rights can manage the report. +- Every internal user will have right to execute the report allowed for + his/her groups. +- The files created are owned and viewable only by the person who run + the report. +- Job queue manager can also see all jobs for each reports. **Table of contents** @@ -57,21 +59,28 @@ Menu: Dashboard > Report Center As Technical Feature users, you can manage reports for Report Center. -- **Report:** choose the report (a window action). Although the option show all window actions - it only make sense for window actions that launch reports. -- **Allow Async:** check this, if you want the report to run in background too, suitable for - report that return file as result, i.e., pdf/xlsx/csv/txt. -- **Email Notification:** if checked, once the background process is completed, email with link to download - report will be sent. -- **Groups:** select user groups allowed to use this report. If left blank, all user can use. +- **Report:** choose the report (a window action). Although the option + show all window actions it only make sense for window actions that + launch reports. +- **Allow Async:** check this, if you want the report to run in + background too, suitable for report that return file as result, i.e., + pdf/xlsx/csv/txt. +- **Email Notification:** if checked, once the background process is + completed, email with link to download report will be sent. +- **Groups:** select user groups allowed to use this report. If left + blank, all user can use. As normal user, you can run your reports from Report Center -- **Run Now button:** to run report immediately as per normal. -- **Run Background button:** to run report asynchronously. Fall back to run now, if not report that produce file. -- **Job Status:** show status of the latest run job. If job fail, exception error will also shown -- **Files:** show all files being produced by the job as run by the user. -- **Jobs:** show all jobs triggered by this report as run by the user. Only job queue manager have access to this button. +- **Run Now button:** to run report immediately as per normal. +- **Run Background button:** to run report asynchronously. Fall back to + run now, if not report that produce file. +- **Job Status:** show status of the latest run job. If job fail, + exception error will also shown +- **Files:** show all files being produced by the job as run by the + user. +- **Jobs:** show all jobs triggered by this report as run by the user. + Only job queue manager have access to this button. Bug Tracker =========== @@ -79,7 +88,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. @@ -87,26 +96,26 @@ Credits ======= Authors -~~~~~~~ +------- * Ecosoft Contributors -~~~~~~~~~~~~ +------------ -* `Ecosoft `__: +- `Ecosoft `__: - * Kitti U. - * Saran Lim. - * Tharathip Chaweewongphan + - Kitti U. + - Saran Lim. + - Tharathip Chaweewongphan -* Opensourceintegrators +- Opensourceintegrators - * Daniel Reis - * Nikul Chaudhary + - Daniel Reis + - Nikul Chaudhary Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -126,6 +135,6 @@ Current `maintainer `__: |maintainer-kittiu| -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_async/__manifest__.py b/report_async/__manifest__.py index 6b29ccc87..0f770f701 100644 --- a/report_async/__manifest__.py +++ b/report_async/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Report Async", "summary": "Central place to run reports live or async", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "author": "Ecosoft, Odoo Community Association (OCA)", "license": "AGPL-3", "website": "https://github.com/OCA/reporting-engine", diff --git a/report_async/models/ir_report.py b/report_async/models/ir_report.py index 03a122cda..e9ca99921 100644 --- a/report_async/models/ir_report.py +++ b/report_async/models/ir_report.py @@ -11,7 +11,7 @@ class Report(models.Model): _inherit = "ir.actions.report" def report_action(self, docids, data=None, config=True): - res = super(Report, self).report_action(docids, data=data, config=config) + res = super().report_action(docids, data=data, config=config) if res["context"].get("async_process", False): rpt_async_id = res["context"]["active_id"] report_async = self.env["report.async"].browse(rpt_async_id) diff --git a/report_async/models/report_async.py b/report_async/models/report_async.py index 632d67c3c..365f61439 100644 --- a/report_async/models/report_async.py +++ b/report_async/models/report_async.py @@ -98,7 +98,7 @@ class ReportAsync(models.Model): order="id desc", ) for rec in self: - rec.file_ids = files.filtered(lambda l: l.res_id == rec.id) + rec.file_ids = files.filtered(lambda file, rec=rec: file.res_id == rec.id) def run_now(self): self.ensure_one() @@ -142,7 +142,7 @@ class ReportAsync(models.Model): # Run report out_file, file_ext = getattr(report, func)(report.xml_id, docids, data) out_file = base64.b64encode(out_file) - out_name = "{}.{}".format(report.name, file_ext) + out_name = f"{report.name}.{file_ext}" # Save report to attachment attachment = ( self.env["ir.attachment"] diff --git a/report_async/pyproject.toml b/report_async/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/report_async/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/report_async/readme/CONTRIBUTORS.md b/report_async/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..3487150f3 --- /dev/null +++ b/report_async/readme/CONTRIBUTORS.md @@ -0,0 +1,7 @@ +- [Ecosoft](http://ecosoft.co.th): + - Kitti U. \<\> + - Saran Lim. \<\> + - Tharathip Chaweewongphan \<\> +- Opensourceintegrators + - Daniel Reis \<\> + - Nikul Chaudhary \<\> diff --git a/report_async/readme/CONTRIBUTORS.rst b/report_async/readme/CONTRIBUTORS.rst deleted file mode 100644 index d01ca6fe9..000000000 --- a/report_async/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,10 +0,0 @@ -* `Ecosoft `__: - - * Kitti U. - * Saran Lim. - * Tharathip Chaweewongphan - -* Opensourceintegrators - - * Daniel Reis - * Nikul Chaudhary diff --git a/report_async/readme/DESCRIPTION.md b/report_async/readme/DESCRIPTION.md new file mode 100644 index 000000000..a11e376ac --- /dev/null +++ b/report_async/readme/DESCRIPTION.md @@ -0,0 +1,18 @@ +The new menu "Report Center" is the central place to host your reports +in one place. From here, there are 2 ways to launch the report, + +1. Run Now - run report immediately as per normal. +2. Run Background - put the report execution to queue job. + +By using the queue job, option 2 is great for long running report. The +report file will be saved for later use, with the option to send report +by email as soon as it is ready. + +Notes: + +- Only user with Technical Feature rights can manage the report. +- Every internal user will have right to execute the report allowed for + his/her groups. +- The files created are owned and viewable only by the person who run + the report. +- Job queue manager can also see all jobs for each reports. diff --git a/report_async/readme/DESCRIPTION.rst b/report_async/readme/DESCRIPTION.rst deleted file mode 100644 index b0c0f140a..000000000 --- a/report_async/readme/DESCRIPTION.rst +++ /dev/null @@ -1,16 +0,0 @@ -The new menu "Report Center" is the central place to host your reports in one place. -From here, there are 2 ways to launch the report, - -1. Run Now - run report immediately as per normal. -2. Run Background - put the report execution to queue job. - -By using the queue job, option 2 is great for long running report. -The report file will be saved for later use, with the option to send report -by email as soon as it is ready. - -Notes: - -* Only user with Technical Feature rights can manage the report. -* Every internal user will have right to execute the report allowed for his/her groups. -* The files created are owned and viewable only by the person who run the report. -* Job queue manager can also see all jobs for each reports. diff --git a/report_async/readme/USAGE.rst b/report_async/readme/USAGE.md similarity index 54% rename from report_async/readme/USAGE.rst rename to report_async/readme/USAGE.md index 9668d579d..2f3be55b5 100644 --- a/report_async/readme/USAGE.rst +++ b/report_async/readme/USAGE.md @@ -1,19 +1,26 @@ -Menu: Dashboard > Report Center +Menu: Dashboard \> Report Center As Technical Feature users, you can manage reports for Report Center. -- **Report:** choose the report (a window action). Although the option show all window actions - it only make sense for window actions that launch reports. -- **Allow Async:** check this, if you want the report to run in background too, suitable for - report that return file as result, i.e., pdf/xlsx/csv/txt. -- **Email Notification:** if checked, once the background process is completed, email with link to download - report will be sent. -- **Groups:** select user groups allowed to use this report. If left blank, all user can use. +- **Report:** choose the report (a window action). Although the option + show all window actions it only make sense for window actions that + launch reports. +- **Allow Async:** check this, if you want the report to run in + background too, suitable for report that return file as result, i.e., + pdf/xlsx/csv/txt. +- **Email Notification:** if checked, once the background process is + completed, email with link to download report will be sent. +- **Groups:** select user groups allowed to use this report. If left + blank, all user can use. As normal user, you can run your reports from Report Center - **Run Now button:** to run report immediately as per normal. -- **Run Background button:** to run report asynchronously. Fall back to run now, if not report that produce file. -- **Job Status:** show status of the latest run job. If job fail, exception error will also shown -- **Files:** show all files being produced by the job as run by the user. -- **Jobs:** show all jobs triggered by this report as run by the user. Only job queue manager have access to this button. +- **Run Background button:** to run report asynchronously. Fall back to + run now, if not report that produce file. +- **Job Status:** show status of the latest run job. If job fail, + exception error will also shown +- **Files:** show all files being produced by the job as run by the + user. +- **Jobs:** show all jobs triggered by this report as run by the user. + Only job queue manager have access to this button. diff --git a/report_async/static/description/index.html b/report_async/static/description/index.html index 631ff9aa1..606d453d3 100644 --- a/report_async/static/description/index.html +++ b/report_async/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,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. @@ -275,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 } @@ -301,7 +301,7 @@ span.option { span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -369,21 +369,23 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:49866d2b712288add9819deb8ff6dc8aa180a52463a72789350974bbf10e17ae !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

-

The new menu “Report Center” is the central place to host your reports in one place. -From here, there are 2 ways to launch the report,

+

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

+

The new menu “Report Center” is the central place to host your reports +in one place. From here, there are 2 ways to launch the report,

  1. Run Now - run report immediately as per normal.
  2. Run Background - put the report execution to queue job.
-

By using the queue job, option 2 is great for long running report. -The report file will be saved for later use, with the option to send report +

By using the queue job, option 2 is great for long running report. The +report file will be saved for later use, with the option to send report by email as soon as it is ready.

Notes:

  • Only user with Technical Feature rights can manage the report.
  • -
  • Every internal user will have right to execute the report allowed for his/her groups.
  • -
  • The files created are owned and viewable only by the person who run the report.
  • +
  • Every internal user will have right to execute the report allowed for +his/her groups.
  • +
  • The files created are owned and viewable only by the person who run +the report.
  • Job queue manager can also see all jobs for each reports.

Table of contents

@@ -404,21 +406,28 @@ by email as soon as it is ready.

Menu: Dashboard > Report Center

As Technical Feature users, you can manage reports for Report Center.

    -
  • Report: choose the report (a window action). Although the option show all window actions -it only make sense for window actions that launch reports.
  • -
  • Allow Async: check this, if you want the report to run in background too, suitable for -report that return file as result, i.e., pdf/xlsx/csv/txt.
  • -
  • Email Notification: if checked, once the background process is completed, email with link to download -report will be sent.
  • -
  • Groups: select user groups allowed to use this report. If left blank, all user can use.
  • +
  • Report: choose the report (a window action). Although the option +show all window actions it only make sense for window actions that +launch reports.
  • +
  • Allow Async: check this, if you want the report to run in +background too, suitable for report that return file as result, i.e., +pdf/xlsx/csv/txt.
  • +
  • Email Notification: if checked, once the background process is +completed, email with link to download report will be sent.
  • +
  • Groups: select user groups allowed to use this report. If left +blank, all user can use.

As normal user, you can run your reports from Report Center

  • Run Now button: to run report immediately as per normal.
  • -
  • Run Background button: to run report asynchronously. Fall back to run now, if not report that produce file.
  • -
  • Job Status: show status of the latest run job. If job fail, exception error will also shown
  • -
  • Files: show all files being produced by the job as run by the user.
  • -
  • Jobs: show all jobs triggered by this report as run by the user. Only job queue manager have access to this button.
  • +
  • Run Background button: to run report asynchronously. Fall back to +run now, if not report that produce file.
  • +
  • Job Status: show status of the latest run job. If job fail, +exception error will also shown
  • +
  • Files: show all files being produced by the job as run by the +user.
  • +
  • Jobs: show all jobs triggered by this report as run by the user. +Only job queue manager have access to this button.
@@ -426,7 +435,7 @@ report will be sent.

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.

@@ -456,13 +465,15 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

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.

Current maintainer:

kittiu

-

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_async/tests/test_report_async.py b/report_async/tests/test_report_async.py index e745fae97..e2b0282f2 100644 --- a/report_async/tests/test_report_async.py +++ b/report_async/tests/test_report_async.py @@ -7,7 +7,7 @@ from odoo.tests.common import Form class TestJobChannel(common.TransactionCase): def setUp(self): - super(TestJobChannel, self).setUp() + super().setUp() self.print_doc = self.env.ref("report_async.report_async_print_document") self.test_rec = self.env.ref("base.module_mail") self.test_rpt = self.env.ref("base.ir_module_reference_print") @@ -21,7 +21,7 @@ class TestJobChannel(common.TransactionCase): async_process=res["context"].get("async_process"), ) ) as form: - form.reference = "{},{}".format(self.test_rec._name, self.test_rec.id) + form.reference = f"{self.test_rec._name},{self.test_rec.id}" form.action_report_id = self.test_rpt print_wizard = form.save() return print_wizard