Odoo Help

Welcome!

This community 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.

0

How to fuse custom data and openerp data using jasper parser

By
lleclerc
on 10/30/13, 5:48 PM 986 views
  1. I create my table

    class aim_invoice_report_model(TransientModel):
        _name = 'aim.report.invoice.model'
        _columns = {
            'invoice_id': fields.many2one('account.invoice', 'Invoice', required=True),
            'custom_field1': fields.char(),
            }
    aim_invoice_report_model()
    
  2. I create the data template with a depth of 2 to access the invoice data.

  3. I need to pass the data that fits this template

    def generate_records(...) :
        result = []
        for invoice in invoice_obj.browse(cr, uid, invoice_obj.search(cr, uid, constraints)):
            data = { 'invoice_id': invoice.id, 'custom_field1': 'myvalue' }
            result.append(data)
        return result
    

How can I do it ? Using the invoice.id doesnt work.

Thanks for the help or any hints.

EDIT: Looked in jasper_report.py code and found :

# If the language used is xpath create the xmlFile in dataFile.
if self.report.language() == 'xpath':
    if self.data.get('data_source','model') == 'records':
        generator = CsvRecordDataGenerator(self.report, self.data['records'] )
    else:
        generator = CsvBrowseDataGenerator( self.report, self.model, self.pool, self.cr, self.uid, self.ids, self.context )
    generator.generate( dataFile )

Doesn't seems to be possible to do what I am trying without modifying jasper_report.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 10/30/13, 5:48 PM
Seen: 986 times
Last updated: 3/16/15, 8:10 AM