[9.0] [MIG] report_custom_filename (#82)
parent
e6be6c7f48
commit
eba7ad247e
|
@ -18,7 +18,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
|||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/143/8.0
|
||||
:target: https://runbot.odoo-community.org/runbot/143/9.0
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
|
|
@ -1,34 +1,18 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
# Copyright 2014 Therp BV (<http://therp.nl>).
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Custom report filenames",
|
||||
"summary": "Configure the filename to use when downloading a report",
|
||||
"version": "8.0.1.0.0",
|
||||
"version": "9.0.1.0.0",
|
||||
"author": "Therp BV,Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"complexity": "normal",
|
||||
"category": "Reporting",
|
||||
"depends": [
|
||||
'web',
|
||||
'email_template',
|
||||
'mail',
|
||||
],
|
||||
"data": [
|
||||
"view/ir_actions_report_xml.xml",
|
||||
|
@ -36,7 +20,7 @@
|
|||
"test": [
|
||||
],
|
||||
"auto_install": False,
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
"application": False,
|
||||
"external_dependencies": {
|
||||
'python': ['jinja2'],
|
||||
|
|
|
@ -1,25 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# This module copyright (C) 2015 Therp BV (<http://therp.nl>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
# Copyright 2014 Therp BV (<http://therp.nl>).
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import http
|
||||
from openerp.addons.email_template import email_template
|
||||
from openerp.addons.mail.models import mail_template
|
||||
from openerp.addons.report.controllers.main import ReportController
|
||||
from openerp.addons.web.controllers.main import content_disposition
|
||||
|
||||
|
@ -42,7 +26,7 @@ class ReportController(ReportController):
|
|||
continue
|
||||
objects = http.request.session.model(report.model)\
|
||||
.browse(docids or [])
|
||||
generated_filename = email_template.mako_template_env\
|
||||
generated_filename = mail_template.mako_template_env\
|
||||
.from_string(report.download_filename)\
|
||||
.render({
|
||||
'objects': objects,
|
||||
|
|
|
@ -1,27 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
# Copyright 2014 Therp BV (<http://therp.nl>).
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
import simplejson
|
||||
from openerp import http
|
||||
from openerp.addons.web.controllers import main
|
||||
from openerp.addons.email_template import email_template
|
||||
from openerp.addons.mail.models import mail_template
|
||||
|
||||
|
||||
class Reports(main.Reports):
|
||||
|
@ -41,7 +25,7 @@ class Reports(main.Reports):
|
|||
continue
|
||||
objects = http.request.session.model(context['active_model'])\
|
||||
.browse(context['active_ids'])
|
||||
generated_filename = email_template.mako_template_env\
|
||||
generated_filename = mail_template.mako_template_env\
|
||||
.from_string(report.download_filename)\
|
||||
.render({
|
||||
'objects': objects,
|
||||
|
|
Loading…
Reference in New Issue