From 00b8f5b0013924af3678e6400db9bfe6282a93ed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= <tde@openerp.com>
Date: Wed, 4 Jun 2014 18:20:55 +0200
Subject: [PATCH] [FIX] mass_mailing: mailing form view: better display of
 action buttons, avoiding having several 'red action buttons' at the same
 time.

---
 addons/mass_mailing/views/mass_mailing.xml | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/addons/mass_mailing/views/mass_mailing.xml b/addons/mass_mailing/views/mass_mailing.xml
index a9cd33f9531c..c7b6eb6f9de7 100644
--- a/addons/mass_mailing/views/mass_mailing.xml
+++ b/addons/mass_mailing/views/mass_mailing.xml
@@ -186,11 +186,17 @@
                 <form string="Mass Mailing" version="7.0">
                     <header>
                         <button name="action_test_mailing" type="object"
-                            class="oe_highlight" string="Test Mailing" states="draft"/>
-                        <button name="send_mail" type="object" states="draft,test"
+                            class="oe_highlight" string="Test Mailing"
+                            attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('body_html', '=', False)]}"/>
+                        <button name="action_test_mailing" type="object"
+                            attrs="{'invisible': ['&amp;', ('state', '=', 'draft'), ('body_html', '!=', False)]}"
+                            string="Test Mailing"/>
+                        <button name="send_mail" type="object"
+                            attrs="{'invisible': ['|', ('state', '=', 'done'), ('body_html', '=', False)]}"
                             class="oe_highlight" string="Send to All"/>
-                        <button name="action_test_mailing" type="object" states="test,done"
-                            string="Send Test Sample"/>
+                        <button name="send_mail" type="object"
+                            attrs="{'invisible': ['&amp;', ('state', '!=', 'done'), ('body_html', '!=', False)]}"
+                            string="Send to All"/>
                         <field name="state" widget="statusbar"/>
                     </header>
                     <div class="oe_form_box_info oe_text_center" attrs="{'invisible': [('scheduled', '=', 0)]}">
@@ -250,9 +256,11 @@
                         </group>
                         <notebook>
                             <page string="Mail Body">
-                                <button name="action_edit_html" type="object" string="Design Email" class="oe_highlight" states="draft"/>
-                                <button name="action_edit_html" type="object" string="Change Email Design" states="test"/>
-                                <div attrs="{'invisible' : ['|', '|', ('state', '=', 'done'), ('body_html','!=',False), ('mailing_domain', '=', False)]}" class="oe_view_nocontent oe_clear">
+                                <button name="action_edit_html" type="object" string="Design Email" class="oe_highlight"
+                                    attrs="{'invisible': [('body_html', '!=', False)]}"/>
+                                <button name="action_edit_html" type="object" string="Change Email Design"
+                                    attrs="{'invisible': [('body_html', '=', False)]}"/>
+                                <div attrs="{'invisible' : ['|', ('state', '=', 'done'), ('body_html','!=',False)]}" class="oe_view_nocontent oe_clear">
                                     <p class="oe_view_nocontent_create oe_edit_only">
                                         Click to design your email.
                                     </p>
-- 
GitLab