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
42 lines
2.2 KiB
XML
42 lines
2.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<data>
|
|
<record id="slide_channel_invite_view_form" model="ir.ui.view">
|
|
<field name="name">slide.channel.invite.view.form</field>
|
|
<field name="model">slide.channel.invite</field>
|
|
<field name="arch" type="xml">
|
|
<form string="Compose Email" class="o_mail_composer_form">
|
|
<group col="1">
|
|
<group col="2">
|
|
<field name="channel_id" invisible="1"/>
|
|
<field name="partner_ids"
|
|
widget="many2many_tags_email"
|
|
placeholder="Add existing contacts..."
|
|
required="1"
|
|
context="{'force_email':True, 'show_email':True, 'no_create_edit': True, 'no_quick_create': True}"/>
|
|
</group>
|
|
<group col="2">
|
|
<field name="render_model" invisible="1"/>
|
|
<field name="subject" placeholder="Subject..."/>
|
|
</group>
|
|
<field name="can_edit_body" invisible="1"/>
|
|
<field name="body" class="oe-bordered-editor" options="{'style-inline': true}" attrs="{'readonly': [('can_edit_body', '=', False)]}" force_save="1"/>
|
|
<group>
|
|
<group>
|
|
<field name="attachment_ids" widget="many2many_binary"/>
|
|
</group>
|
|
<group>
|
|
<field name="template_id" label="Use template" context="{'default_model': 'slide.channel.partner'}"/>
|
|
</group>
|
|
</group>
|
|
</group>
|
|
<footer>
|
|
<button string="Send" name="action_invite" type="object" class="btn-primary" data-hotkey="q"/>
|
|
<button string="Cancel" class="btn-secondary" special="cancel" data-hotkey="z"/>
|
|
</footer>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
</data>
|
|
</odoo>
|