Odoo Help


Error while clicking print

on 8/7/13, 5:38 AM 1,072 views
i have an error while clicking print button "NoneType' object has no attribute '__getitem__'

(<type 'exceptions.TypeError'>, TypeError("'NoneType' object has no attribute '__getitem__'",), <traceback object at 0xc79993c>)"

My code is(calldetails1/wizard/calldata_print.py)

from openerp.osv import fields, osv
import time

class calldata_print_report_wiz(osv.osv_memory):
    _name = "calldata.print.report.wiz"

    _columns = {
        'date_start': fields.date('Date Start', required=True),
        'date_end': fields.date('Date End', required=True),
        'Caller': fields.char('Caller'),
    _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):
   #        print "print reoprt"*100
      if context is None:
            context = {}

      datas = {'ids': context.get('active_ids', [])}
      res = self.read(cr, uid, ids, ['date_start', 'date_end', 'Caller'], context=context)
      res = res and res[0] or {}
      datas['form'] = res
      return {
            'type': 'ir.actions.report.xml',
            'datas': datas,

and my xml is (calldetails1/wizard/calldetails_view.xl)

<?xml version="1.0" encoding="utf-8"?>

<record model="ir.ui.view" id="wizard_with_step_form">

 <field name="model">calldata.print.report.wiz</field>
    <field name="name">Calldetails</field>
    <field name="type">form</field>
    <field name="arch" type="xml">
      <form string="Wizard with step" version="7.0">
       <group col="4" string="Dates">
          <field name="date_start"/>
          <field name="date_end"/>
    <field name="Caller"/>
      <button name="print_report" type="object" string="Print Report" class="oe_highlight"/>
     <button string="Cancel" class="oe_link" special="cancel"/>
 <record model="ir.actions.act_window" id="action_calldata_form1">
    <field name="name">Call Details</field>
    <field name = "target">new</field>
    <field name="res_model">calldata.print.report.wiz</field>
    <field name="view_type">form</field>
    <field name="view_mode">form</field>


<menuitem name="Call" parent="base.menu_reporting" id="calldata_menu_mainform1"  />
  <menuitem name="Calldetails" parent="calldata_menu_mainform1" id="calldata_menu_mainformsub1i" action="action_calldata_form1" />


Any one please help to find the issue?

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 8/7/13, 5:38 AM
Seen: 1072 times
Last updated: 3/16/15, 8:10 AM