[FIX] web: data import: fields matching have to be done first on exactfieldname, then only on string

bzr revid: xal@openerp.com-20120530101608-8al6jw332oz0v2c0
This commit is contained in:
Xavier ALT
2012-05-30 12:16:08 +02:00
parent fc4e1d83ad
commit 6700a95d79
+12 -2
View File
@@ -267,8 +267,13 @@ openerp.web.DataImport = openerp.web.Dialog.extend({
f = _(fields).detect(function (field) {
// TODO: levenshtein between header and field.string
return field.name === name
|| field.string.toLowerCase() === name.toLowerCase();
});
if (!f) {
f = _(fields).detect(function (field) {
// TODO: levenshtein between header and field.string
return field.string.toLowerCase() === name.toLowerCase();
});
}
if (f) { return f.name; }
// if ``name`` is a path (o2m), we need to recurse through its .fields
@@ -279,8 +284,13 @@ openerp.web.DataImport = openerp.web.Dialog.extend({
f = _(fields).detect(function (field) {
// field.name for o2m is $foo/id, so we want to match on id
return field.id === column_name
|| field.string.toLowerCase() === column_name.toLowerCase()
});
if (!f) {
f = _(fields).detect(function (field) {
// field.name for o2m is $foo/id, so we want to match on id
return field.string.toLowerCase() === column_name.toLowerCase()
});
}
if (!f) { return undefined; }
// if we found a matching field for the first path section, recurse in