[IMP] report_async: pre-commit auto fixes

This commit is contained in:
Sakthivel
2024-05-10 13:32:07 +05:30
committed by Atchuthan, Sodexis
parent ae6b4cc924
commit 21310d51a7
12 changed files with 133 additions and 104 deletions

View File

@@ -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 <https://github.com/OCA/reporting-engine/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 <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_async%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_async%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@@ -87,26 +96,26 @@ Credits
=======
Authors
~~~~~~~
-------
* Ecosoft
Contributors
~~~~~~~~~~~~
------------
* `Ecosoft <http://ecosoft.co.th>`__:
- `Ecosoft <http://ecosoft.co.th>`__:
* Kitti U. <kittiu@ecosoft.co.th>
* Saran Lim. <saranl@ecosoft.co.th>
* Tharathip Chaweewongphan <tharathipc@ecosoft.co.th>
- Kitti U. <kittiu@ecosoft.co.th>
- Saran Lim. <saranl@ecosoft.co.th>
- Tharathip Chaweewongphan <tharathipc@ecosoft.co.th>
* Opensourceintegrators
- Opensourceintegrators
* Daniel Reis <dreis@opensourceintegrators.com>
* Nikul Chaudhary <nchaudhary@opensourceintegrators.com>
- Daniel Reis <dreis@opensourceintegrators.com>
- Nikul Chaudhary <nchaudhary@opensourceintegrators.com>
Maintainers
~~~~~~~~~~~
-----------
This module is maintained by the OCA.
@@ -126,6 +135,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-kittiu|
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/16.0/report_async>`_ project on GitHub.
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/17.0/report_async>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -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",

View File

@@ -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)

View File

@@ -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"]

View File

@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

View File

@@ -0,0 +1,7 @@
- [Ecosoft](http://ecosoft.co.th):
- Kitti U. \<<kittiu@ecosoft.co.th>\>
- Saran Lim. \<<saranl@ecosoft.co.th>\>
- Tharathip Chaweewongphan \<<tharathipc@ecosoft.co.th>\>
- Opensourceintegrators
- Daniel Reis \<<dreis@opensourceintegrators.com>\>
- Nikul Chaudhary \<<nchaudhary@opensourceintegrators.com>\>

View File

@@ -1,10 +0,0 @@
* `Ecosoft <http://ecosoft.co.th>`__:
* Kitti U. <kittiu@ecosoft.co.th>
* Saran Lim. <saranl@ecosoft.co.th>
* Tharathip Chaweewongphan <tharathipc@ecosoft.co.th>
* Opensourceintegrators
* Daniel Reis <dreis@opensourceintegrators.com>
* Nikul Chaudhary <nchaudhary@opensourceintegrators.com>

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@@ -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
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/reporting-engine/tree/16.0/report_async"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/reporting-engine-16-0/reporting-engine-16-0-report_async"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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,</p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/reporting-engine/tree/17.0/report_async"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/reporting-engine-17-0/reporting-engine-17-0-report_async"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>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,</p>
<ol class="arabic simple">
<li>Run Now - run report immediately as per normal.</li>
<li>Run Background - put the report execution to queue job.</li>
</ol>
<p>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
<p>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.</p>
<p>Notes:</p>
<ul class="simple">
<li>Only user with Technical Feature rights can manage the report.</li>
<li>Every internal user will have right to execute the report allowed for his/her groups.</li>
<li>The files created are owned and viewable only by the person who run the report.</li>
<li>Every internal user will have right to execute the report allowed for
his/her groups.</li>
<li>The files created are owned and viewable only by the person who run
the report.</li>
<li>Job queue manager can also see all jobs for each reports.</li>
</ul>
<p><strong>Table of contents</strong></p>
@@ -404,21 +406,28 @@ by email as soon as it is ready.</p>
<p>Menu: Dashboard &gt; Report Center</p>
<p>As Technical Feature users, you can manage reports for Report Center.</p>
<ul class="simple">
<li><strong>Report:</strong> choose the report (a window action). Although the option show all window actions
it only make sense for window actions that launch reports.</li>
<li><strong>Allow Async:</strong> 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.</li>
<li><strong>Email Notification:</strong> if checked, once the background process is completed, email with link to download
report will be sent.</li>
<li><strong>Groups:</strong> select user groups allowed to use this report. If left blank, all user can use.</li>
<li><strong>Report:</strong> choose the report (a window action). Although the option
show all window actions it only make sense for window actions that
launch reports.</li>
<li><strong>Allow Async:</strong> 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.</li>
<li><strong>Email Notification:</strong> if checked, once the background process is
completed, email with link to download report will be sent.</li>
<li><strong>Groups:</strong> select user groups allowed to use this report. If left
blank, all user can use.</li>
</ul>
<p>As normal user, you can run your reports from Report Center</p>
<ul class="simple">
<li><strong>Run Now button:</strong> to run report immediately as per normal.</li>
<li><strong>Run Background button:</strong> to run report asynchronously. Fall back to run now, if not report that produce file.</li>
<li><strong>Job Status:</strong> show status of the latest run job. If job fail, exception error will also shown</li>
<li><strong>Files:</strong> show all files being produced by the job as run by the user.</li>
<li><strong>Jobs:</strong> show all jobs triggered by this report as run by the user. Only job queue manager have access to this button.</li>
<li><strong>Run Background button:</strong> to run report asynchronously. Fall back to
run now, if not report that produce file.</li>
<li><strong>Job Status:</strong> show status of the latest run job. If job fail,
exception error will also shown</li>
<li><strong>Files:</strong> show all files being produced by the job as run by the
user.</li>
<li><strong>Jobs:</strong> show all jobs triggered by this report as run by the user.
Only job queue manager have access to this button.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
@@ -426,7 +435,7 @@ report will be sent.</li>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_async%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_async%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
@@ -456,13 +465,15 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/kittiu"><img alt="kittiu" src="https://github.com/kittiu.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/16.0/report_async">OCA/reporting-engine</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/17.0/report_async">OCA/reporting-engine</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

View File

@@ -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