2012-08-14 12:16:10 +00:00
|
|
|
<templates>
|
|
|
|
<t t-name="ImportView">
|
2012-08-30 12:52:32 +00:00
|
|
|
<t t-set="_id" t-value="_.uniqueId('export')"/>
|
2012-08-14 12:48:35 +00:00
|
|
|
<form action="" method="post" enctype="multipart/form-data" class="oe_import">
|
2012-10-03 12:11:37 +00:00
|
|
|
<header>
|
|
|
|
<button type="button" disabled="disabled"
|
2012-10-03 12:16:19 +00:00
|
|
|
class="oe_button oe_import_button oe_import_validate oe_highlight"
|
2012-10-03 12:11:37 +00:00
|
|
|
>Validate</button>
|
|
|
|
<button type="button" disabled="disabled"
|
|
|
|
class="oe_button oe_import_button oe_import_import"
|
|
|
|
>Import</button>
|
|
|
|
<span class="oe_fade">or</span>
|
|
|
|
<a class="oe_import_cancel" href="#">Cancel</a>
|
|
|
|
</header>
|
2012-08-14 12:16:10 +00:00
|
|
|
<input type="hidden" name="session_id"
|
|
|
|
t-att-value="widget.session.session_id"/>
|
|
|
|
<input type="hidden" name="import_id"/>
|
2012-08-14 17:23:22 +00:00
|
|
|
<h2>Upload your file</h2>
|
2012-10-01 11:03:03 +00:00
|
|
|
<p>Select the <a
|
|
|
|
href="http://en.wikipedia.org/wiki/Comma-separated_values"
|
|
|
|
class="oe_import_csv">.CSV</a>
|
2012-08-14 17:23:22 +00:00
|
|
|
file to import. If you need a sample importable file, you
|
2012-10-01 11:03:03 +00:00
|
|
|
can use the export tool to generate one.</p>
|
2012-08-30 12:52:32 +00:00
|
|
|
<label t-attf-for="file_#{_id}" autofocus="autofocus">CSV File:</label>
|
|
|
|
<input type="file" id-attf-id="file_#{_id}"
|
|
|
|
name="file" class="oe_import_file"/>
|
2012-10-04 10:22:36 +00:00
|
|
|
<div class="oe_import_with_file">
|
|
|
|
<a href="#" class="oe_import_toggle">
|
|
|
|
File Format Options…</a>
|
|
|
|
<div class="oe_import_toggled oe_import_options">
|
|
|
|
<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}"
|
|
|
|
t-att-value="option.value"/>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
2012-08-14 12:16:10 +00:00
|
|
|
|
2012-08-14 17:23:22 +00:00
|
|
|
<div class="oe_import_with_file">
|
|
|
|
<h2>Map your data to OpenERP</h2>
|
|
|
|
<input type="checkbox" class="oe_import_has_header"
|
|
|
|
id="oe_import_has_header" checked="checked"/>
|
|
|
|
<label for="oe_import_has_header">The first row of the
|
|
|
|
file contains the label of the column</label>
|
|
|
|
<p class="oe_import_noheaders">If the file contains
|
|
|
|
the column names, OpenERP 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>
|
|
|
|
<table class="oe_import_grid" width="100%"/>
|
|
|
|
|
|
|
|
<h2>Frequently Asked Questions</h2>
|
|
|
|
<dl>
|
2012-08-30 12:52:32 +00:00
|
|
|
<dt><a href="#" class="oe_import_toggle">
|
|
|
|
Need to import data from an other application?</a></dt>
|
2012-08-14 17:23:22 +00:00
|
|
|
<dd>
|
|
|
|
<p>In order to re-create relationships between
|
|
|
|
different records, you should use the unique
|
|
|
|
identifier from the original application and
|
|
|
|
map it to the <abbr title="External ID">ID</abbr>
|
|
|
|
column in OpenERP. When you
|
|
|
|
import an other record that links to the first
|
|
|
|
one, use <abbr title="XXX/External ID">XXX/ID</abbr>
|
|
|
|
to the original unique identifier.</p>
|
|
|
|
<p>The <abbr title="External ID">ID</abbr>
|
|
|
|
will also be used to update the original
|
|
|
|
import if you need to re-import modified data
|
|
|
|
later, it's thus good practice to specify it
|
|
|
|
whenever possible</p>
|
|
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
</div>
|
2012-08-14 12:16:10 +00:00
|
|
|
</form>
|
|
|
|
</t>
|
|
|
|
<t t-name="ImportView.preview">
|
|
|
|
<tr t-if="headers" class="oe_import_grid-header">
|
|
|
|
<td t-foreach="headers" t-as="header" class="oe_import_grid-cell"
|
|
|
|
><t t-esc="header"/></td>
|
|
|
|
</tr>
|
2012-08-14 14:14:56 +00:00
|
|
|
<tr class="oe_import_fields">
|
|
|
|
<!-- Iterate on first row to ensure we have all columns -->
|
|
|
|
<td t-foreach="preview[0]" t-as="column">
|
2012-09-06 10:35:16 +00:00
|
|
|
<input placeholder="Don't Import"
|
|
|
|
class="oe_import_match_field"/>
|
2012-08-14 14:14:56 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2012-08-14 12:16:10 +00:00
|
|
|
<tr t-foreach="preview" t-as="row" class="oe_import_grid-row">
|
|
|
|
<td t-foreach="row" t-as="cell" class="oe_import_grid-cell"
|
|
|
|
><t t-esc="cell"/></td>
|
|
|
|
</tr>
|
|
|
|
</t>
|
2012-08-14 14:14:56 +00:00
|
|
|
<t t-name="ImportView.preview.error">
|
2012-10-01 14:22:27 +00:00
|
|
|
<p>Import preview failed due to: <t t-esc="error"/>. The issue is
|
|
|
|
usually an incorrect file encoding.</p>
|
2012-08-14 12:48:35 +00:00
|
|
|
<p>Here is the start of the file we could not import:</p>
|
|
|
|
<pre><t t-esc="preview"/></pre>
|
|
|
|
</t>
|
2012-08-14 14:14:56 +00:00
|
|
|
<ul t-name="ImportView.error">
|
2012-09-26 16:50:52 +00:00
|
|
|
<li t-foreach="errors" t-as="error"
|
|
|
|
t-attf-class="oe_import_report oe_import_report_#{error_value[0].type}">
|
|
|
|
<t t-call="ImportView.error.each">
|
|
|
|
<t t-set="error" t-value="error_value[0]"/>
|
|
|
|
</t>
|
|
|
|
|
|
|
|
<a href="#" class="oe_import_report_count" t-if="error_value.length gt 1">
|
|
|
|
<t t-esc="more(error_value.length - 1)"/>
|
|
|
|
</a>
|
|
|
|
<ul class="oe_import_report_more" t-if="error_value.length gt 1">
|
|
|
|
<li t-foreach="error_value.length - 1" t-as="index">
|
|
|
|
<t t-call="ImportView.error.each">
|
|
|
|
<t t-set="error" t-value="error_value[index + 1]"/>
|
|
|
|
</t>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2012-08-14 14:14:56 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
2012-09-26 16:50:52 +00:00
|
|
|
<t t-name="ImportView.error.each">
|
|
|
|
<span class="oe_import_report_message">
|
|
|
|
<t t-esc="error.message"/>
|
|
|
|
</span>
|
2012-09-27 07:48:45 +00:00
|
|
|
<t t-if="error.rows" t-esc="at(error.rows)"/>
|
|
|
|
<t t-if="error.moreinfo" t-raw="info(error.moreinfo)"/>
|
2012-09-26 16:50:52 +00:00
|
|
|
</t>
|
2012-09-11 06:38:49 +00:00
|
|
|
<t t-extend="ListView.buttons">
|
|
|
|
<t t-jquery="span.oe_alternative">
|
|
|
|
this.attr('t-if', 'widget.options.import_enabled');
|
|
|
|
</t>
|
|
|
|
<t t-jquery="span.oe_alternative" t-operation="append">
|
|
|
|
<a href="#" class="oe_bold oe_list_button_import">Import</a>
|
|
|
|
</t>
|
|
|
|
</t>
|
2012-08-14 12:16:10 +00:00
|
|
|
</templates>
|