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/views/view_dialogs_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/views/view_dialogs_tests.js')
| -rw-r--r-- | addons/web/static/tests/views/view_dialogs_tests.js | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/addons/web/static/tests/views/view_dialogs_tests.js b/addons/web/static/tests/views/view_dialogs_tests.js index 023a977ad56..1df70b03acc 100644 --- a/addons/web/static/tests/views/view_dialogs_tests.js +++ b/addons/web/static/tests/views/view_dialogs_tests.js @@ -80,11 +80,6 @@ QUnit.module('Views', { }, }); - testUtils.mock.intercept(parent, 'env_updated', function () { - throw new Error("The environment should not be propagated to the action manager"); - }); - - new dialogs.FormViewDialog(parent, { res_model: 'partner', res_id: 1, @@ -155,10 +150,10 @@ QUnit.module('Views', { mockRPC: function (route, args) { if (args.method === 'read_group') { assert.deepEqual(args.kwargs, { - context: {group_by: "bar"}, - domain: [["display_name","like","a"], ["display_name","ilike","piou"], ["foo","ilike","piou"]], - fields:["display_name","foo","bar"], - groupby:["bar"], + context: {}, + domain: [["display_name","like","a"], "&", ["display_name","ilike","piou"], ["foo","ilike","piou"]], + fields: ["display_name","foo","bar"], + groupby: ["bar"], orderby: '', lazy: true }, "should search with the complete domain (domain + search), and group by 'bar'"); @@ -167,8 +162,8 @@ QUnit.module('Views', { search++; assert.deepEqual(args, { context: {}, - domain: [["display_name","like","a"], ["display_name","ilike","piou"], ["foo","ilike","piou"]], - fields:["display_name","foo"], + domain: [["display_name","like","a"], "&", ["display_name","ilike","piou"], ["foo","ilike","piou"]], + fields: ["display_name","foo"], model: "partner", limit: 80, sort: "" @@ -177,7 +172,7 @@ QUnit.module('Views', { assert.deepEqual(args, { context: {}, domain: [["display_name","like","a"]], - fields:["display_name","foo"], + fields: ["display_name","foo"], model: "partner", limit: 80, sort: "" @@ -423,9 +418,11 @@ QUnit.module('Views', { assert.expect(4); testUtils.mock.patch(ListController, { - getContext: function () { + getOwnedQueryParams: function () { return { - shouldBeInFilterContext: true, + context: { + shouldBeInFilterContext: true, + }, }; }, }); @@ -471,9 +468,9 @@ QUnit.module('Views', { // save filter testUtils.dom.click(dialog.$('.o_dropdown_toggler_btn:contains(Favorites)')); - testUtils.dom.click(dialog.$('.o_save_search')); - dialog.$('.o_save_name input[type=text]').val('some name'); // name the filter - testUtils.dom.click(dialog.$('.o_save_name button')); + testUtils.dom.click(dialog.$('.o_add_favorite')); + dialog.$('.o_favorite_name input[type=text]').val('some name'); // name the filter + testUtils.dom.click(dialog.$('.o_save_favorite button')); testUtils.mock.unpatch(ListController); parent.destroy(); |
