[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
|
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||||
:alt: Try me on Runbot
|
: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
|
Credits
|
||||||
=======
|
=======
|
||||||
|
|
|
@ -1,34 +1,18 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
# Copyright 2014 Therp BV (<http://therp.nl>).
|
||||||
#
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
# 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/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
{
|
{
|
||||||
"name": "Custom report filenames",
|
"name": "Custom report filenames",
|
||||||
"summary": "Configure the filename to use when downloading a report",
|
"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)",
|
"author": "Therp BV,Odoo Community Association (OCA)",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"complexity": "normal",
|
"complexity": "normal",
|
||||||
"category": "Reporting",
|
"category": "Reporting",
|
||||||
"depends": [
|
"depends": [
|
||||||
'web',
|
'web',
|
||||||
'email_template',
|
'mail',
|
||||||
],
|
],
|
||||||
"data": [
|
"data": [
|
||||||
"view/ir_actions_report_xml.xml",
|
"view/ir_actions_report_xml.xml",
|
||||||
|
@ -36,7 +20,7 @@
|
||||||
"test": [
|
"test": [
|
||||||
],
|
],
|
||||||
"auto_install": False,
|
"auto_install": False,
|
||||||
'installable': False,
|
'installable': True,
|
||||||
"application": False,
|
"application": False,
|
||||||
"external_dependencies": {
|
"external_dependencies": {
|
||||||
'python': ['jinja2'],
|
'python': ['jinja2'],
|
||||||
|
|
|
@ -1,25 +1,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
# Copyright 2014 Therp BV (<http://therp.nl>).
|
||||||
#
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
# 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/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
from openerp import http
|
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.report.controllers.main import ReportController
|
||||||
from openerp.addons.web.controllers.main import content_disposition
|
from openerp.addons.web.controllers.main import content_disposition
|
||||||
|
|
||||||
|
@ -42,7 +26,7 @@ class ReportController(ReportController):
|
||||||
continue
|
continue
|
||||||
objects = http.request.session.model(report.model)\
|
objects = http.request.session.model(report.model)\
|
||||||
.browse(docids or [])
|
.browse(docids or [])
|
||||||
generated_filename = email_template.mako_template_env\
|
generated_filename = mail_template.mako_template_env\
|
||||||
.from_string(report.download_filename)\
|
.from_string(report.download_filename)\
|
||||||
.render({
|
.render({
|
||||||
'objects': objects,
|
'objects': objects,
|
||||||
|
|
|
@ -1,27 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
# Copyright 2014 Therp BV (<http://therp.nl>).
|
||||||
#
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
# 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/>.
|
|
||||||
#
|
|
||||||
##############################################################################
|
|
||||||
import simplejson
|
import simplejson
|
||||||
from openerp import http
|
from openerp import http
|
||||||
from openerp.addons.web.controllers import main
|
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):
|
class Reports(main.Reports):
|
||||||
|
@ -41,7 +25,7 @@ class Reports(main.Reports):
|
||||||
continue
|
continue
|
||||||
objects = http.request.session.model(context['active_model'])\
|
objects = http.request.session.model(context['active_model'])\
|
||||||
.browse(context['active_ids'])
|
.browse(context['active_ids'])
|
||||||
generated_filename = email_template.mako_template_env\
|
generated_filename = mail_template.mako_template_env\
|
||||||
.from_string(report.download_filename)\
|
.from_string(report.download_filename)\
|
||||||
.render({
|
.render({
|
||||||
'objects': objects,
|
'objects': objects,
|
||||||
|
|
Loading…
Reference in New Issue