Skip to Content
Menu
This question has been flagged
1 Reply
4928 Views

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"/>
Avatar
Discard
Best Answer

Hi,

You can't able use a timepicker separately from datetime. But instead of, you can found a timepicker app in following link 

For V10

https://apps.odoo.com/apps/modules/10.0/web_widget_timepicker/

For V11

https://apps.odoo.com/apps/modules/11.0/field_timepicker/

Thanks.

Avatar
Discard
Related Posts Replies Views Activity
2
Nov 24
25098
2
May 24
5521
3
Mar 24
4964
0
Mar 24
264
3
Feb 24
11421