From eba7ad247e89c600c7062c78fea3a458b8f9bc36 Mon Sep 17 00:00:00 2001 From: susport Date: Sun, 11 Dec 2016 08:32:44 -0300 Subject: [PATCH] [9.0] [MIG] report_custom_filename (#82) --- report_custom_filename/README.rst | 2 +- report_custom_filename/__openerp__.py | 28 ++++--------------- .../controllers/report_controller.py | 26 ++++------------- report_custom_filename/controllers/reports.py | 26 ++++------------- 4 files changed, 17 insertions(+), 65 deletions(-) diff --git a/report_custom_filename/README.rst b/report_custom_filename/README.rst index ca2d8b61..1d7cff4a 100644 --- a/report_custom_filename/README.rst +++ b/report_custom_filename/README.rst @@ -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 ======= diff --git a/report_custom_filename/__openerp__.py b/report_custom_filename/__openerp__.py index 1b78fd7e..dff5c4b0 100644 --- a/report_custom_filename/__openerp__.py +++ b/report_custom_filename/__openerp__.py @@ -1,34 +1,18 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2014 Therp BV (). -# -# 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 . -# -############################################################################## +# Copyright 2014 Therp BV (). +# 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'], diff --git a/report_custom_filename/controllers/report_controller.py b/report_custom_filename/controllers/report_controller.py index 536d2d69..6d034514 100644 --- a/report_custom_filename/controllers/report_controller.py +++ b/report_custom_filename/controllers/report_controller.py @@ -1,25 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2015 Therp BV (). -# -# 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 . -# -############################################################################## +# Copyright 2014 Therp BV (). +# 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, diff --git a/report_custom_filename/controllers/reports.py b/report_custom_filename/controllers/reports.py index 1ff58ed0..33fca19d 100644 --- a/report_custom_filename/controllers/reports.py +++ b/report_custom_filename/controllers/reports.py @@ -1,27 +1,11 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2014 Therp BV (). -# -# 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 . -# -############################################################################## +# Copyright 2014 Therp BV (). +# 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,