Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
1007 Tampilan

I am having Odoo 17 instance where I want to keep only specific date range enabled for selection in Date time picker, I have tried _getDatepickerOptions() but it is not working, I have used _getFlatpickrOptions() but not working, can I get some example of document for the same?

Avatar
Buang
Jawaban Terbai

Hi,


Try with the following code.


Python

from_period = fields.Date(string="From Date", required=True,
help="Choose the from date")
to_period = fields.Date(string="To Date", required=True,
help="Choose the to date")

XML

<label for="from_period" string="Period"/>
<div class="o_row">
<field name="from_period" widget="daterange" nolabel="1"
class="oe_inline"
options="{'related_end_date': 'to_period'}"/>
<i class="fa fa-long-arrow-right mx-2"
aria-label="Arrow icon" title="Arrow"/>
<field name="to_period" widget="daterange" nolabel="1"
class="oe_inline"
options="{'related_start_date': 'from_period'}"/>
</div>

Hope it helps

Avatar
Buang
Jawaban Terbai

Hi Kedar Dave, 

Use 

<field name="date_begin" widget="daterange" options="{'related_end_date': 'date_end'}"/>
<field name="date_end" widget="daterange" options="{'related_start_date': 'date_begin'}"/>

Hope this help.

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Nov 19
3940
0
Okt 16
3687
1
Mar 15
6093
3
Jun 25
682
0
Jun 24
1818