From bb692c76d41bb308ef24e729f907d707c44b99ca Mon Sep 17 00:00:00 2001 From: Khoi Nguyen Date: Thu, 12 Oct 2017 17:42:18 +0200 Subject: [FIX] web: tab navigation with phone widgets in form view This commit ensures that tab navigation works properly when editing a form view that contains input fields with phone widgets. Previously, pressing TAB would skip those fields. --- addons/web/static/src/js/fields/basic_fields.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 6392870dc90..7d7c6735531 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -966,7 +966,7 @@ var FieldPhone = FieldEmail.extend({ * @override */ getFocusableElement: function () { - if (this._canCall()) { + if (this.mode !== 'readonly' || this._canCall()) { return this._super.apply(this, arguments); } return $(); -- cgit v1.2.3 From 8191d6d72e82282c3ea4547d02bfd6ee9fa5022b Mon Sep 17 00:00:00 2001 From: Khoi Nguyen Date: Thu, 12 Oct 2017 17:42:18 +0200 Subject: [FIX] web: tab navigation with phone widgets in form view This commit ensures that tab navigation works properly when editing a form view that contains input fields with phone widgets. Previously, pressing TAB would skip those fields. --- addons/web/static/src/js/fields/basic_fields.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index f2c7fcf37cd..1097039ba2c 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -924,7 +924,7 @@ var FieldPhone = FieldEmail.extend({ * @override */ getFocusableElement: function () { - if (this._canCall()) { + if (this.mode !== 'readonly' || this._canCall()) { return this._super.apply(this, arguments); } return $(); -- cgit v1.2.3 From 841f41f95b7cf7d8f13ddce724d60d1d1149886d Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 18 Oct 2017 18:02:44 +0200 Subject: [FIX] web: domain field should never be considered unset Indeed, false was already considered as "[]" in edit mode. --- addons/web/static/src/js/fields/basic_fields.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 1097039ba2c..3985202fbd4 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -2027,6 +2027,15 @@ var FieldDomain = AbstractField.extend({ // Public //-------------------------------------------------------------------------- + /** + * A domain field is always set since the false value is considered to be + * equal to "[]" (match all records). + * + * @override + */ + isSet: function () { + return true; + }, /** * @override isValid from AbstractField.isValid * Parsing the char value is not enough for this field. It is considered -- cgit v1.2.3 From 1312ee72cf35e3887721ac56472f1188f636ec61 Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Thu, 19 Oct 2017 12:00:50 +0200 Subject: [FIX] web: correctly render the field image Before this commit, the image was directly built without using the corresponding template, which set some properties on the image (class, width, etc.). --- addons/web/static/src/js/fields/basic_fields.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 3985202fbd4..21205bfc033 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -1129,7 +1129,6 @@ var FieldBinaryImage = AbstractFieldBinary.extend({ supportedFieldTypes: ['binary'], _render: function () { var self = this; - var attrs = this.attrs; var url = this.placeholder; if (this.value) { if (!utils.is_bin_size(this.value)) { @@ -1144,11 +1143,7 @@ var FieldBinaryImage = AbstractFieldBinary.extend({ }); } } - var $img = $('').attr('src', url); - $img.css({ - width: this.nodeOptions.size ? this.nodeOptions.size[0] : attrs.img_width || attrs.width, - height: this.nodeOptions.size ? this.nodeOptions.size[1] : attrs.img_height || attrs.height, - }); + var $img = $(qweb.render("FieldBinaryImage-img", {widget: this, url: url})); this.$('> img').remove(); this.$el.prepend($img); $img.on('error', function () { -- cgit v1.2.3 From 2455350c40df86266eabd614ceab451159d67be3 Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Thu, 19 Oct 2017 18:05:17 +0200 Subject: [FIX] web: deal with `date` widget on datetime This use case was not correctly managed as the function evaluating if the value has changed compares datetime and date. This triggered an issue if the widget `date` was set on the field `date_order` on a purchase order for example ; it was not possible to create a record as the datapoint was set `dirty`. This rev. ensures that a `field_changed` is not triggered if the day is the same on a date widget. This rev. also adds support of `datetime` fields on date widget, which appears to be a valid use case. Fixes https://github.com/odoo/odoo/issues/20311 --- addons/web/static/src/js/fields/basic_fields.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 21205bfc033..7420c1bceff 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -352,7 +352,7 @@ var FieldChar = InputField.extend(TranslatableFieldMixin, { var FieldDate = InputField.extend({ className: "o_field_date", tagName: "span", - supportedFieldTypes: ['date'], + supportedFieldTypes: ['date', 'datetime'], /** * @override @@ -411,12 +411,13 @@ var FieldDate = InputField.extend({ * @override * @private * @param {Moment|false} value + * @returns {boolean} */ _isSameValue: function (value) { if (value === false) { return this.value === false; } - return value.isSame(this.value); + return value.isSame(this.value, 'day'); }, /** * Instantiates a new DateWidget datepicker. @@ -455,7 +456,16 @@ var FieldDateTime = FieldDate.extend({ var value = this.datewidget.getValue(); return value && value.add(-this.getSession().getTZOffset(value), 'minutes'); }, - + /** + * @override + * @private + */ + _isSameValue: function (value) { + if (value === false) { + return this.value === false; + } + return value.isSame(this.value); + }, /** * Instantiates a new DateTimeWidget datepicker rather than DateWidget. * -- cgit v1.2.3