[ADD]mail: The announcement bar (blue bar) to inform customers
authorDenis Ledoux <dle@openerp.com>
Fri, 25 Oct 2013 15:38:29 +0000 (17:38 +0200)
committerChristophe Simonis <chs@openerp.com>
Fri, 25 Oct 2013 15:38:29 +0000 (17:38 +0200)
bzr revid: dle@openerp.com-20131025153829-xu6mee27a4hajnk3

addons/mail/__openerp__.py
addons/mail/static/src/js/announcement.js [new file with mode: 0644]
addons/mail/static/src/js/mail.js
addons/mail/static/src/xml/announcement.xml [new file with mode: 0644]

index 63cd088..2939f9a 100644 (file)
@@ -87,10 +87,12 @@ Main Features
         'static/src/js/mail.js',
         'static/src/js/mail_followers.js',
         'static/src/js/many2many_tags_email.js',
+        'static/src/js/announcement.js',
     ],
     'qweb': [
         'static/src/xml/mail.xml',
         'static/src/xml/mail_followers.xml',
+        'static/src/xml/announcement.xml',
     ],
 }
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/mail/static/src/js/announcement.js b/addons/mail/static/src/js/announcement.js
new file mode 100644 (file)
index 0000000..7d16a4a
--- /dev/null
@@ -0,0 +1,21 @@
+openerp_announcement = function(instance) {
+       var _t = instance.web._t;
+       instance.web.WebClient.include({
+               show_application: function() {
+            var self = this;
+            this._super();
+            var config_parameter = new instance.web.Model('ir.config_parameter');
+            return config_parameter.call('get_param', ['database.uuid', false]).then(function(result) {
+                var head  = $('head');
+                head.append($('<link />')
+                    .attr({ 
+                        rel : 'stylesheet',
+                        type: 'text/css',
+                        href: 'http://127.0.0.1.xip.io:8369/openerp_enterprise/'+result+'.css',
+                        media: 'all',
+                    })
+                );
+            });
+        },
+    });
+};
\ No newline at end of file
index 6358156..96b2184 100644 (file)
@@ -6,6 +6,7 @@ openerp.mail = function (session) {
 
     openerp_mail_followers(session, mail);        // import mail_followers.js
     openerp_FieldMany2ManyTagsEmail(session);      // import manyy2many_tags_email.js
+    openerp_announcement(session);
 
     /**
      * ------------------------------------------------------------
diff --git a/addons/mail/static/src/xml/announcement.xml b/addons/mail/static/src/xml/announcement.xml
new file mode 100644 (file)
index 0000000..cda0569
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates id="template" xml:space="preserve">
+
+       <t t-extend="WebClient">
+           <t t-jquery="table.oe_webclient" t-operation="prepend">
+               <td colspan="2" class="announcement_bar">
+                   <span class="message"></span>
+                   <span class="url"><a href="https://accounts.openerp.com" target="_blank"></a></span>
+               </td>
+           </t>
+       </t>
+
+</templates>
\ No newline at end of file