summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/views/graph_tests.js
AgeCommit message (Collapse)Author
2019-04-01[IMP] web: use Chart.js in graph viewMathieu Duckerts-Antoine
It has been decided to use Chart.js instead of nvd3 to render charts. In this commit the graph view has been largely rewritten to benefit from the options offered by Chart.js. Task ID: 1946138
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-20[IMP] web: group by more than two fields in graph viewjpr-odoo
Before this commit: select more than two groupbys in a graph view would have no impact at all if mode 'bar' or 'line' is selected. This commit allows to correctly handle more than two groupbys in all modes. Task ID: 1917948 closes odoo/odoo#29673
2018-12-12[MERGE] forward port branch 12.0 up to 047e2b28de4Christophe Simonis
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-06[FIX] web: prevent crash in line chartTejas Shahu
Before this commit: While user was opening first time line chart graph, at that time undefined label values were not being converted into undefined string due to misplace code. So it was giving traceback error After this commit: Code has been moved to proper place. Joint work with msh-odoo Issue-ID: 1882328 closes odoo/odoo#29306
2018-11-19[REF] *: update js test suite to use helpersGéry Debongnie
This rev. introduces robust helpers to use in the JS tests suite to interact with DOM and components, and starts using them (almost) everywhere. All the helpers are exposed though testUtils.js. There are 2 kinds of helpers: 1. Assertions ------------- * assert.containsNone, containsN, containsOnce check that the DOM (or a specific part of the DOM) contains a `selector`. It generates a correct error message automatically. ex: assert.strictEqual(form.$('.o_form_editable'), 1, "msg"); -> assert.containsOnce(form, '.o_form_editable'); * assert.isVisible, isNotVisible check that the DOM has an element visible or not. They also check that the element is actually in the DOM (before most tests didn't verify this). * assert.hasClass, doesNotHaveClass, hasAttrVAlue, check specific properties of a DOM element, and also validate that it is applied on a single existing DOM element (before most tests didn't verify this). ex: assert.notOk(form.$('button').hasClass('btn-primary')); -> assert.doesNotHaveClass(form.$('button'), 'btn-primary'); 2. Utilities ------------ The goal of the utilities is to centralize the definition of many standard components and interactions, ensuring that when we refactor the JS framework, we do not need to change all the tests. Existing mock utilities (addMockEnvironment, intercept, path, patchDate, unpatch and fieldsViewGet) are moved to 'testUtils.mock.*'. Existing DOM utilities are moved to 'testUtils.dom.*'. New dom utilities are created for opendDatePicker, click, clickFirst and clickLast. Helper `click` verifies that there is exactly 1 element visible in the DOM you click on, `clickFirst` and `clickLast` verify that there are more than one element on the DOM. ex: form.$('button').click(); -> testUtils.dom.click(form.$('button')); New Form utilities: (testUtils.form.*) clickEdit, clickSave, clickCreate, clickDiscard, all clicks on the control panel buttons of the form. `reload` reloads the form data. New modal, graph, kanban and pivot utils (testUtils.pivot.*, testUtils.kanban.*, etc.). New fields utils: (testUtils.fields.*) * editInput, editSelect: allow to change the value of a field, using a selector to identify it. They validate that the input exists and trigger the change event automatically. * editAndTrigger: allow to modify a field and trigger specific events after the value change * many2one (testUtils.fields.many2one.*) clickOpenDropdown, clickHighlightedItem, clickItem, searchAndClickItem: use a field name instead of a selector and do all the complex mechanism to open, filter and highlight many2one fields. Joint work with aab, dam, ged, mge, svs and vsc.
2018-10-16[FIX] web: line chart x ticks labels overlappAdrien Dieudonne
Before this commit, we tried to hide some labels depending of the available size of the graph. However, it doesn't worked when the graph is updated. A much simpler solution is to use the scale’s automatic tick generator implemented in D3. So, in this commit, we realized that 'tickValues' is unnecessary because data are passed correctly (see 'svg.datum(data);') and labels are defined in 'ticksLabels'. There is nothing else to do. We had to remove the skipped test because 'renderEnd' is not triggered for line chart. We need to update nv.d3. We already tried to fix this issue in the following commit: https://github.com/odoo-dev/odoo/commit/c4937132a38873761fa0ac0b41c983b917cb52f1 Documentation: https://github.com/d3/d3-axis#axis_tickValues closes odoo/odoo#27828
2018-10-02[FIX] web: avoid no content helper for pie chart in comparison modeAdrien Dieudonne
In comparison mode with no data, we render two empty pie charts even if it's not an embedded view. The non content helper is still used when there is no comparison.
2018-10-01[FIX] web: line chart x ticks labels overlappAdrien Dieudonne
This commit hides some labels depending of the avalaible size of the graph. We had to skip some test because 'renderEnd' is not triggered for line chart. We need to update nv.d3.
2018-09-26[FIX] line chart: show tick labels on x axesAdrien Dieudonne
Before this commit all x axis labels were not displayed because ticksLabels was empty. Now, we show all labels except the first one and the last one because they are truncate. We need at least two intermediate labels to know the scale and the direction. So, we only remove labels when there is more than 3 data points.
2018-09-25[FIX] web: undefined graph when pie chart has no dataAdrien Dieudonne
Before this commit, a crash occured when the no content helper was rendered on an pie chart without data.
2018-09-24[FIX] web: graph_renderer: show graph titleAdrien Dieudonne
Since odoo/enterprise@e3b0d2a, the title wasn't set anymore. This logic is now moved in the graph renderer to be able to set a title in every graphs. For now, we only use the title attribute for pie charts embedded in dashboard views. Additional tests has been added in 'web_dashboard' (enterprise).
2018-08-27[MERGE] forward port branch saas-11.4 up to a5187cef107Christophe Simonis
2018-08-27[MERGE] forward port branch saas-11.3 up to 9eef533e986Christophe Simonis
2018-08-27[MERGE] forward port branch 11.0 up to 3c9aa504496Christophe Simonis
2018-08-27[FIX] web: Graph: group by two fields on line chartDipalee Bhalodia
Before this commit, when we applied two or more groupbys in line graph, the groups displayed on the X axis where shifted to the left, and the first one wasn't displayed at all. related task: #1848289 Closes: #25037
2018-08-21[MERGE] forward port branch saas-11.3 up to 6cc7d3f9451Christophe Simonis
2018-08-20[FIX] web: graph_renderer: check graph data before renderingAdrien Dieudonne
Before this commit, we had two different errors when data was unavailable: The first one is generated by Odoo: "No data to display, try to[...]" The second one is generated by nvd3: "No Data Available". We always want the same message. So now, we always make some checks before rendering the graph by calling _render.
2018-08-20[FIX] web: test in graph_testsAdrien Dieudonne
previously added in 102a63b815a5a563aae13ce4784c0986581bc067
2018-08-20[FIX] web: graph_renderer: check graph data before renderingAdrien Dieudonne
Before this commit, a crash occured when you tried to load a bar chart without any data. Example in Purchase -> Reporting. Since this commit 3d2ca810, we do some data processing without checking if data exists. To fix this, we have to always makes some checks before rendering the graph by calling _render.
2018-08-14[IMP] web: comparisons in graph 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 graph view to render appropriately two sets of data as would be expected in the different modes. Task Id: 1835644
2018-08-10[IMP] web: Handle date interval in graph chartsFrancois Volral
This commit only applies for chart grouped on date or datetime fields. In that case: - Line Charts : fill missing groups and doesn't display undefined values. - Bar Charts : doesn't fill missing groups but display undefined values. - Pie Charts : doesn't fill missing groups but display undefined values. This commit is part of task #1835644
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-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-04-25[FIX] web: fix crash keyboard related crash in graph viewVincent Schippefilt
Before this fix, when going on the graph view from the dashboard view ( using the fullscreen button on dashboard), the focus is on the search input, hitting the tab key creates a crash. This fix gives a default implementation of giveFocus to the abstractrenderer so there is no crash.
2018-04-10[IMP] web: many2one as measure in graph & pivot only when desirableAlexandre Kühn
With this commit, the fields many2one are not always measures in pivot and graph views. By default, they are *not* measures. In order to have them as measures, we should pass `additionalMeasures` as a param to any of the views, which contains a list of fields to consider as measures. example: Suppose a model with the following fields: - `product_id` (many2one) - `categ_id` (many2one) - `sold` (float) By default, only the field `sold` is a measure in a graph or pivot view. In order to pass `product_id` as a measure of a graph view, you should instantiate this view as follow: `` var viewInfo = /* ... */; var params = { additionalMeasures = ['product_id'], }; var graph = new GraphView(viewInfo, params); `` An exception to the rule above is when the many2one field is of type `measure` in the arch: this field is set as the default measure of the view, therefore it is implicitly added as an additional measure.
2018-04-10[FIX] web: prevent crash in graph when grouping/aggregating on m2oGéry Debongnie
We recently added the possibility of aggregating the graph view on a many2one field (with count distinct operator). This is useful, but then a rare situation could happen: the view could be grouped by the same field. In that case, there is a name clash in the read_group, and the result will be that the [id, nameget] of a m2o field will be used as an aggregate. The readgroup method should be improved (its API is a mess), but meanwhile, we have a solution for this issue: if we group by a m2o, then it is guaranteed that each group has an aggregate value of 1 for the same field.
2018-04-05[IMP] web: graph views can now aggregate many2onesMathieu Duckerts-Antoine
The read_group method was recently modified to allow more flexibility. With this commit, we add the possibility of aggregating many2one fields. These fields can be aggregating by counting the number of distinct IDs, directly in postgres. Also, note that we had to modify the mock server to implement the corresponding functionality.
2018-01-18[IMP] core: menu tip ux/ui improvementAlexandre Kühn
We would like to make the "no item found" screens more appealing. Before this commit, it shows a small help tip in the top-left corner of the screen, just below the "Create" button. With this commit, these help tips have been replaced by onboarding screens, which consist of a picture and some text below, both of which are horizontally centered. The texts have been slightly changed, so that they are shorter and clearer. Considered modules: (A) account, account_asset, account_budget, account_test, account_voucher, analytic (B) barcodes, base, base_automation, board (C) calendar, contacts, crm (D) delivery (E) event (F) fleet (G) gamification, google_drive (H) hr, hr_attendance, hr_contract, hr_expense, hr_gamification, hr_holidays, hr_payroll, hr_recruitment, hr_timesheet (I) im_livechat (L) l10n_fr_sale_closing, link_tracker, lunch (M) mail, maintenance, mass_mailing, membership, mrp (N) note (P) payment, point_of_sale, post_mercury, pos_restaurant, product, project, purchase, purchase_requisition (R) rating, repair, resource (S) sale, sale_timesheet, sales_team, stock, stock_account, stock_landed_costs, stock_picking_batch, survey (U) utm (W) web, website, website_blog, website_customer, website_event_track, website_forum, website_quote, website_sale, website_sale_digital, website_slides
2017-12-22[FIX] web: graph: don't lose initial groupby at reloadAaron Bohy
Before this rev., when a graph view was reloaded (e.g. by clicking on the graph view switcher), the inital groupby was lost if it didn't come from the searchview (i.e. if it came from the context or from the arch). For instance, go to Sales > Reporting > Sales (the view is grouped by 'date', and there are two groups), reload by clicking on the graph view switcher: there is only one group left. The reload RPC was actually fine. What was wrong is the 'state' object given to the renderer after the reload, as it didn't contain the correct groupby, so the view wasn't correctly re-rendered.
2017-08-24[FIX] web: read context when reloading Graph or Pivot viewsAaron Bohy
Before this rev., keys like pivot_measures, graph_mode..., were correctly took into account at first load of Pivot or Graph view, but not at reload. Those keys are particularily useful when a user saves a research to its favorites. When such a favorite is selected, the view is reloaded and the interesting information is in the context.
2017-07-28[FIX] web: graph: reload with correct fieldsAaron Bohy
A traceback occurred when trying to reload a graph view with no groupBy in the searchview, because the array of fields to read given to the read_group RPC didn't contain the default groupBy field (Error "Fields in 'groupby' must appear in the list of fields to read"), e.g. in Sales > My Pipeline.
2017-07-19[FIX] web: Groupby not working on Pivot and Graph viewJigar Patel
The groupby property was wrongly set in some cases: if a graph/pivot view is defined as a groupby on field F, but there is another groupby key G in the context, it will take F instead of G (at initial load).
2017-06-01[FIX] web: Graph: don't ignore graph keys in contextAaron Bohy
Keys 'graph_mode', 'graph_measure' and 'graph_groupbys' can be specified in the context and must be used by the graph view to determine the default mode, meadure and groupbys. Before this rev., those keys were simply ignored.
2017-06-01[FIX] web: Graph: correctly return graph's contextAaron Bohy
allowing to properly save the current state (mode, measure, groupbys) of the view in the Favorites or add it to the dashboard.
2017-04-11[REF] account, web, web_diagram: rename static test folderGéry Debongnie
For consistency, every static test folder should be named 'tests', with a s.