1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# Author: Yannick Vaucher
5
# Copyright 2013 Camptocamp SA
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU Affero General Public License as
9
# published by the Free Software Foundation, either version 3 of the
10
# License, or (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU Affero General Public License for more details.
17
# You should have received a copy of the GNU Affero General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
##############################################################################
22
from openerp import pooler
23
from openerp.osv import orm
24
from openerp.tools.translate import _
25
from openerp.addons.base_report_assembler import report_assembler
28
class InvoicePDFReportAssembler(report_assembler.PDFReportAssembler):
29
"""InvoicePDFReportAssembler allows to merge multiple
30
invoice reports into one pdf"""
32
def _get_report_ids(self, cr, uid, ids, context=None):
33
pool = pooler.get_pool(cr.dbname)
34
user_obj = pool.get('res.users')
35
company = user_obj.browse(cr, uid, uid, context=context).company_id
36
report_ids = [r.report_id.id for r in company.assemble_invoice_report_ids]
38
msg = _("No report defined in Configuration -> Accounting for model invoice.")
39
raise orm.except_orm(_('Error'), msg)
42
InvoicePDFReportAssembler('report.invoice_report_assemblage',