'Converts records from the source iterable (recursive dicts of
strings) into forms which can be written to the database (via
self.create or (ir.model.data)._update)
:returns: a list of triplets of (id, xid, record)
:rtype: list((int|None, str|None, dict))'

@api.model
def _convert_records(self, records, log=(lambda a: None)):

    field_names = {name: field.string for (name, field) in self._fields.iteritems()}
    if self.env.lang:
        field_names.update(self.env['ir.translation'].get_field_string(self._name))
    convert = self.env['ir.fields.converter'].for_model(self)
    def _log(base, record, field, exception):
        type = ('warning' if isinstance(exception, Warning) else 'error')
        exc_vals = dict(base, record=record, field=field_names[field])
        record = dict(base, type=type, record=record, field=field, message=(unicode(exception.args[0]) % exc_vals))
        if ((len(exception.args) > 1) and exception.args[1]):
            record.update(exception.args[1])
        log(record)
    stream = CountingStream(records)
    for (record, extras) in stream:
        xid = record.get('id', False)
        dbid = False
        if ('.id' in record):
            try:
                dbid = int(record['.id'])
            except ValueError:
                dbid = record['.id']
            if (not self.search([('id', '=', dbid)])):
                log(dict(extras, type='error', record=stream.index, field='.id', message=(_(u"Unknown    database    identifier    '%s'") % dbid)))
                dbid = False
        converted = convert(record, functools.partial(_log, extras, stream.index))
        (yield (dbid, xid, converted, dict(extras, record=stream.index)))
