diff options
| author | Xavier Morel <xmo@odoo.com> | 2019-08-28 13:02:23 +0000 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2019-09-13 09:45:29 +0000 |
| commit | f58368210c9c962c84cdcd2e2a799c5fc6183a13 (patch) | |
| tree | 2a39c15d739c3beba061e4df91c75b7260ec7020 /addons/base_import/static/src/xml/base_import.xml | |
| parent | 71e9c4dc7a3a1839290801e963ca9dc15f31eb76 (diff) | |
[ADD] base_import: batching (& some other features)
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
Diffstat (limited to 'addons/base_import/static/src/xml/base_import.xml')
| -rw-r--r-- | addons/base_import/static/src/xml/base_import.xml | 72 |
1 files changed, 42 insertions, 30 deletions
diff --git a/addons/base_import/static/src/xml/base_import.xml b/addons/base_import/static/src/xml/base_import.xml index 6d69d6995aa..aa0e956f9fd 100644 --- a/addons/base_import/static/src/xml/base_import.xml +++ b/addons/base_import/static/src/xml/base_import.xml @@ -4,7 +4,7 @@ <form action="" method="post" enctype="multipart/form-data" class="oe_import"> <input type="hidden" name="csrf_token" t-att-value="csrf_token"/> <input type="hidden" name="import_id"/> - <div class="oe_import_box col-lg-12 d-none"> + <div class="oe_import_box d-none"> <input accept=".csv, .xls, .xlsx, .xlsm, .ods" t-attf-id="file_#{_id}" name="file" class="oe_import_file" type="file" style="display:none;"/> <div class="oe_import_with_file row"> @@ -36,34 +36,45 @@ </div> </div> </div> + <div class="o_import_batch_alert alert alert-warning d-none"> + Due to its large size, the file will be imported by batches. + </div> + <div class="o_import_partial_alert alert alert-warning d-none"> + Click 'Resume' to proceed with the import, resuming at line + <span class="o_import_partial_count">0</span>.<br/> + You can test or reload your file before resuming the import. + </div> - <div class="oe_import_with_file oe_padding col-md-12 d-none"> + <div class="oe_import_with_file d-none"> <h2>Map your columns to import</h2> - <div title="If the model uses openchatter, history tracking - will set up subscriptions and send notifications - during the import, but lead to a slower import." - class="oe_import_tracking"> - <input type="checkbox" id="oe_import_tracking"/> - <label for="oe_import_tracking"> - Track history during import - </label> - </div> - <div title="If the model uses parent/child relations, computing the - parent / child relation occurs on every line, and lead to a slower import. - Defering it can speed up import." - class="oe_import_deferparentstore"> - <input type="checkbox" id="oe_import_deferparentstore" checked="checked"/> - <label for="oe_import_deferparentstore"> - Defer parent/child computation - </label> + <div class="oe_import_debug_options"> + <div title="If the model uses openchatter, history tracking will set up subscriptions and send notifications during the import, but lead to a slower import." class="oe_import_debug_option"> + <input type="checkbox" id="oe_import_tracking"/> + <label for="oe_import_tracking"> + Track history during import + </label> + </div> + <div> + <input type="checkbox" class="oe_import_has_header" + id="oe_import_has_header" checked="checked"/> + <label for="oe_import_has_header">The first row + contains the label of the column</label> + </div> + <div class="js_import_options oe_import_debug_option oe_import_batch_limit"> + <label for="oe_import_batch_limit">Batch limit</label> + <input id="oe_import_batch_limit" value="2000"/> + </div> + <div class="js_import_options oe_import_debug_option" title="Warning: ignores the labels line, empty lines and + lines composed only of empty cells"> + <label for="oe_import_row_start">Start at line</label> + <input id="oe_import_row_start" value="1"/> + </div> + <div class="oe_import_debug_option"> + <input type="checkbox" class="oe_import_advanced_mode" checked="checked" + id="oe_import_advanced_mode"/> + <label for="oe_import_advanced_mode">Show fields of relation fields (advanced)</label> + </div> </div> - <input type="checkbox" class="oe_import_has_header" - id="oe_import_has_header" checked="checked"/> - <label for="oe_import_has_header">The first row - contains the label of the column</label> - <input type="checkbox" class="oe_import_advanced_mode" checked="checked" - id="oe_import_advanced_mode"/> - <label for="oe_import_advanced_mode">Show fields of relation fields (advanced)</label> <p class="oe_import_noheaders text-muted">If the file contains the column names, Odoo can try auto-detecting the field corresponding to the column. This makes imports @@ -95,8 +106,9 @@ </t> <t t-name="ImportView.buttons"> - <button type="button" class="btn btn-primary o_import_import d-none">Import</button> - <button type="button" class="btn btn-secondary o_import_validate d-none">Test Import</button> + <button type="button" class="btn btn-primary o_import_import o_import_import_full d-none">Import</button> + <button type="button" class="btn btn-primary o_import_import o_import_import_partial d-none">Resume</button> + <button type="button" class="btn btn-secondary o_import_validate d-none">Test</button> <button type="button" class="btn btn-secondary o_import_file_reload d-none">Reload File</button> <button type="button" class="btn btn-primary oe_import_file">Load File</button> <button type="button" class="btn btn-secondary o_import_cancel">Cancel</button> @@ -132,7 +144,7 @@ </tbody> </t> <t t-name="ImportView.preview.error"> - <div class="oe_import_report bg-danger"> + <div class="oe_import_report alert alert-danger"> <p>Import preview failed due to: <t t-esc="error"/>.</p> <p>For CSV files, you may need to select the correct separator.</p> <p t-if="preview">Here is the start of the file we could not import:</p> @@ -141,7 +153,7 @@ </t> <ul t-name="ImportView.error"> <li t-foreach="errors" t-as="error" - t-attf-class="oe_import_report bg-#{error_value[0].type}"> + t-attf-class="oe_import_report alert alert-#{error_value[0].type}"> <t t-if="error_value.length gt 1"> <t t-call="ImportView.error.multi.header"> <t t-set="error" t-value="error_value[0]"/> |
