diff --git a/invoice.py b/invoice.py index 7155a1f564..0052da4de5 100644 --- a/invoice.py +++ b/invoice.py @@ -1160,6 +1160,35 @@ class InvoiceTax(OSV): InvoiceTax() +class InvoiceReport(Report): + _name = 'account.invoice' + + def _get_objects(self, cursor, user_id, ids, model, datas, context): + invoice_obj = self.pool.get('account.invoice') + user_obj = self.pool.get('res.user') + user = user_obj.browse(cursor, user_id, user_id, context) + context = context.copy() + if 'language' in context: + del context['language'] + invoice_ids = invoice_obj.search(cursor, user_id, [ + ('id', 'in', ids), + ('company', '=', user.company.id), + ], context=context) + return invoice_obj.browse(cursor, user_id, invoice_ids, context=context) + + def parse(self, cursor, user_id, report, objects, datas, context): + user_obj = self.pool.get('res.user') + user = user_obj.browse(cursor, user_id, user_id, context) + if context is None: + context = {} + context = context.copy() + context['company'] = user.company + return super(InvoiceReport, self).parse(cursor, user_id, report, objects, + datas, context) + +InvoiceReport() + + class Address(OSV): _name = 'partner.address' invoice = fields.Boolean('Invoice') diff --git a/invoice.xml b/invoice.xml index 987f13219b..f0f293c65c 100644 --- a/invoice.xml +++ b/invoice.xml @@ -248,6 +248,7 @@ account.invoice account.invoice account_invoice/invoice.odt + company/header_A4.odt form_print