Function returns datetime in openerp
I am trying to create a function that returns date and time, but it doesn't work. It returns error code 2:
def _date_(self, cr, uid, ids, fields, arg, context):
x={}
for record in self.browse(cr, uid, ids):
if record.date :
a = datetime.strptime(record.date, "%Y-%m-%d %H:%M:%S")
b = a.strftime("%Y-%m-%d %H:%M:%S")
x[record.id] = b
return x
_columns = {
'date': fields.datetime('Date-Hour of Call', required=True),
'date_': fields.function(_date_, string='date copy'),
Regards,
+3
source to share