summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/control_panel/control_panel_model.js
AgeCommit message (Collapse)Author
2020-07-23[IMP] web: Model: extensions registryJulien Mougenot
Refactoring of the Model class of `model.js` to support multiple extensions. The purpose is to build a model having the appropriate modules for a given situation. For instance, we don't need the control panel model if we don't have a control panel to start with. Some logic of the control panel model (which was until now the "main" search model) has been given to another model extension named "Search Model Extension" which will synchronize the informations of all models providing search data (domain, context, etc.). The model instantiated in the actions/views is now an instance of the "Action Model" (which directly extends the Model) and is meant to replace the view model in the long term. It might however need some improvements to hold such a role (partial interface rendering, etc.). Part of task 2228968 Co-authored-by: Julien Mougenot <jum@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-07-14[FIX] web: Properly handle default favorite filtersJulien Mougenot
Before this commit, the default active favorite filter was determined by its ID given by the control panel. These IDs start at index 0, meaning that if a condition checks for the value of such an ID, it could be false even though the ID and its filter exists. Now the indexation starts at 1 to avoid such problems. closes odoo/odoo#54435 X-original-commit: cfb7bbea1b428a062ee08ca045509d189b1fd1d4 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-07-06[FIX] web: do no try to render filters referencing access restricted fieldsXavier ALT
In case a field is limited to specific groups on the model, those fields are discarded from `fields_view_get()` but can still be referenced by some filters on the search view causing a traceback (see #53797) Model: ```python class MyModel(models.Model): my_field = fields.Char(groups='base.group_system') ``` Search views: ```xml <search string="My Model"> <filter name="group_myfield" context="{'group_by': 'my_field'}"/> </search> ``` This commit ensure those filter are correctly discarded. OPW-2284621 closes odoo/odoo#54112 X-original-commit: b3452a1863c36290b13e16161e2703d9a3737f0e Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-07-03[FIX] web: Support widgets in search viewJulien Mougenot
Since the refactor of the control panel, support of "widgets" attributes in the search view archs has been inadvertently dropped. Now, they are once again supported. Task 2061795 closes odoo/odoo#54066 X-original-commit: f33b0bc7a93e60bd0ed00b40d7459225ec0b749a Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-06-30[FIX] web: Allow default favorite filter over search defaultJulien Mougenot
Before this commit, when a search_default on a many2one field tried to update its label after a name_get, the value was set on its initial associated query element which could have been erased by a default favorite. Now, the model determines whether there is a default favorite before processing default filters, preventing any unnecessary RPC. closes odoo/odoo#53840 X-original-commit: ff834d0ba6f9b7eadc23c28dbbf892eba2058583 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-06-25[FIX] web: in search view, use modifiers to determine if filter is invisibleXavier ALT
In search view, the "invisible" attribute can use complex expression, and so we must rely on the "modifiers" attribute set by the ir.ui.view post-processing to determine if a filter should be invisible or not. For example, considering the context {'hide_myfilter': False}, the following view: ```xml <search> ... <filter name="myfilter" string="My Filter" invisible="context.get('hide_myfilter')"/> ... </search> ``` Will be returned as such by the server: ```xml <search> ... <filter name="myfilter" string="My Filter" invisible="context.get('hide_myfilter')" modifiers="{&quot;invisible&quot;: false}"/> ... </search> ``` After this commit, the filter "myfilter" will correctly be shown. OPW-2243639 closes odoo/odoo#53690 X-original-commit: 00969326e24dadd9b3f6e026789a1e575dd1c8dc Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Julien Mougenot (jum) <jum@odoo.com> Signed-off-by: Xavier ALT <xavieralt@users.noreply.github.com>
2020-06-04[IMP] web: Comparison menuMathieu Duckerts-Antoine
This commit replaces the "time range menu" in the control panel by a new component: the "comparison menu". Its purpose is roughly the same: compare a period of data in a reporting view with the previous period or the previous year. Its implementation is a bit simpler: it will only appear if at least one date filter is selected in the search view, and will suggest to compare each selected date option with the previous period or the previous year. Task ID: 2245719 Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Julien Mougenot <jum@odoo.com>
2020-05-11[FIX] web: do not use groupbys in views not groupableMohammed Shekha
Before this commit: A problem occurs with kanban views that are not groupable (i.e. for which searchMenuTypes does not contain 'groupBy'): if the action has a default groupby (set in Studio for instance) then it is still applied and causes crashes. That happens in the documents kanban view for instance. More generally, if a view is not groupable, some information on groupbys can appear in the interface (in a facet) while not used/useful for the view. After this commit: - if a kanban view is not groupable, a default groupby will never be applied. - if a view is not groupable, we ensures that - the search query generated in the control panel has groupBy = [], - groupbys cannot be represented in a facet. closes odoo/odoo#51041 X-original-commit: 91c80291e90127792623476d8997fd2a67569170 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
2020-03-20[FIX] web: do not activate falsy search defaultsMathieu Duckerts-Antoine
Before this commit, if an action context would contain a key/value pair like search_default_foo : 0 the filter foo would be activated, while it should be not considered as default. The present commit fixes that situation. closes odoo/odoo#47958 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-13[REF] web: Control panel OwlJulien Mougenot
Refactoring of the control panel with the Owl framework. The MVC structure of the control panel has been changed to a 'component <-> model' relationship. As such: - Removed the old control panel: view/model/controller/renderer - Created a new Owl Component (ControlPanel) - Created a new class: the Model (an Owl Store did not fit here) and a newly designed ControlPanelModel extending it Refactored all inner subcomponents, including: - Pager - ActionMenus (peviously SideBar) - Filter menu > Custom filter item - Group by menu > Custom group by item > Removal of groupby_menu_mixin (and refactored graph controller in sibling commit) - Time range menu - Favorite menu > Custom favorite item > Moved the favorite menu registry to the favorite_menu file - Search bar > Removed and splitted auto-completion dropdown logic between the new SearchBar Component (descriptions) and to the new ControlPanelModel (domains). The templates (all in web/base.xml) have been adapted to the new standards. Most of the DOM structure remains unchanged with some occasional improvements (replace hiding with not rendering, removed pointless wrapper divs, etc.). Part of task 2196029 Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>