Skip to Content
Menu
This question has been flagged
3870 Views

Hello everybody,

I add a method in hr.payslip:

_number_of_months(self, cr, uid, ids, date_from, date_to, context=None):

     date1 = datetime.strptime(self.browse(cr, uid, ids, context=context).date_from, '%Y-%m-%d')

    date2 = datetime.strptime(self.browse(cr, uid, ids, context=context).date_to, '%Y-%m-%d')

    p= (date2.year - date1.year) * 12 + (date2.month - date1.month)

    return p

i call this function in salary rule like this:

result = payslip._number_of_months(payslip.date_from, payslip.date_to)

but this not work

Please some helps


Thank you

Avatar
Discard
Related Posts Replies Views Activity
2
Mar 24
288
0
Mar 24
226
2
Feb 24
653
0
Dec 23
342
0
May 23
764