I wanted to assign the current date to a date field 'start_date' in the following code:
calendar_obj.create(cr,uid,
{'name' : rec_res.act_ion,
'user_id' : rec_res.asgnd_to.id,
'start_date' : lambda *a:datetime.today().strftime('%m-%d-%Y'),
'stop_date' : rec_res.due_date,
'allday' : True,
'partner_ids' : [(6,0, [rec_res.asgnd_to.partner_id.id])]
},
context=context)
How to set or assign the current date value to the start_date field ?
The Date field includes a today()
method, just for cases like this:
'start_date': fields.Date.today(),
Of course you need to import fields
first:
from openerp import fields