diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-11-17 13:14:02 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2018-01-16 20:49:19 +0100 |
| commit | 32b8cec5361174c92c45a4975d4e02f1fb448aa2 (patch) | |
| tree | 110bd6986c2da1ed5047002b7ea40c91ea9fa5ed /addons/web/static/src/js/chrome/web_client.js | |
| parent | 9bee25a9df65f657fef0f2f32a7ad823fdc7d4e1 (diff) | |
[REF] web,*: ActionManager/ViewManager refactoring
This rev. is the first part (out of 3) of the refactoring of the
ActionManager and ViewManager layer of the webclient.
The main changes are:
- there is no ViewManager anymore, its work is now handled by the
ActionManager itself, but isolated in a specific file ; this
eases a lot of things, as the breadcrumbs handling for example.
- the ActionManager code is converted to the new coding principles
and guidelines ; mainly, children widgets communicate with it by
triggering events up, and not by function calls anymore.
- the ActionManager layer is now testable, and a lot of tests have
already been written.
- the code in other addons has been adapted consequently.
What's coming next:
- introduce the 'AbstractAction' Widget, and make client actions
and view controllers inherit from it ; this widget will
implement a common API that could be used uniformly by the
ActionManager (e.g. restore(), canBeLeft(), renderButtons(),
getTitle()...).
- move the ControlPanel handling from the ActionManager to the
AbstractAction.
Diffstat (limited to 'addons/web/static/src/js/chrome/web_client.js')
| -rw-r--r-- | addons/web/static/src/js/chrome/web_client.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/addons/web/static/src/js/chrome/web_client.js b/addons/web/static/src/js/chrome/web_client.js index e725aaee8f6..c39917d5118 100644 --- a/addons/web/static/src/js/chrome/web_client.js +++ b/addons/web/static/src/js/chrome/web_client.js @@ -83,7 +83,7 @@ return AbstractWebClient.extend({ action_buttons: true, headless: true, }; - self.action_manager.do_action(result).then(function () { + self.action_manager.doAction(result).then(function () { var form = self.action_manager.dialog_widget.views.form.controller; form.on("on_button_cancel", self.action_manager, self.action_manager.dialog_stop); form.on('record_saved', self, function() { @@ -110,7 +110,7 @@ return AbstractWebClient.extend({ .done(function(result) { var data = result[0]; if(data.action_id) { - self.action_manager.do_action(data.action_id[0]); + self.action_manager.doAction(data.action_id[0]); self.menu.open_action(data.action_id[0]); } else { var first_menu_id = self.menu.$el.find("a:first").data("menu"); @@ -140,11 +140,10 @@ return AbstractWebClient.extend({ self.menu.menu_click(state.menu_id); }); } else { - state._push_me = false; // no need to push state back... - self.action_manager.do_load_state(state, !!self._current_state).then(function () { - var action = self.action_manager.get_inner_action(); + self.action_manager.loadState(state, !!self._current_state).then(function () { + var action = self.action_manager.getCurrentAction(); if (action) { - self.menu.open_action(action.action_descr.id); + self.menu.open_action(action.id); } }); } @@ -163,10 +162,10 @@ return AbstractWebClient.extend({ .then(function (result) { return self.action_mutex.exec(function() { var completed = $.Deferred(); - $.when(self.action_manager.do_action(result, { + self.action_manager.doAction(result, { clear_breadcrumbs: true, action_menu_id: self.menu.current_menu, - })).fail(function() { + }).fail(function() { self.menu.open_menu(options.previous_menu_id); }).always(function() { completed.resolve(); |
