summaryrefslogtreecommitdiff
path: root/addons/web
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-05-17 15:50:59 +0200
committerChristophe Simonis <chs@odoo.com>2019-05-17 15:50:59 +0200
commitd785adba6c09b0773bdd874182f450ba2ebe7c6d (patch)
tree5189f5dc30c84515eda62c4d6a512f552ae8f900 /addons/web
parent8968a620105e2e79f2aa9d8db36b5408b89e92ee (diff)
parentc545783b95b15f65a9798003b614f75685dc434e (diff)
[MERGE] forward port branch 12.0 up to c545783b95b
Diffstat (limited to 'addons/web')
-rw-r--r--addons/web/static/src/js/chrome/abstract_web_client.js6
-rw-r--r--addons/web/static/src/js/tools/test_menus.js6
-rw-r--r--addons/web/static/src/js/widgets/date_picker.js7
-rw-r--r--addons/web/static/tests/fields/basic_fields_tests.js19
4 files changed, 36 insertions, 2 deletions
diff --git a/addons/web/static/src/js/chrome/abstract_web_client.js b/addons/web/static/src/js/chrome/abstract_web_client.js
index 2516b0a7230..2a8e8151560 100644
--- a/addons/web/static/src/js/chrome/abstract_web_client.js
+++ b/addons/web/static/src/js/chrome/abstract_web_client.js
@@ -491,7 +491,11 @@ var AbstractWebClient = Widget.extend(ServiceProviderMixin, KeyboardNavigationMi
new RainbowMan(data).appendTo(this.$el);
} else {
// For instance keep title blank, as we don't have title in data
- this.notification_manager.notify('', data.message, true);
+ this.call('notification', 'notify', {
+ title: "",
+ message: data.message,
+ sticky: false
+ });
}
} else {
throw new Error('Unknown effect type: ' + type);
diff --git a/addons/web/static/src/js/tools/test_menus.js b/addons/web/static/src/js/tools/test_menus.js
index c7b1846b1e9..7f69c65a13e 100644
--- a/addons/web/static/src/js/tools/test_menus.js
+++ b/addons/web/static/src/js/tools/test_menus.js
@@ -44,8 +44,12 @@
}
}
- // Main function that starts orchestration of tests
function clickEverywhere(){
+ setTimeout(_clickEverywhere, 1000);
+ }
+
+ // Main function that starts orchestration of tests
+ function _clickEverywhere(){
console.log("Starting ClickEverywhere test");
var startTime = performance.now();
createWebClientHooks();
diff --git a/addons/web/static/src/js/widgets/date_picker.js b/addons/web/static/src/js/widgets/date_picker.js
index 57c935905e5..df9601b3a04 100644
--- a/addons/web/static/src/js/widgets/date_picker.js
+++ b/addons/web/static/src/js/widgets/date_picker.js
@@ -13,6 +13,7 @@ var DateWidget = Widget.extend({
type_of_date: "date",
events: {
'change.datetimepicker': 'changeDatetime',
+ 'error.datetimepicker': 'errorDatetime',
'change .o_datepicker_input': 'changeDatetime',
'input input': '_onInput',
'keydown': '_onKeydown',
@@ -104,6 +105,12 @@ var DateWidget = Widget.extend({
}
},
/**
+ * Library clears the wrong date format so just ignore error
+ */
+ errorDatetime: function (e) {
+ return false;
+ },
+ /**
* Focuses the datepicker input. This function must be called in order to
* prevent 'input' events triggered by the lib to bubble up, and to cause
* unwanted effects (like triggering 'field_changed' events)
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js
index 3e69a66b308..0b3e124f9fa 100644
--- a/addons/web/static/tests/fields/basic_fields_tests.js
+++ b/addons/web/static/tests/fields/basic_fields_tests.js
@@ -2661,6 +2661,25 @@ QUnit.module('basic_fields', {
form.destroy();
});
+ QUnit.test('date field should remove the date if the date is not valid', function (assert) {
+ assert.expect(1);
+
+ var form = createView({
+ View: FormView,
+ model: 'partner',
+ data: this.data,
+ arch: '<form string="Partners"><field name="date"/></form>',
+ res_id: 4,
+ });
+ // switch to edit mode
+ form.$buttons.find('.o_form_button_edit').click();
+ // set an invalid date
+ var $input = form.$('.o_field_widget[name=date] input');
+ $input.val('mmmh').trigger('change');
+ assert.strictEqual($input.text(), "", "The date field should be empty");
+ form.destroy();
+ });
+
QUnit.test('date field value should not set on first click', function (assert) {
assert.expect(2);