Odoo Help

1 Answer

Davide Corio

--Davide Corio--
Davide Corio
| 5 4 7
Bricherasio, Italy
--Davide Corio--

Odoo Evangelist and Consultant

Davide Corio
3/16/13, 5:31 AM

By default in your reports, you can access all the object linked to the main object (o, the one you associated the report to, i.e. an invoice).

This means for instance, that you can access the partner object by doing o.partner_id, and a partner category object with o.partner_id.category_id.

Since there are fields related to accounting on the partner form, you can access this way more or less every object.

But, if you don't want to take this "dirty" way, you can use a parser.

Take the invoice report definition for instance (addons/account/report/account_print_invoice.py):

class account_invoice(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(account_invoice, self).__init__(cr, uid, name, context=context)
            'time': time,

the self.localcontext is always passed to the report, then you put a key (i.e. sale_orders) inside this dict, with value all the SOs i need.

Obviously, you'll have to populate this value with the list of object you need loop on. And you can do this by searching the sale orders with, for instance:

from openerp import pooler

Inside [] you can put your domain to filter the results.

This way you can print whatever you like in your report.

1 Comment
3/16/13, 9:14 AM

Thanks a lot Davide! I might have to ask more questions along the way, but just even knowing it is possible is a very good news. I will be doing test during the weekend.

Ask a Question
Keep Informed
0 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now