[FIX] mass_mailing: mail template become invisible after saving

Bug
===
In the mailing mailing form view, after saving the email and creating it, the body is invisible and one needs to edit and save again to see the content
The view has two fields with the same name

Fix
===
At the end, we have only one field and some condition on the attributes (class, widget)

TASK_ID : 2078918

Co-authored-by: Stéphane Debauche <std@odoo.com>
This commit is contained in:
ryv-odoo
2019-10-01 11:04:10 +00:00
co-authored by Stéphane Debauche
parent 43a880eb6c
commit a7489feed0
2 changed files with 15 additions and 13 deletions
@@ -137,6 +137,13 @@ var MassMailingFieldHtml = FieldHtml.extend({
}
return this._super.apply(this, arguments);
},
/**
* @override
*/
_renderReadonly: function () {
this.value = this.recordData[this.nodeOptions['inline-field']];
return this._super.apply(this, arguments);
},
/**
* @override
@@ -168,19 +168,14 @@
</group>
<notebook>
<page string="Mail Body" name="mail_body">
<div attrs="{'invisible': [('state', 'in', ('sending', 'done'))]}">
<field name="body_html" class="oe_read_only" widget="html"
options="{'cssReadonly': 'mass_mailing.iframe_css_assets_readonly'}"/>
<field name="body_arch" class="o_mail_body oe_edit_only" widget="mass_mailing_html"
options="{
'snippets': 'mass_mailing.email_designer_snippets',
'cssEdit': 'mass_mailing.iframe_css_assets_edit',
'inline-field': 'body_html'
}"/>
</div>
<div attrs="{'invisible': [('state', 'not in', ('sending', 'done'))]}">
<field name="body_html" attrs="{'readonly': [('state', 'in', ('sending', 'done'))]}"/>
</div>
<field name="body_html" class="oe_read_only" widget="html"
options="{'cssReadonly': 'mass_mailing.iframe_css_assets_readonly'}"/>
<field name="body_arch" class="o_mail_body oe_edit_only" widget="mass_mailing_html"
options="{
'snippets': 'mass_mailing.email_designer_snippets',
'cssEdit': 'mass_mailing.iframe_css_assets_edit',
'inline-field': 'body_html'
}" attrs="{'readonly': [('state', 'in', ('sending', 'done'))]}"/>
</page>
<page string="Settings">
<group>