'Returns a converter object for the model. A converter is a
callable taking a record-ish (a dictionary representing an odoo
record with values of typetag ``fromtype``) and returning a converted
records matching what :meth:`odoo.osv.orm.Model.write` expects.
:param model: :class:`odoo.osv.orm.Model` for the conversion base
:returns: a converter callable
:rtype: (record: dict, logger: (field, error) -> None) -> dict'

@api.model
def for_model(self, model, fromtype=str):

    model = self.env[model._name]
    converters = {name: self.to_field(model, field, fromtype) for (name, field) in model._fields.iteritems()}
    def fn(record, log):
        converted = {}
        for (field, value) in record.iteritems():
            if (field in REFERENCING_FIELDS):
                continue
            if (not value):
                converted[field] = False
                continue
            try:
                (converted[field], ws) = converters[field](value)
                for w in ws:
                    if isinstance(w, basestring):
                        w = ImportWarning(w)
                    log(field, w)
            except ValueError as e:
                log(field, e)
        return converted
    return fn
