Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
4835 Prikazi

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
Opusti
Related Posts Odgovori Prikazi Aktivnost
2
mar. 24
1719
0
mar. 24
1410
2
feb. 24
1921
0
dec. 23
1267
0
maj 23
1794