Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
4252 Zobrazení
  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.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
srp 20
15385
5
čvn 15
23973
1
bře 15
5653
1
led 16
3797
3
bře 15
16421