Odoo 도움말


1 응답

Parth Gajjar India

--Parth Gajjar--

| 4 4 7
Gandhinagar, India
--Parth Gajjar--

Parth Gajjar India
19. 4. 16. 오전 9:48

Try this one,

var FieldDate = require('web.basic_fields').FieldDate;
init: function () {
this._super.apply(this, arguments);
if (this.nodeOptions.disable_past_date) {     var d = new Date();                 d.setHours(0,0,0,0);
this.datepickerOptions['minDate'] = moment(d);

Repeat the code for the FieldDateTime for datetime fields

4 의견
Maitree Trivedi India
19. 4. 16. 오전 10:55

Thanks for the help.

Your code is also working, but the same issue(I have mentioned my issue) is reflected in your code too.

when you select other date value and after that, you want to reselect today's date it will not allow changing the date.

Maitree Trivedi India
19. 4. 16. 오후 1:11

var DateWidget = require('web.datepicker').DateWidget;


start: function(parent, options) {

if (this.__parentedParent.attrs.options.disable_past_date) {

var min_date = new Date()



this.options['minDate'] = moment(min_date);


this._super.apply(this, arguments);



I have tried this code. It's works for me.

Parth Gajjar India
19. 4. 17. 오전 1:27

I have missed that part in your comment. I have updated the example 😅

BTW, You should never use this.__parentedParent directly some time it can break the things.

require('web.basic_fields').FieldDate is the last abstraction for the date picker for the form view so you should use it to avoid the side effects.

Maitree Trivedi India
19. 4. 17. 오전 2:46

ohk, Thank you for help

Keep Informed
1 팔로워
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