I am new to OpenERP development and I am trying to learn how to assign functions to fields so I can retrieve values based on my needs, but after following the manual or taking a look at the code from another modules I can't seem to get it right.
I tried a really simple function to retrieve the current time into a field. Here is the code to my function
def get_text(self, cr, uid, ids, fields, arg, context): #records = self.browse(cr, uid, ids) #sale = 'Some Text' dd = datetime.now() return dd
And this is how I call the
'varText': fields.function(get_text, obj='sim.student', method=True, store=False, type='string', string='Text')
Whatever I try in my
get_text function I always get an error like the following:
AttributeError: 'datetime.datetime' object has no attribute 'get'
If I comment the line starting with
dd and uncomment the line starting with
sale the error would be
AttributeError: 'str' object has no attribute 'get'
If anyone can give me a tip on what I am doing wrong I will really appreciate it!