summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/abstract_view.js
AgeCommit message (Collapse)Author
2019-04-02[IMP] web,base: put buttons in list group headersMartin Geubelle
It is now possible to put buttons in the list view group headers. When the view is grouped by a many2one field, those buttons appear next to the header title when the group is opened. The buttons are specified in the views in a <groupby> tag in the list arch, with the following structure: <groupby name="groupedField"> <!-- must be a many2one --> <button type="object" name="my_method" string="Button1"/> </groupby> It is also possible to add `field`, inside the `groupby` which can be used for modifiers. These fields thus belong on the many2one comodel, like: <groupby name="partner_id"> <field name="name"/> <!-- name of partner_id --> <button type="object" name="my_method" string="Button1" attrs="{'invisible': [('name', '=', 'Georges')]}"/> </groupby> These extra fields are fetched in batch when grouping on the field. Part of task 1915702
2019-04-01[IMP] web: graph view improvementsMathieu Duckerts-Antoine
This commit extends the support of comparison mode for the graph view and refine the tooltips and rendering in line mode. The graph view code has also been slightly refactored. Task ID: 1946138
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-28[MERGE] forward port branch saas-12.1 up to f9d3b5b7dfeChristophe Simonis
2019-02-26[FIX] web: search more in many2one: filter on idsAaron Bohy
Let's assume a many2one field with a lot of possible values. The user clicks on 'Search More...'. In the opened dialog, only 160 records are available (their ids have been obtained with a name_search, with the optional text the user could have typed in the many2one input). Before 4cd379cf, that extra domain on ids was removed automatically as soon as the user interacted with the search view in the dialog. This was especially useful when there were more than 160 records. However, this was rather an happy coincidence than a designed feature. From 4cd379cf, the ids selection was added to the initial domain of the list, so they couldn't be removed from the domain afterwards. The user was thus stucked with its preselected 160 records. This rev. doesn't restore the former behavior, but rather improves the current one, as follows: - when there is no text in the many2one input (i.e. no value to filter on), we bypass the name_search, s.t. all records are available in the dialog - when there is some text in the input, we perform a name_search (as before) to get a list of record ids, and we add a special filter to the search view in the dialog (the filter on those ids), s.t. the user can remove it if he wants to access the remaining records. - finally, the limit is now set to 320, to mitigate the problem Issue reported on the saas-12.1 migration pad. closes odoo/odoo#31232
2019-02-13[IMP] web: add kanban searchPanelAaron Bohy
This rev. defines a searchPanel widget used in Kanban views to refine search according to specific dimensions. This wigdet is displayed as a sidebar to the left of the kanban view. Part of task 1892462 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Raphael Collet <rco@odoo.com>
2019-02-13[IMP] web: force activeActions to be booleanAaron Bohy
The docstring says they are boolean, but they actually aren't (e.g. edit="0" in the arch would lead to activeActions.edit=0). This could cause issue if that value is used to toggle a class with jQuery, as in this case the flag argument *must* be a boolean.
2018-12-11[FIX] web: display action menu in form/list viewGéry Debongnie
The recent refactoring of the control panel moved the sidebar management from the action manager to the view itself. However, the sidebar parameter was forgotten, which resulted in the fact that it was no longer created. This fix was a little tricky, because the sidebar needs to be instantiated in some tests, but not in most of them (in particular, the document application changes its behaviour, which is annoying). closes odoo/odoo#29389
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-11-29[MERGE] forward port branch 12.0 up to 82a1e1dcc33Christophe Simonis
2018-11-29[MERGE] forward port branch saas-11.3 up to c0eef427111Christophe Simonis
2018-11-28[MERGE] forward port branch 11.0 up to bb6f6c57f97Christophe Simonis
2018-11-28[FIX] web: context orderedBy not propagated to x2mLucas Perais (lpe)
Have: - Model A with a x2m to model B - Object A with multiple objects B in x2m (that will be sorted) - On the list view of model A, click on a column to sort by a field - this field shall not exist in B - open a record A (towards form view) Before this commit, the sorting of the x2m crashed, because the key orderedBy was propagated Due to commit e713ed2a69af9fe97fbe2d54843adc8f1ce689aa After this commit, it doesn't crash OPW 1913133 closes odoo/odoo#29094
2018-11-06[MERGE] forward port branch 12.0 up to dd70c684268Christophe Simonis
2018-11-06[FIX] web: accept field name as a groupby descriptorGéry Debongnie
In some cases, and for historical reasons, the groupby property can be expressed as a string (for example, 'stage_id') instead of a list of strings (for example, ['stage_id']). However, the support was not complete. A crash could happen in some cases. For example, if there is a group_by: 'stage_id' property in the context of an action, it works in list view, but adding that view to the dashboard would result in a crash, without this commit.
2018-10-19[FIX] web: kanban quick create when grouped by selectionAaron Bohy
Rev. 42e1efded5 aimed to disable the quick create feature when grouped by date(time) fields, by only enabling it for char, boolean and many2one fields. However, the selection case is quite important and must be handled as well. This is what this rev. does. Task 1878254
2018-10-19[MERGE] forward port branch 11.0 up to 22a13073f0eChristophe Simonis
2018-10-19[FIX] web: kanban quick create properly disabledAaron Bohy
when grouped on field types for which it isn't supported. Rev. 42e1efd disabled the quick create feature when the view is grouped by date(time) fields. However, it hasn't been correctly forwardported to 11.0 (with the new views). Indeed, the check was done only once, at the initilization of the view. So if the user selected another field to group by afterwards, the quick create feature wasn't enabled/disabled accordingly. Moreover, we didn't check if it was available when the user clicked on CREATE in the control panel. So even if it wasn't (and thus if there were no '+' icon in the columns), when the user clicked on CREATE, the quick create widget was inserted in the first column. This rev. fixes both issues. Task 1878254 closes odoo/odoo#27867
2018-10-22[MERGE] forward port branch saas-11.4 up to 3c108977c1eChristophe Simonis
2018-10-19[MERGE] forward port branch saas-11.3 up to d82a9077289Christophe Simonis
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-09-25[FIX] web: display empty pie chart for embedded viewAdrien Dieudonne
Before this commit, every pie chart without any data displayed the non content helper in the middle of the screen. This behavior is intended most of the time except for embedded pie chart (such as in the dashboard views). Now, an embedded pie chart without any data is rendered and displays the error message in the middle of it. We had to render it with nv.d3 to match the size of the other graph in comparison mode. Another commit in enterprise will add a test for this fix. For the moment, embedded empty pie charts are only used on dasboard views.
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-09-03[FIX] web: display view name in debug menu ('Edit View: X')Alexandre Kühn
Revision on https://github.com/odoo/odoo/commit/f7fbe8adffb1ee585c8171f6c86d38145c11848d The commit above wrongly assumes that the object 'view' is an instance of the view class. As a result, the property `display_name` was undefined. This commit fixes the issue by letting the controller remember the name of the view in a similar was as the type of the view. That way, the name of the view can simply be retrieved from the instance of the controller class. Task-ID 1878254
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-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-06-12[IMP] web: add support for interval selection in groupbysMathieu Duckerts-Antoine
In this commit, we extend the search view to allow the selection of some intervals for date or datetime fields in groupby menu. The valid intervals are day, week, month, quarter, and year. It is also possible to add a button 'Group By' in the control panel owned by a graph view in case it is declared 'embedded' (e.g. in a dashboard view). Note that have three new generic reusable widgets have been introduced in this commit: DropdownMenu, GroupByMenu, and FiltersMenu.
2018-05-04[FIX] web: one2many form view with action buttonAaron Bohy
Assume a one2many field inside a form, displaying field A in its list view, and a field B in its (dialog) form view. Moreover, there is an action button in the dialog, which updates the value of B. Before this rev., B wasn't correctly reloaded when the button was clicked, because the BasicModel reloaded the fields on the list view (i.e. field A), whereas it should reload the fields in both views. This fix is twofold. First, we force the viewType to 'form' when the record is reloaded, instead of the default ('list'), so that fields in the form view are correctly reloaded. Second, when we open the form view in the dialog, we add the fields of the list view to the dict of fields of the form view, so that the form is aware of those fields and can ask the model to reload them (still without displaying them). Fixes #24189
2018-02-12[MERGE] forward port branch saas-11.1 up to c69d00157edChristophe Simonis
2018-02-08[FIX] web: Views: always destroy BasicModel instancesChristophe Matthieu
Before this rev., it might happen that the parent of BasicModel instances wasn't correctly set to the Controller instance. It was actually set to the ActionManager instance, which is never destroyed. So when this happened, the BasicModel instance wasn't destroyed when it's controller was.
2018-02-08[FIX] web: Views: always destroy BasicModel instancesChristophe Matthieu
Before this rev., it might happen that the parent of BasicModel instances wasn't correctly set to the Controller instance. It was actually set to the ActionManager instance, which is never destroyed. So when this happened, the BasicModel instance wasn't destroyed when it's controller was.
2018-01-26[REF] web,*: move fvg processing from DataManager to ViewsGéry Debongnie
*: mail, web_diagram
2018-01-26[REF] web: move _loadSubviews() from FormViewGéry Debongnie
... as this function is only used by the FormView.
2018-01-25[IMP] web: hide group by option in search view for calendar viewPrakash Prajapati
2018-01-16[REF] web,*: ActionManager/ViewManager refactoringAaron Bohy
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.
2017-12-04[FIX] web(_diagram): set viewType on viewsAaron Bohy
The attibute was correctly set on form, list and kanban views, but not on the other ones. It wasn't really used until now, so it wasn't a big deal.
2017-11-28[MERGE] forward port branch 11.0 up to 8fb25e185bbChristophe Simonis
2017-11-28[MERGE] forward port branch saas-16 up to 3f66814a0d0Christophe Simonis
2017-11-23[REF] web,*: give evaluated contexts to load_viewsAaron Bohy
*board,sale_timesheet This rev. changes the API of load_views, as it now assumes that the given context has no longer to be evaluated. This is more convenient that way, as we can now call load_views with contexts that are dict, and not instances of the Context class.
2017-11-20[FIX] web: add support for limit attr in arch in sub tree viewGéry Debongnie
Before this commit, the 'limit' attribtue worked properly for list views (but was not documented), and was ignored for inline tree views. There was no good reason for that limitation, so we fix this issue.
2017-10-13[MERGE] forward port branch saas-16 up to 8ee9024a4c8Christophe Simonis
2017-10-12[FIX] web: allow widget many2many_tags to display more than 40 recordsGéry Debongnie
Before this commit, the widget many2many_tags only loaded the first 40 records. This was difficult to see, because there were not so many views with a lot of tags.
2017-09-19[MERGE] forward port branch saas-17 up to 2a343d7c9c4Christophe Simonis
2017-09-19[MERGE] forward port branch saas-16 up to c3a48da767bChristophe Simonis
2017-09-19[FIX] web: FormView: invisible='True' on x2many fieldsDarshan Kalola
Before this rev., it crashed if an x2many field had the attr invisible set to 'True' in a form view.
2017-09-12[MERGE] forward port branch saas-17 up to d08b4407be3Christophe Simonis
2017-09-11[MERGE] forward port branch saas-16 up to 295a377e5d4Christophe Simonis
2017-09-11[FIX] web: evaluate the view context for the subviews not inlinefwi-odoo
Before this commit, the xml attributes defined with 'context.get(key)' in the subviews not inline were not evaluated correctly. This was caused by the loss of the one context in the '_loadSubviews' method. This commit fixes this issue and modifies the mockserver in order to be able to use the parameter 'viewOptions.context'.
2017-08-31[IMP] web: lazy load nvd3, ace and fullCalendar lib to reduce asset sizeChristophe Matthieu
2017-08-10[MERGE] forward port branch saas-16 up to 85571bb78c9Christophe Simonis