Browse Source

[11.0][FIX] web_widget_timepicker: zero value

pull/1272/head
Alexandre Díaz 5 years ago
parent
commit
86278bd8db
  1. 2
      web_widget_timepicker/readme/USAGE.rst
  2. 5
      web_widget_timepicker/static/src/js/web_widget_timepicker.js

2
web_widget_timepicker/readme/USAGE.rst

@ -16,5 +16,3 @@ Additional bootstrap datetime-picker plugin options can be specified by an optio
...
<field name="mytimefieldname" widget="timepicker" options="{'datepicker': {'stepping': 15}}"/>
...
See the available options at `datetime-picker <https://eonasdan.github.io/bootstrap-datetimepicker/Options/>`_.

5
web_widget_timepicker/static/src/js/web_widget_timepicker.js

@ -25,7 +25,8 @@ odoo.define('web_widget_timepicker', function (require) {
setValue: function (value) {
this.set({'value': value});
var formatted_value = value ? this._formatClient(value) : null;
var formatted_value = _.isNumber(value)
? this._formatClient(value) : null;
this.$input.val(formatted_value);
if (this.picker) {
var fdate = new moment(formatted_value, this.options.format);
@ -36,7 +37,7 @@ odoo.define('web_widget_timepicker', function (require) {
getValue: function () {
var value = this.get('value');
return value ? this._formatClient(value) : null;
return _.isNumber(value) ? this._formatClient(value) : null;
},
changeDatetime: function () {

Loading…
Cancel
Save