diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /addons/base_import/static/src/xml | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'addons/base_import/static/src/xml')
| -rw-r--r-- | addons/base_import/static/src/xml/base_import.xml | 227 |
1 files changed, 227 insertions, 0 deletions
diff --git a/addons/base_import/static/src/xml/base_import.xml b/addons/base_import/static/src/xml/base_import.xml new file mode 100644 index 00000000..4bee0203 --- /dev/null +++ b/addons/base_import/static/src/xml/base_import.xml @@ -0,0 +1,227 @@ +<templates> + <t t-name="base_import.ImportMenu" owl="1"> + <li class="o_menu_item o_import_menu" role="menuitem"> + <button type="button" class="dropdown-item" t-on-click="_onImportClick"> + Import records + </button> + </li> + </t> + + <t t-name="ImportView"> + <t t-set="_id" t-value="_.uniqueId('export')"/> + <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 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"> + <a href="#" class="oe_import_toggle col-sm-12"> + Formatting Options…</a> + <div class="row col-sm-12"> + <div class="oe_import_toggled oe_import_options js_import_options col-md-6 col-lg-4"> + <p t-foreach="widget.opts" t-as="option"> + <!-- no @name, avoid submission when file_update called --> + <label t-attf-for="#{option.name}_#{_id}"> + <t t-esc="option.label"/></label> + <input t-attf-id="#{option.name}_#{_id}" + t-attf-class="oe_import_#{option.name}" + style="width: 50%;" + t-att-value="option.value"/> + </p> + </div> + <div t-foreach="[widget.parse_opts_formats, widget.parse_opts_separators]" t-as="options" class="oe_import_toggled oe_import_options col-md-6 col-lg-4"> + <p t-foreach="options" t-as="option"> + <!-- no @name, avoid submission when file_update called --> + <label t-attf-for="#{option.name}_#{_id}"> + <t t-esc="option.label"/></label> + <input t-attf-id="#{option.name}_#{_id}" + t-attf-class="oe_import_#{option.name}" + style="width: 50%;" + t-att-value="option.value"/> + </p> + </div> + </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 d-none"> + <h2>Map your columns to import</h2> + <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 class="oe_import_has_multiple_sheets js_import_options"> + <label for="oe_import_sheet">Selected Sheet:</label> + <input class="oe_import_sheet" id="oe_import_sheet"/> + </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> + <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 + simpler especially when the file has many columns.</p> + + <div class="oe_import_error_report"></div> + <div class="table-responsive"> + <table class="table-striped table-bordered oe_import_grid bg-white" /> + </div> + <h6 class="oe_padding">This is a preview of the first 10 rows of your file</h6> + </div> + <div class="o_view_nocontent"> + <div class="o_nocontent_help"> + <p class="o_view_nocontent_smiling_face"> + Select a CSV or Excel file to import. + </p> + <p> + Excel files are recommended as fields formatting is automatic. + </p> + <div class="mt16 mb4">Need Help?</div> + <div t-foreach="widget.importTemplates" t-as="template"> + <a t-att-href="template.template" aria-label="Download" title="Download"> + <i class="fa fa-download"/> <span><t t-esc="template.label"/></span> + </a> + </div> + <a href="https://www.odoo.com/documentation/14.0/applications/general/base_import/import_faq.html" target="new">Import FAQ</a> + </div> + </div> + </form> + </t> + + <t t-name="ImportView.buttons"> + <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-primary oe_import_file">Load File</button> + <button type="button" class="btn btn-secondary o_import_cancel">Cancel</button> + </t> + + <t t-name="ImportView.create_record_option"> + <div class="mt4"> + <label title="Creates new records if they can't be found (instead of failing to import). Note that the value in the column will be used as the new record's 'name', and assumes this is sufficient to create the record."> + <input type="checkbox" class="o_import_create_option"/> + Create if doesn't exist + </label> + </div> + </t> + + <t t-name="ImportView.preview"> + <thead> + <tr t-if="headers" class="oe_import_grid-header"> + <td t-foreach="headers" t-as="header" class="oe_import_grid-cell" + ><span class="o_import_header_name o_single_line_text" t-att-title="header"><t t-esc="header"/></span></td> + </tr> + <tr class="oe_import_fields"> + <!-- Iterate on first row to ensure we have all columns --> + <td t-foreach="preview[0]" t-as="column"> + <input class="oe_import_match_field"/> + </td> + </tr> + </thead> + <tbody> + <tr t-foreach="preview" t-as="row" class="oe_import_grid-row"> + <td t-foreach="row" t-as="cell" class="oe_import_grid-cell"> + <!-- content can be displayed on several lines if it contains whitespaces --> + <!-- in that case, we only display the 120 first characters --> + <!-- otherwise, we let the text-overflow: ellipsis do the job --> + <t t-set="multiline" t-value="cell.includes(' ')"/> + <t t-set="content" t-value="(multiline && cell.length > 120) ? (cell.substring(0, 120) + '...') : cell"/> + <span t-attf-class="#{multiline ? 'o_multi_line_text' : 'o_single_line_text'}"> + <t t-esc="content"/> + </span> + </td> + </tr> + </tbody> + </t> + <t t-name="ImportView.preview.error"> + <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> + </div> + <pre t-if="preview"><t t-esc="preview"/></pre> + </t> + <ul t-name="ImportView.error"> + <li t-foreach="errors" t-as="error" + 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]"/> + <t t-set="error_length" t-value="error_value.length"/> + </t> + <ul> + <t t-foreach="error_value.length" t-as="index"> + <li t-att-class="index gt 4 ? 'oe_import_report_more':''"> + <t t-call="ImportView.error.multi.body"> + <t t-set="error" t-value="error_value[index]"/> + <t t-set="index" t-value="index"/> + </t> + </li> + <li t-if="error_value.length gt 5 and index == 4" style="display: block;"> + <a href="#" class="oe_import_report_count"> + <t t-esc="more(error_value.length - 5)"/> + </a> + </li> + </t> + </ul> + <t t-if="error_value[0].moreinfo" t-raw="info(error_value[0].moreinfo)"/> + + </t> + <t t-else=""> + <t t-call="ImportView.error.single"> + <t t-set="error" t-value="error_value[0]"/> + </t> + </t> + </li> + </ul> + <t t-name="ImportView.error.multi.header"> + <span class="oe_import_report_message"> + <t t-esc="error.message"/> + <t t-esc="at_multi_header(error_length)"/> + </span> + </t> + <t t-name="ImportView.error.multi.body"> + <span class="oe_import_report_message" t-if="error.rows"> + <t t-esc="at_multi(error.rows)"/> + </span> + </t> + <t t-name="ImportView.error.single"> + <span class="oe_import_report_message"> + <t t-esc="error.message"/> + </span> + <t t-if="error.rows" t-esc="at(error.rows)"/> + <t t-if="error.moreinfo" t-raw="info(error.moreinfo)"/> + </t> +</templates> |
