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

How I could limit the datepicker from today to fifteen days after?


Thanks



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

Hello Raimon,

In the Date or Date time field limit of days in the date-picker, you can update the range of date-picker fields, and the date range picker library is supported in odoo 14.

Example - 

<div id="reportrange" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">

    <i class="fa fa-calendar"></i>&nbsp;

    <span></span> <i class="fa fa-caret-down"></i>

</div>

<script type="text/javascript">

$(function() {

    $('#reportrange').daterangepicker({

        startDate: start,

        endDate: end,

        ranges: {

           'Today': [moment(), moment()],

           'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],

           'Last 7 Days': [moment().subtract(6, 'days'), moment()],

           'Last 30 Days': [moment().subtract(29, 'days'), moment()],

           'This Month': [moment().startOf('month'), moment().endOf('month')],

           'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]

        }

    }, cb);

    cb(start, end);

});

</script>

Hereby I have changed for 15 days range in the date picker

           'Last 15': [moment().startOf('month'),  moment().subtract(15, 'days').endOf('month')],

Thanks

Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Thans, but I'm a beginner! 

I'm waiting someone like this:

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

But it don't work. 

I have not explained well, sorry. I want to do the minDate starts 15 days after today. 



อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
เม.ย. 21
3654
1
ก.ค. 25
2353
2
ก.ค. 25
7847
2
ก.ค. 25
4241
2
ก.ค. 25
4012