summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/pivot
AgeCommit message (Collapse)Author
2021-01-15[FIX] web: dropdown remains always open on MobileRomeo Fragomeli
Before this commit, on pivot view when a user adds some groupBy the dropdown menu remains always open. This commit restore the same behaviour like on desktop. Steps to reproduce: * Open an app with a Pivot view * Select the Pivot view * Add one "groupBy" * The dropdown remains open => BUG Task ID: 2439742 closes odoo/odoo#64613 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2020-08-18[IMP] web: manage invisible fields in graph and pivot viewJérémy Hennecart
PURPOSE Be able to remove some measures from graph / pivot views. Currently fields are automatically added but some of them make no sense. SPECIFICATIONS Add the possibility to not display some fields in the measures dropdown for the graph and pivot views. When a field is not displayed in the measures of a pivot views we remove them also from the list of groupable fields. LINKS Task ID-2288381 Community PR #54774 Enterprise PR odoo/enterprise#11970 Upgrade PR odoo/upgrade#1519
2020-08-14[FIX] web: pivot non-persistant on null valueNicolas Lempereur
In pivot view, a cell data is determined by his row/column key which are the value chain of field values to get to that row/column. If you had a grouping with value in a cell and then close the grouping, you could somehow get the old value back wrongly on next grouping operations. This happened because: - the key was computed based on the value (eg. for relational field the record ID) but without the field name. - succeeding read_group only fill existing values. eg. If on pivot view we had a salesperson with same ID as product category, if we closed salesperson grouping then opened product category grouping, we could possibly get the cell value to the product category that has the same ID as the salesperson. With this changeset, we clear the cell data corresponding to a grouping that has been closed. Added test without the fix would fail by displaying data of a previous read_group that should have been cleared inbetween. opw-2262306 closes #55129 closes odoo/odoo#55936 X-original-commit: f1df73adca4955561814d4b8e90a62d7d50c1c33 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
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-25[IMP] web: display comparison period first in pivotPriyanka Kakadiya
When comparing time ranges in pivot, it makes more sense to display the previous period before the one being compared. This commit allows that. Task ID: 2269770 closes odoo/odoo#52746 Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com> Co-authored-by: Priyanka Kakadiya <pka@odoo.com> Co-authored-by: Mohammed Shekha <msh@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: expose pivot variablesPierre Rousseau
This is useful for integration with spreadsheet. closes odoo/odoo#52582 Task-id: 2168016 Signed-off-by: Pierre Rousseau (pro) <pro@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-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-18[FIX] web: pivot no content helperAaron Bohy
This commit reverts [1], which fixed the no content helper message of the pivot view, by moving the message definition in the JS. With Owl components, one must always use the translation function in the env (env._t), and no longer import it from 'web.core'. Moreover, there is no valid reason to define the message in JS here, except that there was a bug in owl, that has been fixed by [2] (merged in Odoo by the previous commit). [1] https://github.com/odoo/odoo/commit/c7cc672aba669175280d619ad39b14daefd7733f [2] https://github.com/odoo/owl/commit/2af8cccd65424ea75fbaa9f0a83c6974be4b1b5d closes odoo/odoo#51442 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com> Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-05-05[IMP] web: Standardize FALSE and TRUE leaves/domainsJulien Mougenot
Add four static properties on the Domain.js class: (TRUE|FALSE)_(LEAF|DOMAIN). This increases consistency for domains using these concepts.
2020-05-04[FIX] web: keep server group order in pivotMathieu Duckerts-Antoine
In the pivot view, groups comming from many read_group are assemble to create the header hierarchies and the table. Groups returned by the read_group may be already sorted by the server using the order set on the model for instance and that order should be reflected in the header hierarchies (and in the table). It is important to keep that order since it might not be possible to recreate it in the interface. Even if possible it might not be a good idea for performance reasons. Before this commit: The groups are added in a JS object, whose keys are the group ids (when grouping on a many2one at least). Then, to generate the table, we iterate over the keys of that object, but those keys are sorted according to the numerical order (not the insertion order), because keys are kind of numeric. See https://stackoverflow.com/questions/5525795/does-javascript-guarantee-object-property-order. After this commit: Instead of a JS object, we use a Map for which the insertion order is used (official spec). Task ID: 2243416 closes odoo/odoo#50551 X-original-commit: 1a9a85c8b8d0f47c3c6f3878cd6d9401ddc3ad75 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-29[FIX] web: pivot view nocontenthelp messageHardik Prajapati
Since the commit https://github.com/odoo/odoo/commit/46cf65d68e9c13193dff4b563b9b0bbb2199dfc1 when help is not defined in action then nocontenthelp is displayed as [object, object] due to the desciption passed from renderder of the pivot view. So in this commit while calling the NoContentHelper pass the descitption as string instead of jquery element. we can use the t-value in template but that string will create issue for transalation so pass the desctiption from the pivot render. closes odoo/odoo#50347 Taskid: 2240167 Closes: #49859 X-original-commit: c7cc672aba669175280d619ad39b14daefd7733f Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-04-16[REF] web,mail: use patchMixin and patch instead of utils.patchMichael Mattiello (mcm)
This commit replaces the use of utils.patch by the new class patcher and makes the renderers that are converted to owl patchable. closes odoo/odoo#47700 Related: odoo/enterprise#9551 Signed-off-by: Géry Debongnie (ged) <ged@openerp.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-03[REF] web: remove custom useExternalListener hookAaron Bohy
This hook is now available in owl directly, so we remove its custom definition in Odoo, and adapt the code using it.
2020-01-28[IMP] web: show measure row in xlsx fileMohammed Shekha
before this commit: if only one measure is enabled then measure row not displayed in downloaded xlsx file after this commit: downloaded xlsx file will always have measure row either single measure enabled or multiple measure enabled task-2127388 closes odoo/odoo#40769 Signed-off-by: Aaron Bohy (aab) <aab@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>
2020-01-08[FIX] crm: check if name is present in measuresmalex-emesa
Fix an error which occurs during an attempt to access the string attribute of a non existing measure If a pivot view is defined with a "string" attribute of a field of type "row", e.g. <field name="stage_id" string="Stage" type="row"/> an error was raised "TypeError: measures[name] is undefined" closes odoo/odoo#42971 X-original-commit: de1dbc9bfba3ec205c75590d3e38b20d30b39c39 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-12-12[FIX] web: pivot isHeaderClickedPierre Rousseau
This commit explains why we use isHeaderClicked. closes odoo/odoo#41756 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.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-07-29[MERGE] forward port branch saas-12.4 up to cda4f3c308cChristophe Simonis
2019-07-26[MERGE] forward port branch saas-12.3 up to 40e8b67179fChristophe Simonis
2019-07-26[MERGE] forward port branch saas-12.2 up to 1d6d790513eChristophe Simonis
2019-07-23[FIX] web: pivot keeps controlpanel's domain on reloadLucas Perais (lpe)
Open a pivot view, make a search for some field Click on a pivot cell to display the list view of elements matching the group's domain Go back to the pivot using breadcrumbs Before this commit, the original search domain was not kept across those actions After this commit, it is kept This difference is due to the fact that before 12.2, the whole action had an env, containing the search domain in 12.2 and afterwards, things are not done this way anymore OPW 2030555 OPW 2030983 closes odoo/odoo#35096 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-06-27[MERGE] forward port branch saas-12.3 up to 0247d2f35fdChristophe Simonis
2019-06-27[MERGE] forward port branch saas-12.2 up to 465909f0fdeChristophe Simonis
2019-06-27[MERGE] forward port branch 12.0 up to cd21c016b06Christophe Simonis
2019-06-25[MERGE] forward port branch saas-12.3 up to 793933a1287Christophe Simonis
2019-06-21[MERGE] forward port branch saas-12.2 up to 8747d72f1efChristophe Simonis
2019-06-25[FIX] web: measure/groupby many2one variation in pivot viewMathieu Duckerts-Antoine
In case a many2one field (let us say 'foo') is used simultaneously as a groupby and a measure in the pivot view, the values returned by a read_group for that many2one are of the form [id, label] and the aggregated values (always 1) are missing in the read_group results (datapoints). Thus typically, a datapoint is of the form {'foo': [1, 'Bar'], '__count': 4, ...} and does not contain information on the 'foo:count_distinct' value (this is a read_group bug). As a consequence, a special processing of the read_group datapoints is done in the pivot model to handle that situation and the value for 'foo:count_distinct' is infered correctly to be 1. In the pivot comparison mode, datapoints comming from the period and the comparison period (data and comparisonData sets) are identified if they have same values for the groupby fields and the measure values become small objects containing information on the the measure values for data and for comparisonData and on the related variation. Thus {foo: [1, 'Bar'], __count: 4, ...} from data and {foo: [1, 'Bar'], __count: 3, ...} from comparisonData should become a single datapoint { foo: [1, 'Bar'], __count: { data: 4, comparisonData: 3, variation: { magnitude: +33 (%) } } fooAggregate: { data: 1, comparisonData: 1, variation: { magnitude: 0 (%) } } It turns out that the code responsible for merging the data and comparison datapoints made a mistake by mixing the keys 'foo' and 'fooAggregate', with the consequence that the variations were not correctly computed in the situation described above. This is fixed in this commit. closes odoo/odoo#33118 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
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-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-07-17[REF] web: factorize no content helperAaron Bohy
Different templates were defined for graph, pivot and cohort views for the no content helper. Those templates were similar (only the message sometimes slighlty changed). This rev. creates one generic template used by those three views. closes odoo/odoo#34916 Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
2019-05-28[IMP] web: unify the use of GROUPABLE_TYPESMartin Trigaux
cf discussion on #31789 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-06-27[MERGE] forward port branch saas-12.4 up to 5e81b18e24aChristophe Simonis
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-03-21[MERGE] forward port branch saas-12.1 up to 6878c9f3424Christophe Simonis
2019-03-19[MERGE] forward port branch 12.0 up to 82c4393fd02Christophe Simonis
2019-03-11[MERGE] forward port branch saas-12.1 up to 2b3296bbf8bChristophe Simonis
2019-03-08[MERGE] forward port branch 12.0 up to c023d0784f2Christophe Simonis
2019-03-06[FIX] web: keep col group by on 2nd reload+after 0 resultNicolas Lempereur
In 11.0 f8b38f64d improved the column group by managment when reloading several times by having the same "groupbys" dictionaries between the pivot model instance and the header menu. This has been reverted in 12.0 (with c6e7adfb95d) because the following pivot tests failed with the change: - 'rendering of pivot view with comparison' - 'export data in excel with comparison' The failure is because now that the "groupbys" dictionaries are the same object, the truncated dictionary of a header truncate the one of the model instance. So if we search something that has no results, then something with results, the groupbys could be lost. This behavior has no reason to be and is changed in 11.0 with #31644, this commit is the forward-port of f8b38f64d and #31644. closes #31627 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>