summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/relational_fields_tests.js
diff options
context:
space:
mode:
authorKhoi Nguyen <bng@odoo.com>2017-10-03 16:52:08 +0200
committerKhoi Nguyen <bng@odoo.com>2017-10-09 09:00:19 +0200
commit1bbb7d62410d0fef9304c32b62a8aef032f97af8 (patch)
tree8b985c2ff4ac451a8a5acc0711a1be7439d226f7 /addons/web/static/tests/fields/relational_fields_tests.js
parent5d1a1942dfa366a5fdd0509c3f9b1df712e06591 (diff)
[FIX] web: clear input on clicking 'Create and Edit' from many2one fields
We clear the input field when clicking 'Create and Edit' to ensure that the field is empty if the user chooses to cancel the record creation. If a record is indeed created, then the field value will still be updated.
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/relational_fields_tests.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js
index 5325132c09d..cfa6726f429 100644
--- a/addons/web/static/tests/fields/relational_fields_tests.js
+++ b/addons/web/static/tests/fields/relational_fields_tests.js
@@ -1489,7 +1489,7 @@ QUnit.module('relational_fields', {
QUnit.test('pressing ENTER on a \'no_quick_create\' many2one should not trigger M2ODialog', function (assert) {
var done = assert.async();
- assert.expect(1);
+ assert.expect(2);
var M2O_DELAY = relationalFields.FieldMany2One.prototype.AUTOCOMPLETE_DELAY;
relationalFields.FieldMany2One.prototype.AUTOCOMPLETE_DELAY = 0;
@@ -1527,6 +1527,10 @@ QUnit.module('relational_fields', {
$input.blur();
assert.strictEqual($('.modal').length, 1,
"should have one modal in body");
+ // Check that discarding clears $input
+ $('.modal .o_form_button_cancel').click();
+ assert.strictEqual($input.val(), '',
+ "the field should be empty");
form.destroy();
relationalFields.FieldMany2One.prototype.AUTOCOMPLETE_DELAY = M2O_DELAY;
done();