Odoo Help

Welcome!

This community 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.

0

Error while clicking print

By
Anuradha
on 8/7/13, 5:38 AM 761 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',
            'report_name':'calldata_report',
            'datas': datas,
           }
calldata_print_report_wiz()

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

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

<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"/>
       </group>
    <field name="Caller"/>
    <footer>
      <button name="print_report" type="object" string="Print Report" class="oe_highlight"/>
                    or
     <button string="Cancel" class="oe_link" special="cancel"/>
   </footer>
   </form>
   </field>
   </record>
 <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>

  </record>


<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" />

</data>
</openerp>

Any one please help to find the issue?

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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