From e179d4750d371c8a0796db194305819eda429ff4 Mon Sep 17 00:00:00 2001 From: Raf Geens Date: Tue, 8 Sep 2020 14:01:25 +0000 Subject: [PATCH] [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 --- doc/reference/views.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/reference/views.rst b/doc/reference/views.rst index 67a01ff570e..841900917d2 100644 --- a/doc/reference/views.rst +++ b/doc/reference/views.rst @@ -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 ` + rules won't apply. + +.. _reference/views/inheritance/view-matching: + View matching -------------