diff options
| author | Géry Debongnie <ged@odoo.com> | 2018-12-06 12:39:06 +0000 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2018-12-07 13:16:06 +0000 |
| commit | 40dd121938552d3f88289d2e5fcd1d57a0dd01bb (patch) | |
| tree | 4830c8ffdea1e10d35c7ddf096f536bd8999240f /addons/web/static/tests/fields/relational_fields_tests.js | |
| parent | 48a50b4bc011fc6dfc82a673f921fad941dc79cf (diff) | |
[REF] web: move ControlPanel inside controllers/actions
This branch introduces a large-scale reorganization of the
component tree generated by the web client. The short version is
that now, the control panel is a child of the view controller and
no longer a sibling. Graphically (and simplified), we go from
this:
webClient
/ | \
... ... actionManager
/ \
controlPanel viewController
/ \
to this:
webClient
/ | \
... ... actionManager
|
viewController
/ | \
ControlPanelController
/ \
CPRenderer CPModel
The motivation is that this work moves the code where it should be.
Before this commit, it was kind of weird to have code in the
controllers to render buttons outside of their root node (in
renderButtons). Also, the action manager had to take care of
coordinating search view states between view transitions.
So, this work simplifies the code. It also makes it easier to
extend. We see day after day that Odoo needs to take care of more
complex UI needs, and in many cases, these needs were quite
difficult to implement (we prefer spaghettis in our plates, not in
our code). The changes in this branch should open the way to
implement these features.
For example,
- it will now be easy to add the possibility of views (for example,
the search view or a new ControlPanel view) to add custom buttons
(of type action or object) in the control panel.
- Another need will be to serialize/ restore the state of the
search view across action boundaries (needed by the dashboard).
- Another example is the possibility for views to customize easily
the presence/absence of sub menus (filters/groupbys/favorites/
time range/...)
- Another need is an easier way for views/client action to customize
their control panel.
This commit also contains a large rewrite of the search view (so it
is more inline with our architecture and easier to maintain).
Part of task 1893568
Co-authored-by: Aaron Bohy <aab@odoo.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Martin Geubelle <mge@odoo.com>
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
| -rw-r--r-- | addons/web/static/tests/fields/relational_fields_tests.js | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js index ab7a603fb80..6c3493828ad 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -615,7 +615,7 @@ QUnit.module('relational_fields', { list.destroy(); }); - QUnit.test('widget selection, edition and on many2one field', function (assert) { + QUnit.test('widget selection, edition and on many2one field', function (assert) { assert.expect(18); this.data.partner.onchanges = {product_id: function () {}}; @@ -640,7 +640,7 @@ QUnit.module('relational_fields', { }, }); - assert.ok(!form.$('select').length, "should not have a select tag in dom"); + assert.containsNone(form.$('.o_form_view'), 'select'); assert.strictEqual(form.$('.o_field_widget[name=product_id]').text(), 'xphone', "should have rendered the many2one field correctly"); assert.strictEqual(form.$('.o_field_widget[name=trululu]').text(), '', @@ -650,11 +650,10 @@ QUnit.module('relational_fields', { testUtils.form.clickEdit(form); - assert.containsN(form, 'select', 3, - "should have 3 select tag in dom"); - assert.strictEqual(form.$('select[name="product_id"] option:contains(xphone)').length, 1, + assert.containsN(form.$('.o_form_view'), 'select', 3); + assert.containsOnce(form, 'select[name="product_id"] option:contains(xphone)', "should have fetched xphone option"); - assert.strictEqual(form.$('select[name="product_id"] option:contains(xpad)').length, 1, + assert.containsOnce(form, 'select[name="product_id"] option:contains(xpad)', "should have fetched xpad option"); assert.strictEqual(form.$('select[name="product_id"]').val(), "37", "should have correct product_id value"); @@ -757,7 +756,7 @@ QUnit.module('relational_fields', { }, }); - testUtils.fields.editSelect(form.$('select'), "false"); + testUtils.fields.editSelect(form.$('.o_form_view select'), 'false'); testUtils.form.clickSave(form); form.destroy(); @@ -1297,11 +1296,11 @@ QUnit.module('relational_fields', { // update foo, which will trigger an onchange and update timmy // -> m2mtags input should not have taken the focus - form.$('input:first').focus(); - testUtils.fields.editInput(form.$('input:first'), 'trigger onchange'); + form.$('input[name=foo]').focus(); + testUtils.fields.editInput(form.$('input[name=foo]'), 'trigger onchange'); assert.containsNone(form, '.o_field_many2manytags .badge', "should contain no tags"); - assert.strictEqual(form.$('input:first').get(0), document.activeElement, + assert.strictEqual(form.$('input[name=foo]').get(0), document.activeElement, "foo input should have kept the focus"); // add a tag -> m2mtags input should still have the focus @@ -1864,7 +1863,6 @@ QUnit.module('relational_fields', { QUnit.test('name_create in form dialog', async function (assert) { assert.expect(2); - var form = createView({ View: FormView, model: 'partner', @@ -1891,7 +1889,7 @@ QUnit.module('relational_fields', { testUtils.dom.click(form.$('.o_field_x2many_list_row_add a')); await testUtils.fields.many2one.searchAndClickItem('product_id', - {selector:'.modal', search:'new record'}); + {selector: '.modal', search: 'new record'}); assert.verifySteps(['name_create']); @@ -1922,7 +1920,7 @@ QUnit.module('relational_fields', { res_id: 1, }); - // Cuurent Form + // Current Form assert.equal(form.$('.o_form_uri.o_field_widget[name=reference]').text(), 'xphone', 'the field reference of the form should have the right value'); |
