Skip to Content
Menu
This question has been flagged
2506 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??

     

Avatar
Discard
Related Posts Replies Views Activity
3
Dec 22
9951
5
Apr 24
39345
6
Apr 24
36750
3
Mar 24
9218
2
Jul 19
765