تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
4248 أدوات العرض
  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.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أغسطس 20
15382
5
يونيو 15
23972
1
مارس 15
5648
1
يناير 16
3796
3
مارس 15
16420