Odoo Help


How to filter by date in a wizard in odoo 8

Abayomi Olatidoye
on 10/2/16, 8:13 PM 722 views

I created a wizard to print a payslip report in a specific way i designed. The payslip report works quite well. 

However, I couldn't get it to filter by the specific date selected. It prints every information .

My wizard code is below

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','>=',date_from),('date_from','<=',date_to)])

    datas = {

            'ids': ids,

            'model': 'bluspiral.sche.schedule.template',

            'form': data[0]


    return self.pool['report'].get_action( cr, uid, [], 'bluspiral_sche.cash_report', data=datas, context=context )

Any ideas??


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

1 follower(s)


Asked: 10/2/16, 8:13 PM
Seen: 722 times
Last updated: 10/3/16, 12:27 AM