Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
5383 มุมมอง

hi all,

requirment is i defined date field. it should hide previous dates how can we do this.

or is there any method to that it should not select previous dates like it should through an error.

Thanks

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

You can use the following module

https://apps.openerp.com/apps/modules/11.0/web_widget_datepicker_options/

Suppose you have a field like below

<field name="current_date" />

After installing the module, just add the option for the jquery datepicker minDate and set it to 0 like this

<field name="current_date" options="{'datepicker':{'minDate': 0}}"/>

For reference

https://stackoverflow.com/questions/38581583/disable-previous-dates-in-odoo-datepicker

Regards

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

OpenERP uses JQuery DatePicker widget to select the dates.  This post provides a overview of how you can control dates to be disabled in various ways.  The datepicker, I think, is instantiated in the odoo/odoo/addons/web/static/src/js/view_form.js file (search for the start method of instance.web.DateTimeWidget).  You can either change it from that file or override the start method of instance.web.DateTimeWidget.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You define onchange method for this filed. In this method you verify selected date, if date is previous, generate Error, Warning or Info exception.

อวตาร
ละทิ้ง

How Please Elaborate