I made a method for an on_change method and here is my method for it.
def onchange_date_start(self, cr, uid, ids, date_start, context=None):
factor = 2
date_1 = datetime.strptime(date_start, '%Y-%m-%d')
date2 = date_1.date()
end_date = datetime(date2.year,date2.month,date2.day) + relativedelta(months=+factor)
e_date = end_date
_logger.info("\n\t\t\t\tEND Date Final %s"%(str(e_date.date())))
value = {"value":{"end_on" : e_date.date()}}
return value
So far it print out my **e_date** correctly but an error also pop saying:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<h1>Internal Server Erro</h1>
<h1>Internal Server Error<</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
and here is what the terminal says:
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: datetime.date(2015, 10, 18) is not JSON serializable
What error i committed?
Thanks for any help/suggestion