diff options
| author | Julien Castiaux <juc@odoo.com> | 2019-12-12 09:30:27 +0000 |
|---|---|---|
| committer | Julien Castiaux <juc@odoo.com> | 2020-02-07 14:32:58 +0000 |
| commit | 450263338ccbb4cf02a95fd87e84a8963096c920 (patch) | |
| tree | 6462922fe250e327ae9403d76fa38c16b3e6f0ea /addons/web/static | |
| parent | 20ff585c2b156aceba7b8224b9633211d4ac4853 (diff) | |
[FIX] web: attach the trad alert to the form
The translation alert dialog was attached to the entire view in case no
status bar was found. This resulted in the following layout on large
screens:
chrome
--------------------------------------
| alert dialog | form view | chatter |
| | | |
--------------------------------------
Whereas when a status bar was set on the form view, the rendering was as
follow:
chrome
--------------------------------------
| status bar | chatter |
| alert dialog | |
| form view | |
--------------------------------------
The fix make sure the alert dialog is always placed just above the form
view just like when there is a status bar.
closes odoo/odoo#44878
Task: 2075172
X-original-commit: dacdc30681510e9c2db23610c5be5285a72a8949
Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
Diffstat (limited to 'addons/web/static')
| -rw-r--r-- | addons/web/static/src/js/views/form/form_renderer.js | 2 | ||||
| -rw-r--r-- | addons/web/static/tests/views/form_tests.js | 19 |
2 files changed, 11 insertions, 10 deletions
diff --git a/addons/web/static/src/js/views/form/form_renderer.js b/addons/web/static/src/js/views/form/form_renderer.js index 89972e700aa..f3c663891b0 100644 --- a/addons/web/static/src/js/views/form/form_renderer.js +++ b/addons/web/static/src/js/views/form/form_renderer.js @@ -147,6 +147,8 @@ var FormRenderer = BasicRenderer.extend({ })); if (this.$('.o_form_statusbar').length) { this.$('.o_form_statusbar').after($notification); + } else if (this.$('.o_form_sheet_bg').length) { + this.$('.o_form_sheet_bg').prepend($notification); } else { this.$el.prepend($notification); } diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js index 66cfdc2413f..fc776ab8ee2 100644 --- a/addons/web/static/tests/views/form_tests.js +++ b/addons/web/static/tests/views/form_tests.js @@ -6075,13 +6075,13 @@ QUnit.module('Views', { await testUtils.form.clickEdit(form); await testUtils.fields.editInput(form.$('input[name="foo"]'), "test"); await testUtils.form.clickSave(form); - assert.containsOnce(form, '.o_form_view > .alert > div .oe_field_translate', + assert.containsOnce(form, '.o_form_view .alert > div .oe_field_translate', "should have single translation alert"); await testUtils.form.clickEdit(form); await testUtils.fields.editInput(form.$('input[name="display_name"]'), "test2"); await testUtils.form.clickSave(form); - assert.containsN(form, '.o_form_view > .alert > div .oe_field_translate', 2, + assert.containsN(form, '.o_form_view .alert > div .oe_field_translate', 2, "should have two translate fields in translation alert"); form.destroy(); @@ -6117,24 +6117,23 @@ QUnit.module('Views', { await testUtils.fields.editInput(form.$('input[name="foo"]'), "test"); await testUtils.form.clickSave(form); - assert.containsOnce(form, '.o_form_view > .alert > div',"should have a translation alert"); - + assert.containsOnce(form, '.o_form_view .alert > div',"should have a translation alert"); // click on the pager to switch to the next record await testUtils.dom.click(form.pager.$('.o_pager_next')); - assert.strictEqual(form.$('.o_form_view > .alert > div').length, 0, + assert.strictEqual(form.$('.o_form_view .alert > div').length, 0, "should not have a translation alert"); // click on the pager to switch back to the previous record await testUtils.dom.click(form.pager.$('.o_pager_previous')); - assert.containsOnce(form, '.o_form_view > .alert > div',"should have a translation alert"); + assert.containsOnce(form, '.o_form_view .alert > div',"should have a translation alert"); // remove translation alert by click X and check alert even after form reload - await testUtils.dom.click(form.$('.o_form_view > .alert > .close')); + await testUtils.dom.click(form.$('.o_form_view .alert > .close')); assert.strictEqual(form.$('.o_form_view > .alert > div').length, 0, "should not have a translation alert"); await form.reload(); - assert.strictEqual(form.$('.o_form_view > .alert > div').length, 0, + assert.strictEqual(form.$('.o_form_view .alert > div').length, 0, "should not have a translation alert after reload"); form.destroy(); @@ -6199,7 +6198,7 @@ QUnit.module('Views', { actionManager.$('input[name="foo"]').val("test").trigger("input"); await testUtils.dom.click(actionManager.$('.o_form_button_save')); - assert.strictEqual(actionManager.$('.o_form_view > .alert > div').length, 1, + assert.strictEqual(actionManager.$('.o_form_view .alert > div').length, 1, "should have a translation alert"); var currentController = actionManager.getCurrentController().widget; @@ -6213,7 +6212,7 @@ QUnit.module('Views', { }); await testUtils.dom.click($('.o_control_panel .breadcrumb a:first')); - assert.strictEqual(actionManager.$('.o_form_view > .alert > div').length, 1, + assert.strictEqual(actionManager.$('.o_form_view .alert > div').length, 1, "should have a translation alert"); actionManager.destroy(); |
