summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/abstract_controller.js
AgeCommit message (Collapse)Author
2021-05-28[FIX] web: add the context in the parameters of the rpc in the _renderBannerDjamel (otd)
Steps to reproduce the bug: - Install Accounting - Connect with a user who has a default company (e.g: Company A) and allowed companies (e.g: “Company A” and “Company B”) - Choose in the company selector “Company B” - Make sure that the onboarding panel in the default company has not been closed - Go to accounting and close the onboarding panel - Refresh the page Problem: The onboarding panel is still open because in the `account/account_dashboard_onboarding` method we check the`account_dashboard_onboarding_state` field of the default company instead of the current company because "allowed_company_ids" is not in the context This problem is also present in all the other views where an onboarding panel is present Solution: Add the context in the parameters of the rpc in the _renderBanner opw-2477148 closes odoo/odoo#71384 X-original-commit: 902950541f8c361e03821314aab4bf4f304ac37d Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com> Signed-off-by: Djamel Touati <DjamelTouati@users.noreply.github.com>
2020-08-12[IMP] web: sample data in reporting views (preparatory work)Mathieu Duckerts-Antoine
The present commit brings the global changes necessary to have sample data in the reporting views. This includes several modifications/ fixes of the sample server (many of them for better visual results). Task ID: 2282196 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-08-04[IMP] web: Optimize action model loadingJulien Mougenot
The loading of the action model extensions have been split in this commit: - when calling load, a first promise is returned. It is meant to be resolved as soon as all the query informations are available. - a second promise returned by a new method "isReady" is resolved when all of the extension data have been fetched. This difference allow to not wait for server calls irrelevant for the query. By default "isReady" will always wait for a full load call, but this is meant to be overridden in case optimisations can be made.
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-07-03[FIX] web: reload search panel before view modelMathieu Duckerts-Antoine
Problem: Go to the application apps, select accounting in the search panel, then filter on lunch in the search bar: the category all is displayed as selected in the search panel (accounting is no more a valid value since expand="0") but the application lunch does not appear in the kanban view. Root cause: The kanban model is reloaded with the old domain using accounting without waiting the search panel to be reloaded but it is only known after the search panel has been reloaded that the accounting value is no more valid and that all should be selected instead of accounting, thus that the domain used by the kanban model should be updated. Solution: The solution to the problem is simple: first reload the search panel, then reload the view model with the updated domain. X-original-commit: 8589babcd0f2c15433fe1eb06d0d745e80d01c22
2020-06-22[IMP] web: disable keyboard navigation with sample dataJulien Mougenot
Previous commit introduces the sample data feature in list and kanban views. When sample data is displayed, most parts of the renderers can't be clicked on, to prevent the user from interacting with sample records (e.g. to open a sample record in form view from the list). This commit disables keyboard navigation as well, as those sample records could still be accessed with the keyboard. To do so, several refactorings have been done in views: - _giveFocus function added on controllers (so that we can hook on the moment where we want to focus the renderer, and prevent it in sample mode), it kind of replaces giveFocus of ActionMixin which wasn't use from the outside - updateRendererState -> _updateRendererState as it is private - _setState function added on controllers, to have a hook when we set a new state (already existed, but only in kanban) - _renderView function moved from Basic to AbstractRenderer, so that we have a proper hook to deactivate clickable elements in sample mode Task 2232801 X-original-commit: 4482a03fe2f083f4f44fc6eb76d90ae22afbff91
2020-06-22[IMP] web: add support of "sample" attribute in viewsJérémy Hennecart
With this commit, it is now possible to display sample (fake) data in empty views, in the hope of easing user onboarding. This can be enabled (in list and kanban views) with attribute sample="1" on the arch root element. In this case, if there is no data to display, sample data will be generated based on heuristics (depending on field types and names). This can be used in addition to the no content helper. Task 2232801 X-original-commit: 7c8e627ff5029cb539d702705e5ce53d658c76ed Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Jérémy Hennecart <jeh@odoo.com> Co-authored-by: Julien Mougenot <jum@odoo.com>
2020-06-12[IMP] *: expand and hierarchize in search panelMathieu Duckerts-Antoine
The commit introduces two new attributes for search panel fields: - hierarchize: boolean attribute (default True) available for many2one fields with select="one". It allows to choose whether to hierarchize the field values using the _parent_name (if set) on the field comodel. Note that a sanitization of the parent hierarchy takes place. Basically, it ensures that parent chains are completely in the domain (on comodel) accessible by the user. See _search_panel_sanitized_parent_hierarchy documentation for more information. - expand: boolean attribute (default False) available for many2one and many2many fields. If set to true, all field values are fetched and displayed in the search panel. If set to false, only the values that have at least one corresponding value in the field model (and in some domain) are fetched. An exception in the case of an hierarchized field (hierarchize=True and _parent_name set): more/less values can be displayed in order to have a good representation of the parent hierarchy. That means we complete and sanitize the set of initial field image values. Note that the fix 8d57153b34c04952a85f6642951cb2697016da84 bringing the notion of limit in search panel has been reverted in the present commit. An upcomming commit will reintroduce the limit principle in a better way. Task ID: 2154749 Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Julien Mougenot <jum@odoo.com>
2020-05-27[FIX] web: mount owl renderer onceMichael Mattiello (mcm)
Before this commit, owl renderers were mounted twice. This commit makes owl renderers mounted just once as it should be X-original-commit: 9234aa5c5c7de2f7af23071a3ff76adf93e9cee7
2020-04-17[FIX] web,lunch: separate search panel domainJulien Mougenot
Before this commit, the SearchPanel widget was given a single unified domain coming from the view/controller. The issue was that some modules injected additional leaves in this domain and there was no way to remove them/separate them from the original view/controller domain. Now, another paramater (the `viewDomain`) is given to the SearchPanel, containing the distinct domain related to the view. The Lunch module has been adapted to give the `location` domain through this new key. Note that some tests steps had to be inverted since the method retreiving the domain of the view/controller is asynchronous (needed by Lunch to give time to the model to be loaded). It mainly concerns the RPC order which does not matter in this case. Task 2239706 closes odoo/odoo#49720 X-original-commit: e895e553899933be14c8abfd8c676b44a7f534d8 Signed-off-by: Julien Mougenot (jum) <jum@odoo.com> Signed-off-by: Aaron Bohy (aab) <aab@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-02-25[FIX] web: grouped list with pager: reset offset on searchaab-odoo
Have a grouped list view with enough groups to have several pages. Go to the second page, and toggle a filter s.t. it only remains a single page of groups. Before this commit, no group is displayed (like if there was no record matching the domain), whereas it should display groups of page 1. The issue occurs because we didn't reset the group offset to 0, like we do for the regular offset. Bug reported in the v13 migration pad. closes odoo/odoo#46257 X-original-commit: c6a4123b25e884495c5c44287d4d9fed061eeaa4 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-01-21[REF] web: pivot: use owl_compatibility toolsmcm-odoo
This commit changes ControllerAdapter to a mixin that inherits WidgetAdapterMixin and RendererWrapper now extends ComponentWrapper. This commit also changes PivotController base class/mixin and uses the Odoo legacy custom_events because of the adapter. closes odoo/odoo#43256 Related: odoo/enterprise#7744 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
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-12-09[IMP] web: add Odoo view compatibility for OWLVincent Schippefilt
Add a base class for a complete OWL renderer Add a compatibility layer for a Odoo controller that uses a OWL renderer. Co-authored-by: Pierre Rousseau <pro@odoo.com>
2019-10-29[FIX] mail: dicuss can save favorite filtersLucas Perais (lpe)
In discuss, make a search with some stuff, and try to save that filter as favorite Before this commit, there was a crash, because the Discuss action did not implement what the controllers do to save favorites. After this commit, it is possible to save a filter as favorite OPW 2087258 closes odoo/odoo#39519 X-original-commit: 5514a414324675bf5c2cc0360e429a7d2548b16f Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-09-20[MERGE] forward port branch saas-12.4 up to 4a1321bc99dChristophe Simonis
closes odoo/odoo#37127 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-09-17[MERGE] forward port branch saas-12.3 up to d8ce75466e4Christophe Simonis
2019-09-16[FIX] web: pass the context when executing an actionRomainLibert
In case you have a button of type action, the controller is doing an rpc on the model using the right method, but in this rpc, the context is not passed. This creates a translation problem (nothing is translated) since the language is not defined in the context. Task Id 2062419 Closes #36189 closes odoo/odoo#36969 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-08-16[IMP] web: keyboard navigation between searchbar and rendererJulien Mougenot
This change allows direct keyboard navigation between the current action searchbar and renderer. Focus can now be toggled using DOWN arrow when focusing the searchbar or the UP arrow when focusing the top cell/record of a kanban or a list.
2019-07-22[MERGE] Forward port of saas-12.3 to saas-12.4 up to fe4caecb59dMartin Trigaux
closes odoo/odoo#35059 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-18[FIX] web: execute action from new record and go backAaron Bohy
Let's assume a form view with a readonly many2one field with a default value. When creating a new record, the user can click on the many2one value, which should open the related record in a form view (stacked in the breadcrumbs). Before this rev., this didn't work: we actually came back to the previous view/action in the breadcrumbs, when trying to open the related record. closes odoo/odoo#33172 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-07-22[MERGE] Forward port of saas-12.4 to master up to aadc4a9f0be4Martin Trigaux
2019-07-19[IMP] web: searchpanel: keep scroll positionAaron Bohy
... when switching between controllers
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-05-13[MERGE] forward port branch saas-12.2 up to 243a4ae5cbcChristophe Simonis
2019-06-21[FIX] web: fix layout when banner and search_panelAaron Bohy
Before this rev., the layout was broken when a search_panel was used alongside the onboarding banner in a kanban view. Note that this usecase doesn't exist in standard. Closes #31986 closes odoo/odoo#34303 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-05-28[FIX] web: avoid flickering when click on action defined using href tagJigar Patel
Before this commit, Defining action using <a type="action"> outside of normal views(like qweb view) css style does not apply to it because missing the href tag. by defining href tag on a link will first open home screen then perform do_action thus it will do flickering. After this commit, Prevent event default behaviour so it will stop flickering and restore css style for action by defining href tag on it. closes odoo/odoo#33703 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-04-02[FIX] web: remove comfiguration panel without page refreshPriyanka Kakadiya
- This issue occurs after the upgrading latest bootstrap library While there is an action with data-toggle="collapse" on anchor tag and also any parent function which returns false, it will prevent the click event from bubbling to parent elements. Hence, It will not call the click event in bootstrap library, and configuration panel will not be removed unless you refresh the page - so, removed return statement as no need to return anything from the event function. Related to Issue: 1943483
2019-03-11[MERGE] forward port branch saas-12.1 up to 2b3296bbf8bChristophe Simonis
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-15[FIX] web: update domain when switching between viewsAaron Bohy
Let's assume the following scenario on an action with two multi records views (e.g. kanban and list). In the kanban view, activate a domain or groupby, switch to list view, remove the domain or groupby, switch back to kanban: the domain or groupby is still applied (even though it's no longer displayed in the search view). This is due to the jQuery update (ab56e637b7f9) and the use of native Promises (always async) instead of old jQuery 1.11 Deferreds (which where sync when already resolved). In the new version, the domain/context/groupby were added to the params a 'tick too late', so the view was updated without that information (and thus the old domain/context/groupby were kept). Issue reported on the jquery update pad. closes odoo/odoo#31859 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.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>
2019-02-01[IMP] web: control panel add on_detach_callbackRomeo Fragomeli
Adding event listener in on_attach_callback need to be removed in on_detach_callback. Before this commit on_detach_callback was not implemented in control panel. After this commit we can use on_detach_callback. Needed for task ID: 1934261 closes odoo/odoo#30758
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>
2019-01-29[ADD] web: server-side-rendered qweb templates as viewsXavier Morel
2019-01-29[IMP] web: prevent default in _onActionClickedXavier Morel
This avoids odd behaviour when leaving a `href="#"` on a link with target=action: without preventing the default behaviour, it would first switch to the application switcher (/web/#) then actually execute the action.
2019-01-29[IMP] web: action links from bits & piecesXavier Morel
Before this, the action manager only supported auto-triggering actions from (model, method) or (action_name). This adds support for providing all the action details via data attributes: * model (defaults to current action's) * resid (defaults to none) * views (defaults to list, form, unless resid is specified then defaults to just form) * domain (defaults to []) * context (defaults to {active_id, active_ids, active_model} from current action if the model has not changed, empty otherwise) The action's name/title is either the link's title (?) or its textual content.
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-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-10[FIX] onboarding: Fix/Update onboarding to v2.0eco-odoo
Specification ============= - Fix lots of bug due to the BS4 migration - Improve steps - Validate some steps (Like the company configuration) in all the onboarding bars if done in one onboarding bar. - Only animate the confetti one time if a step is done, instead of on each view loading For more information, see: https://www.odoo.com/web#id=1869513&action=333&active_id=965&model=project.task&view_type=form&menu_id=4720
2018-07-25[IMP] base_import, web: add view switcher and h 'Import' button in mobileHiral Bhavsar
As there are a few chance that someone will import something on a mobile view. So, we hide the button 'Import' in a mobile view. For mobile view, we added a view switcher button and it'll display a list of views buttons. Also set active view's icon as its icon. Related to Task: 1857696 Co-authored-by: Mohammed Shekha <msh@openerp.com>
2018-07-20[FIX] web: controller update now waits for _update to resolveeco-odoo
Before this, the deffered returned by _update was not taken into account.
2018-07-20[IMP] web: add option to display a banner above a vieweco-odoo
Add a banner_route attribute to AbstractView to allow fetching html from a controller route and displaying it above the view. The initial use case was the onboarding panels. Supported views are the ones inheriting both AbstractView and AbstractController.
2018-05-30[MERGE] forward port branch saas-11.3 up to 53300648edeChristophe Simonis
2018-05-29[MERGE] forward port branch saas-11.2 up to a2f275dfc48Christophe Simonis
2018-05-29[MERGE] forward port branch saas-11.3 up to 37eed7c509fChristophe Simonis
2018-05-28[FIX] web: Controller: concurrent control panel updatesAaron Bohy
Let's assume the following scenario: in a kanban view with a domain, remove that domain and quickly click on a record to open it in form view. On a slow network, it may happen that the reload of the kanban view (triggered by the domain change) returns after the load of the form view. Before this rev., when this happened, the form view was correctly displayed but the control panel contained the buttons, searchview, pager... of the kanban view. Note that this fix is quite ugly, but it won't be necessary anymore as soon as the control panel won't be shared between actions and controllers, i.e. as soon as each controller will have its own control panel.
2018-05-25[MERGE] forward port branch saas-11.2 up to 58e35522468Christophe Simonis