summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/widgets/data_export.js
AgeCommit message (Collapse)Author
2021-03-09[FIX] web: fix float value representation in exportAndrea Grazioso (agr-odoo)
- Create a product with: Cost: 60.80 Quantity On Hand: 999.0 - Go to Inventory / Reporting / Inventory Valuation - Click on export all (little button next to "Inventory at date") The field "Total value" have too many decimals: 60739.2000000004 This occur because of the multiplication: it yield the correct value (60739.2), but every rounding attempt done, even in the ORM, will mess up the representation https://github.com/odoo/odoo/blob/042298f8c949fba470eda6ad90f94c95ca291030/odoo/fields.py#L1333 opw-2438384 closes odoo/odoo#67543 X-original-commit: 67cf82962688360cfe25c6b2118a7dbd17a6ee95 Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2020-12-14[FIX] web: Select subfields without removing filter text on exportAchraf (abz)
What are the steps to reproduce your issue ? 1. Install "contacts" 2. Select list view and select one or more contacts 3. Select "Export" actions What is currently happening ? When filtering fields with text, the system only displays the corresponding fields, but when clicking on sub-field the text written just before is deleted, which prevents us to return to all fields without filter What are you expecting to happen ? Filter fields and select sub-field without deleting the filter text opw-2411928 closes odoo/odoo#63329 X-original-commit: d947ea609b458ddbccabd661c22652d6c86a8167 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2020-11-24[FIX] web: grouped exportNicolas Martinelli
- Create a product with: Cost: 60.80 Quantity On Hand: 999.0 - Go to Inventory / Reporting / Inventory Report - Export as XLS The header values have too many decimals: 60739.2000000007 The root cause is `convert_to_cache` returns this value: https://github.com/odoo/odoo/blob/042298f8c949fba470eda6ad90f94c95ca291030/odoo/fields.py#L1333 In this case, `currency.round()` keeps the extra digits. Since the field is not stored, the useless digits are kept. A simple solution is to use `float_repr` on the non-stored float fields to make sure that doesn't happen. Another solution could be to not convert the floats to strings, but that doesn't seem intended. opw-2378895 closes odoo/odoo#62260 X-original-commit: 2ebcbb16f113dee1416097b7a52f8068a40a34cf Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-09-12[IMP] web: removed extra space in export field listHardik Prajapati
before this commit: when manually adding field in export wizard, string has extra space in begining. after this commit: manually added field in export field list doesn't contain any extra spaces. task-2065433 closes odoo/odoo#36759 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-12-09[REV] web: reverts update to fontawesome 5.11.2Kevin Baptiste
This reverts commit ff1c35513aecef5fbc30f7c2f3834450e719714e. closes odoo/odoo#41480 X-original-commit: 116057b26e71db4692280463669f3e80d813ddcc Related: odoo/enterprise#7110 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-11-28[IMP] web: update to fontawesome 4.7.0 to 5.11.2Kevin Baptiste
FontAwesome 5 introduced new names for some icons as described on https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#name-changes This commit replaces the old names to the new ones. closes odoo/odoo#35826 Taskid: 2050241 Related: odoo/enterprise#5180 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-09-20[IMP] web: Export grouped list view in xls fileLucas Lefèvre
PURPOSE ======= Add the support of grouped exports. Allow the user to export all records in one click from the listview, without having to go through the export modal, taking into account the domain, groupbys, and visible fields. SPECIFICATION ============= When exporting (whether it is from the modal or from the shortcut), any groupby(s) set on the listview should be taken into account (all unfolded) - UNLESS the export is import-compatible - each subgroup header has an indentation compared to its parent - the 'group headers' in the exported file should contain the same info (label, field aggregates) as it has in the listview. New secondary button on the tree view with label 'EXPORT' (to be confirmed...) - the export shortcut disregard the selected records, it exports all records according to the domain. - the button is visible even if there is no selected records. - essentially the export shortcut does the same thing as the following: - select all records - hit 'action' then 'export' - hit 'export' Define a boolean attribute on <tree> to specify whether or not the export shortcut should be displayed Task 2072910
2019-09-13[ADD] web: make export FAYT also match technical namesXavier Morel
Previously only matched the label / user-visible name. closes odoo/odoo#36472 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.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-20[FIX] web: race condition in export widgetXavier Morel
Looks like the race condition dates back to the introduction of "default" export fields but #32339 made it into a hard error (rather than silently not load the fields): setting / selecting the default fields waited in the exports lists to be loaded, but the exports lists are just predefined lists of fields, that's got no relation to the loaded or default fields, which are loaded (somewhat implicitly) by _onChangeCompatibleInput. As a result, if the lookup of the ir.exports was faster than fetching the model's fields, we'd execute "select the fields from the list view" before the exports widget knew anyting about the model's own fields. Because the old code iterated on the loaded fields and checked if they were to enable it would just do nothing (as it would iterate an empty object). Because the new code iterates on the defaults fields and looks them up in the records map, it gets an undefined and triggers an error. Fix by waiting on the proper RPC call. Reported-by: Andreas Stauder (@BT-astauder) closes odoo/odoo#35837 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-08-12[IMP] web: export improvementsKishan Gajjar
* remove center buttons, corresponding features either moved to fields list (handle / bin on exported, etc...) or removed entirely (e.g. clear) * replace XLS to XLSX format, increases rows# to 1048579 * add FAYT filtering of available fields * sort available fields alphabetically (CI) always * change export templates UI: remove buttons TaskID: 1910953 closes odoo/odoo#32339 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.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-05[IMP] *: use new helper config.isDebug()Romain Derie
Before this commit, both config and session were aliases to odoo.debug. Now, config.isDebug() should be call, with possibility to pass a parameter to check if we are in a specific debug mode such as 'tests' or 'assets'. task-1934445 Coming with https://github.com/odoo/enterprise/pull/4281 Closes https://github.com/odoo/odoo/pull/33213
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[REF] web: small refactoring for export wizardKishan Gajjar
- add missing docstrings - correctly order functions - move functions in correct sections - follow JS guidelines closes #31261
2019-01-31[FIX] web: do not select disabled elementMartin Trigaux
If xlwt is not installed on the server, the option is disabled. However, the first element was checked, even if it is disabled. Trying to export record without xlwt was causing a traceback. Introduced at b60de0db41b where xls is now the first choice closes odoo/odoo#30724
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-17[IMP] import/export UIsJigar Patel
Task 40692 Various changes to import/export (mainly) UIs: * default to excel & "full" (non-import-compatible) export * auto-detect encoding of CSV using chardet * remember column -> field mapping after having imported a file (useful for repeated imports where auto-matching failed) * better handle localised booleans & column names * automatically select source list view's fields when exporting * better integrate import templates feature and add a number of templates
2018-07-06[REF] *: rename web.pyeval into web.py_utilsGéry Debongnie
The pyeval name is quite confusing, given that there is already an eval and an evaluate function in py.js, and that the web.pyeval exports two evaluate functions. Since this file is more about odoo specific customization to py.js, it is renamed in py_utils to better express its intended use.
2018-04-18[REF] *: stop mentioning "LESS" where this is not requiredqsm-odoo
* web, web_editor, website, im_livechat
2018-03-05[FIX] web: translate 'External ID' stringsum1201
Closes #22763
2017-08-24[MERGE] forward port branch saas-17 up to 877e7098719Christophe Simonis
2017-08-11[FIX] web: fix traceback when saving fields list during data exportKhoi Nguyen
The traceback was caused by an occurence of this.dataset, which was left out in the new views refactoring (this.dataset has been replaced by this.record).
2017-07-24[IMP] web, *: lazy load dialog xml templateqsm-odoo
* web_editor, web_planner, website The 'Dialog' class is used in both backend and frontend. Also, lots of actions can be done without the use of any modal. It thus makes sense to lazy load its related xml only when a first modal is opened. This change also allows to get rid of the "base_common.xml" file as the dialog template is the only remaining one in there and, in the future website update, it will allow to not load any static XML file on website page loadings.
2017-05-29[FIX] web: prevent crash when exporting all dataGéry Debongnie
In the list controller, some code to determine the active domain to export was causing a crash. It was easy to see: just select all records in a list view, then click on 'Export' in the sidebar. Note that the data_export code is still quite old, and did evolve organically. It does not conform to our new design principles, in particular, the way component should communicate. But this is a task for another day.
2017-04-19[FIX] web: adapt export data to new viewsMartin Geubelle
This commit just fixes the traceback due to the new views. Another commit to refactor the whole widget will follow.
2017-04-14[MERGE] forward port branch saas-15 up to b0992d082daChristophe Simonis
2017-04-13[MERGE] forward port branch 10.0 up to 00e169c05a2Christophe Simonis
2017-04-12[MERGE] forward port branch saas-11 up to f830c7c3e31Christophe Simonis
2017-04-11[REF] web, *: simplify our RPC system (in JS)Géry Debongnie
The RPC system was not completely satisfactory, we decided to prepare the future and do it properly. This commit introduces the new rpc system, which replace the previous new one. We now simply have a method, this._rpc, which takes a dictionary of parameters. The idea is that depending on the parameters, it is able to add correct default value when necessary. For situations where we don't have the this._rpc method, we can use the rpc.query method, which takes the same arguments, but directly calls ajax.rpc instead of triggering up some events.
2017-04-11[REF] *: use _rpc method for all rpcsGéry Debongnie
The _rpc method is now the preferred method to do a rpc, so we need to update all calls.
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
2017-03-28[FIX] web: fix export dialog design on IEqsm-odoo
As the export dialog has always lots of content, the design was made so that it always takes 100% of the viewport height. This allowed to design the dialog content so that the fields panels do not overflow the modal and are individually scrollable and so that the buttons are vertically centered. The problem is that this was not properly working on IE. Indeed, the `.modal-body` element overflowed the `.modal-content` one. The solution is in two parts: 1) IE does not properly distribute heights when combining flex elements with max-height containers. The `.modal-content` has to be forced to `height: 100%;` for this to work. This is done in javascript as there is no way to detect `.modal-content` elements specific to export dialogs. 2) IE does not properly render `flex: 1 0 0;` elements. The rule is supposed to tell the browser "render the element as if it was of dimension 0 and was able to grow to fill its parent container". Fortunatly, a workaround with `flex: 1 1 auto;` combined with `min-height: 0;` seems to achieve the same behavior for this case (by telling "render the element by shrinking or growing it to fill its parent container, without caring of its minimum size"). opw-725391 Cherry-pick of odoo/enterprise@dd059f0af79df24121d94cd81f2dd023c180583c
2017-01-23[MERGE] forward port branch 10.0 up to 6804085b8ceChristophe Simonis
2017-01-23[MERGE] forward port branch saas-11 up to b9374d5c215Christophe Simonis
2017-01-19[FIX] web: conserve /id for saved export listNicolas Lempereur
With 003d85b instead of getting the name of the relation field_relation we get field_relation/id. But the data about the related fields are not gotten all at once when opening the export modal. They are gotten by clicking on the arrow of the related record. So we need to have these /id information saved in the export list, otherwise for example the related records can be missing when exporting from an export list, whilst everything was OK without using the saved export list. With the previous change, an export list could contain an id and .id fields for the same relational field, so a change must also be done in fields_info method used when getting a saved list. opw-665994 opw-693535 note: adapted forward-port of 8.0's 29be9ae80 which was lost when merging web enterprise onto web community.
2016-11-09[IMP] web: show technical field name in export wizard by hover in debug modeKishan Gajjar
In export wizard on mouse hover display technical name of field in debug mode
2016-11-04[IMP] web: Ask user to confirm export template removalsah
PURPOSE: When users try to delete records in the database, we usually warn them about the possible damage they would cause by asking them to confirm this is what they want to do (just in case you misclicked for example) Unfortunately, that feature wasn't implemented everywhere, at least no in the export window, which means a user can remove ir.exports records without having to confirm that's indeed what he wants to do. This got worsened by the fact, in the export window (like pictured in the attachment), the "Save field list" button is less than 10px away from the DELETE button, meaning you could really remove 10min of your work (or worse, anybody else's work as we don't have any specific record rule on that) in one click
2016-08-26[IMP] web: export: keep compatible fields when switching export typeSimon Lejeune
Previously all the fields were removed when switching export type, even if they are available in the newly selected export type. This commit fixes that.
2016-04-25[MERGE] forward port of branch saas-10 up to bb8f0f1Christophe Simonis
2016-04-21[REF] web: stop duplicating webAaron Bohy
Avoid duplicating web addon in enterprise by extracting a common basis. Enterprise features stay in enterprise, but use that common basis. Mainly: - JS refactoring and linting - Conversion of .sass into .less split into multiple files - Templates cleaning and DOM simplification - Re-generation of web.pot, and update of .po files
2016-04-14[FIX] web: consistency between list and exportNicolas Martinelli
Following commit 8276fb585, the data exported should match the data displayed on the list view. Therefore, we need to make sure that the context used match the context of the list view. When a filter is applied in the list view, the context is evaluated thanks to pyeval (see the call to `/web/dataset/search_read`). The fix is to evaluate the context in a similar way. opw-674473
2016-01-29[MERGE] forward port of branch saas-6 up to 2616defDenis Ledoux
2015-06-17[IMP] web, web_*, mail, board : New modals and dialogsqsm-odoo
2015-03-18[IMP] web+addons: improvement to module systemGéry Debongnie
The module system needs to know the dependencies of a given module before executing the function. This is why the dependencies were defined once in an array, and then were described one more times in the call to require. But a trick can simplify this: the boot function can parse the string representation of the module and extract the calls to require from it. It is more work for the processor, but it leads to simpler module definitions.
2015-03-18[REF] web: add module system to the web clientGéry Debongnie
This commit introduces a new module system for the javascript code. Instead of using global (namespaced) variables everywhere (like openerp.web.whatever, ...), each file declare one (or more) module with its dependencies. Each module will be loaded after its dependencies, and will be given a reference to the return values. This change is a massive departure from the way the client worked previously. It will sadly break some/most history, but I am sure that the future git ecosystem will allow you to easily browse the history past this revision (one can dream). This commit feature: * main namespace is now odoo instead of openerp * a way to define modules and dependencies (inspired by requirejs) * many files have been splitted in simpler subfiles * basic support for debugging in odoo.__DEBUG__ * no global variable (i.e. nothing in window.openerp) * many bug fixes, many new bugs Future vision: this modularization should simplify future code development, simplify debugging and will allow a serious testing effort