[FIX] mass_mailing{_sms}: fix various views for proper behavior

This commit fixes few views related to mass mailing for ensuring their
proper behavior. The changes are listed as below:

 - in the mass mailing form view (view_mail_mass_mailing_form), made the
   mailing_type field readonly if the mailing is not in draft state to
   prevent switching the type once mailing is launched.
 - in the mass mailing sms form view (mailing_mailing_view_form_sms), made the
   'body_plaintext' field readonly if the mailing is in sent/done state to
   prevent sms content modification after the sms are already sent

Task ID-2390284
COM PR odoo/odoo#62740
ENT PR odoo/enterprise#15098

closes odoo/odoo#69600

X-original-commit: 94f1994c08d3a54f6358c31634ff27532da2a569
Related: odoo/enterprise#17846
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Anjali
2021-04-21 10:38:22 +00:00
committed by Thibault Delavallée
parent 67f9ce9f51
commit 1d8b34760c
2 changed files with 3 additions and 2 deletions
@@ -159,7 +159,7 @@
<group>
<field name="active" invisible="1"/>
<field name="mailing_type" widget="radio" options="{'horizontal': true}" invisible="1"
attrs="{'readonly': [('state', 'in', ('sending', 'done'))]}"/>
attrs="{'readonly': [('state', '!=', 'draft')]}" force_save="1"/>
<field class="o_text_overflow" name="subject" string="Subject" attrs="{'readonly': [('state', 'in', ('sending', 'done'))]}" widget="char_emojis" placeholder="e.g. New Sale on all T-shirts"/>
<field class="o_text_overflow" name="preview" string="Preview Text" attrs="{'readonly': [('state', 'in', ('sending', 'done'))]}" widget="char_emojis" placeholder="e.g. Check it out before it's too late!"/>
<label for="mailing_model_id" string="Recipients"/>
@@ -117,7 +117,8 @@
</xpath>
<xpath expr="//page[@name='mail_body']" position="after">
<page string="SMS Content" name="sms_body" attrs="{'invisible': [('mailing_type', '!=', 'sms')]}">
<field name="body_plaintext" widget="sms_widget" attrs="{'required': [('mailing_type', '=', 'sms')]}"
<field name="body_plaintext" widget="sms_widget"
attrs="{'required': [('mailing_type', '=', 'sms')], 'readonly': [('state', 'in', ('sending', 'done'))]}"
options='{"enable_emojis": True}'/>
</page>
</xpath>