how to create date wizard in odoo 8
<p>I am trying to create a wizard to streamline my search. I have created the report and xml and it works fine. However when I try to do the search it brings all the payslip of all the months not the months I selected. I hence, tried to use a wizard to filter my search. This has been given my issues.</p>

<p>My wizard code is </p>

<pre><code>import time
from datetime import datetime
from dateutil import relativedelta
from openerp.osv import fields, osv


class ReportWizard(osv.osv_memory):

    _name = 'bluspiral.sche.schedule'
#    _inherit = 'account.invoice'
    _description = 'Cash Payroll Schedule'

    _columns = {
        'date_from': fields.date('Date From', required=True),
        'date_to': fields.date('Date To', required=True),
    }

    _defaults = {
        'date_from': lambda *a: time.strftime('%Y-%m-01'),
        'date_to': lambda *a: str(datetime.now() + relativedelta.relativedelta(months=+1, day=1, days=-1))[:10],
    }

    def print_payroll_schedule_report(self, cr, uid, ids, context=None):
        datas = {}
        if context is None:
            context = {}
        data = self.read(cr, uid, ids,['date_from', 'date_to'],     context=context)
        date_from = data[0]['date_from']
        date_to = data[0]['date_to']
        obj = self.pool['hr.payslip']
        ids = obj.search(cr, uid, [('date_from','&gt;=',date_from),    ('date_from','&lt;=',date_to)])
        datas = {
                 'ids': ids,
                 'model': 'bluspiral.sche.schedule.template',
                 'form': data
                }
        return self.pool['report'].get_action(
            cr, uid, [], 'bluspiral_sche.cash_report', data=datas,     context=context
        )
</code></pre>

<p>And the error i keep getting is:</p>

<p>Traceback (most recent call last):
  File "/opt/openerp-8.0/openerp/addons/report/controllers/main.py", line 125, in report_download
    response = self.report_routes(reportname, converter='pdf', **dict(data))
  File "/opt/openerp-8.0/openerp/http.py", line 396, in response_wrap
    response = f(*args, **kw)
  File "/opt/openerp-8.0/openerp/addons/report/controllers/main.py", line 65, in report_routes
    pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=options_data, context=context)
  File "/opt/openerp-8.0/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/openerp-8.0/openerp/addons/report/models/report.py", line 190, in get_pdf
    html = self.get_html(cr, uid, ids, report_name, data=data, context=context)
  File "/opt/openerp-8.0/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/openerp-8.0/openerp/addons/report/models/report.py", line 165, in get_html
    return particularreport_obj.render_html(cr, uid, ids, data=data, context=context)
  File "/opt/openerp-8.0/openerp/api.py", line 241, in wrapper
    return old_api(self, *args, **kwargs)
  File "/opt/openerp-8.0/openerp/addons/report/models/abstract_report.py", line 35, in render_html
    if data and data.get('form', {}).get('landscape'):
AttributeError: 'list' object has no attribute 'get'</p>

<p>Any Ideas please?</p>

<p>Odoo expects a dict and it found a list for <code>form</code> variable (<code>read</code> function returns a list of dicts), you need to change:  </p>

<pre><code>'form': data
</code></pre>

<p>To:  </p>

<pre><code>'form': data[0]
</code></pre>

python python-2.7 openerp odoo-8