I try to add some minutes and hours to a Datetime field. Somehow I get a datatype missmatch and I can't figure out what is wrong. Everything that I try gets an error:
File "/opt/odoo/custom/....... in onchange_duration_hrs
end_time = (self.start_datetime + timedelta(hours=hour, minutes=minute))
TypeError: coercing to Unicode: need string or buffer, datetime.timedelta found
File "/opt/odoo/custom/addons..... line 182, in onchange_duration_hrs
end_time = (self.start_datetime + datetime.timedelta(hours=hour, minutes=minute))
AttributeError: type object 'datetime.datetime' has no attribute 'timedelta'
If I just change the field self.start_datetime to datetime.now() the function works correct.
start_datetime = fields.Datetime(string='Start DateTime')
end_time = (datetime.now() + datetime.timedelta(hours=hour, minutes=minute))
Any hint would be welcome?