This question has been flagged
2345 Views
hi,
I have created a pentaho report and uploaded it to open erp. In report i added two fileds and in print preview it shows all the data. I want filtering of this data based on date_start , date_end, caller while clicking print in open erp.I have written print function ,my code is 
 def print_report(self, cr, uid, ids, context=None):

      _logger = logging.getLogger(__name__)
      if context is None:
            context = {}
      i = context.get('active_ids', [])
      datas = {'ids': context.get('active_ids', [])}
      res = self.read(cr, uid, ids, ['date_start', 'date_end', 'caller_id'], context=context)
     # datas['form'] = res
      _logger.info('print ...%s...',res)
      caller = ''
      date = res[0]['date_start'] + ' 00:00:00'
      if res[0]['caller_id']:
       caller = res[0]['caller_id'][1]

      _logger.info('print filters.......%s......%s...',date,caller)

      calldata_obj = self.pool.get('calldata1')
      ids  = calldata_obj.search(cr, uid, [('call_start','=',date),('caller','=',caller)])
    #  ids = calldata_obj.search(cr, uid, [])
      calldats = calldata_obj.read(cr, uid, ids, ['caller','call_start'], context)

#      calldats = calldata_obj.read(cr, uid, ids, ['Caller','Call_start'], context
      _logger.info('print ing form.......%s',calldats)
      result = {}
      for pos in calldats:
        result = {
                     'caller':pos['caller'],
                     'call_start':pos['call_start']
                          }
      datas['form'] = result
      _logger.info('calldataa reultt...........%s',result)
      return {
           'type': 'ir.actions.report.xml',
             'report_name':'call1',
             'call_start':result['call_start'],
             'caller': result['caller']
   }

but filtering not works any one please help?

Avatar
Discard