1
votes

I am working on odoo11 survey module.

I am assigning deadline from survey wizard and wizard contains only date field as deadline. whereas in Answers deadline field is datetime and its show 5:30 default time value.

My requirement: I want to show default time for deadline field in Answers is 23:59.

Try:

deadline = fields.Datetime('Deadline', help="Date by which the person can open the survey and submit answers",oldname="date_deadline", default=lambda *a: time.strftime('23:59:59'))

But its not worked.

Thanks in advance

1

1 Answers

1
votes

As far as I know you cannot assign just a time to Datetime field. You can specify default value to be specific datetime or current date with specified time.

For example:

from odoo import fields

deadline = fields.Datetime('Deadline', oldname="date_deadline", default='2021-02-08 23:59:59')

or

from odoo import fields
from datetime import datetime

deadline = fields.Datetime('Deadline', oldname="date_deadline", default=lambda self: fields.Datetime.to_string(datetime.now().replace(hour=23, minute=59, second=59)))