summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2018-04-12 13:32:17 +0200
committerNicolas Martinelli <nim-odoo@users.noreply.github.com>2018-04-12 14:54:25 +0200
commit72425445062bc595d0718d83580de9901023aaf3 (patch)
tree4977031f7b36a777a18c43f8828f6bd19ec5ec92
parent9c1c2c55c23655c56dcd04c3d80da59b5bcab177 (diff)
[FIX] base_import: activate advanced mode
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
-rw-r--r--addons/base_import/models/base_import.py1
-rw-r--r--addons/base_import/static/src/js/import_action.js1
-rw-r--r--addons/base_import/static/src/xml/base_import.xml2
-rw-r--r--addons/base_import/tests/test_base_import.py8
4 files changed, 5 insertions, 7 deletions
diff --git a/addons/base_import/models/base_import.py b/addons/base_import/models/base_import.py
index dbff99fab88..748b37e86af 100644
--- a/addons/base_import/models/base_import.py
+++ b/addons/base_import/models/base_import.py
@@ -497,7 +497,6 @@ class Import(models.TransientModel):
'headers_type': header_types or False,
'preview': preview,
'options': options,
- 'advanced_mode': any([len(models.fix_import_export_id_paths(col)) > 1 for col in headers or []]),
'debug': self.user_has_groups('base.group_no_one'),
}
except Exception as error:
diff --git a/addons/base_import/static/src/js/import_action.js b/addons/base_import/static/src/js/import_action.js
index 1872dec6205..153e41ed632 100644
--- a/addons/base_import/static/src/js/import_action.js
+++ b/addons/base_import/static/src/js/import_action.js
@@ -301,7 +301,6 @@ var DataImport = Widget.extend(ControlPanelMixin, {
this.$buttons.filter('.o_import_button').add(this.$('.oe_import_file_reload'))
.prop('disabled', false);
this.$el.addClass('oe_import_preview');
- this.$('input.oe_import_advanced_mode').prop('checked', result.advanced_mode);
this.$('.oe_import_grid').html(QWeb.render('ImportView.preview', result));
if (result.headers.length === 1) {
diff --git a/addons/base_import/static/src/xml/base_import.xml b/addons/base_import/static/src/xml/base_import.xml
index c9c4e8a5037..7a9881849ac 100644
--- a/addons/base_import/static/src/xml/base_import.xml
+++ b/addons/base_import/static/src/xml/base_import.xml
@@ -76,7 +76,7 @@
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" disabled="disabled"
+ <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">If the file contains
diff --git a/addons/base_import/tests/test_base_import.py b/addons/base_import/tests/test_base_import.py
index 55f3300da91..df2d18a3feb 100644
--- a/addons/base_import/tests/test_base_import.py
+++ b/addons/base_import/tests/test_base_import.py
@@ -258,7 +258,7 @@ class TestPreview(TransactionCase):
['qux', '5', '6'],
])
# Ensure we only have the response fields we expect
- self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'advanced_mode', 'debug'])
+ self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'debug'])
@unittest.skipUnless(can_import('xlrd'), "XLRD module not available")
def test_xls_success(self):
@@ -288,7 +288,7 @@ class TestPreview(TransactionCase):
['qux', '5', '6'],
])
# Ensure we only have the response fields we expect
- self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'advanced_mode', 'debug'])
+ self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'debug'])
@unittest.skipUnless(can_import('xlrd.xlsx'), "XLRD/XLSX not available")
def test_xlsx_success(self):
@@ -318,7 +318,7 @@ class TestPreview(TransactionCase):
['qux', '5', '6'],
])
# Ensure we only have the response fields we expect
- self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options','advanced_mode', 'debug'])
+ self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'debug'])
@unittest.skipUnless(can_import('odf'), "ODFPY not available")
def test_ods_success(self):
@@ -348,7 +348,7 @@ class TestPreview(TransactionCase):
['aux', '5', '6'],
])
# Ensure we only have the response fields we expect
- self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'advanced_mode', 'debug'])
+ self.assertItemsEqual(list(result), ['matches', 'headers', 'fields', 'preview', 'headers_type', 'options', 'debug'])
class test_convert_import_data(TransactionCase):