跳至内容
菜单
此问题已终结
4829 查看

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

形象
丢弃
相关帖文 回复 查看 活动
2
3月 24
1711
0
3月 24
1409
2
2月 24
1917
0
12月 23
1263
0
5月 23
1787