[IMP] doc: Add example for inherit_id + mode

Added an example because it's non-trivial to realize why you would want
to set `mode` to `primary` together with `inherit_id`.

Another way to look at it is that the view matching doesn't understand
delegation inheritance. If it did there would be no need to override
`mode` because it would be able to see that the parent and derived views
refer to related models. But since that feature might not be worth the
effort, it's ok for me to just document the current situation.

X-original-commit: 549d159a836229f634be04131db947b275240edb
This commit is contained in:
Raf Geens
2020-09-16 10:21:36 +00:00
parent 0447a061f1
commit e179d4750d
+12
View File
@@ -204,6 +204,18 @@ inherited views.
inheritance mode, ``extension`` by default if ``inherit_id`` is set,
``primary`` otherwise.
An example of where you would want to override ``mode`` while using
``inherit_id`` is delegation inheritance.
In that case your derived model will be separate from its parent and views
matching with one won't match with the other. Suppose you inherit from a view
associated with the parent model and want to customize the derived view to
show data from the derived model. The ``mode`` of the derived view needs to
be set to ``primary``, because it's the base (and maybe only) view for that
derived model. Otherwise the :ref:`view matching <reference/views/inheritance/view-matching>`
rules won't apply.
.. _reference/views/inheritance/view-matching:
View matching
-------------