Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
10194 Widoki

This is with Odoo 10 and the default bootstrap-datetimepicker.

I have a field in my view that has a "Start of event" datetime. I'd like the date picker that shows up to work in 5 minute intervals (minuteStepping: 5) and to show the time picker along with the date picker (sideBySide: true).

I've confirmed that this works as I want it to by editing addons/web/static/src/js/widgets/date_picker.js manually.

However, I'd prefer to just give the two options I want to change as a parameter to my <field ..>definition under my <form> tag in the view XML. The source Widget accepts an optionsparameter in its init method that it extends to end up with the final options object, but I've been unable to insert my configuration options into this object.

I tried giving it as <field ... options="{...}" and as .. t-field-options='..', but I'm guessing the latter won't work since I'm not in a qweb context in my view, and the first one isn't read by widgets.

Is there any way I can do this without creating a new widget? (and hopefully without subclassing or extending the existing widget, but keep it as a pure view configuration option instead)?

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

In the repository https://github.com/jo541/web ,download web_widget_datepicker_options module from odoo10 ,after installation you can add in your field like below.

<field name="date_order" options="{'datepicker':{'minuteStepping': 5}}" attrs="{'invisible': [('state', 'in', ['sale', 'done', 'cancel'])]}"/>

Hope it helps

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
lip 17
2766
0
mar 17
3120
3
gru 23
21648
1
sie 18
9294
2
sie 17
2881