Hi
try this function
import calendar
def onchange_type(self,cr,uid,ids,type,month,year,context=None):
res = {}
cal = calendar.Calendar()
count = 0.0
if type and month and year:
if type == '5':
for week in cal.monthdayscalendar(int(year), int(month)):
for i, day in enumerate(week):
if i not in [5,6] and day > 0:
count += 1
elif type == '5.5':
for week in cal.monthdayscalendar(int(year), int(month)):
for i, day in enumerate(week):
if i not in [5,6] and day > 0:
count += 1
elif i == 5 and day > 0:
count += .5
elif type == '6':
for week in cal.monthdayscalendar(int(year), int(month)):
for i, day in enumerate(week):
if i not in [6] and day > 0:
count += 1
res = {'value':{
'no_of_days' : count
}}
return res
i hope this will help you.