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()
I create the data template with a depth of 2 to access the invoice data.
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.