Files
odoo_source/addons/website_slides/wizard
std-odoo 93fc52c8e1 [FIX] mail: allow a normal user to view the template body
Followup of odoo/odoo@1a3e713

Bug
===
If the user doesn't have the template editor, he cannot open the template
preview.

Technical
=========
The reason for that is because the web editor moves some CSS properties,
and so when the user tries to open the preview, an access error is raised.

Ideally, the template form view should not be editable if the access
rules do not allow it. But in _postprocess_tag_field, we only check
for access right because we don't have the record. So a user without
write access rules, but having write access right can edit the template
in the UI, and gets an error when saving.

Also, the web editor should not save the HTML value if no change are
made on the field (like all other text / char field).

To mitigate the issue in stable, we add a computed field that check the
access rules and make the body readonly if he can not edit the template.
So the web editor is not loaded, the CSS properties are not moved. Other
possible solutions are way to complex technically speaking (editor internals
to update in frontend, complex comparison of html blobs in backend, cache
usage making fields_view_get override not working in all cases, ... )

As the HTML body look weird in readonly mode, add the same border as the web
editor.

Task-2845877

X-original-commit: dcf3ab5fb41aa9ef6e59b2155bfd192e551b6476
Part-of: odoo/odoo#99256
2022-08-30 21:25:55 +02:00
..