From f58f17762643a211e77227a326b5fc3a721a2120 Mon Sep 17 00:00:00 2001 From: Julien Mougenot Date: Tue, 17 Sep 2019 12:31:22 +0000 Subject: [IMP] web: added increments to the minutes in daterange Minutes can now be chosen by increments of 5 instead of 10. Task 2068164 --- 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 c1d01022c68..a34d024b8e6 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -588,7 +588,7 @@ var FieldDateRange = InputField.extend({ timePicker: !this.isDateField, timePicker24Hour: _t.database.parameters.time_format.search('%H') !== -1, autoUpdateInput: false, - timePickerIncrement: 10, + timePickerIncrement: 5, locale: { format: this.isDateField ? time.getLangDateFormat() : time.getLangDatetimeFormat(), }, -- cgit v1.2.3 From fd3c3821861dcfecdd63079c799863002fd67d71 Mon Sep 17 00:00:00 2001 From: Julien Mougenot Date: Mon, 16 Sep 2019 11:49:00 +0000 Subject: [FIX] web: field color: adapted for views The FieldColor widget had been designed exclusively for the document layout configurator. Because of this, the widget would not display/behave correctly in other views. Before this commit: - in list views, the widget had a "white-space" attribute adapted for char fields, which gave it much more space than it needed - there was no handling of the widget in readonly state: it was always editable - its size in list views was a bit too large Now: - all styling problems have been adjusted for list views (unchanged for forms) - the widget is disabled when in readonly mode Task 2072466 closes odoo/odoo#36949 Signed-off-by: VincentSchippefilt --- addons/web/static/src/js/fields/basic_fields.js | 52 ++++++++++++++++++++----- 1 file changed, 42 insertions(+), 10 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 a34d024b8e6..69be202a33d 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -3271,11 +3271,22 @@ var AceEditor = DebouncedField.extend({ */ var FieldColor = AbstractField.extend({ template: 'FieldColor', - events: { + events: _.extend({}, AbstractField.prototype.events, { 'click .o_field_color': '_onColorClick', - }, - custom_events: { + }), + custom_events: _.extend({}, AbstractField.prototype.custom_events, { 'colorpicker:saved': '_onColorpickerSaved', + }), + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * @override + */ + getFocusableElement: function () { + return this.$('.o_field_color'); }, //-------------------------------------------------------------------------- @@ -3287,10 +3298,10 @@ var FieldColor = AbstractField.extend({ * @private */ _render: function () { - this._super.apply(this, arguments); this.$('.o_field_color').data('value', this.value) .css('background-color', this.value) .attr('title', this.value); + return this._super.apply(this, arguments); }, //-------------------------------------------------------------------------- @@ -3299,13 +3310,20 @@ var FieldColor = AbstractField.extend({ /** * @private - * @param {MouseEvent} ev */ - _onColorClick: function (ev) { - new ColorpickerDialog(this, { - defaultColor: this.value, - noTransparency: true, - }).open(); + _onColorClick: function () { + if (this.mode === 'edit') { + const dialog = new ColorpickerDialog(this, { + defaultColor: this.value, + noTransparency: true, + }).open(); + dialog.on('closed', this, () => { + // we need to wait for the modal to execute its whole close function. + Promise.resolve().then(() => { + this.getFocusableElement().focus(); + }); + }); + } }, /** @@ -3315,6 +3333,20 @@ var FieldColor = AbstractField.extend({ _onColorpickerSaved: function (ev) { this._setValue(ev.data.hex); }, + + /** + * @override + * @private + */ + _onKeydown: function (ev) { + if (ev.which === $.ui.keyCode.ENTER) { + ev.preventDefault(); + ev.stopPropagation(); + this._onColorClick(ev); + } else { + this._super.apply(this, arguments); + } + }, }); return { -- cgit v1.2.3 From ececa1f7bf851a884c916f4ad095ba586ecbbd02 Mon Sep 17 00:00:00 2001 From: Juhil Somaiya Date: Wed, 21 Aug 2019 06:14:05 +0000 Subject: [FIX] *: hide technical field widgets in non-debug mode (Studio) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *: - account - barcodes - calenndar - hr_timesheet - mail - mass_mailing - partner_autocomplete - web - website_slides This commit removes description of fields that should not be shown in non-debug mode Studio. Only field widgets whose own description is set are displayed in non-debug mode Studio in "Widget" of sidebar. In other words, even if any ancestor has a description but not the current widget, it won't be displayed in the sidebar in non-debug mode. Task-Id 2056992 closes odoo/odoo#35902 Signed-off-by: Alexandre Kühn (aku) --- addons/web/static/src/js/fields/basic_fields.js | 1 - 1 file changed, 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 69be202a33d..72b0b1adc5f 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -1166,7 +1166,6 @@ var FieldFloatTime = FieldFloat.extend({ }); var FieldFloatFactor = FieldFloat.extend({ - description: "", supportedFieldTypes: ['float'], className: 'o_field_float_factor', formatType: 'float_factor', -- cgit v1.2.3 From d2f024d25437cd1893e727c702aafa9cfb23c3e6 Mon Sep 17 00:00:00 2001 From: Julien Mougenot Date: Wed, 18 Sep 2019 14:39:19 +0000 Subject: [FIX] web: allow line return in textareas Before this commit, textareas in x2many would not allow line return when pressing enter. Now, it does. --- addons/web/static/src/js/fields/basic_fields.js | 1 + 1 file changed, 1 insertion(+) (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 72b0b1adc5f..4590f490932 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -1370,6 +1370,7 @@ var FieldText = InputField.extend(TranslatableFieldMixin, { */ _onKeydown: function (ev) { if (ev.which === $.ui.keyCode.ENTER) { + ev.stopPropagation(); return; } this._super.apply(this, arguments); -- cgit v1.2.3