← Back to team overview

openerp-community team mailing list archive

Print multiple rows in one report

 

Hi effortful community.

I have a question: How I can print a report more than one row in single loop? Let me explain more.

I have a PostgreSQL view V containing 100 rows and I have a OpenERP view to view. I created a report, in the normal way. What I want is to print all the rows in that view PDF report in one click.

I was digging a lot of server source code. Here is a first attempt:

###########################################################################
# -*- coding: utf-8 -*-
from report import report_sxw
import time

class the_parser(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(the_parser, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
        })
        # self.context = context

    def *set_context*(self, objects, data, ids, report_type=None):
        import xmlrpclib

        SERVER  = 'localhost'
        PORT = '8069'
        DATABASE = 'the_database'
        USER = 'the_user'
        PASSWORD = 'the_password'

        URL = 'http://' + SERVER + ':' + PORT
        common = xmlrpclib.ServerProxy(URL + '/xmlrpc/common')

        UID = common.login(DATABASE, USER, PASSWORD)
        obj = xmlrpclib.ServerProxy(URL + '/xmlrpc/object')

the_ids = obj.execute(DATABASE, UID, PASSWORD, 'the.resource', 'search', []) return super(the_parser, self).set_context(objects, data, the_ids, report_type=report_type)

report_sxw.report_sxw('report.the.resource', 'the.resource.report', 'report/the_resource.rml', parser=the_parser, header=None)
###########################################################################

But I have 02 problems:

1. The client tells me I have to select at least one row.

2. It generates a report of 100 pages, one page per record (but what I want are far fewer pages for all records).

I hope your help. Thanks in advance.

--
Best regards
David Soria


Follow ups