current_module, res, mode=mode, xml_id=xml_id,
noupdate=noupdate, res_id=res_id, context=context)
except Exception, e:
- return (-1, res, 'Line ' + str(position) +' : ' + str(e), '')
+ return (-1, res, 'Line ' + str(position) +' : ' + tools.ustr(e), '')
if config.get('import_partial', False) and filename and (not (position%100)):
data = pickle.load(file(config.get('import_partial')))
del vals[self._inherits[table]]
record_id = tocreate[table].pop('id', None)
-
+
+ # When linking/creating parent records, force context without 'no_store_function' key that
+ # defers stored functions computing, as these won't be computed in batch at the end of create().
+ parent_context = dict(context)
+ parent_context.pop('no_store_function', None)
+
if record_id is None or not record_id:
- record_id = self.pool.get(table).create(cr, user, tocreate[table], context=context)
+ record_id = self.pool.get(table).create(cr, user, tocreate[table], context=parent_context)
else:
- self.pool.get(table).write(cr, user, [record_id], tocreate[table], context=context)
+ self.pool.get(table).write(cr, user, [record_id], tocreate[table], context=parent_context)
upd0 += ',' + self._inherits[table]
upd1 += ',%s'
order_direction = order_split[1].strip() if len(order_split) == 2 else ''
inner_clause = None
if order_field == 'id':
- order_by_clause = '"%s"."%s"' % (self._table, order_field)
+ inner_clause = '"%s"."%s"' % (self._table, order_field)
elif order_field in self._columns:
order_column = self._columns[order_field]
if order_column._classic_read: