[IMP] base: advertise view's active behavior in <template> vs <record>

Upon updates, the `active` field of `ir.ui.view` behaves differently
depending on whether the view is defined by using the `<template>` tag
or the `<record>` tag.

When using `<record>`, it behaves like any other field and gets updated
with the new value (notice that for qweb view, you should rarely rely
on this as if users customized those views with the website builder,
they are duplicated (COW)... updating the active field without migration
script would then be a source of errors).
When using `<template>`, it is not updated since [1], except for new
records since [2].

This commit adds a comment to the `active` field to help developers find
out about this difference.

See this [discussion].

[1]: https://github.com/odoo/odoo/commit/2d296cb77922d33be2dc45b900191fac34bda429#diff-175c28787c272a219b9275f79262a48af9aa029e718f45077fd609737559e84eR803-R804
[2]: https://github.com/odoo/odoo/commit/f1c70d4cc943ac4eb81a85a9dc005de34cd2060a#diff-175c28787c272a219b9275f79262a48af9aa029e718f45077fd609737559e84eR801-R804
[discussion]: https://github.com/odoo/odoo/pull/104836#discussion_r1013155860

Related to task-2963840

closes odoo/odoo#105647

X-original-commit: 454a47fdc1583bb7f77708e483606782743537b2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
This commit is contained in:
Benoit Socias
2022-11-14 16:21:29 +01:00
committed by qsm-odoo
co-authored by qsm-odoo
parent 382d6924b8
commit fc61a2da5a
+7
View File
@@ -272,6 +272,13 @@ different model than this one), then this view's inheritance specs
(<xpath/>) are applied, and the result is used as if it were this view's
actual arch.
""")
# The "active" field is not updated during updates if <template> is used
# instead of <record> to define the view in XML, see _tag_template. For
# qweb views, you should not rely on the active field being updated anyway
# as those views, if used in frontend layouts, can be duplicated (see COW)
# and will thus always require upgrade scripts if you really want to change
# the default value of their "active" field.
active = fields.Boolean(default=True,
help="""If this view is inherited,
* if True, the view always extends its parent