'Determine the inherited and custom fields of the model.'

@api.model
def _setup_base(self, partial):

    cls = type(self)
    if cls._setup_done:
        return
    cls0 = cls.pool.model_cache.get(cls._model_cache_key)
    if (cls0 and (cls0._model_cache_key == cls._model_cache_key)):
        for name in (set(cls._fields) - cls0._proper_fields):
            delattr(cls, name)
            cls._fields.pop(name, None)
        for name in cls0._proper_fields:
            field = cls0._fields[name]
            if (not field.related):
                self._add_field(name, field)
            else:
                self._add_field(name, field.new(**field.args))
        cls._proper_fields = set(cls._fields)
    else:
        for name in cls._fields:
            delattr(cls, name)
        cls._fields = {}
        for (name, field) in getmembers(cls, Field.__instancecheck__):
            if (not any((field.args.get(k) for k in ('automatic', 'manual', 'inherited')))):
                self._add_field(name, field.new())
        self._add_magic_fields()
        cls._proper_fields = set(cls._fields)
    cls.pool.model_cache[cls._model_cache_key] = cls
    self._add_manual_fields(partial)
    self._inherits_check()
    for parent in self._inherits:
        self.env[parent]._setup_base(partial)
    self._add_inherited_fields()
    cls._field_computed = {}
    cls._field_inverses = Collector()
    cls._field_triggers = Collector()
    cls._setup_done = True
