I am using the datetime field for SMS server. I want the SMS to be sent always on the current date, but I want the user to be able to change the only the time from a view.
I am using a datetime field that will be used to post a request to the sms server, and a float field for the time, which is the one that is going appear on the view. What I want is to take the values from the view for the float field for the hour and minutes and pass it to the datetime field to set time. i.e I want to replace the hard coded values for hour and minute parameters inside the replace method, with values from the delivery_time field.
import datetime as dt
class SmsTemplate(models.Model):
_name = "sms.template"
delivery_time = fields.Float(string='Time')
delivery_datetime = fields.Datetime(default=timezone('Asia/Baghdad').localize(dt.datetime.today()).replace(hour=1,minute=20))
<field name="delivery_time" widget="float_time"/>