[FIX] base: useless view validations when validate=False

When a view is created/modified, it is required to validate it, the
validation checks the syntax, the inheritances, the fields, etc. When a
view is rendered there are a few more steps to perform like to (dis)able
the `edit` button from a view form if the user only have `read`
accesses. Those postprocess are useless when the view is validated and
should only be performed when the view is rendered.

closes odoo/odoo#68469

Signed-off-by: Julien Castiaux <Julien00859@users.noreply.github.com>
This commit is contained in:
Raphael Collet
2021-06-15 08:44:03 +00:00
committed by Julien Castiaux
parent 4f22ae270a
commit 7fca29b443
+6 -2
View File
@@ -952,7 +952,9 @@ actual arch.
if model not in self.env:
self.handle_view_error(_('Model not found: %(model)s', model=model), node)
self._postprocess_on_change(model, node)
if not validate:
# validation mode does not care about on_change
self._postprocess_on_change(model, node)
name_manager = NameManager(validate, self.env[model])
self.postprocess(node, [], editable, name_manager)
@@ -960,7 +962,9 @@ actual arch.
name_manager.check_view_fields(self)
name_manager.update_view_fields()
self._postprocess_access_rights(model, node)
if not validate:
# validation mode does not care about access rights
self._postprocess_access_rights(model, node)
return etree.tostring(node, encoding="unicode").replace('\t', ''), name_manager