summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/chrome/action_manager_act_window.js
AgeCommit message (Collapse)Author
2021-05-03[FIX] web: no error on single active_ids state loadPhilémon van Helden
In eg. 13.0 when refreshing sales analysis action of a product, we would get an error because we have a single active_ids which is not expected by the code. With this commit, we use .toString() on the jQuery BBQ parsed active_ids as it was done before 32b8cec5 refactoring (january 2018). The added test with the fix fails with an error: TypeError: state.active_ids.split is not a function at Class.loadState (/web/static/src/js/chrome/action_manager_act_window.js) opw-2471982 closes odoo/odoo#70279 X-original-commit: bf9a985f4b62cc6f1eef4f9fcca2a8dfbd453004 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: pvh-odoo <SwagSamaSempai@users.noreply.github.com> Co-authored-by: Nicolas Lempereur <nle@odoo.com>
2020-08-04[IMP] web: Do not store search panel categoriesJulien Mougenot
This commit handles two things: 1) Move the local storage logic of the search panel into the documents module. 2) This allows for a variety of optimisations now that we do not have to constantly wait for a potential default value hidden in the storage. This is why this commit also introduces a way for the search panel model extension to sometimes return its query informations sooner than after being completely loaded. Task 2284207
2020-07-23[IMP] *: adapt modules to Owl search panelJulien Mougenot
Adaptation of the rest of the environment to the changes regarding the refactored search panel and model. This commit includes the following changes: - Since the control panel model is now part of the search model, the view widget is responsible of its instantiation with the appropriate API; creating an ActionModel holding the required model extensions. - The controller is now importing/exporting the state of the entire search model as well as the current state of the search panel (given throught its props). Changes have been made to adapt to this behaviour. - The multiple components linked to the control panel model have been adapted to reflect the changes brought to it (they will now listen to the "searchModel" instead of the "controlPanelModel"). - The `test_utils_create` methods have also been adapted to properly instantiate a searchModel Part of task 2228968 Co-authored-by: Julien Mougenot <jum@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-03-13[REF] web: Adapt views/actions to new control panelJulien Mougenot
Some web actions/controllers/viewsl have been adapted to properly instantiate the newly refactored control panel and update it accordingly. We needed to adapt the starting mechanism of actions and controllers to ensure that the control panel instantiation did not delay the loading of any widget. Part of task 2196029 Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-03-10[FIX] web: data-mobile on action_manager_act_windowRomain Estievenart
Commit ca4eaf4 introduced the data-mobile attribute, used to specify options to pass when executing an action, only in mobile (like using a fullscreen modal). However, we forgot to add the 'isMobile' check, so the option was passed in desktop as well. This commit fixes the issue and adds some tests. Task ID: 2155601 closes odoo/odoo#47333 X-original-commit: 6cb68a53106fa7326a7f818461418437d5a0df77 Signed-off-by: res-odoo <res-odoo@users.noreply.github.com>
2020-03-06[IMP] web: allow options on mobile inside the xml inside an ir_act_windowRomain Estievenart
Now if you use the data attribute 'data-mobile' inside a type="action", we can now send some specifics options on the dialogs. Here a sample to open an action dialog in fullscreen on mobile: Here the original action: ``` <button name="%(sign.action_sign_send_request)d" type="action" class="btn btn-primary btn-sm mt8 o_kanban_sign_send_request" context="{'sign_directly_without_mail': 0}">Send</button> ``` Now if you define the data-attribute data-mobile to allow fullscreen like: ``` <button name="%(sign.action_sign_send_request)d" type="action" class="btn btn-primary btn-sm mt8 o_kanban_sign_send_request" context="{'sign_directly_without_mail': 0}" data-mobile='{"fullscreen": true}'>Send</button> ``` Task ID: 2155601 X-original-commit: 66f99636d2d8bd850e33ed6c8f272eb662d835f7
2019-10-31[IMP] web: allow custom state in action mixinDamien Bouvy
Sometimes, it might be useful for an action (e.g. a client action, although this may be used by standard views as well) to include custom values in its state. Since the state of a 'fullscreen' action is pushed in the URL, this means that it is possible for the action to resume its state properly upon refresh of the page (before this commit, only some standard information were pushed to the state - action_id, menu_id, etc. for window actions and action's name, active_id, active_ids for client actions). By implementing the `getState` method, an extension of the action mixin can thus push any state it wishes to the URL. closes odoo/odoo#39529 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2019-10-10[REM] web: remove unused controller /apps/<app>Romain Derie
This controller never really worked in the last 3 versions. It was fixed in 11.3 with e9350993ca0 but broken with refactoring in 12.0 at a higher level with 19eacf7d23c9. It was even worse in 13.0 as it was leading to a traceback: `view_type` field got removed with 3cd7ed07a29c8 but this controller was still reading that field. closes odoo/odoo#38355 X-original-commit: a5c4e262449fef03d05d5250e4523832db5fbf00 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-09-27[FIX] web, *: button special not working to close dialogPriyanka Kakadiya
*: event_sale mail sale_product_connfigurator stock Before this commit: if we open dialog from acitivity view and try to discard it (i.e. close it), it throws traceback. Issue arises from following commits: https://github.com/odoo/odoo/commit/d3d576cf8ec9e5b5f6ae5f9d8845cf384435f12d https://github.com/odoo/odoo/commit/3210f108272be89f1a7b01f4e1816b7f04ae0a3b Previously, special attribute was passed directly, but now `on_close` gets action info as an object. After this commit, it passes special key as an object for `on_close`, also changed special action based logic in other modules. Task-Id 2072181 closes odoo/odoo#37078 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
2019-09-16[FIX] web: do not disable searchpanel on button clickedAaron Bohy
Before this rev., the searchpanel was automatically disabled (not present) in actions obtained by following links or buttons (e.g. stat buttons). This rev. removes this constraint, but adds the possibiliy to disable it by setting key 'search_panel' to false in the context. Note that in this case, the active categories are never retrieved from the local storage (i.e. the last one set). If no default is given, 'All' is simply selected (no domain). Task 2069310
2019-07-29[MERGE] forward port branch saas-12.4 up to cda4f3c308cChristophe Simonis
2019-07-26[MERGE] forward port branch saas-12.3 up to 40e8b67179fChristophe Simonis
2019-07-24[MERGE] Forward port of saas-12.2 to saas-12.3 up to 860ab5a1c28baMartin Trigaux
closes odoo/odoo#35119 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-19[FIX] web: remove lazyloaded controller from stackAaron Bohy
... if the current action can't be executed. Let's assume a form view for a record with a multicompany ir.rule. If the user switches to another company, the webclient is reloaded, but he doesn't have access to that record anymore. In this case, he is redirected to the Home menu. Before this rev., when he clicked on an app in this situation, it crashed. This was due to a leftover reference of the failed action (the lazyloaded, multi-record controller) in the controller stack. closes odoo/odoo#34994 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-06-14[MERGE] forward port branch saas-12.2 up to 498b4b4350dChristophe Simonis
2019-06-17[MERGE] forward port branch saas-12.3 up to 48a9f5a6335Christophe Simonis
2019-07-19[IMP] base,web*: searchpanel in all multi record viewsLucas Perais (lpe)
Before this rev. the searchpanel could only be activated in kanban views (and it was specified in the kanban arch). From now on, the searchpanel can be activated in any multi record view. It's arch is moved to the search view arch (inside the <searchpanel> tag). Task 1985921 Co-authored-by: Aaron Bohy <aab@odoo.com>
2019-06-06[MERGE] forward port branch saas-12.3 up to 409679866b2Christophe Simonis
2019-06-04[FIX] web: correct forward-port of e9350993ca0b81df17308766d7e26d458bc39520Christophe Simonis
2019-06-03[MERGE] forward port branch saas-12.2 up to 995aa1685eeChristophe Simonis
2019-05-31[MERGE] forward port branch 12.0 up to 8f21148e1a8Christophe Simonis
2019-06-05[IMP] *: use new helper config.isDebug()Romain Derie
Before this commit, both config and session were aliases to odoo.debug. Now, config.isDebug() should be call, with possibility to pass a parameter to check if we are in a specific debug mode such as 'tests' or 'assets'. task-1934445 Coming with https://github.com/odoo/enterprise/pull/4281 Closes https://github.com/odoo/odoo/pull/33213
2019-05-29[MERGE] forward port branch saas-11.3 up to 8a0e819d0bbChristophe Simonis
2019-05-27[FIX] web: restore /apps/<app> controllerRomain Derie
Since JS refactoring of ActionManager at 32b8cec536, the /apps/<app> controller was not working anymore as the refactoring dropped the support of `sa` as URL state. closes odoo/odoo#33679 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-06-03[FIX] web: log missing view warning rather than errorDavid Monjoie
The point of this warning is to help a view developer realize that his view is not loaded at all. However, console 'error' and 'warn' are observed by the runbot clickall tour as meaningful errors regarding a build resulting status. It makes sense, but it is an issue for community modules which have a gantt view that only exists in Enterprise. We don't want to create a bridge module for each and every module which uses a view that only exists in Enterprise, so we need to live with this warning. Since its purpose is for developers only, they can read the log and notice the error even if we use console.log rather than console.error, and that will not alter the result of the runbot clickall tour. closes odoo/odoo#33814 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-05-02[IMP] web: various small improvements to form viewGéry Debongnie
This commit is a few small improvement/fixes to the web framework: - allow placeholder attribute on input tags in form view - only bind click event handler to buttons managed by the framework, not custom ones - _onExecuteAction method in action manager properly fails if event cannot be properly handled closes odoo/odoo#32458 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-03-06[FIX] web: update breadcrumbs when switching viewMartin Geubelle
To reproduce: 1. go on list view 2. open record in form view 3. come back on list view 4. switch to kanban 5. open record in form view 6. click on breadcrumb Before this rev. we were back on the list view, and not the kanban view. This is due to the fact that the breadcrumb was not updated when switching view, (if a controller was already existing) so the form view control panel breadcrumb was still referencing the wrong (list) controller. This bug appeared with the control panel refactoring, which is now managed by the view itself (and not the action manager as previously). Task 1932646 closes odoo/odoo#31598 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-03-22[FIX] *: pass context in kwargs in rpc callsRaphael Collet
2019-03-15[IMP] web: only display missing view erorr in debug assetsDavid Monjoie
This error is there to help developpers realize their view has not been loaded due to an error. However, we have cases where we define actions containing views that only exist in Enterprise to avoid creating an entire bridge module just to add one view to an action. The error was triggered in this case which resulted in a red build for the click all runbot test, even though this was not really a true error, as it was intended. This commit changes the error to only appear in debug=assets such that it will no longer put the click all runbot tour red while still providing help for the developper trying to debug his view since he will need to be in debug=assets to debug his view anyway. closes odoo/odoo#31884 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-03-13[MERGE] forward port branch saas-12.2 up to c9f832d9f03Christophe Simonis
closes odoo/odoo#31790 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-06[REF] web: adapt code after jQuery updateVincent Schippefilt
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2018-12-19[FIX] web: fetch toolbar info for target=current actionsAaron Bohy
The 'Actions' menu displayed in the control panel (aka sidebar, or toolbar), wasn't displayed anymore since the control panel refactoring of 4cd379cf6e. Rev. c1752b834 correctly made it appear again in list and form views. However, there was another issue as the additional model-related items (like Print, or custom actions) weren't fetched anymore. Thus, the sidebar only contained the default 'Export' and 'Delete' actions. This rev. fixes the second issue. fixes #29546 closes odoo/odoo#29633
2018-12-12[MERGE] forward port branch 12.0 up to 047e2b28de4Christophe Simonis
2018-12-11[MERGE] forward port branch saas-11.3 up to 55dafc20f6bChristophe Simonis
2018-12-11[FIX] web: correct load act_window with empty idMartin Geubelle
There was a traceback when reloading the webclient with an act_window and an empty id in the URL (ex: after saving Settings). A `read` without id was peformed when loading data instead of a `default_get`. Before rev. odoo/odoo@40dd121 the action environment was generated by the ActionManagerActWindow, which was currently defaulting the `currentId`. Now that this is not the case anymore, the `loadState` should have this responsability. Task 1902826 closes odoo/odoo#29411
2018-12-07[REF] web: move ControlPanel inside controllers/actionsGéry Debongnie
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>
2018-12-05[FIX] web: exclude orderedBy when changing actionLucas Perais (lpe)
When activating a filter on a list view, the environment of the action contained a context with an orderedBy key which was then used by every controller and model in the various parallel flows, i.e. changing actions After this commit, we prevent it by excluding the key when executing an action OPW 1913190, 1914019 closes #29190
2018-11-16[MERGE] forward port branch 12.0 up to bc744a1da46Christophe Simonis
2018-11-14[FIX] web: restore formview mode when coming back (breadcrumbs)Géry Debongnie
Before this commit, when the user is in a form view (edit mode) and click on a stat button, a new action is added to the action stack. When the user then comes back to the form view by clicking on the breadcrumb, it is supposed to be in readonly mode. Before this commit, this was not the case. This bug comes from the action manager refactoring, which removed the view manager. With this commit, we add a new action lifecycle method which is called when the action is restored. Note that this commit implicitely changes the semantic of actions with 'target=inline'. As far as I can tell, this only applies to the settings form view, which can easily be fixed by overriding the restore hook. closes odoo/odoo#28663
2018-10-23[REF] web: small refactoring pass on some web componentsAaron Bohy
(mainly views and ActionManager) - add missing docstrings - fix typos - correctly order functions and imports - put functions in correct sections - stop using 'event' as argument of handlers - don't call handlers directly - remove trailing spaces/tabs - move module created in stable version to its own file - follow js guidelines in general closes odoo/odoo#28024
2018-10-01[MERGE] forward port branch saas-11.4 up to 57e387b6452Christophe Simonis
2018-10-01[MERGE] forward port branch saas-11.3 up to e980af9df00Christophe Simonis
2018-09-27[FIX] web: handle lazy load with previous actionsMartin Geubelle
Before this rev. the lazy loading of views was correctly handled if there was only one action in the action stack (which is usually the case when performing a F5, the main use case of the view lazy loading). Nevertheless, it might happen that the lazy-loading is used in top of other actions (when performing a `doAction` with a form view for an action with another view as first view, i.e. when leaving Studio while editing the form view). The controller was `unshift` in the case (put in the first position of the controller stack), which is not correct. This causes the breadcrumb to be misordered and a traceback occured when trying to access a breadcrumb element. Co-authored-by: Aaron Bohy <aab@odoo.com>
2018-09-04[REF] web: improved fix from 'Edit View: X' (017e7132)Alexandre Kühn
Revision on https://github.com/odoo/odoo/commit/017e71322b6b7f0c232f0d66ba659a5972fc3534 Commit above correctly fixes an issue with 'Edit View: X' menu item in the debug manager, in which the name of the view was missing. To do so, it lets the controller be aware of the name of the view, so that it can be used in the template of the debug menu. However, we think there is a much better solution to fixing this issue: since the debug manager has knowledge of the view action, we can extend this object with the name of the view. This is exactly what this commit does: extend the action view object so that it knows the name of the view. That way, the template is much more readable, as `view.displayName` is more meaningful than `controller.viewName`. Task-ID 1878254
2018-08-14[MERGE] forward port branch saas-11.4 up to dabe59df9c8Christophe Simonis
2018-08-14[IMP] web: new TimeRangeMenu widget in search viewMathieu Duckerts-Antoine
This commit introduces a new widget 'TimeRangeMenu' used in the search view. It allows a user to easily: - search data with a given date or datetime field value in a specified period of time - compare the data of interest with data of the previous period or the previous year. The time range menu is available in the search view when one of the four following view types is instantiated: graph, pivot, cohort, or dashboard. Task Id: 1835644
2018-08-13[IMP] web: add infos key to on_close from special actionSimon Lejeune
2018-08-01[MERGE] forward port branch saas-11.4 up to 8d9366197e1Christophe Simonis
2018-07-24[MERGE] forward port branch saas-11.2 up to 3c521f6d05cChristophe Simonis
2018-07-23[FIX] web: no traceback on button call action of type `'button'`.Priyanka Kakadiya
Before this commit, there was a traceback when clicking on a button that generates a button call action with type `'button'`. This is due to the handler of such an action that assumes only a small set of button actions. Each of those cases correctly sets the local variable `def` to a deferred, so that the post-processing is correct (i.e. it handles this variable as a deferred). However, this is wrong with a different button call action, so that this variable is `undefined` instead of a deferred. This commit fixes the issue by ensuring that the variable `def` is always a deferred. As a result, the post-processing can make the correct assumption that this variable is a deferred. Steps to reproduce: - Install Google Drive Integration app - Go to General Settings - In the category "Google Drive", click on "Get Authorization Code" (displayed as "Get Author...") Task-ID 1861630