summaryrefslogtreecommitdiff
path: root/addons/base_import/static/src/js
AgeCommit message (Collapse)Author
2020-07-23[IMP] *: adapt modules to Owl search panelJulien Mougenot
Adaptation of the rest of the environment to the changes regarding the refactored search panel and model. This commit includes the following changes: - Since the control panel model is now part of the search model, the view widget is responsible of its instantiation with the appropriate API; creating an ActionModel holding the required model extensions. - The controller is now importing/exporting the state of the entire search model as well as the current state of the search panel (given throught its props). Changes have been made to adapt to this behaviour. - The multiple components linked to the control panel model have been adapted to reflect the changes brought to it (they will now listen to the "searchModel" instead of the "controlPanelModel"). - The `test_utils_create` methods have also been adapted to properly instantiate a searchModel Part of task 2228968 Co-authored-by: Julien Mougenot <jum@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-07-07[FIX] base_import: fix re-importing same filejvm-odoo
Issue Chrome - Sales > Product - Select a file - Change something in the file - Re-select it Nothing changed Cause Chrome doesn't trigger change on input if the file is the same Solution Clear the input value after the parse_preview so we can load a new file even if the preview failed. OPW-2288191 closes odoo/odoo#54175 X-original-commit: f7d2bdf65901e3ee78e1055cab7cf8d60f798621 Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-06-12[IMP] *: update notifications to optional titleJulien Mougenot
closes odoo/odoo#52826 Related: odoo/enterprise#11084 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-06-02[FIX] base_import: ensure reloaded file is validJulien Castiaux
The *Reload File* import functionality stands on an undefined behavior or the HTML File API. The API is not clear about what should done in case the underlying file change on the filesystem after it has been imported in the browser. It turns out the actual behavior vary among browsers and even among OSes. The *Reload File* button only works as intended when importing files via Chrome on Linux. In other cases, the browser may refuse to send the file or may send it in a corrupted HTTP request. Such malformed request is rejected in the best cases by the backend web application but there is chance it hangs. Security-wise, this problem is not much likely to happen as it requires an authenticated user with importation privileges to perform the operation. When it comes to the severity, it is possible to exhaust the available workers by forcing every one of them to hang. As there is a security impact, we decided to disable the *Reload File* functionality. Steps to reproduce ------------------ 1) Import a CSV or XLSX document in any model. 2) Wait for the data visualization to come back to the browser. 3) Change the file on disk to a) remove a few lines b) add a few more lines. 4) Click the Reload button. Wrong `size` attribute on Firefox. ---------------------------------- Impact: Firefox The advertised `Content-Length` HTTP header in the POST request is a) *greater* than the actual body length. The backend web application hangs on a `socket.recv` like function waiting for those missing bytes. b) *smaller* than the actual body length. The request is truncated and futher processing is impossible. The malformed request should have been detected and reported by the http web application as requested by the HTTP/1.1 spec [1]: > When a Content-Length is given in a message where a message-body is allowed, its field value MUST exactly match the number of OCTETs in the message-body. HTTP/1.1 user agents MUST notify the user when an invalid length is received and detected. Mitigating the issue is possible using nginx as reverse-proxy. The connection is closed after one minute if data are missing. Invalid `ERR_UPLOAD_FILE_CHANGED` --------------------------------- Impact: Chrome on Windows Chrome prevent sending the XHR due to a `ERR_UPLOAD_FILE_CHANGED` error, this error should only happens when the underlying file content have been changed the second before the request. On Windows, the error is triggered as soon as the file have been changed, not considering the modification time. [1]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html Section 4.4 opw-2252440 closes odoo/odoo#52276 X-original-commit: 30be09cdb7d5b80fb1e0221f58024586bd72ac61 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com> Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
2020-05-04[IMP] base_import,*: move Import button to Favorite menupka-odoo
*account,crm_iap_lead,hr_expense Part of task 2234547 Co-authored-by: Mohammed Shekha <msh@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
2019-11-26[IMP] base_import: support multiple xlsx sheetsJulien Castiaux
Excel can store data in multiple tables, each is called a sheet. Odoo was only importing the first sheet making the process to import a file containing multiple sheets cumbersome. It is now possible to select the sheet in the import options. By default the first sheet is selected. closes odoo/odoo#40728 Task: 2043768 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2019-09-13[ADD] base_import: batching (& some other features)Xavier Morel
various UI changes ------------------ * renamed "test import" button to "test" * move relation fields thing to debug mode * remove "Defer parent/child computation" option as it was deprecated / removed from the backend in 80f1ac3599ee630e7556ff4fcf3eb192931eccd8, turns out this checkbox existed inactive for longer than it's been of any use (added in 68cb2ade09206b0abb3f7c8dccb5d35a6499f802 on 2017-11-29, made non-operating on 2018-01-24, that's so sad) batching -------- * add support for batching imports (skip & limit parameters) * modify client to use batched imports & properly adapt responses so it still looks like a single import for the client (more or less) e.g. update row numbers in error messages, etc... * properly handle partial imports though * disable usual loading throbber to have a single progress notification displayed continuously throughout all the batches: the normal throbber only shows after 3s of waiting for an RPC response, so it would keep flashing in and out (appear 3s into a batch's import then disappear at the end only to reappear 3s into the next batch's loading) NOTE: the limit is row-wise. If a record straddles the limit (because of nested O2M records), the record is imported in full and the "next row" is whatever row follows the record. This means a limit of 10 can lead to an import of 17 lines, and as the progress indicator is in records# the increments can jump around. Task 2059448
2019-08-28[FIX] base_import: layout issuesAaron Bohy
This rev. makes the 'Formatting Options' area responsive. Closes #34257 Task 2007558 closes odoo/odoo#36159 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-08-23[FIX] import: Avoid empty error messagejbm-odoo
2019-08-20[IMP] base_import: Improve import general UX (back2basics)Yannick Tivisse
Purpose ======= Improve error management UX on import. TaskID: 2049992 closes odoo/odoo#35804 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
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-04-02[IMP] web: list: import attrsAaron Bohy
The 'import' attrs is valid according to the rng definition of the list view. It is used in a few views in Odoo. However, it didn't actually work (in most cases, it worked by chance because it is set to "0" in addition to create="0", and create="0" already disables the import feature). With this ref, the 'import' attrs is taken into account and we can now disable the import feature even if the create one is enabled. Moreover, it is now documented.
2019-03-06[REF] base_import: 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>
2018-12-11[FIX] base_import: adapt import client actionGéry Debongnie
With the recent control panel refactoring, abstract actions had to be adapted. The base import action is actually quite complicated, it relies on introspection and is fragile. With this commit, I attempt to make it work again. The main issue is that now, the root of the abstractaction is a div, which contains the root of the content template, so most of the code was assuming that the $el of the import action was the form tag, and not a parent. Note that there are no meaningful tests for import actions, because testing iframes are tricky. closes odoo/odoo#29421
2018-12-07[REF] *: adapt all client actionsAaron Bohy
to ControlPanel/Search view refactoring. The ControlPanel being now inside the DOM of client actions, those existing widgets needed to be adapted (in the way they define if and how they want a ControlPanel, and in the way the manipulate their DOM as it slightly changed). Tests needed to be adapted as well. Part of task 1893568 Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com>
2018-10-03[FIX] base_import: show error message in some situation where it was missingXavier Morel
On an AccessError, the relevant message is passed as the first arg. But the import error handler would only check for the second arg (if any) then fallback on error.message, which is missing entirely when the issue is raised as an except_orm subclass.
2018-08-16[FIX] base_import: fix formatting options structureDavid Monjoie
It used to work by chance with Bootstrap 3, but since we are now using Bootstrap 4, the fake good appearance collapsed, revealing the awful structure it used to have.
2018-08-16[ADD] base_import: debug option to create M2O/M2M recordsMohammed Shekha
Adds a checkbox to import columns (in debug mode) allowing a user to create records M2O and M2M records not found (via name_search). Task ID: 1850633 * uses a context key to avoid altering basically all the import callstack * attempted to lift the creation in the `_str_to_*` functions and create m2m via commands, but that doesn't really work out
2018-08-13[IMP] base_import: error message on transport/HTTP failureXavier Morel
Attempt to clarify/improve error message (and avoid traceback) when import fails due to some intermediate system e.g. memory error or gateway timeout. Task 38254 Closes #20627 This change is loosely related to 35d452cffbb1554c70f0acba85dfc4ef472f544c and PR #24854 in the sense that that was an attempt to better handle transport/gateway issues during file download.
2018-08-09[IMP] base_import: date-parsing patternsXavier Morel
* expand auto-detected date and time patterns (e.g. %b, %I, ...) * try to make date-pattern-detection clearer * add a select2 dropdown for date patterns (with a bunch of preselected patterns) rather than just an input * also try to improve other column-matching bits (e.g. less reliance on exceptions, attempts to avoid redundant work)
2018-08-07[IMP] base_import: attempt to automatically guess the separatorXavier Morel
It would probably be even better to iterate the file content and get the non-quoted non-alphanumeric characters as separator candidates (instead of a hard-coded list) however Python does not seem to have a decoding iterator (taking bytes and yielding an iterator of codepoints or even grapheme clusters) — incidentally uniseg seems to require up-front decoding as well — so that's not really convenient as we may be dealing with large-ish files and not want to load it entirely in memory. An alternative would be to use TextIOWrapper and iterate the file by buffers of a few ks, and classify that based on either codepoints or grapheme clusters.
2018-08-07[IMP] base_import: reintroduce encoding selector & override guessXavier Morel
* if an encoding is explicitly specified, use it and don't guess * otherwise guess and return the guessed encoding so it can be displayed in the configuration UI * fix less-than-stellar configuration & behaviour of select2 inputs to properly reflect underlying values as they get modified, to correctly handle future configuration guesses
2018-07-27[REF] *: BS4, rename btn-default to btn-secondaryqsm-odoo
BS4 "btn-default" class was replaced with "btn-secondary", which makes more sense.
2018-07-27[REF] *: BS4, adapt display classesqsm-odoo
The system completely changed. I also had to adapt classes to new screen breakpoints. hidden/hide -> d-none show -> d-block hidden-xs -> d-none d-md-(block/inline/...) hidden-sm -> d-md-none d-lg-(block/inline/...) hidden-md -> d-lg-none d-xl-(block/inline/...) hidden-lg -> d-xl-none visible-xs-* -> d-* d-md-none visible-sm-* -> d-none d-md-* d-lg-none visible-md-* -> d-none d-lg-* d-xl-none visible-lg-* -> d-none d-xl-* hidden-print -> d-print-none visible-print-* -> d-none d-print-* ... and all possible combination of those had to be handled too.
2018-07-25[IMP] base_import, web: add view switcher and h 'Import' button in mobileHiral Bhavsar
As there are a few chance that someone will import something on a mobile view. So, we hide the button 'Import' in a mobile view. For mobile view, we added a view switcher button and it'll display a list of views buttons. Also set active view's icon as its icon. Related to Task: 1857696 Co-authored-by: Mohammed Shekha <msh@openerp.com>
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-04-18[REF] *: get rid of introduced @​extendqsm-odoo
During first scss convertion, classes called as mixins were changed to an @​extend instruction which was the best approximation given the fact there is no equivalent in sass to do that. The problem is that the instruction is slowing the scss computation a lot and might also break the style in unexpected ways because of the complex unwanted selectors the instruction induces. This commit removes the need of extends. This is done case per case. Sometimes this involves adding classes in xml, sometimes to change the style a little, ... The button rendering refactoring which was made at the start of the LESS to SASS merge was also done in prevision of this. After this commit, sass computation is like 5-6 times faster than less computation while it was like 10 times *slower* before this commit.
2018-04-16[MERGE] forward port branch saas-11.2 up to 90f8f17fb4fChristophe Simonis
2018-04-16[MERGE] forward port branch 11.0 up to ad825b673b5Christophe Simonis
2018-04-12[FIX] base_import: activate advanced modeNicolas Martinelli
The commit 1ba4fbe640cf22abe did not match the specs of the task, but was merged anyway. Reverting the commit, and check by default so the user is not confused with missing fields. opw-1824074
2018-03-08[REF] web,*: introduce the concept of AbstractActionGéry Debongnie
Before this commit, a client action was simply a subclass of Widget. This is quite simple, but not really enough for the ActionManager. The ActionManager needs to handle client actions in a different way that view actions. Sometimes, it needs to check if a method exists before calling it. With this commit, we introduce a new abstraction: the AbstractAction class, which defines a common API for all actions managed by the web client. Note that the API proposed in this commit is just the beginning. We will introduce other methods in the future, to manage the focus, or the scroll position, for example.
2018-02-05[MERGE] forward port branch saas-11.1 up to 73610ff9921Christophe Simonis
2018-02-05[MERGE] forward port branch 11.0 up to aed8f453467Christophe Simonis
2018-02-02[FIX] base_import: translate column nameMartin Trigaux
The labels of the imported columns were untranslated, displaying the name of the field in English opw-813996 Fixes #22703 Closes #22717
2018-01-16[REF] web,*: ActionManager/ViewManager refactoringAaron Bohy
This rev. is the first part (out of 3) of the refactoring of the ActionManager and ViewManager layer of the webclient. The main changes are: - there is no ViewManager anymore, its work is now handled by the ActionManager itself, but isolated in a specific file ; this eases a lot of things, as the breadcrumbs handling for example. - the ActionManager code is converted to the new coding principles and guidelines ; mainly, children widgets communicate with it by triggering events up, and not by function calls anymore. - the ActionManager layer is now testable, and a lot of tests have already been written. - the code in other addons has been adapted consequently. What's coming next: - introduce the 'AbstractAction' Widget, and make client actions and view controllers inherit from it ; this widget will implement a common API that could be used uniformly by the ActionManager (e.g. restore(), canBeLeft(), renderButtons(), getTitle()...). - move the ControlPanel handling from the ActionManager to the AbstractAction.
2018-01-03[MERGE] forward port branch saas-11.1 up to 726b91b9fbcChristophe Simonis
2017-12-15[FIX] base_import: don't reload twice when leavingAaron Bohy
The 'on_reverse_breadcrumbs' option of do_action() allows to define an handler to execute when coming back to the previous action by clicking on the breadcrumbs. This option was set when executing the Import client action, to ensure that the previous view was reloaded when the client action was left. However, the view to restore is always reloaded, so specifying the option in this case produces a double reload.
2017-12-12[MERGE] forward port branch 11.0 up to b37cc1f9b78Christophe Simonis
2017-12-12[IMP] base_import: defer parent storeNicolas Seinlet
Makes possible to choose `defer_parent_store_computation` in UI. Closes #21320
2017-10-24[IMP, ADD] base_import,account,...: Provide import templates to ease the ↵Rohan Patel
import process PURPOSE ======= Provide import templates to ease the import process Specification ============= SPECIFICATION ============== 1/ Add specific templates to import screens: e.g. for product.template, res.partner and bank statements 2/ Replace import files suggested in planners (sales & website) by those ones. 3/ Add import template to bank statement import wizard for CSV, OFX, QIF and CODA files
2017-05-05[FIX] base_import: fix broken rpc calls Mehul Patel
PR #16762
2017-04-11[REF] base_import: split import button code out of actionGéry Debongnie
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] web: change internal representation of fields and view meta datasChristophe Matthieu
* Data manager load_view returns a viewInfo object * ViewInfo contains: the arch, fields and fieldsInfo objects, and some extra informations * The fields come from the server and are frozen, without any view attributes (depend of the model). * The fieldsInfo contains every view attributes and informations.
2017-04-11[IMP] base_import,web: enable 'Import' feature in KanbanAaron Bohy
Applies commit odoo/odoo@dba53fb117d678bf277b55c5a5df83fe44e252fa in the new views. The import feature was only available in List views before this commit.
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,*: remove 'web.model' and 'web.dataModelGéry Debongnie
Use this.rpc instead of Model object, with web.ajax if necessary. nb: EventDispatcherMixin include now the custom_events managment instead of widget
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-09[IMP] base_import: show import button on kanban view.Siddharth Gajjar
PURPOSE ======= Import button in list view only, its confusing for first time user. When people start using Odoo first thing they try to import contacts or products. Specificaion ============ Import button should be display in kanban view also
2016-11-10[IMP] base_import: Improve import preview for related fieldsHaresh Shyara
normal mode: Importing only regular/basic fields from source file advanced mode: Importing any related fields from source file(i.e. if detected pattern in header like '<relational_fieldname>/<fname>') - Rename following checkbox "Show all fields for completion (advanced)" in "Show fields of relation fields (advanced)" - If the import file contains a column with a field of a relation field, show the column label in the preview, even if "Show fields of relation fields (advanced)" is not checked > to make it less confusing when importing advanced files (e.g. products with attributes)