Odoo Help


This community 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.


Set time to default in openerp

on 8/4/15, 5:17 AM 597 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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


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