I've created a custom field called caldays in payslip screen and in this field I want to get days between from_date
and to_date
in openerp with onchange function please help me with code
I got below code but how can I put it onchange function
datej = str(payslip.date_to)
datek = str(payslip.date_from)
dj = datej[-2:]
x=0
new = 0
while (x<=31):
x= x+1
if str(x) == dj or "0"+str(x) == dj:
new= x
dk = datek[-2:]
y=0
old = 0
while (y<=31):
y= y+1
if str(y) == dk or "0"+str(y) == dk:
old= y
caldays = new-old + 1
result = caldays