Odoo Help


Set time to default in openerp

on 8/4/15, 5:17 AM 1,419 views

I have defined a field called 'datetime'. 

Here the time should be set to 08:00 by default and date we need to set manually.

How can we do this?

I did something like this, here am setting date and time by default. But unable to set only time.

_defaults = {

'date_start': lambda self,cr,uid,context=None: fields.date.context_today(self,cr,uid,context) + " 02:30:00",  


Please Suggest


On 8/5/15, 2:35 AM

date.fields.datetime('Creation Date', required=True),

given like this

_defaults = {
        'date': lambda *a: time.strftime('%Y-%m-%d 08:00:00'),

Try like this...I think,it ll be work for your criteria

which field you want set default time.for example-

current_time.fields.char(string="Current Time: ",default=time.strftime('08:00:00'),readonly=True)

Thanks, actually what i need is date should be set manually from user and time should be set to 8 o' clock by default.

on 8/5/15, 2:53 AM

Try like this,, current_time.fields.char(string="Current Time: ",default=time.strftime('08:00:00'),readonly=True). think this ll be work for your case

on 8/5/15, 3:01 AM

Thanks Bailey

on 8/5/15, 4:37 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 8/4/15, 5:17 AM
Seen: 1419 times
Last updated: 8/5/15, 3:21 AM