diff options
| author | Ajay Chauhan (OpenERP) <cha@tinyerp.com> | 2012-07-10 15:52:01 +0530 |
|---|---|---|
| committer | Ajay Chauhan (OpenERP) <cha@tinyerp.com> | 2012-07-10 15:52:01 +0530 |
| commit | 6dbd4e000dcb22d2ffcfeb7a9080eeffcbbcc7f8 (patch) | |
| tree | 5d1c3d763d9282312b22ca9e226515f20ce37d47 /addons/mail | |
| parent | 4e08b80952c7f50357f8f97b69495562631e9d55 (diff) | |
| parent | f25ad676a34670f4ba1ac14bf2d6babd8ccc88b5 (diff) | |
[MERGE] merge with parent branch
bzr revid: cha@tinyerp.com-20120710102201-h5mjjkoyprp70lf0
Diffstat (limited to 'addons/mail')
| -rw-r--r-- | addons/mail/__openerp__.py | 56 | ||||
| -rw-r--r-- | addons/mail/static/src/img/icon.png | bin | 0 -> 5754 bytes | |||
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 12 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 4 | ||||
| -rw-r--r-- | addons/mail/wizard/mail_compose_message.py | 39 |
5 files changed, 81 insertions, 30 deletions
diff --git a/addons/mail/__openerp__.py b/addons/mail/__openerp__.py index f501cc58d2c..e911f24e809 100644 --- a/addons/mail/__openerp__.py +++ b/addons/mail/__openerp__.py @@ -20,36 +20,41 @@ ############################################################################## { - 'name': 'Emails Management', + 'name': 'Social Network', 'version': '1.0', - 'category': 'Hidden/Dependency', + 'category':'Social Network', + "sequence": 2, 'description': """ -A generic email subsystem with message storage and queuing -========================================================== +A bussiness oriented Social Networking with a fully-integrated email +and message management. +===================================================================== +The Social Networking module provides an unified social network +abstraction layer allowing applications to display a complete +communication history on documents.It gives the users the possibility +to read and send messages and emails in an unified way. -This email subsystem is not intended to be used as as standalone -application, but to provide a unified email abstraction that all -other applications can use. +It also provides a feeds page combined to a subscription mechanism, that +allows to follow documents, and to be constantly updated about recent +news. + +The main features of the module are : -The main features are: - - * Relies on the global Outgoing Mail Servers configured in the - Administration menu for delivering outgoing mail - * Provides an API for sending messages and archiving them, - grouped by conversation - * Any OpenERP document can act as a conversation topic, provided - it includes the necessary support for handling incoming emails - (see the ``mail.thread`` class for more details). - * Includes queuing mechanism with automated configurable - scheduler-based processing - * Includes a generic email composition assistant, that can turn + * a clean and renewed communication history for any OpenERP + document that can act as a discussion topic, + * a discussion mean on documents, + * a subscription mechanism to be updated about new messages on + interesting documents, + * an unified feeds page to see recent messages and activity + on followed documents, + * user communication through the feeds page, + * a threaded discussion design, + * relies on the global outgoing mail server, an integrated email + management system allowing to send emails with a configurable + scheduler-based processing engine + * includes an extensible generic email composition assistant, that can turn into a mass-mailing assistant, and is capable of interpreting simple *placeholder expressions* that will be replaced with - dynamic data when each email is actually sent. - This generic assistant is easily extensible to provide advanced - features (see ``email_template`` for example, which adds email - templating features to this assistant) - + dynamic data when each email is actually sent """, 'author': 'OpenERP SA', 'website': 'http://www.openerp.com', @@ -69,6 +74,7 @@ The main features are: ], 'installable': True, 'auto_install': False, + 'application':True, 'certificate': '001056784984222247309', 'images': [ 'images/customer_history.jpeg', @@ -94,6 +100,6 @@ The main features are: ], 'demo': [ 'mail_demo.xml', - ], + ], } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mail/static/src/img/icon.png b/addons/mail/static/src/img/icon.png Binary files differnew file mode 100644 index 00000000000..53ccc469127 --- /dev/null +++ b/addons/mail/static/src/img/icon.png diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 3c0b61c173e..0f68a548590 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -91,7 +91,7 @@ openerp.mail = function(session) { this.params = params; this.params.parent_id = this.params.parent_id || false; this.params.thread_level = this.params.thread_level || 0; - this.params.msg_more_limit = this.params.msg_more_limit || 100; + this.params.msg_more_limit = this.params.msg_more_limit || 290; this.params.limit = this.params.limit || 100; this.params.offset = this.params.offset || 0; this.params.records = this.params.records || null; @@ -304,7 +304,6 @@ openerp.mail = function(session) { // format date according to the user timezone record.date = session.web.format_value(record.date, {type:"datetime"}); - var rendered = session.web.qweb.render('mail.Thread.message', {'record': record, 'thread': this, 'params': this.params, 'display': this.display}); $(rendered).appendTo(this.$element.children('div.oe_mail_thread_display:first')); // expand feature @@ -635,6 +634,7 @@ openerp.mail = function(session) { start: function () { this._super.apply(this, arguments); var self = this; + this.display_current_user(); // add events this.add_event_handlers(); // load mail.message search view @@ -694,6 +694,14 @@ openerp.mail = function(session) { }); }, + display_current_user: function () { + return this.$element.find('img.oe_mail_msg_image').attr('src', this.thread_get_avatar('res.users', 'avatar', this.session.uid)); + }, + + thread_get_avatar: function(model, field, id) { + return this.session.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + (id || ''); + }, + /** * Initializes the wall and calls fetch_comments * @param {Number} limit: number of notifications to fetch diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index 2eb3a390933..982fb8aeb2f 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -56,9 +56,7 @@ <div t-name="mail.Thread" class="oe_mail oe_mail_thread"> <div class="oe_mail_thread_action"> <img class="oe_mail_msg_image oe_left" alt="User img"/> - <div class="oe_mail_msg_content"> - <textarea class="oe_mail oe_mail_action_textarea" placeholder="Add your comment here..." onfocus="this.value = '';"/> - </div> + <textarea class="oe_mail oe_mail_action_textarea" placeholder="Add your comment here..." onfocus="this.value = '';"/> </div> <div class="oe_mail_thread_display"></div> <div class="oe_mail_thread_more"> diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index cb2ed1eec19..1b19a383c10 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -292,4 +292,43 @@ class mail_compose_message(osv.osv_memory): return tools.ustr(result) return template and EXPRESSION_PATTERN.sub(merge, template) + + +class mail_compose_message_extended(osv.osv_memory): + """ Extension of 'mail.compose.message' to support default field values related + to CRM-like models that follow the following conventions: + + 1. The model object must have an attribute '_mail_compose_message' equal to True. + + 2. The model should define the following fields: + - 'name' as subject of the message (required); + - 'email_from' as destination email address (required); + - 'email_cc' as cc email addresses (required); + - 'section_id.reply_to' as reply-to address (optional). + """ + _inherit = 'mail.compose.message' + + def get_value(self, cr, uid, model, res_id, context=None): + """Overrides the default implementation to provide more default field values + related to the corresponding CRM case. + """ + result = super(mail_compose_message_extended, self).get_value(cr, uid, model, res_id, context=context) + model_obj = self.pool.get(model) + if getattr(model_obj, '_mail_compose_message', False) and res_id: + data = model_obj.browse(cr, uid , res_id, context) + user = self.pool.get('res.users').browse(cr, uid, uid, context=context) + result.update({ + 'model': model, + 'res_id': res_id, + 'email_from': user.user_email or tools.config.get('email_from', False), + 'email_to': data.email_from or False, + 'email_cc': tools.ustr(data.email_cc or ''), + 'subject': data.name or False, + 'body_text': '\n' + tools.ustr(user.signature or ''), + 'subtype': 'plain', + }) + if hasattr(data, 'section_id'): + result['reply_to'] = data.section_id and data.section_id.reply_to or False + return result + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
