This question has been flagged
2 Replies
7185 Views

I created a petaho report and uploaded it to open erp. now i want to print it by clicking print button. I have filters (date start , date end , caller) in form.How to send filters to the report from OpenERP ?

Avatar
Discard
Best Answer

After you created the modele in pentaho with the parametrs(Filtrers) : date start, date end, caller. You should juste create a new penatho report in the menu : setup -->Technical --> Actions --> Pentaho report with your informations: Name, Name of service, Model, the file and you have to linked to menu After that you find the menu of this report after the linked menu, and if you open this menu, a new wizard open with the parametrs to enter. That's All

Avatar
Discard
Author

@kh@lidoss i have done all this then it shows error on clicking print "Pentaho returned no data for the report 'Calldetails'. Check report definition and parameters". Report details are Name:Calldetails,Model:smdrcalldata,Service Name:Calldetails,Output format:PDF,File :Download smdrcalldata_report.prpt . Ple3ase help me to find issue

Author Best Answer
I had done all this. I have a table calldata1 and i want to show its contents in report print. i created pentaho report by adding  calldata1 as datasource and uplodaded this report to open erp. Then i created a wizard table  calldata_print_report_wiz . i created a pop up window which displays datestart, date end ,caller from this table as filters. (similar to Reporting/Point of sale/Sale details).
How can i print data by passing filters to report code is
calldetails/calldata.py

from osv import osv,fields
class calldata1(osv.osv):
  _name = 'calldata1'
  _columns = {
              'Call_start': fields.datetime('Call start'),
              'Call_duration':fields.datetime('Call duration'),
               'Caller':fields.char('Caller'),
          }
calldata1()
calldetails/wizard/call_print.py

import logging
from openerp.osv import fields, osv
import time

class calldata_print_report_wiz(osv.osv_memory):
    _name = "calldata.print.report.wiz"
    def _sel_func(self, cr, uid,context=None):
       obj = self.pool.get('calldata1')
       ids = obj.search(cr, uid, [])
       res = obj.read(cr, uid, ids, ['id','Caller'], context)
       res =[(r['id'],r['Caller']) for r in res]
      return res

    _columns = {
        'date_start': fields.date('Date Start', required=True),
        'date_end': fields.date('Date End', required=True),
        'caller_id':fields.many2one(
        'calldata1',
        'caller_id',
        selection=_sel_func
        )
     }
    _defaults = {
        'date_start': lambda *a: time.strftime('%Y-%m-%d'),
        'date_end': lambda *a: time.strftime('%Y-%m-%d'),
     }

 def print_report(self, cr, uid, ids, context=None):
      if context is None:
            context = {}
      datas = {'ids': context.get('active_ids', [])}
      res = self.read(cr, uid, ids, ['date_start', 'date_end', 'caller_id'], context=context)
      res = res and res[0] or {}
      datas['form'] = res
      return {
            'type': 'ir.actions.report.xml',
            'report_name':'call1',
           }
calldata_print_report_wiz()

Any one please help?
Avatar
Discard