summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/pivot/pivot_controller.js
AgeCommit message (Collapse)Author
2020-08-14[FIX] web: pivot: avoid to toggle invalid measureMathieu Duckerts-Antoine
Before this commit, click on the divider in the menu 'Measures' of the pivot control panel would cause a crash. The present commit fixes that situation. We also bring another small correction: the menu won't close if one clicks on the measure list but not exactly on a menu item or the divider. closes odoo/odoo#55902 X-original-commit: aad9f3fd7499ef8b660cc25fea840a34d70f75a6 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com> Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-08-12[IMP] web: sample data in pivot viewAaron Bohy
A previous commit has paved the way for displaying sample data in the reporting views. The present commit brings the required changes to have sample data in pivot views. Task ID: 2282196 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
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-11[IMP] web: allow to add buttons to pivot controllerPierre Rousseau
This is useful for the integration of pivot views with spreadsheet Task-ID: 2168016
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-01-28[IMP] web: change pivot download file from xls to xlsxMohammed Shekha
before this commit: file was downloaded in xls format, which supports maximum 256 columns and 65536 rows. after this commit: pivot returns xlsx file when table printed and downloaded, we have support of xlsxwriter, xlsx file supports 16384 columns and 1048576 rows task-2127388
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-12-09[REF] web: rewrite pivot view renderer with OWLPierre Rousseau
Because the webclient and other higher level components such as the actionManager are not yet rewritten in OWL, we cannot make a complete migration of the controller and the model to a more OWL-ish code. We have rewritten the renderer completely in OWL, it uses more extensively a template and manages its own state and its sub-components. We did not rewrite the controller, however we have made it inherit from `web.ControllerAdapter` which is a thin compatibility layer used when a odoo controller uses a OWL renderer. In the tests, the only changes are that all the events triggered by the test and handled by OWL must be triggered on DOM nodes directly and not on JQuery elements. closes odoo/odoo#39491 Related: odoo/enterprise#7135 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com> Co-authored-by: VincentSchippefilt <vsc@odoo.com> Co-authored-by: pro-odoo <pro@odoo.com>
2019-11-29[FIX] web: fix RTL pivot view dropdownJason Van Malder
Reproduce the issue - Load Arabic language - Install Sales - Report > Sales - Switch to arabic - Click on the pivot view to display the dropdown The dropdown position is incorrect Cause The calculations are based on a `left` value who is weird. This commit use the mouse X position to compute the `left` value. OPW-2146210 X-original-commit: d021f4257c87863b75f148c4809f5e2797a1e99f
2019-09-18[IMP] web: PivotView: display grouped columns on mobileAdrien Dieudonne
Before this commit, only "Total" column was shown on mobile and it wasn't possible to add another one. (1) Now, we let the user to add it even if he probably will have to scroll horizontally. (2) The "Flip" button has been reintroduced like in desktop. (3) By default, the old behavior will remain the same (only one colum will be displayed) but to avoid frustrating for users who always have to add manually columns to see the same information as in desktop; you can use favorite filters. In this case, all columns will be displayed. Task ID : 1945893 opw-1935645 closes odoo/odoo#37057 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-09-12[FIX] web: click on an embedded pivot view cell does not causes a crashMathieu Duckerts-Antoine
The custom event 'open_view' triggered by the pivot renderer was not stopped in the pivot controller. This used to cause a crash because the dashboard controller also listens to a custom event with the same name but following another logic. The present fix simply stop the propagaton of the event. A test has been added in the module web_dashboard. closes odoo/odoo#36466 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-08-27[FIX] web: crashmanager wrong syntax of arrow functionMohammed Shekha
arrow function used for error handler and error function is defined inside inner function so this will get changed, need to use self, also arrow function doesn't have its own arguments object, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions Issue raised from following commit: https://github.com/odoo/odoo/commit/2d6dc75a2cb5fa81189920d0f7fdc7b7f12132ab task-2052484 closes odoo/odoo#35788 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
2019-08-02[REF] *: pivot view refactoringMathieu Duckerts-Antoine
The main aim of the present refactoring is twofold: - simplify the code that was largely complexified at the time of the introduction of comparisons in the pivot view (Time Ranges menu), - factorize the method expandHeader and _loadData that were too much complex. Along the way, the pivot model structure has been simplified and many tests have been added. Performances in mobile mode have been improved by avoiding unecessary operations due to useless column groupbys in that mode. It should now be easier to understand and modify the pivot view in future. Co-Authored-By: Aaron Bohy <aab@odoo.com> closes odoo/odoo#33615 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-07-30[FIX] web, *: make crash_manager use services correctlyfja-odoo
* = website_forum, stock Fix for: https://github.com/odoo/odoo/pull/32132 crash_manager.js was using the services while bypassing ServiceProviderMixin That means all services are duplicated, each having their own state. To fix this issue, CrashManager now extends AbstractService. Also crash_manager is now registered in serviceRegistry instead of being instanciated on the fly. The crash_manager now being a Service raise one issue with the tests: The services are not run for the tests but some tests needs the crash_manager 'unhandledrejection' listener. For that matter the services are reenable in qunit. Also the crash_manager's 'unhandledrejection' listener has to have precedence over the qunit listener as it will handle rejections wich have no reason or are not Errors. Part of: https://github.com/odoo/odoo/pull/35209
2019-06-27[MERGE] forward port branch saas-12.4 up to 5e81b18e24aChristophe Simonis
2019-06-17[FIX] web: highlight clickable pivot cells on hoverAnshuman Sharma
After a recent reorganization of the web client's components tree, the class 'o_enable_linking' was added on the wrong element. This made the css rule responsible of the highlighting of the clickable pivot cells impossible to satisfy. This commit fixes the issue by adding the class directly in the template 'PivotView'. Additionally, this commit also makes visually clear when a field selection menu-items is disabled (because it is already used) using a 'not-allowed' cursor (which was removed in bs4). It is now again possible to open a list view by clicking on a cell with zero value (like in Odoo 11). task-1916889 closes odoo/odoo#34165 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-06-17[IMP] *: remove 'view_type' on window actions.Hiral Bhavsar
The old tree views don't really exist anymore, this odd pseudo-flag to dispatch between "list" and "tree" tree views has no reason to remain. Task 1937686 closes odoo/odoo#31243 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-01-09[MERGE] forward port branch 12.0 up to 3e4138deaa2Christophe Simonis
closes odoo/odoo#30045
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-18[FIX] web: sort pivot rows in comparison modeMathieu Duckerts-Antoine
Before this commit, it was not possible to sort the rows of a pivot view while in comparison mode. This fix makes it now possible. Note that in comparison mode, a click on a header of type "measure" will sort the rows according to the column values coming from the data of interest. closes odoo/odoo#28411
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-26[FIX] web: menu items are now correctly sorted by alphabetical ordersvs-odoo
Menu items for measures list are now sorted by their 'string' value. We set that string in lowercase because uppercase/lowercase influences string comparison, so we are sure to compare always strings with the same case. This fix is effective for pivot view, cohord view and graph board. Task #1882576
2018-09-04[FIX] web: disable buttons when no data presented in pivot viewMathieu Duckerts-Antoine
The buttons 'Flip Axis', 'Expand All', and 'Download xls' are now deactivated when no data are displayed in the pivot view (those buttons are useless in that situation).
2018-08-14[IMP] web: comparisons in pivot viewAdrien Dieudonne
A previous commit [333ac27] has introduced a new widget TimeRangeMenu that allows to create two sets of data to compare relatively to a given date or datetime field. This commit allows the pivot view to render appropriately two sets of data in a unique table. In comparison mode, instead of one column, three columns are created. One contains the aggregates from the data of interest, one contains the aggregates from the comparison data, and the last one contains information on the data variation (expressed in percentage). Task Id: 1835644
2018-08-10[REF] *: add support for RTL languagesMartin Trigaux
מזל טוב The direction parameter will now have a real impact on the web interface and completly switch the direction of the interface. Add the dependency rtlcss to switch the direction with a css postprocessor. Two different assets will be generated for ltr or rtl /web/content/<...>/web.assets_backend.0.css and /web/content/<...>/rtl/web.assets_backend.0.css to be able to differentiate it easily Adapt the css and views to be easier to switch direction Render graph as it is, do not move y-axis right side, as per mathematical rule value goes left from origin are considered negative, so keep graph as it is for right to left language add test cases for language direction specific assets bundle if language direction is rtl then we also store css files in assets bundle now we store two assets bundle, one for ltr and one for rtl language direction test two assets bundles generated, also test two assets bundle generated for en_US and ar_SY
2018-07-27[REF] *: BS4, adapt dropdowns and caretsqsm-odoo
- The dropdown structure was simplified, allowing to get rid of the 3-levels structure induced by <ul/> elements and dropdowns can now contain anything. The class 'dropdown-item' is now mandatory for each dropdown clickable element. The class 'dropdown-item-text' can be used to add same padding and style but without making the element have a clickable look. - Dividers now use the class 'dropdown-divider' - The way dropdowns are opened and hidden also changed (before the 'open' class was added on the `.dropdown-menu` parent, now the 'show' class is added on both the `.dropdown-menu` parent and the `.dropdown-menu` itself). - JS-wise, no click event handlers can be put on `.dropdown-toggle` elements anymore (instead, use handlers for dropdown events). - Carets are automatically put on `.dropdown-toggle` elements, so this commit replaces the `.caret` elements with this. This feature was possible to disable but would prevent us from adding a caret with scss. Also, this simplifies the DOM. The 'o-no-caret' class was also introduced to allow using the 'dropdown-toggle' class on non-caret elements. - Also adapt the scss to use $caret-width instead of $caret-width-base
2018-07-10[IMP] web: sort measures in graph view and pivot viewRomainLibert
2018-03-07[MERGE] forward port branch saas-15 up to cb87388d727Christophe Simonis
2017-07-27[FIX] web,*: display dashboard panel if no contentAaron Bohy
*board,crm Before this rev., the dashboard panel (e.g. of the sales team dashboard) wasn't displayed when there were no record to display, whereas it should. Only the nocontent helper was displayed. This was a bug introduced with the new view: the views' controller was in charge to display the renderer (if there were data to display) xor the nocontent helper. As the dashboard panel was rendered by the renderer, it couldn't be displayed alongside the nocontent helper. This rev. moves this logic to the renderer. So now, the controller always contains the renderer, which decides what to render (the data or the nocontent helper). This way, the dashboards can display their panel and the nocontent helper.
2017-06-14[FIX] web: Pivot: allow to click on a cellAaron Bohy
Before this rev., when the user clicked on a data cell of a pivot view, it crashed. This was due to several problems, fixed by this commit.
2017-05-26[FIX] web: Pivot: make expand all actually workAaron Bohy
The 'Expand All' feature was tested, but in the test environment RPCs are mocked, and everything is synchronous (by default). So even if the tests passed, the feature actually didn't work because of a deferred (the reload deferred) that wasn't waited for.
2017-05-26[FIX] web: Pivot: don't reload twice on expand allAaron Bohy
Before this rev., the option 'reload: false' wasn't correctly passed when clicking on 'Expand All', and the data was reloaded twice.
2017-05-26[FIX] web: Pivot: correctly return contextAaron Bohy
allowing to save the current state of the pivot view in the search view, or to add it to the dashboard.
2017-05-22[FIX] web: prevent crash when downloading pivot viewGéry Debongnie
The download feature in the pivot view was broken since we introduced the new views. Simply clicking on the download button caused a traceback.
2017-04-21[FIX] web: fix expand all button in pivot viewDavid Monjoie
Also took this opportunity to refactor the code of pivot to adapt the parts that were not up to date and remove the useless deferred in sortRows, courtesy of aab. The exportData function still needs reworking.
2017-04-11[FIX] web: various bugs with pivot view and no dataGéry Debongnie
The pivot view had various small issues causing a crash when transitioning from and to a 'no data' state.
2017-04-11[FIX] web: pivot view should not crash when sortingGéry Debongnie
2017-04-11[REF] web, *: redesign all JS viewsGéry Debongnie
This commit introduce a full redesign of all JS views. We started basically from scratch. The goal was to unify all the various views under a common framework, to make them testable, to make then usable in different conditions (in studio, or in the frontend), and to make our lives easier. Some important points are: - we introduced new coding guidelines (camelCase, 80 chars width, ...) - we have a brand new testing framework (still QUnit based) - kanban view moved to the web addon - calendar view (formerly web_calender) moved to web as well - the tree view was removed - all new code should be documented We hope that this code is the start of a new era for the Odoo web client, we want to have a high quality codebase, well documented, well tested, well designed. Work done by the framework team: mostly aab, ged, chm, dmo, qsm