Odoo 10: change date and time options for a field

This is with Odoo 10 and the standard datetimepicker loader.

I have a field, in my opinion, that has a "start event" datetime. I would like the date picker to show that it works at intervals of 5 minutes ( minuteStepping: 5), and to show the timing along with the date selection ( sideBySide: true).

I have confirmed that this works the way I want by addons/web/static/src/js/widgets/date_picker.jsmanually editing .

However, I would prefer to simply specify two parameters that I want to change as a parameter in the definition <field ..>below my tag <form>in the XML representation. The source widget accepts a parameter optionsin its method init, which it extends to eventually get the final options object, but I was not able to insert my configuration parameters into this object.

I tried to give it how <field ... options="{...}"and how .. t-field-options='..', but I assume that the latter will not work, since I am not in the qweb context in my opinion, and the first is not readable widgets.

Is there any way to do this without creating a new widget? (and hopefully without subclassing or extending the existing widget, but instead save it as an option with a clean configuration)?

+4
source share
1

. https://github.com/OCA/web/tree/10.0/web_m2x_options

. /SRC/JS/form.js.

Many2one , XML.

Example : <field name="partner_id" options="{'search_more':true}" />

. .

.

:

Github.

https://github.com/jo541/web

10.0. "web_widget_datepicker_options". , .

Odoo. , .

:

. , sale.order.

view sale.order "date_order". , 5 5.

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

datepicker bootprap datepicker.

+2

Source: https://habr.com/ru/post/1687029/


All Articles