diff --git a/report_custom_filename/README.rst b/report_custom_filename/README.rst deleted file mode 100644 index ca2d8b61..00000000 --- a/report_custom_filename/README.rst +++ /dev/null @@ -1,47 +0,0 @@ -Custom report filenames -======================= - -This addon allows for custom filenames for reports. - -Configuration -============= - -To configure this module, open the report whose filename you want to change and fill in the `Download filename` field. This field is evaluated as jinja2 template with `objects` being a list of browse records of the records to print, and `o` the first record. If your model contains a name field, you might write something like `${o.name}_report.pdf` as filename. - -Bug Tracker -=========== - -Bugs are tracked on `GitHub Issues `_. -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 feedback -`here `_. - -.. 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 - -Credits -======= - -Contributors ------------- - -* Holger Brunn - -Icon ----- - -Icon courtesy of http://www.picol.org/ (download_settings.svg) - -Maintainer ----------- - -.. image:: http://odoo-community.org/logo.png - :alt: Odoo Community Association - :target: http://odoo-community.org - -This module is maintained by the OCA. - -OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. - -To contribute to this module, please visit http://odoo-community.org. diff --git a/report_custom_filename/__init__.py b/report_custom_filename/__init__.py deleted file mode 100644 index cba0a4dc..00000000 --- a/report_custom_filename/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- 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 . -# -############################################################################## -from . import controllers -from . import model diff --git a/report_custom_filename/__manifest__.py b/report_custom_filename/__manifest__.py deleted file mode 100644 index 1b78fd7e..00000000 --- a/report_custom_filename/__manifest__.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- 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 . -# -############################################################################## -{ - "name": "Custom report filenames", - "summary": "Configure the filename to use when downloading a report", - "version": "8.0.1.0.0", - "author": "Therp BV,Odoo Community Association (OCA)", - "license": "AGPL-3", - "complexity": "normal", - "category": "Reporting", - "depends": [ - 'web', - 'email_template', - ], - "data": [ - "view/ir_actions_report_xml.xml", - ], - "test": [ - ], - "auto_install": False, - 'installable': False, - "application": False, - "external_dependencies": { - 'python': ['jinja2'], - }, -} diff --git a/report_custom_filename/controllers/__init__.py b/report_custom_filename/controllers/__init__.py deleted file mode 100644 index 6eb84a90..00000000 --- a/report_custom_filename/controllers/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- 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 . -# -############################################################################## -from . import reports -from . import report_controller diff --git a/report_custom_filename/controllers/report_controller.py b/report_custom_filename/controllers/report_controller.py deleted file mode 100644 index 536d2d69..00000000 --- a/report_custom_filename/controllers/report_controller.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- 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 . -# -############################################################################## -from openerp import http -from openerp.addons.email_template import email_template -from openerp.addons.report.controllers.main import ReportController -from openerp.addons.web.controllers.main import content_disposition - - -class ReportController(ReportController): - @http.route([ - '/report//', - '/report///', - ]) - def report_routes(self, reportname, docids=None, converter=None, **data): - response = super(ReportController, self).report_routes( - reportname, docids=docids, converter=converter, **data) - if docids: - docids = [int(i) for i in docids.split(',')] - report_xml = http.request.session.model('ir.actions.report.xml') - report_ids = report_xml.search( - [('report_name', '=', reportname)]) - for report in report_xml.browse(report_ids): - if not report.download_filename: - continue - objects = http.request.session.model(report.model)\ - .browse(docids or []) - generated_filename = email_template.mako_template_env\ - .from_string(report.download_filename)\ - .render({ - 'objects': objects, - 'o': objects[:1], - 'object': objects[:1], - 'ext': report.report_type.replace('qweb-', ''), - }) - response.headers['Content-Disposition'] = content_disposition( - generated_filename) - return response - - @http.route(['/report/download']) - def report_download(self, data, token): - response = super(ReportController, self).report_download(data, token) - # if we got another content disposition before, ditch the one added - # by super() - last_index = None - for i in range(len(response.headers) - 1, -1, -1): - if response.headers[i][0] == 'Content-Disposition': - if last_index: - response.headers.pop(last_index) - last_index = i - return response diff --git a/report_custom_filename/controllers/reports.py b/report_custom_filename/controllers/reports.py deleted file mode 100644 index 1ff58ed0..00000000 --- a/report_custom_filename/controllers/reports.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- 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 . -# -############################################################################## -import simplejson -from openerp import http -from openerp.addons.web.controllers import main -from openerp.addons.email_template import email_template - - -class Reports(main.Reports): - @http.route('/web/report', type='http', auth="user") - @main.serialize_exception - def index(self, action, token): - result = super(Reports, self).index(action, token) - action = simplejson.loads(action) - context = dict(http.request.context) - context.update(action["context"]) - report_xml = http.request.session.model('ir.actions.report.xml') - report_ids = report_xml.search( - [('report_name', '=', action['report_name'])], - 0, False, False, context) - for report in report_xml.browse(report_ids): - if not report.download_filename: - continue - objects = http.request.session.model(context['active_model'])\ - .browse(context['active_ids']) - generated_filename = email_template.mako_template_env\ - .from_string(report.download_filename)\ - .render({ - 'objects': objects, - 'o': objects[0], - 'object': objects[0], - }) - result.headers['Content-Disposition'] = main.content_disposition( - generated_filename) - return result diff --git a/report_custom_filename/i18n/report_custom_filename.pot b/report_custom_filename/i18n/report_custom_filename.pot deleted file mode 100644 index fa2ec82c..00000000 --- a/report_custom_filename/i18n/report_custom_filename.pot +++ /dev/null @@ -1,34 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * report_custom_filename -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-12-19 12:17+0000\n" -"PO-Revision-Date: 2014-12-19 12:17+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" - -#. module: report_custom_filename -#: field:ir.actions.report.xml,download_filename:0 -msgid "Download filename" -msgstr "" - -#. module: report_custom_filename -#: help:ir.actions.report.xml,download_filename:0 -msgid "Fill in this field to have a custom file name when downloading this report. This string is evaluated as a jinja2 expression.\n" -"You can use python expressions, `objects` is a browse record list of the objects for which the report is being generated.\n" -"Check for this list's length to determine if it is a report being printed for multiple records or not. You also have access to `o`, which is the first record in the list" -msgstr "" - -#. module: report_custom_filename -#: model:ir.model,name:report_custom_filename.model_ir_actions_report_xml -msgid "ir.actions.report.xml" -msgstr "" - diff --git a/report_custom_filename/model/__init__.py b/report_custom_filename/model/__init__.py deleted file mode 100644 index b7da7af1..00000000 --- a/report_custom_filename/model/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- 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 . -# -############################################################################## -from . import ir_actions_report_xml diff --git a/report_custom_filename/model/ir_actions_report_xml.py b/report_custom_filename/model/ir_actions_report_xml.py deleted file mode 100644 index 5ea04300..00000000 --- a/report_custom_filename/model/ir_actions_report_xml.py +++ /dev/null @@ -1,37 +0,0 @@ -# -*- 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 . -# -############################################################################## -from openerp import models, fields - - -class IrActionsReportXml(models.Model): - _inherit = 'ir.actions.report.xml' - - download_filename = fields.Char( - 'Download filename', - help='Fill in this field to have a custom file name when downloading ' - 'this report. This string is evaluated as a jinja2 expression.\n' - 'You can use python expressions, `objects` is a browse record list of ' - 'the objects for which the report is being generated.\n' - 'Check for this list\'s length to determine if it is a report being ' - 'printed for multiple records or not. You also have access to `o`, ' - 'which is the first record in the list.\n' - 'For qweb reports, the variable `ext` gives you the requested format' - '\'s extension') diff --git a/report_custom_filename/static/description/icon.png b/report_custom_filename/static/description/icon.png deleted file mode 100644 index df9ef01c..00000000 Binary files a/report_custom_filename/static/description/icon.png and /dev/null differ diff --git a/report_custom_filename/view/ir_actions_report_xml.xml b/report_custom_filename/view/ir_actions_report_xml.xml deleted file mode 100644 index 412bc8db..00000000 --- a/report_custom_filename/view/ir_actions_report_xml.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - ir.actions.report.xml - - - - - - - - -