summaryrefslogtreecommitdiff
path: root/addons/web/static/tests
diff options
context:
space:
mode:
authorDhruv Patel <dhp@odoo.com>2020-08-10 10:32:18 +0000
committerAaron Bohy <aab@odoo.com>2020-09-09 11:41:51 +0000
commitdf37ce50e847e3489eb43d1ef6fc1bac6d6af333 (patch)
tree7873edaf9adc379a902982d54a011d797f950043 /addons/web/static/tests
parent10f58e490f3a7b7621b3cea9ef183ba8fa53d32f (diff)
[FIX] web: no more double discard dialog
This issue only occurred in community. Steps to produce: 1) Create/Edit any record. 2) Change the menu using menu switcher 3) You will get the discard dialog at the instance and after some time it will also display another duplicate discard dialog. So, we have one extra redundant discard dialog on menu switching. It is working fine when we have dirty form and then click on the breadcrumb or click on any internal child menu. Task : 2312437 closes odoo/odoo#57343 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
Diffstat (limited to 'addons/web/static/tests')
-rw-r--r--addons/web/static/tests/views/form_tests.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js
index 51d070d197c..b130721fd66 100644
--- a/addons/web/static/tests/views/form_tests.js
+++ b/addons/web/static/tests/views/form_tests.js
@@ -8625,6 +8625,38 @@ QUnit.module('Views', {
form.destroy();
});
+ QUnit.test('call canBeRemoved twice', async function (assert) {
+ assert.expect(4);
+
+ const form = await createView({
+ View: FormView,
+ model: 'partner',
+ data: this.data,
+ arch: '<form><field name="display_name"/><field name="foo"/></form>',
+ res_id: 1,
+ viewOptions: {
+ mode: 'edit',
+ },
+ });
+
+ assert.containsOnce(form, '.o_form_editable');
+ await testUtils.fields.editInput(form.$('.o_field_widget[name=foo]'), 'some value');
+
+ form.canBeRemoved();
+ await testUtils.nextTick();
+ assert.containsOnce(document.body, '.modal');
+
+ form.canBeRemoved();
+ await testUtils.nextTick();
+ assert.containsOnce(document.body, '.modal');
+
+ await testUtils.dom.click($('.modal .modal-footer .btn-secondary'));
+
+ assert.containsNone(document.body, '.modal');
+
+ form.destroy();
+ });
+
QUnit.test('domain returned by onchange is cleared on discard', async function (assert) {
assert.expect(4);