diff options
| author | Xavier Morel <xmo@openerp.com> | 2012-09-11 08:20:46 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2012-09-11 08:20:46 +0200 |
| commit | 80c2e5e2e869ea56b13faab596e2e51fad6e2db7 (patch) | |
| tree | 56d08a6c157413f9046e2e351ce1f0921acb69ee /addons/mail | |
| parent | 5cf0ec526052fb28f38907c1618162fe8f919954 (diff) | |
| parent | 063c548209a9669fe05f494555521fc92bd51af0 (diff) | |
[MERGE] from trunk
bzr revid: xmo@openerp.com-20120910142154-rp2wv8l84c5cat2x
bzr revid: xmo@openerp.com-20120911062046-r0otrm9pizuv26sv
Diffstat (limited to 'addons/mail')
| -rw-r--r-- | addons/mail/mail_group.py | 13 | ||||
| -rw-r--r-- | addons/mail/res_users.py | 15 | ||||
| -rw-r--r-- | addons/mail/static/src/css/mail.css | 15 | ||||
| -rw-r--r-- | addons/mail/static/src/js/mail.js | 11 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 5 |
5 files changed, 33 insertions, 26 deletions
diff --git a/addons/mail/mail_group.py b/addons/mail/mail_group.py index fdfeafd4afe..175ce650f06 100644 --- a/addons/mail/mail_group.py +++ b/addons/mail/mail_group.py @@ -56,25 +56,24 @@ class mail_group(osv.Model): help="Members of those groups will automatically added as followers. "\ "Note that they will be able to manage their subscription manually "\ "if necessary."), + # image: all image fields are base64 encoded and PIL-supported 'image': fields.binary("Photo", - help="This field holds the image used as photo for the "\ - "user. The image is base64 encoded, and PIL-supported. "\ - "It is limited to a 1024x1024 px image."), + help="This field holds the image used as photo for the group, limited to 1024x1024px."), 'image_medium': fields.function(_get_image, fnct_inv=_set_image, string="Medium-sized photo", type="binary", multi="_get_image", - store = { + store={ 'mail.group': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10), }, help="Medium-sized photo of the group. It is automatically "\ - "resized as a 180x180px image, with aspect ratio preserved. "\ + "resized as a 128x128px image, with aspect ratio preserved. "\ "Use this field in form views or some kanban views."), 'image_small': fields.function(_get_image, fnct_inv=_set_image, string="Small-sized photo", type="binary", multi="_get_image", - store = { + store={ 'mail.group': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10), }, help="Small-sized photo of the group. It is automatically "\ - "resized as a 50x50px image, with aspect ratio preserved. "\ + "resized as a 64x64px image, with aspect ratio preserved. "\ "Use this field anywhere a small image is required."), 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True, help="The email address associated with this group. New emails received will automatically " diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py index 1bc193051a1..f9ca54c478d 100644 --- a/addons/mail/res_users.py +++ b/addons/mail/res_users.py @@ -55,9 +55,20 @@ class res_users(osv.Model): return init_res def _auto_init(self, cr, context=None): - """Installation hook to create aliases for all users and avoid constraint errors.""" - self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(res_users,self)._auto_init, + """ Installation hook: aliases, partner following themselves """ + # create aliases for all users and avoid constraint errors + self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(res_users, self)._auto_init, self._columns['alias_id'], 'login', alias_force_key='id', context=context) + # make already existing users follow themselves, using SQL to avoid using the ORM during the auto_init + cr.execute(""" SELECT p.id FROM res_partner p + LEFT JOIN mail_followers n + ON (n.partner_id = p.id AND n.res_model = 'res.partner' AND n.res_id = p.id) + WHERE n.id IS NULL + """) + params = [(res[0], res[0]) for res in cr.fetchall()] + cr.executemany(""" INSERT INTO mail_followers (partner_id, res_model, res_id) + VALUES (%s, 'res.partner', %s) + """, params) def create(self, cr, uid, data, context=None): # create default alias same as the login diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 240627c9e6c..815f0ec92c4 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -322,11 +322,7 @@ text-decoration: none; } -.openerp .oe_mail_msg_subtitle { - margin: 0 0 .5em 0; -} -.openerp .oe_mail_msg_footer, -.openerp .oe_mail_msg_subtitle { +.openerp .oe_mail_msg_footer { color: #888; } @@ -340,12 +336,13 @@ text-align: justify; } -.openerp .oe_mail_msg_body span.oe_mail_msg_tail { - display: inline; +.openerp .oe_mail_msg_record_body pre { + font-family: "Lucida Grande", Helvetica, Verdana, Arial, sans-serif; + margin: 0px; } -.openerp .oe_mail_oe_bold { - font-weight: bold; +.openerp .oe_mail_msg_body span.oe_mail_msg_tail { + display: inline; } /* Read more/less link */ diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index a5a64a59a8b..e8d8e25e684 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -411,7 +411,7 @@ openerp.mail = function(session) { self.thread = new mail.Thread(self, { 'context': { 'default_model': record.model, - 'default_id': record.res_id, + 'default_res_id': record.res_id, 'default_parent_id': record.id }, 'message_data': record.child_ids, 'thread_level': self.options.thread_level-1, 'show_header_compose': false, 'show_reply': self.options.thread_level > 1, @@ -473,7 +473,7 @@ openerp.mail = function(session) { }, display_user_avatar: function () { - var avatar = mail.ChatterUtils.get_image(this.session.prefix, this.session.session_id, 'res.users', 'image_small', this.options.uid); + var avatar = mail.ChatterUtils.get_image(this.session.prefix, this.session.session_id, 'res.users', 'image_small', this.session.uid); return this.$el.find('img.oe_mail_icon').attr('src', avatar); }, @@ -484,9 +484,9 @@ openerp.mail = function(session) { var body = comment_node.val(); comment_node.val(''); } - return this.ds_post.call('message_post', [ - [this.options.context.res_id], body, false, 'comment', this.options.context.parent_id] - ).then(this.proxy('message_fetch')); + return this.ds_thread.call('message_post', [ + [this.options.context.default_res_id], body, false, 'comment', this.options.context.default_parent_id, undefined] + ).then(self.message_fetch()); }, /** Action: 'shows more' to fetch new messages */ @@ -585,6 +585,7 @@ openerp.mail = function(session) { var thread = new mail.Thread(self, { 'context': this.options.context, 'thread_level': this.options.thread_level, 'show_header_compose': true, + 'message_ids': this.get_value(), 'show_delete': true, 'composer': true }); this.thread_list.push(thread); return thread.appendTo(this.$el.find('div.oe_mail_recthread_main')); diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index f6be765c603..66b82d5a36c 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -118,15 +118,14 @@ <t t-raw="record.subject"/> </h1> <div class="oe_mail_msg_body"> - <div class="oe_mail_msg_record_body"> - <a t-attf-href="#model=#{params.res_model}&id=#{params.res_id}" t-if="(params.thread_level > 0) & (!record.subject)"><t t-raw="record.record_name"/></a> + <a t-attf-href="#model=#{record.model}&id=#{record.res_id}" t-if="(params.thread_level > 0) & (!record.subject)"><t t-raw="record.record_name"/></a> <t t-raw="record.body"/> </div> </div> <div class="oe_clear"/> <ul class="oe_mail_msg_footer"> - <li t-if="record.subject & params.thread_level > 0"><a t-attf-href="#model=#{params.res_model}&id=#{params.res_id}"><t t-raw="record.record_name"/></a></li> + <li t-if="record.subject & params.thread_level > 0"><a t-attf-href="#model=#{record.model}&id=#{record.res_id}"><t t-raw="record.record_name"/></a></li> <li><a t-attf-href="#model=res.partner&id=#{record.author_id[0]}"><t t-raw="record.author_id[1]"/></a></li> <li><span t-att-title="record.date"><t t-raw="record.timerelative"/></span></li> <li t-if="display['show_reply']"><a href="#" class="oe_mail_msg_reply">Reply</a></li> |
