[FIX] issue in splitting field paths for export: would create empty path sections because too eager

do replacement in two passes of re-base replacement: replace old-style 'field:id' and 'field.id' in resp. 'field/id' and 'field/.id', don't touch anything else (especially not 'field/.id') and leave them through instead.

bzr revid: xmo@openerp.com-20110831094547-8evd7ecm5qojspnr
This commit is contained in:
Xavier Morel 2011-08-31 11:45:47 +02:00
parent f2d080780c
commit ddadb2ce75
1 changed files with 4 additions and 3 deletions

View File

@ -984,9 +984,10 @@ class orm_template(object):
cols = self._columns.copy()
for f in self._inherit_fields:
cols.update({f: self._inherit_fields[f][2]})
def fsplit(x):
if x=='.id': return [x]
return x.replace(':id','/id').replace('.id','/.id').split('/')
def fsplit(fieldname):
fixed_db_id = re.sub(r'([^/])\.id', r'\1/.id', fieldname)
fixed_external_id = re.sub(r'([^/]):id', r'\1/id', fixed_db_id)
return fixed_external_id.split('/')
fields_to_export = map(fsplit, fields_to_export)
datas = []
for row in self.browse(cr, uid, ids, context):