report_async: Pre-Commit

This commit is contained in:
Hardik-OSI
2022-06-03 10:48:53 +05:30
committed by Nikul-OSI
parent a618b05461
commit feb9f2b953
7 changed files with 86 additions and 86 deletions

View File

@@ -14,13 +14,13 @@ Report Async
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
:target: https://github.com/OCA/reporting-engine/tree/14.0/report_async :target: https://github.com/OCA/reporting-engine/tree/15.0/report_async
:alt: OCA/reporting-engine :alt: OCA/reporting-engine
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-0-report_async :target: https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-0-report_async
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/143/14.0 :target: https://runbot.odoo-community.org/runbot/143/15.0
:alt: Try me on Runbot :alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
@@ -76,7 +76,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_. 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. 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 If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_async%0Aversion:%2014.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:%2015.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. Do not contact contributors directly about support or help with technical issues.
@@ -118,6 +118,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-kittiu| |maintainer-kittiu|
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/14.0/report_async>`_ project on GitHub. This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/15.0/report_async>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. 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", "name": "Report Async",
"summary": "Central place to run reports live or async", "summary": "Central place to run reports live or async",
"version": "14.0.1.0.0", "version": "15.0.1.0.0",
"author": "Ecosoft, Odoo Community Association (OCA)", "author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3", "license": "AGPL-3",
"website": "https://github.com/OCA/reporting-engine", "website": "https://github.com/OCA/reporting-engine",

View File

@@ -1,72 +1,69 @@
<?xml version="1.0" encoding="utf-8" ?> <odoo noupdate="1">
<odoo> <record id="async_report_delivery" model="mail.template">
<data noupdate="1"> <field name="name">Report Async: New Report Available</field>
<record id="async_report_delivery" model="mail.template"> <field name="model_id" ref="base.model_ir_attachment" />
<field name="name">Report Async: New Report Available</field> <field name="subject">Your report is available, ${object.name}</field>
<field name="model_id" ref="base.model_ir_attachment" /> <field
<field name="subject">Your report is available, ${object.name}</field> name="email_from"
<field >${object.company_id.partner_id.email_formatted|safe}</field>
name="email_from" <field name="partner_to">${user.partner_id.id}</field>
>${object.company_id.partner_id.email_formatted|safe}</field> <field name="body_html" type="html">
<field name="partner_to">${user.partner_id.id}</field> <table
<field name="body_html" type="html"> border="0"
<table cellpadding="0"
border="0" cellspacing="0"
cellpadding="0" style="background-color: #F1F1F1; font-family:Verdana, Arial,sans-serif; color: #454748; width: 100%; border-collapse:separate;"
cellspacing="0" >
style="background-color: #F1F1F1; font-family:Verdana, Arial,sans-serif; color: #454748; width: 100%; border-collapse:separate;" <tr>
> <td align="center">
<tr> <table
<td align="center"> border="0"
<table cellpadding="0"
border="0" cellspacing="0"
cellpadding="0" width="590"
cellspacing="0" style="padding: 16px; background-color: white; color: #454748; border-collapse:separate;"
width="590" >
style="padding: 16px; background-color: white; color: #454748; border-collapse:separate;" <tbody>
> <tr>
<tbody> <td align="center" style="min-width: 590px;">
<tr> <table
<td align="center" style="min-width: 590px;"> border="0"
<table cellpadding="0"
border="0" cellspacing="0"
cellpadding="0" width="590"
cellspacing="0" style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;"
width="590" >
style="min-width: 590px; background-color: white; padding: 0px 8px 0px 8px; border-collapse:separate;" <tr>
> <td
<tr> valign="top"
<td style="font-size: 13px;"
valign="top" >
style="font-size: 13px;" % set base_url = object.env['ir.config_parameter'].sudo().get_param('web.base.url')
> % set download_url = '%s/web/content/ir.attachment/%s/datas/%s?download=true' % (base_url, object.id, object.name, )
% set base_url = object.env['ir.config_parameter'].sudo().get_param('web.base.url') <div>
% set download_url = '%s/web/content/ir.attachment/%s/datas/%s?download=true' % (base_url, object.id, object.name, ) Dear ${object.create_uid.partner_id.name or ''},
<div> <br /><br />
Dear ${object.create_uid.partner_id.name or ''}, Your requested report, ${object.name}, is available for <b
<br /><br /> >
Your requested report, ${object.name}, is available for <b <a
> href='${download_url}'
<a >download</a>
href='${download_url}' </b>.
>download</a> <br /><br />
</b>. Have a nice day!<br />
<br /><br /> --<br />${object.company_id.name}
Have a nice day!<br /> </div>
--<br />${object.company_id.name} </td>
</div> </tr>
</table>
</td> </td>
</tr> </tr>
</table> </tbody>
</td> </table>
</tr> </td>
</tbody> </tr>
</table> </table>
</td> </field>
</tr> <field name="auto_delete" eval="True" />
</table> </record>
</field>
<field name="auto_delete" eval="True" />
</record>
</data>
</odoo> </odoo>

View File

@@ -28,7 +28,6 @@ class ReportAsync(models.Model):
required=True, required=True,
) )
allow_async = fields.Boolean( allow_async = fields.Boolean(
string="Allow Async",
default=False, default=False,
help="This is not automatic field, please check if you want to allow " help="This is not automatic field, please check if you want to allow "
"this report in background process", "this report in background process",

View File

@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" /> <meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Report Async</title> <title>Report Async</title>
<style type="text/css"> <style type="text/css">
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !! !! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !! !! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/reporting-engine/tree/14.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" href="https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-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" href="https://runbot.odoo-community.org/runbot/143/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p> <p><a class="reference external" 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" 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" href="https://github.com/OCA/reporting-engine/tree/15.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" href="https://translation.odoo-community.org/projects/reporting-engine-15-0/reporting-engine-15-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" href="https://runbot.odoo-community.org/runbot/143/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>The new menu “Report Center” is the central place to host your reports in one place. <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> From here, there are 2 ways to launch the report,</p>
<ol class="arabic simple"> <ol class="arabic simple">
@@ -424,7 +424,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>. <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. 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 If you spotted it first, help us smashing 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:%2014.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:%2015.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> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@@ -455,7 +455,7 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p> <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/kittiu"><img alt="kittiu" src="https://github.com/kittiu.png?size=40px" /></a></p> <p><a class="reference external" 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/14.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/15.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> <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>
</div> </div>

View File

@@ -19,7 +19,11 @@ class TestJobChannel(common.TransactionCase):
"active_id": self.print_doc.id, "active_id": self.print_doc.id,
} }
ctx.update(res["context"]) ctx.update(res["context"])
with Form(obj.with_context(ctx)) as form: with Form(
obj.with_context(
active_model=self.print_doc._name, active_id=self.print_doc.id
)
) as form:
form.reference = "{},{}".format(self.test_rec._name, self.test_rec.id) form.reference = "{},{}".format(self.test_rec._name, self.test_rec.id)
form.action_report_id = self.test_rpt form.action_report_id = self.test_rpt
print_wizard = form.save() print_wizard = form.save()
@@ -29,7 +33,7 @@ class TestJobChannel(common.TransactionCase):
"""Run now will return report action as normal""" """Run now will return report action as normal"""
res = self.print_doc.run_now() res = self.print_doc.run_now()
report_action = self._print_wizard(res).print_report() report_action = self._print_wizard(res).print_report()
self.assertEquals(report_action["type"], "ir.actions.report") self.assertEqual(report_action["type"], "ir.actions.report")
def test_2_run_async(self): def test_2_run_async(self):
"""Run background will return nothing, job started""" """Run background will return nothing, job started"""
@@ -39,8 +43,8 @@ class TestJobChannel(common.TransactionCase):
res = self.print_doc.run_async() res = self.print_doc.run_async()
print_wizard = self._print_wizard(res) print_wizard = self._print_wizard(res)
report_action = print_wizard.print_report() report_action = print_wizard.print_report()
self.assertEquals(report_action, {}) # Do not run report yet self.assertEqual(report_action, {}) # Do not run report yet
self.assertEquals(self.print_doc.job_status, "pending") # Job started self.assertEqual(self.print_doc.job_status, "pending") # Job started
# Test produce file (as queue will not run in test mode) # Test produce file (as queue will not run in test mode)
docids = [print_wizard.reference.id] docids = [print_wizard.reference.id]
data = None data = None

View File

@@ -4,7 +4,7 @@
<field name="name">report.async.tree</field> <field name="name">report.async.tree</field>
<field name="model">report.async</field> <field name="model">report.async</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Report Center"> <tree>
<field name="action_id" context="{'access_sudo': True}" /> <field name="action_id" context="{'access_sudo': True}" />
<button type="object" name="run_now" string="Run Now" icon="fa-bolt" /> <button type="object" name="run_now" string="Run Now" icon="fa-bolt" />
<button <button