Skip to content

Commit 9a6e276

Browse files
committed
[ADD] New glue module between report_py3o and report_custom_filename
1 parent e662a1a commit 9a6e276

9 files changed

Lines changed: 115 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
2+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
3+
:alt: License: AGPL-3
4+
5+
===========================
6+
Report Py3o Custom Filename
7+
===========================
8+
9+
Glue module Between Report Py3o and Report Custom Filename
10+
11+
Usage
12+
=====
13+
14+
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
15+
:alt: Try me on Runbot
16+
:target: https://runbot.odoo-community.org/runbot/143/9.0
17+
18+
Known issues / Roadmap
19+
======================
20+
21+
* ...
22+
23+
Bug Tracker
24+
===========
25+
26+
Bugs are tracked on `GitHub Issues
27+
<https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please
28+
check there if your issue has already been reported. If you spotted it first,
29+
help us smashing it by providing a detailed and welcomed feedback.
30+
31+
Credits
32+
=======
33+
34+
Images
35+
------
36+
37+
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
38+
39+
Contributors
40+
------------
41+
42+
* Laurent Mignon <laurent.mignon@acsone.eu>
43+
44+
Maintainer
45+
----------
46+
47+
.. image:: https://odoo-community.org/logo.png
48+
:alt: Odoo Community Association
49+
:target: https://odoo-community.org
50+
51+
This module is maintained by the OCA.
52+
53+
OCA, or the Odoo Community Association, is a nonprofit organization whose
54+
mission is to support the collaborative development of Odoo features and
55+
promote its widespread use.
56+
57+
To contribute to this module, please visit https://odoo-community.org.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2017 ACSONE SA/NV
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
{
6+
'name': 'Report Py3o Custom Filename',
7+
'summary': """
8+
Glue module Between report Py3o and Report Custom Filename""",
9+
'version': '9.0.1.0.0',
10+
'license': 'AGPL-3',
11+
'author': 'ACSONE SA/NV,Odoo Community Association (OCA)',
12+
'website': 'https://acsone.eu/',
13+
'depends': [
14+
'report_py3o',
15+
'report_custom_filename'
16+
],
17+
18+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import ir_actions_report_xml
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2017 ACSONE SA/NV
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
4+
5+
from openerp import api, models
6+
from openerp.addons.mail.models import mail_template
7+
8+
9+
class IrActionsReportXml(models.Model):
10+
11+
_inherit = 'ir.actions.report.xml'
12+
13+
@api.multi
14+
def gen_report_download_filename(self, res_ids, data):
15+
"""Override this function to change the name of the downloaded report
16+
"""
17+
self.ensure_one()
18+
if not self.download_filename:
19+
return super(IrActionsReportXml, self). \
20+
gen_report_download_filename(res_ids, data)
21+
objects = self.env[self.model].browse(res_ids)
22+
return mail_template.mako_template_env \
23+
.from_string(self.download_filename) \
24+
.render({
25+
'objects': objects,
26+
'o': objects[0],
27+
'object': objects[0],
28+
'ext': self.py3o_filetype
29+
})
30+
return "%s.%s" % (self.name, self.py3o_filetype)
9.23 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__import__('pkg_resources').declare_namespace(__name__)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../report_py3o_custom_filename
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)

0 commit comments

Comments
 (0)