From 6ea4181244579279fde119a79ac214531922870d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 23 Oct 2012 17:56:31 +0200 Subject: [PATCH 01/41] [FIX] mail: incoming emails are not correctly set with email type. bzr revid: tde@openerp.com-20121023155631-h7gbhrmgpg3mwj0f --- addons/mail/mail_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 04da686b49d..273e0edaa36 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -554,7 +554,7 @@ class mail_thread(osv.AbstractModel): ('file2', 'bytes')} } """ - msg_dict = {} + msg_dict = {'type': 'email'} if not isinstance(message, Message): if isinstance(message, unicode): # Warning: message_from_string doesn't always work correctly on unicode, From a8da0fbef74cf71d934140c3b9a27b2846b1ebc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 23 Oct 2012 17:57:10 +0200 Subject: [PATCH 02/41] [IMP] mail: res_partner override: incoming emails are set as private, by setting thread_id to False. In message_post, this will set model and res_id of the message to False, leading to a private message. bzr revid: tde@openerp.com-20121023155710-j6ugemc60khdqk74 --- addons/mail/res_partner.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/addons/mail/res_partner.py b/addons/mail/res_partner.py index 6b13fe6ad20..46b250328f8 100644 --- a/addons/mail/res_partner.py +++ b/addons/mail/res_partner.py @@ -42,4 +42,21 @@ class res_partner_mail(osv.Model): 'notification_email_send': lambda *args: 'comment' } + def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification', + subtype=None, parent_id=False, attachments=None, context=None, **kwargs): + """ Override related to res.partner. In case of email message, set it as + private: + - add the target partner in the message partner_ids + - set thread_id as None, because this will trigger the 'private' + aspect of the message (model=False, res_is=False) + """ + if isinstance(thread_id, (list, tuple)): + thread_id = thread_id[0] + if type == 'email': + partner_ids = kwargs.get('partner_ids', []) + partner_ids.append(thread_id) + kwargs['partner_ids'] = partner_ids + return super(res_partner_mail, self).message_post(cr, uid, False, body=body, subject=subject, + type=type, subtype=subtype, parent_id=parent_id, attachments=attachments, context=context, **kwargs) + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 96e097e1dca6780fae4b6d6a31c383132ef2db11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 31 Oct 2012 16:10:40 +0100 Subject: [PATCH 03/41] [FIX] mail: in init, load vote and favorite models before others, to avoid issues about not existing columns. bzr revid: tde@openerp.com-20121031151040-6bx8y910cn9q1fk1 --- addons/mail/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/__init__.py b/addons/mail/__init__.py index aea7ee62cbc..b34993ffd32 100644 --- a/addons/mail/__init__.py +++ b/addons/mail/__init__.py @@ -22,12 +22,12 @@ import mail_message_subtype import mail_alias import mail_followers +import mail_vote +import mail_favorite import mail_message import mail_mail import mail_thread import mail_group -import mail_vote -import mail_favorite import res_partner import res_users import report From 53a6056a352fc2b476a128bfa583836dab6f73ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 6 Nov 2012 13:11:34 +0100 Subject: [PATCH 04/41] =?UTF-8?q?[FIX]=20email=5Ftemplate:=20html=5Fsaniti?= =?UTF-8?q?ze=20not=20in=20html=5Fsanitize,=20but=20in=20mail.=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bzr revid: tde@openerp.com-20121106121134-8tws1ckwh0mhpiwm --- addons/email_template/email_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 73337d92ab0..6965fa0c222 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -28,7 +28,7 @@ from osv import osv from osv import fields import tools from tools.translate import _ -from tools.html_sanitize import html_sanitize +from tools.mail import html_sanitize from tools import append_content_to_html from urllib import quote as quote _logger = logging.getLogger(__name__) From 92c97ecd904fa407d4fd462cd3b818cdc2f6aa9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 6 Nov 2012 13:15:31 +0100 Subject: [PATCH 05/41] [REF] mail: tests: moved test class with mockup in a dedicated file, to clean the directoy structure. bzr revid: tde@openerp.com-20121106121531-0bmki7skb8b1xc8y --- addons/mail/tests/__init__.py | 1 + addons/mail/tests/test_mail.py | 37 ++---------------- addons/mail/tests/test_mail_mockup.py | 54 +++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 34 deletions(-) create mode 100644 addons/mail/tests/test_mail_mockup.py diff --git a/addons/mail/tests/__init__.py b/addons/mail/tests/__init__.py index 2d48fa233c4..3dcddf769e8 100644 --- a/addons/mail/tests/__init__.py +++ b/addons/mail/tests/__init__.py @@ -18,6 +18,7 @@ # along with this program. If not, see . # ############################################################################## + from . import test_mail, test_mail_access_rights checks = [ diff --git a/addons/mail/tests/test_mail.py b/addons/mail/tests/test_mail.py index 6af0aba633c..5e19a8f0ce4 100644 --- a/addons/mail/tests/test_mail.py +++ b/addons/mail/tests/test_mail.py @@ -21,8 +21,9 @@ import tools +from openerp.addons.mail.tests import test_mail from openerp.tests import common -from openerp.tools.html_sanitize import html_sanitize +from openerp.tools.mail import html_sanitize MAIL_TEMPLATE = """Return-Path: To: {to} @@ -84,39 +85,7 @@ Sylvie """ -class TestMailMockups(common.TransactionCase): - - def _mock_smtp_gateway(self, *args, **kwargs): - return True - - def _init_mock_build_email(self): - self._build_email_args_list = [] - self._build_email_kwargs_list = [] - - def _mock_build_email(self, *args, **kwargs): - """ Mock build_email to be able to test its values. Store them into - some internal variable for latter processing. """ - self._build_email_args_list.append(args) - self._build_email_kwargs_list.append(kwargs) - return self._build_email(*args, **kwargs) - - def setUp(self): - super(TestMailMockups, self).setUp() - # Install mock SMTP gateway - self._init_mock_build_email() - self._build_email = self.registry('ir.mail_server').build_email - self.registry('ir.mail_server').build_email = self._mock_build_email - self._send_email = self.registry('ir.mail_server').send_email - self.registry('ir.mail_server').send_email = self._mock_smtp_gateway - - def tearDown(self): - # Remove mocks - self.registry('ir.mail_server').build_email = self._build_email - self.registry('ir.mail_server').send_email = self._send_email - super(TestMailMockups, self).tearDown() - - -class test_mail(TestMailMockups): +class test_mail(test_mail.TestMailMockups): def _mock_send_get_mail_body(self, *args, **kwargs): # def _send_get_mail_body(self, cr, uid, mail, partner=None, context=None) diff --git a/addons/mail/tests/test_mail_mockup.py b/addons/mail/tests/test_mail_mockup.py new file mode 100644 index 00000000000..cba04a0c6b3 --- /dev/null +++ b/addons/mail/tests/test_mail_mockup.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Business Applications +# Copyright (c) 2012-TODAY OpenERP S.A. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.tests import common + + +class TestMailMockups(common.TransactionCase): + + def _mock_smtp_gateway(self, *args, **kwargs): + return True + + def _init_mock_build_email(self): + self._build_email_args_list = [] + self._build_email_kwargs_list = [] + + def _mock_build_email(self, *args, **kwargs): + """ Mock build_email to be able to test its values. Store them into + some internal variable for latter processing. """ + self._build_email_args_list.append(args) + self._build_email_kwargs_list.append(kwargs) + return self._build_email(*args, **kwargs) + + def setUp(self): + super(TestMailMockups, self).setUp() + # Install mock SMTP gateway + self._init_mock_build_email() + self._build_email = self.registry('ir.mail_server').build_email + self.registry('ir.mail_server').build_email = self._mock_build_email + self._send_email = self.registry('ir.mail_server').send_email + self.registry('ir.mail_server').send_email = self._mock_smtp_gateway + + def tearDown(self): + # Remove mocks + self.registry('ir.mail_server').build_email = self._build_email + self.registry('ir.mail_server').send_email = self._send_email + super(TestMailMockups, self).tearDown() From ffc23f22f06160645dc0e6fba44aceffd175dd5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 6 Nov 2012 13:19:49 +0100 Subject: [PATCH 06/41] [CLEAN] Removed unused variables. bzr revid: tde@openerp.com-20121106121949-2u577j7f1guq4tyu --- addons/mail/mail_thread.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index f3203336615..a7ebefdce25 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -682,7 +682,6 @@ class mail_thread(osv.AbstractModel): # avoid loops when finding ancestors processed_list = [] if message_ids: - _counter, _counter_max = 0, 200 message = mail_message.browse(cr, SUPERUSER_ID, message_ids[0], context=context) while (message.parent_id and message.parent_id.id not in processed_list): processed_list.append(message.parent_id.id) From f00ae8a73b36a41b9ed40b182dc285aed1b80d3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 6 Nov 2012 13:34:42 +0100 Subject: [PATCH 07/41] [FIX] Addons: fixed some import due to renaming. bzr revid: tde@openerp.com-20121106123442-jqiq5myhal6ouodr --- addons/note/note.py | 4 +--- addons/pad/pad.py | 2 +- addons/portal/wizard/portal_wizard.py | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/addons/note/note.py b/addons/note/note.py index fe5eca5efd7..9e1a9187095 100644 --- a/addons/note/note.py +++ b/addons/note/note.py @@ -20,9 +20,7 @@ ############################################################################## from openerp.osv import osv, fields -from tools.translate import _ -import re -from openerp.tools.misc import html2plaintext +from openerp.tools import html2plaintext class note_stage(osv.osv): """ Category of Note """ diff --git a/addons/pad/pad.py b/addons/pad/pad.py index e5b36e5f64c..03286f7eab9 100644 --- a/addons/pad/pad.py +++ b/addons/pad/pad.py @@ -6,7 +6,7 @@ import string import urllib2 import logging from tools.translate import _ -from openerp.tools.misc import html2plaintext +from openerp.tools import html2plaintext from py_etherpad import EtherpadLiteClient _logger = logging.getLogger(__name__) diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py index c94d6509f63..bf8353c92c1 100644 --- a/addons/portal/wizard/portal_wizard.py +++ b/addons/portal/wizard/portal_wizard.py @@ -24,10 +24,9 @@ import random from osv import osv, fields from tools.translate import _ -from tools.misc import email_re +from tools import email_re from openerp import SUPERUSER_ID -from base.res.res_partner import _lang_get _logger = logging.getLogger(__name__) # welcome email sent to portal users From 92c20ba1d303980d51ced3d5a2e886dcb6186b14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 6 Nov 2012 13:40:42 +0100 Subject: [PATCH 08/41] [FIX] mail: fixed some wrong name due to file renaming. bzr revid: tde@openerp.com-20121106124042-r7tak3o340w9gzol --- addons/mail/tests/test_mail.py | 5 ++--- addons/mail/tests/test_mail_access_rights.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/mail/tests/test_mail.py b/addons/mail/tests/test_mail.py index 5e19a8f0ce4..6b045a60ff4 100644 --- a/addons/mail/tests/test_mail.py +++ b/addons/mail/tests/test_mail.py @@ -21,8 +21,7 @@ import tools -from openerp.addons.mail.tests import test_mail -from openerp.tests import common +from openerp.addons.mail.tests import test_mail_mockup from openerp.tools.mail import html_sanitize MAIL_TEMPLATE = """Return-Path: @@ -85,7 +84,7 @@ Sylvie """ -class test_mail(test_mail.TestMailMockups): +class test_mail(test_mail_mockup.TestMailMockups): def _mock_send_get_mail_body(self, *args, **kwargs): # def _send_get_mail_body(self, cr, uid, mail, partner=None, context=None) diff --git a/addons/mail/tests/test_mail_access_rights.py b/addons/mail/tests/test_mail_access_rights.py index 7b90e07b9b5..ec08d257efe 100644 --- a/addons/mail/tests/test_mail_access_rights.py +++ b/addons/mail/tests/test_mail_access_rights.py @@ -19,11 +19,11 @@ # ############################################################################## -from openerp.addons.mail.tests import test_mail +from openerp.addons.mail.tests import test_mail_mockup from osv.orm import except_orm -class test_mail_access_rights(test_mail.TestMailMockups): +class test_mail_access_rights(test_mail_mockup.TestMailMockups): def setUp(self): super(test_mail_access_rights, self).setUp() From 5cb888e7473dd39c9d5ec97953adc261365f1ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 6 Nov 2012 16:32:49 +0100 Subject: [PATCH 09/41] [IMP] mail: mail_message body for chatter now calls the html_email_clean method; some var cleaning in mail.js. bzr revid: tde@openerp.com-20121106153249-63xhbuiy8h0rww6c --- addons/mail/static/src/js/mail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 9133e5de257..6d9b21d272a 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -432,7 +432,6 @@ openerp.mail = function (session) { // data of this expandable message this.id = datasets.id || -1, - this.model = datasets.model || false, this.parent_id = datasets.parent_id || false, this.nb_messages = datasets.nb_messages || 0, this.thread_level = datasets.thread_level || 0, @@ -565,6 +564,7 @@ openerp.mail = function (session) { this.author_id = datasets.author_id || [], this.attachment_ids = datasets.attachment_ids || [], this._date = datasets.date; + this.partner_ids = datasets.partner_ids; this.show_reply_button = this.options.show_compose_message && this.options.show_reply_button > this.thread_level; From c0e139bd4bdbd5e5feb9b3595a67655302be840c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 7 Nov 2012 09:59:26 +0100 Subject: [PATCH 10/41] [IMP] mail: displayed messages now goe through html_email_clean to clean their content; added a css because we now have lots of

in chatter messages, and default margin is quite big (to be improved maybe); updated demo data. bzr revid: tde@openerp.com-20121107085926-9g609zgmkg4kieqc --- addons/mail/data/mail_demo.xml | 15 ++++++++------- addons/mail/data/mail_group_data.xml | 11 +++++------ addons/mail/mail_message.py | 3 ++- addons/mail/static/src/css/mail.css | 4 ++++ 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/addons/mail/data/mail_demo.xml b/addons/mail/data/mail_demo.xml index bda93fc485d..889a3381135 100644 --- a/addons/mail/data/mail_demo.xml +++ b/addons/mail/data/mail_demo.xml @@ -1,12 +1,13 @@ - + + mail.group - Your monthly meal vouchers arrived. You can get them at Christine's office. -This month you also get 250 EUR of eco-vouchers if you have been in the company for more than a year. + Your monthly meal vouchers arrived. You can get them at Christine's office. +This month you also get 250 EUR of eco-vouchers if you have been in the company for more than a year.

]]> comment @@ -14,7 +15,7 @@ This month you also get 250 EUR of eco-vouchers if you have been in the company mail.group - + Great.

]]>
comment @@ -23,7 +24,7 @@ This month you also get 250 EUR of eco-vouchers if you have been in the company mail.group - Thanks, but where is Christine's office, if I may ask? (I'm new here) + Thanks, but where is Christine's office, if I may ask? (I'm new here)

]]>
comment @@ -32,7 +33,7 @@ This month you also get 250 EUR of eco-vouchers if you have been in the company mail.group - Building B3, second floor on the right :-) + Building B3, second floor on the right :-)

]]>
comment @@ -41,7 +42,7 @@ This month you also get 250 EUR of eco-vouchers if you have been in the company mail.group - Great news, I need to buy a new fridge, I think I can pay it with the eco-vouchers! + Great news, I need to buy a new fridge, I think I can pay it with the eco-vouchers!

]]>
comment diff --git a/addons/mail/data/mail_group_data.xml b/addons/mail/data/mail_group_data.xml index 11d0ee7d04b..fe24f0b8661 100644 --- a/addons/mail/data/mail_group_data.xml +++ b/addons/mail/data/mail_group_data.xml @@ -1,6 +1,7 @@ - + + Sales @@ -18,11 +19,9 @@ notification Welcome to OpenERP! - Your homepage is a summary of messages you received and key information about documents you follow. - -The top menu bar contains all applications you installed. You can use this <i>Settings</i> menu to install more applications, activate others features or give access to new users. - -To setup your preferences (name, email signature, avatar), click on the top right corner. + Your homepage is a summary of messages you received and key information about documents you follow.
+The top menu bar contains all applications you installed. You can use this <i>Settings</i> menu to install more applications, activate others features or give access to new users.
+To setup your preferences (name, email signature, avatar), click on the top right corner.

]]>
diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index bd0ade31b68..3637bb371dc 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -25,6 +25,7 @@ import tools from email.header import decode_header from openerp import SUPERUSER_ID from openerp.osv import osv, orm, fields +from openerp.tools import html_email_clean from openerp.tools.translate import _ _logger = logging.getLogger(__name__) @@ -242,7 +243,7 @@ class mail_message(osv.Model): 'id': message['id'], 'type': message['type'], 'attachment_ids': attachment_ids, - 'body': message['body'], + 'body': html_email_clean(message['body']), 'model': message['model'], 'res_id': message['res_id'], 'record_name': message['record_name'], diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index af3cc3ed359..652714bffd7 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -57,6 +57,10 @@ margin-bottom: 0px; margin-top: 2px; } +.openerp .oe_mail .oe_msg .oe_msg_content .oe_msg_body p{ + margin-top: 0px; + margin-bottom: 0px; +} /* a) Indented Messages */ From c983fba3c3ad75f367d3b06bf131ff51e76f3b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 7 Nov 2012 11:02:06 +0100 Subject: [PATCH 11/41] [FIX] mail: demo data back as noupdate. bzr revid: tde@openerp.com-20121107100206-bi39ap6821woug8x --- addons/mail/data/mail_demo.xml | 3 +-- addons/mail/data/mail_group_data.xml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/mail/data/mail_demo.xml b/addons/mail/data/mail_demo.xml index 889a3381135..3244e047da4 100644 --- a/addons/mail/data/mail_demo.xml +++ b/addons/mail/data/mail_demo.xml @@ -1,7 +1,6 @@ - - + mail.group diff --git a/addons/mail/data/mail_group_data.xml b/addons/mail/data/mail_group_data.xml index fe24f0b8661..6f039d64c0d 100644 --- a/addons/mail/data/mail_group_data.xml +++ b/addons/mail/data/mail_group_data.xml @@ -1,7 +1,6 @@ - - + Sales From f9829bbb93d6fee682cb78df93b00548a4de2b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 7 Nov 2012 11:51:48 +0100 Subject: [PATCH 12/41] [FIX] mail_thread: in message_parse, correctly set partner_ids of the message dict. By the way small things in amil module. bzr revid: tde@openerp.com-20121107105148-6o1dvu7f4ms24rbx --- addons/mail/mail_message.py | 2 +- addons/mail/mail_thread.py | 2 +- addons/mail/res_partner.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 3637bb371dc..4f1c0a00e77 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -730,7 +730,7 @@ class mail_message(osv.Model): ], context=context) fol_objs = fol_obj.read(cr, uid, fol_ids, ['partner_id'], context=context) partners_to_notify |= set(fol['partner_id'][0] for fol in fol_objs) - # when writing to a wall + # remove me from notified partners, unless the message is written on my own wall if message.get('author_id') and message.get('model') == "res.partner" and message.get('res_id') == message.get('author_id')[0]: partners_to_notify |= set([message.get('author_id')[0]]) elif message.get('author_id'): diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index a7ebefdce25..4790fb3393f 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -588,7 +588,7 @@ class mail_thread(osv.AbstractModel): else: msg_dict['email_from'] = message.get('from') partner_ids = self._message_find_partners(cr, uid, message, ['From', 'To', 'Cc'], context=context) - msg_dict['partner_ids'] = partner_ids + msg_dict['partner_ids'] = [(4, partner_id) for partner_id in partner_ids] if 'Date' in message: date_hdr = decode(message.get('Date')) diff --git a/addons/mail/res_partner.py b/addons/mail/res_partner.py index 46b250328f8..6f291f62f1b 100644 --- a/addons/mail/res_partner.py +++ b/addons/mail/res_partner.py @@ -54,7 +54,8 @@ class res_partner_mail(osv.Model): thread_id = thread_id[0] if type == 'email': partner_ids = kwargs.get('partner_ids', []) - partner_ids.append(thread_id) + if thread_id not in partner_ids: + partner_ids.append(thread_id) kwargs['partner_ids'] = partner_ids return super(res_partner_mail, self).message_post(cr, uid, False, body=body, subject=subject, type=type, subtype=subtype, parent_id=parent_id, attachments=attachments, context=context, **kwargs) From 48cec81235101034eea33cfe92ce0812159bde32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 7 Nov 2012 16:21:26 +0100 Subject: [PATCH 13/41] [IMP] Chatter widget: display email icon only when sender is unknown. bzr revid: tde@openerp.com-20121107152126-71yzsy1nb0tj549w --- addons/mail/static/src/js/mail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index ece8e65144d..6be6693d8d8 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -590,7 +590,7 @@ openerp.mail = function (session) { //formating and add some fields for render this.date = session.web.format_value(this._date, {type:"datetime"}); this.timerelative = $.timeago(this.date); - if (this.type == 'email') { + if (this.type == 'email' && !this.author_id[0]) { this.avatar = ('/mail/static/src/img/email_icon.png'); } else { this.avatar = mail.ChatterUtils.get_image(this.session, 'res.partner', 'image_small', this.author_id[0]); From 2799ba172c260ce220e2e57ace2ed541e210c0e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 7 Nov 2012 16:21:58 +0100 Subject: [PATCH 14/41] [FIX] portal: fixed class name and imports. bzr revid: tde@openerp.com-20121107152158-ze50vqj673nvavib --- addons/portal/tests/test_portal.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/portal/tests/test_portal.py b/addons/portal/tests/test_portal.py index 83b10b39c28..be32b015743 100644 --- a/addons/portal/tests/test_portal.py +++ b/addons/portal/tests/test_portal.py @@ -19,12 +19,11 @@ # ############################################################################## -from openerp.addons.mail.tests import test_mail -from openerp.tools import append_content_to_html +from openerp.addons.mail.tests import test_mail_mockup from osv.orm import except_orm -class test_portal(test_mail.TestMailMockups): +class test_portal(test_mail_mockup.TestMailMockups): def setUp(self): super(test_portal, self).setUp() From 281a4d08014514e768a6b5354c1324602a58ead2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 7 Nov 2012 16:38:22 +0100 Subject: [PATCH 15/41] [FIX] mail: notifications: fixed access rights issues when setting as read/unread for lambda users. bzr revid: tde@openerp.com-20121107153822-j7f1a63a2ix66e5n --- addons/mail/mail_followers.py | 15 ++++++++------- addons/mail/security/ir.model.access.csv | 7 ++++--- addons/mail/security/mail_security.xml | 10 +++++++++- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/addons/mail/mail_followers.py b/addons/mail/mail_followers.py index e8cf2648f29..31220b7c348 100644 --- a/addons/mail/mail_followers.py +++ b/addons/mail/mail_followers.py @@ -84,11 +84,13 @@ class mail_notification(osv.Model): return False def set_message_read(self, cr, uid, msg_ids, read=None, context=None): - """ Set a message and its child messages as (un)read for uid. + """ Set messages as (un)read. Technically, the notifications related + to uid are set to (un)read. If for some msg_ids there are missing + notifications (i.e. due to load more or thread parent fetching), + they are created. - :param bool read: read / unread + :param bool read: (un)read notification """ - # TDE note: use child_of or front-end send correct values ? user_pid = self.pool.get('res.users').read(cr, uid, uid, ['partner_id'], context=context)['partner_id'][0] notif_ids = self.search(cr, uid, [ ('partner_id', '=', user_pid), @@ -100,10 +102,9 @@ class mail_notification(osv.Model): return self.write(cr, uid, notif_ids, {'read': read}, context=context) # some messages do not have notifications: find which one, create notification, update read status - exist_notification = dict.fromkeys(msg_ids, False) - for notification in self.browse(cr, uid, notif_ids, context=context): - exist_notification[notification.message_id] = True - for msg_id in exist_notification.keys(): + notified_msg_ids = [notification.message_id.id for notification in self.browse(cr, uid, notif_ids, context=context)] + to_create_msg_ids = list(set(msg_ids) - set(notified_msg_ids)) + for msg_id in to_create_msg_ids: self.create(cr, uid, {'partner_id': user_pid, 'read': read, 'message_id': msg_id}, context=context) return self.write(cr, uid, notif_ids, {'read': read}, context=context) diff --git a/addons/mail/security/ir.model.access.csv b/addons/mail/security/ir.model.access.csv index 4d68b7e3aef..b87c323b53d 100644 --- a/addons/mail/security/ir.model.access.csv +++ b/addons/mail/security/ir.model.access.csv @@ -7,12 +7,13 @@ access_mail_mail_system,mail.mail.system,model_mail_mail,base.group_system,1,1,1 access_mail_followers_all,mail.followers.all,model_mail_followers,,1,0,0,0 access_mail_followers_system,mail.followers.system,model_mail_followers,base.group_system,1,1,1,1 access_mail_notification_all,mail.notification.all,model_mail_notification,,1,0,0,0 -access_mail_notification_aystem,mail.notification.system,model_mail_notification,base.group_system,1,1,1,1 +access_mail_notification_group_user,mail.notification.user,model_mail_notification,base.group_user,1,1,1,0 +access_mail_notification_system,mail.notification.system,model_mail_notification,base.group_system,1,1,1,1 access_mail_group_all,mail.group.all,model_mail_group,,1,0,0,0 access_mail_group_user,mail.group.user,model_mail_group,base.group_user,1,1,1,1 access_mail_alias_all,mail.alias.all,model_mail_alias,,1,0,0,0 -access_mail_alias_user,mail.alias,model_mail_alias,base.group_user,1,1,1,0 -access_mail_alias_system,mail.alias,model_mail_alias,base.group_system,1,1,1,1 +access_mail_alias_user,mail.alias.user,model_mail_alias,base.group_user,1,1,1,0 +access_mail_alias_system,mail.alias.system,model_mail_alias,base.group_system,1,1,1,1 access_mail_message_subtype_all,mail.message.subtype.all,model_mail_message_subtype,,1,0,0,0 access_mail_vote_all,mail.vote.all,model_mail_vote,,1,1,1,1 access_mail_favorite_all,mail.favorite.all,model_mail_favorite,,1,1,1,1 diff --git a/addons/mail/security/mail_security.xml b/addons/mail/security/mail_security.xml index 3f2b7bf3e9a..525425c2aa0 100644 --- a/addons/mail/security/mail_security.xml +++ b/addons/mail/security/mail_security.xml @@ -10,7 +10,7 @@ ['|', '|', ('public', '=', 'public'), ('message_follower_ids', 'in', [user.partner_id.id]), '&', ('public','=','groups'), ('group_public_id','in', [g.id for g in user.groups_id])] - + mail.followers: read and write its own entries [('partner_id', '=', user.partner_id.id)] @@ -18,6 +18,14 @@ + + mail.notification: read and write its own entries + + [('partner_id', '=', user.partner_id.id)] + + + + @@ -24,14 +24,11 @@ Our company's first blog-post ! mail.group - sit amet, consectetur adipiscing elit. Pellentesque et quam sapien, in sagittis tellus. -Praesent vel massa sed massa consequat egestas in tristique orci. Praesent iaculis libero et neque vehicula iaculis. Vivamus placerat tincidunt orci ac ornare. Proin ut dolor fringilla velit ultricies consequat. Maecenas sit amet ipsum non leo interdum imperdiet. Donec sapien mi. - -Fusce tempus elit volutpat mi auctor adipiscing. Nam congue luctus suscipit. Sed tellus libero, venenatis ut mollis ut, luctus quis dui. Sed rhoncus pulvinar orci in consectetur. - -Nulla turpis leo, rhoncus ut egestas sit amet, consectetur vitae urna. Mauris in dolor in sapien tempus vehicula.]]> + Hello, and welcome to our company's portal !

+

Lorem ipsum sit amet, consectetur adipiscing elit. Pellentesque et quam sapien, in sagittis tellus. +Praesent vel massa sed massa consequat egestas in tristique orci. Praesent iaculis libero et neque vehicula iaculis. Vivamus placerat tincidunt orci ac ornare. Proin ut dolor fringilla velit ultricies consequat. Maecenas sit amet ipsum non leo interdum imperdiet. Donec sapien mi.

+

Fusce tempus elit volutpat mi auctor adipiscing. Nam congue luctus suscipit. Sed tellus libero, venenatis ut mollis ut, luctus quis dui. Sed rhoncus pulvinar orci in consectetur.

+

Nulla turpis leo, rhoncus ut egestas sit amet, consectetur vitae urna. Mauris in dolor in sapien tempus vehicula.

]]>
comment
@@ -39,7 +36,7 @@ Nulla turpis leo, rhoncus ut egestas sit amet, consectetur vitae urna. Mauris in mail.group - + Great first blogpost!

]]>
comment @@ -48,7 +45,7 @@ Nulla turpis leo, rhoncus ut egestas sit amet, consectetur vitae urna. Mauris in mail.group - + Thanks!

]]>
comment From 3027b749ba9561b5b83fb2477ef30f6547471171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 7 Nov 2012 18:02:41 +0100 Subject: [PATCH 18/41] [IMP] mail: signature in send notifications is now plaintext (as before), but htmlized (not inside a pre, but inside div and p, with entities escaped). Updated mail tests. Same for portal URL. Updated portal tests. bzr revid: tde@openerp.com-20121107170241-0gjwraxkuhe0fm6p --- addons/mail/mail_followers.py | 10 ++++++---- addons/mail/tests/test_mail.py | 10 +++++----- addons/portal/mail_mail.py | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/addons/mail/mail_followers.py b/addons/mail/mail_followers.py index 31220b7c348..7406108229a 100644 --- a/addons/mail/mail_followers.py +++ b/addons/mail/mail_followers.py @@ -151,16 +151,18 @@ class mail_notification(osv.Model): # add the context in the email # TDE FIXME: commented, to be improved in a future branch - # quote_context = self.pool.get('mail.message').message_quote_context(cr, uid, msg_id, context=context) + quote_context = self.pool.get('mail.message').message_quote_context(cr, uid, msg_id, context=context) mail_mail = self.pool.get('mail.mail') # add signature body_html = msg.body - # if quote_context: - # body_html = tools.append_content_to_html(body_html, quote_context, plaintext=False) + if quote_context: + pass + # print quote_context + # body_html = tools.append_content_to_html(body_html, quote_context, plaintext=False) signature = msg.author_id and msg.author_id.user_ids[0].signature or '' if signature: - body_html = tools.append_content_to_html(body_html, signature) + body_html = tools.append_content_to_html(body_html, tools.text2html(signature), plaintext=False) mail_values = { 'mail_message_id': msg.id, diff --git a/addons/mail/tests/test_mail.py b/addons/mail/tests/test_mail.py index b15c699f09c..bd0509fb22c 100644 --- a/addons/mail/tests/test_mail.py +++ b/addons/mail/tests/test_mail.py @@ -88,7 +88,7 @@ class test_mail(test_mail_mockup.TestMailMockups): def _mock_send_get_mail_body(self, *args, **kwargs): # def _send_get_mail_body(self, cr, uid, mail, partner=None, context=None) - body = tools.append_content_to_html(args[2].body_html, kwargs.get('partner').name if kwargs.get('partner') else 'No specific partner') + body = tools.append_content_to_html(args[2].body_html, kwargs.get('partner').name if kwargs.get('partner') else 'No specific partner', plaintext=False) return body def setUp(self): @@ -343,10 +343,10 @@ class test_mail(test_mail_mockup.TestMailMockups): _subject = 'Pigs' _mail_subject = '%s posted on %s' % (user_admin.name, group_pigs.name) _body1 = 'Pigs rules' - _mail_body1 = 'Pigs rules\n
Admin
\n' - _mail_bodyalt1 = 'Pigs rules\nAdmin' + _mail_body1 = 'Pigs rules\n

Admin

\n' + _mail_bodyalt1 = 'Pigs rules\nAdmin\n' _body2 = 'Pigs rules' - _mail_body2 = html_sanitize('Pigs rules\n
Admin
\n') + _mail_body2 = html_sanitize('Pigs rules\n

Admin

\n') _mail_bodyalt2 = 'Pigs rules\nAdmin' _attachments = [('First', 'My first attachment'), ('Second', 'My second attachment')] @@ -367,7 +367,7 @@ class test_mail(test_mail_mockup.TestMailMockups): # Test: sent_email: email send by server: correct subject, body, body_alternative for sent_email in sent_emails: self.assertEqual(sent_email['subject'], _subject, 'sent_email subject incorrect') - self.assertEqual(sent_email['body'], _mail_body1 + '\n
Bert Tartopoils
\n', 'sent_email body incorrect') + self.assertEqual(sent_email['body'], _mail_body1 + '\nBert Tartopoils\n', 'sent_email body incorrect') # the html2plaintext uses etree or beautiful soup, so the result may be slighly different # depending if you have installed beautiful soup. self.assertIn(sent_email['body_alternative'], _mail_bodyalt1 + '\nBert Tartopoils\n', 'sent_email body_alternative is incorrect') diff --git a/addons/portal/mail_mail.py b/addons/portal/mail_mail.py index f57170ed67b..0dc7348f2c8 100644 --- a/addons/portal/mail_mail.py +++ b/addons/portal/mail_mail.py @@ -36,5 +36,5 @@ class mail_mail(osv.Model): if partner: context = dict(context or {}, signup_valid=True) partner = self.pool.get('res.partner').browse(cr, uid, partner.id, context) - body = tools.append_content_to_html(body, "Log in our portal at: %s" % partner.signup_url) + body = tools.append_content_to_html(body, ("

Log in our portal at: %s

" % partner.signup_url), plaintext=False) return body From ead36dfd9a4d6f65327e951825c35859649c74fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 7 Nov 2012 18:03:05 +0100 Subject: [PATCH 19/41] [TMP] mail.compose.message wizard: set some fields visible for debug purpose. Will have to be reverted when merging. bzr revid: tde@openerp.com-20121107170305-1ukzn33bak8y0irl --- addons/mail/wizard/mail_compose_message_view.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/mail/wizard/mail_compose_message_view.xml b/addons/mail/wizard/mail_compose_message_view.xml index b9c3d237e78..2ba774f50fc 100644 --- a/addons/mail/wizard/mail_compose_message_view.xml +++ b/addons/mail/wizard/mail_compose_message_view.xml @@ -8,11 +8,11 @@
- - - - - + + + + + From 389b502b63c4ebfe5386dc8bacd5e2e5b5bdc1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 7 Nov 2012 18:15:21 +0100 Subject: [PATCH 20/41] [FIX] mail: posting from mailboxes now correctly handles recipients of replies message. Body is now converted into html. bzr revid: tde@openerp.com-20121107171521-whwcjefpjvt91ye6 --- addons/mail/mail_thread.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index ca598ce3a93..c483fca9537 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -710,12 +710,24 @@ class mail_thread(osv.AbstractModel): def message_post_api(self, cr, uid, thread_id, body='', subject=False, parent_id=False, attachment_ids=None, context=None): """ Wrapper on message_post, used only in Chatter (JS). The purpose is to handle attachments. - # TDE FIXME: body is plaintext: convert it into html + - body is plaintext: convert it into html + - handle reply to a previous message """ - new_message_id = self.message_post(cr, uid, thread_id=thread_id, body=body, subject=subject, type='comment', - subtype='mail.mt_comment', parent_id=parent_id, context=context) + # 1. handle body + body = tools.text2html(body) - # HACK FIXME: Chatter: attachments linked to the document (not done JS-side), load the message + # 2. handle message partner_ids + if parent_id: + parent_data = self.pool.get('mail.message').browse(cr, uid, parent_id, context=context) + partner_ids = [(4, partner.id) for partner in parent_data.partner_ids] + else: + partner_ids = [] + + # 3. post message + new_message_id = self.message_post(cr, uid, thread_id=thread_id, body=body, subject=subject, type='comment', + subtype='mail.mt_comment', parent_id=parent_id, context=context, partner_ids=partner_ids) + + # 4. HACK FIXME: Chatter: attachments linked to the document (not done JS-side), load the message if attachment_ids: ir_attachment = self.pool.get('ir.attachment') mail_message = self.pool.get('mail.message') From 935964a7100c8d3992c39ee7cb3a7162263c8c9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 7 Nov 2012 18:22:37 +0100 Subject: [PATCH 21/41] [IMP] mail: mail_message: some string made more understandable. bzr revid: tde@openerp.com-20121107172237-iqe5ay844eh2zsm5 --- addons/mail/mail_message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 4f1c0a00e77..08c14dbc4d1 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -125,7 +125,7 @@ class mail_message(osv.Model): help="Author of the message. If not set, email_from may hold an email address that did not match any partner."), 'partner_ids': fields.many2many('res.partner', string='Recipients'), 'notified_partner_ids': fields.many2many('res.partner', 'mail_notification', - 'message_id', 'partner_id', 'Recipients'), + 'message_id', 'partner_id', 'Notified partners'), 'attachment_ids': fields.many2many('ir.attachment', 'message_attachment_rel', 'message_id', 'attachment_id', 'Attachments'), 'parent_id': fields.many2one('mail.message', 'Parent Message', select=True, ondelete='set null', help="Initial thread message."), From 46eb09b933ccc6544c29a37eac67f343bd903471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 8 Nov 2012 10:07:33 +0100 Subject: [PATCH 22/41] [FIX] mail: needaction counter on mailboxes. bzr revid: tde@openerp.com-20121108090733-nhjug1ysn22tnjvw --- addons/mail/mail_thread_view.xml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/addons/mail/mail_thread_view.xml b/addons/mail/mail_thread_view.xml index 9737d93dd8f..768bbc25b75 100644 --- a/addons/mail/mail_thread_view.xml +++ b/addons/mail/mail_thread_view.xml @@ -4,6 +4,7 @@ Inbox mail.wall + mail.message @@ -11,29 +12,33 @@ To: me mail.wall + mail.message + 'context': {'default_model': 'res.users', 'default_res_id': uid, 'typeof_thread': 'inbox'}, }""/> Favorites mail.wall + mail.message + 'context': {'default_model': 'res.users', 'default_res_id': uid, 'typeof_thread': 'stared'}, }""/> Archives mail.wall + mail.message + 'context': {'default_model': 'res.users', 'default_res_id': uid, 'typeof_thread': 'archives'}, }""/> Sent mail.wall + mail.message + 'context': {'default_model': 'res.users', 'default_res_id': uid, 'typeof_thread': 'send'}, }""/> From 03cfda4febad3034524fd2dabf6eb073fb95ac4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 8 Nov 2012 11:18:05 +0100 Subject: [PATCH 23/41] [IMP] [DEMO] mail, portal: updated demo data. bzr revid: tde@openerp.com-20121108101805-1sb1gcatj2oztq39 --- addons/mail/data/mail_demo.xml | 16 +++++++----- addons/portal/portal_demo.xml | 46 +++++++++++++++++++++++----------- 2 files changed, 41 insertions(+), 21 deletions(-) diff --git a/addons/mail/data/mail_demo.xml b/addons/mail/data/mail_demo.xml index 3244e047da4..f196b1c48a4 100644 --- a/addons/mail/data/mail_demo.xml +++ b/addons/mail/data/mail_demo.xml @@ -5,46 +5,50 @@ mail.group - Your monthly meal vouchers arrived. You can get them at Christine's office. -This month you also get 250 EUR of eco-vouchers if you have been in the company for more than a year.

]]>
+ Your monthly meal vouchers arrived. You can get them at Christine's office.

]]>
comment +
mail.group - Great.

]]>
+ Oh, I had forgotten. This month you also get 250 EUR of eco-vouchers if you have been in the company for more than a year.

]]>
comment +
mail.group - Thanks, but where is Christine's office, if I may ask? (I'm new here)

]]>
+ Thanks! Could you please remind me where is Christine's office, if I may ask? I'm new here!

]]>
comment +
mail.group - Building B3, second floor on the right :-)

]]>
+ Building B3, second floor on the right :-).

]]>
comment +
mail.group - Great news, I need to buy a new fridge, I think I can pay it with the eco-vouchers!

]]>
+ Many thanks. Actually that's good news, next year I'll have to buy a new fridge, I think I will pay it with the eco-vouchers!

]]>
comment +
diff --git a/addons/portal/portal_demo.xml b/addons/portal/portal_demo.xml index d40837d4c0b..5ab4bdd7365 100644 --- a/addons/portal/portal_demo.xml +++ b/addons/portal/portal_demo.xml @@ -2,21 +2,26 @@ - - + + Demo Portal User - portal - portal - - + demo@portal.example.com - demo@portal.wrong.address + + + + portal + portal + -- +Mr Demo Portal + + - + @@ -25,29 +30,40 @@ mail.group Hello, and welcome to our company's portal !

-

Lorem ipsum sit amet, consectetur adipiscing elit. Pellentesque et quam sapien, in sagittis tellus. -Praesent vel massa sed massa consequat egestas in tristique orci. Praesent iaculis libero et neque vehicula iaculis. Vivamus placerat tincidunt orci ac ornare. Proin ut dolor fringilla velit ultricies consequat. Maecenas sit amet ipsum non leo interdum imperdiet. Donec sapien mi.

-

Fusce tempus elit volutpat mi auctor adipiscing. Nam congue luctus suscipit. Sed tellus libero, venenatis ut mollis ut, luctus quis dui. Sed rhoncus pulvinar orci in consectetur.

-

Nulla turpis leo, rhoncus ut egestas sit amet, consectetur vitae urna. Mauris in dolor in sapien tempus vehicula.

]]>
+

It is a great pleasure to announce you the creation of our portal by writing this first news! As you may have seen, a new discussion group is now present under your 'My groups' menu: Company's News. We will post news about the company and its employees in this discussion group. Moreover, we will be able to communicate with our partners that are given the opportunity to join us in our portal.

+

A new era of communication has begun! Feel free to post your feelings about our portal by replying on this message!

]]>
comment +
mail.group - Great first blogpost!

]]>
+ As your first portal member, I am very pleased to be able to be able to communicate directly with you. Be sure I'll read all news carefully!

]]>
comment - + +
mail.group - Thanks!

]]>
+ That's good news! As said by Demo Portal User in the previous post, I'm looking forward to hearing from you!

]]>
comment + + +
+ + + mail.group + + This feature is realy great! We will be able to communicate directly to our partners!

]]>
+ + comment +
From 72f218bd24a64acc5f6c573199a20d4d88e7c9fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 8 Nov 2012 11:18:19 +0100 Subject: [PATCH 24/41] [IMP] mail: css: small tweak. bzr revid: tde@openerp.com-20121108101819-qsuhbo0qk3u5j92k --- addons/mail/static/src/css/mail.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 652714bffd7..c9d2a3fd52d 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -58,8 +58,8 @@ margin-top: 2px; } .openerp .oe_mail .oe_msg .oe_msg_content .oe_msg_body p{ - margin-top: 0px; - margin-bottom: 0px; + margin-top: 2px; + margin-bottom: 2px; } /* a) Indented Messages */ From d5d7dced4d3f2b27c14f8925ca98dff8f9f30b50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 8 Nov 2012 16:25:02 +0100 Subject: [PATCH 25/41] [FIX] mail: message_process now handles replies to messages without model, thread_id. Based on in-reply-to, it finds the parent message. mail_thread.message_post_user_api is called to create a new mail.message, bypassing message_new / message_update in this case. Some improvements added to partner_ids when using the chatter or message processing. bzr revid: tde@openerp.com-20121108152502-aow7vhu4erx7fb9l --- addons/mail/mail_thread.py | 110 ++++++++++++++++++++---------- addons/mail/static/src/js/mail.js | 2 +- 2 files changed, 74 insertions(+), 38 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index c483fca9537..b3e5423ae4d 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -319,10 +319,12 @@ class mail_thread(osv.AbstractModel): """ assert isinstance(message, Message), 'message must be an email.message.Message at this point' message_id = message.get('Message-Id') + references = decode_header(message, 'References') + in_reply_to = decode_header(message, 'In-Reply-To') # 1. Verify if this is a reply to an existing thread - references = decode_header(message, 'References') or decode_header(message, 'In-Reply-To') - ref_match = references and tools.reference_re.search(references) + thread_references = references or in_reply_to + ref_match = thread_references and tools.reference_re.search(thread_references) if ref_match: thread_id = int(ref_match.group(1)) model = ref_match.group(2) or model @@ -333,6 +335,15 @@ class mail_thread(osv.AbstractModel): message_id, model, thread_id, custom_values, uid) return [(model, thread_id, custom_values, uid)] + # Verify this is a reply to a private message + message_ids = self.pool.get('mail.message').search(cr, uid, [('message_id', 'ilike', in_reply_to)], limit=1, context=context) + if message_ids: + message = self.pool.get('mail.message').browse(cr, uid, message_ids[0], context=context) + _logger.debug('Routing mail with Message-Id %s: reply to a private message: %s, custom_values: %s, uid: %s', + message_id, message.id, custom_values, uid) + return [(False, 0, custom_values, uid)] + + # 2. Look for a matching mail.alias entry # Delivered-To is a safe bet in most modern MTAs, but we have to fallback on To + Cc values # for all the odd MTAs out there, as there is no standard header for the envelope's `rcpt_to` value. @@ -376,14 +387,19 @@ class mail_thread(osv.AbstractModel): def message_process(self, cr, uid, model, message, custom_values=None, save_original=False, strip_attachments=False, thread_id=None, context=None): - """Process an incoming RFC2822 email message, relying on - ``mail.message.parse()`` for the parsing operation, - and ``message_route()`` to figure out the target model. + """ Process an incoming RFC2822 email message, relying on + ``mail.message.parse()`` for the parsing operation, + and ``message_route()`` to figure out the target model. - Once the target model is known, its ``message_new`` method - is called with the new message (if the thread record did not exist) + Once the target model is known, its ``message_new`` method + is called with the new message (if the thread record did not exist) or its ``message_update`` method (if it did). + There is a special case where the target model is False: a reply + to a private message. In this case, we skip the message_new / + message_update step, to just post a new message using mail_thread + message_post. + :param string model: the fallback model to use if the message does not match any of the currently configured mail aliases (may be None if a matching alias is supposed to be present) @@ -425,15 +441,18 @@ class mail_thread(osv.AbstractModel): for model, thread_id, custom_values, user_id in routes: if self._name != model: context.update({'thread_model': model}) - model_pool = self.pool.get(model) - assert thread_id and hasattr(model_pool, 'message_update') or hasattr(model_pool, 'message_new'), \ - "Undeliverable mail with Message-Id %s, model %s does not accept incoming emails" % \ - (msg['message_id'], model) - if thread_id and hasattr(model_pool, 'message_update'): - model_pool.message_update(cr, user_id, [thread_id], msg, context=context) + if model: + model_pool = self.pool.get(model) + assert thread_id and hasattr(model_pool, 'message_update') or hasattr(model_pool, 'message_new'), \ + "Undeliverable mail with Message-Id %s, model %s does not accept incoming emails" % \ + (msg['message_id'], model) + if thread_id and hasattr(model_pool, 'message_update'): + model_pool.message_update(cr, user_id, [thread_id], msg, context=context) + else: + thread_id = model_pool.message_new(cr, user_id, msg, custom_values, context=context) else: - thread_id = model_pool.message_new(cr, user_id, msg, custom_values, context=context) - model_pool.message_post(cr, uid, [thread_id], context=context, **msg) + model_pool = self.pool.get('mail.thread') + model_pool.message_post_user_api(cr, uid, [thread_id], context=context, **msg) return thread_id def message_new(self, cr, uid, msg_dict, custom_values=None, context=None): @@ -556,7 +575,6 @@ class mail_thread(osv.AbstractModel): """ msg_dict = { 'type': 'email', - 'subtype': 'mail.mt_comment', 'author_id': False, } if not isinstance(message, Message): @@ -640,10 +658,13 @@ class mail_thread(osv.AbstractModel): ``(name,content)``, where content is NOT base64 encoded :return: ID of newly created mail.message """ - context = context or {} - attachments = attachments or [] + if context is None: + context = {} + if attachments is None: + attachments = {} + assert (not thread_id) or isinstance(thread_id, (int, long)) or \ - (isinstance(thread_id, (list, tuple)) and len(thread_id) == 1), "Invalid thread_id" + (isinstance(thread_id, (list, tuple)) and len(thread_id) == 1), "Invalid thread_id; should be 0, False, an ID or a list with one ID" if isinstance(thread_id, (list, tuple)): thread_id = thread_id and thread_id[0] mail_message = self.pool.get('mail.message') @@ -707,30 +728,45 @@ class mail_thread(osv.AbstractModel): return mail_message.create(cr, uid, values, context=context) - def message_post_api(self, cr, uid, thread_id, body='', subject=False, parent_id=False, attachment_ids=None, context=None): - """ Wrapper on message_post, used only in Chatter (JS). The purpose is - to handle attachments. - - body is plaintext: convert it into html - - handle reply to a previous message + def message_post_user_api(self, cr, uid, thread_id, body='', subject=False, parent_id=False, + attachment_ids=None, context=None, content_subtype='plaintext', **kwargs): + """ Wrapper on message_post, used for user input : + - mail gateway + - quick reply in Chatter (refer to mail.js), not + the mail.compose.message wizard + The purpose is to perform some pre- and post-processing: + - if body is plaintext: convert it into html + - if parent_id: handle reply to a previous message by adding the + parent partners to the message + - type and subtype: comment and mail.mt_comment by default + - attachment_ids: supposed not attached to any document; attach them + to the related document. Should only be set by Chatter. """ - # 1. handle body - body = tools.text2html(body) + ir_attachment = self.pool.get('ir.attachment') + mail_message = self.pool.get('mail.message') - # 2. handle message partner_ids + # 1. Pre-processing: body, partner_ids, type and subtype + if content_subtype == 'plaintext': + body = tools.text2html(body) + + partner_ids = kwargs.pop('partner_ids', []) if parent_id: - parent_data = self.pool.get('mail.message').browse(cr, uid, parent_id, context=context) - partner_ids = [(4, partner.id) for partner in parent_data.partner_ids] - else: - partner_ids = [] + parent_message = self.pool.get('mail.message').browse(cr, uid, parent_id, context=context) + partner_ids += [(4, partner.id) for partner in parent_message.partner_ids] + # TDE FIXME HACK: mail.thread -> private message + if self._name == 'mail.thread' and parent_message.author_id.id: + partner_ids.append((4, parent_message.author_id.id)) - # 3. post message - new_message_id = self.message_post(cr, uid, thread_id=thread_id, body=body, subject=subject, type='comment', - subtype='mail.mt_comment', parent_id=parent_id, context=context, partner_ids=partner_ids) + message_type = kwargs.pop('type', 'comment') + message_subtype = kwargs.pop('type', 'mail.mt_comment') - # 4. HACK FIXME: Chatter: attachments linked to the document (not done JS-side), load the message + # 2. Post message + new_message_id = self.message_post(cr, uid, thread_id=thread_id, body=body, subject=subject, type=message_type, + subtype=message_subtype, parent_id=parent_id, context=context, partner_ids=partner_ids, **kwargs) + + # 3. Post-processing + # HACK TDE FIXME: Chatter: attachments linked to the document (not done JS-side), load the message if attachment_ids: - ir_attachment = self.pool.get('ir.attachment') - mail_message = self.pool.get('mail.message') filtered_attachment_ids = ir_attachment.search(cr, SUPERUSER_ID, [ ('res_model', '=', 'mail.compose.message'), ('res_id', '=', 0), diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 6be6693d8d8..91b16aeed45 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -350,7 +350,7 @@ openerp.mail = function (session) { if (body.match(/\S+/)) { //session.web.blockUI(); - this.parent_thread.ds_thread.call('message_post_api', [ + this.parent_thread.ds_thread.call('message_post_user_api', [ this.context.default_res_id, mail.ChatterUtils.get_text2html(body), false, From 7e1369cca827680a37ea83ae32ac772723bb8e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 8 Nov 2012 17:08:26 +0100 Subject: [PATCH 26/41] [FIX] fetchmail: fixed a bug about fetchmail_server_id when sending an email. bzr revid: tde@openerp.com-20121108160826-40dj27zvmqxf4im7 --- addons/fetchmail/fetchmail.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py index e0023697594..68f05dfeee2 100644 --- a/addons/fetchmail/fetchmail.py +++ b/addons/fetchmail/fetchmail.py @@ -243,20 +243,20 @@ class mail_mail(osv.osv): def create(self, cr, uid, values, context=None): if context is None: - context={} + context = {} fetchmail_server_id = context.get('fetchmail_server_id') if fetchmail_server_id: values['fetchmail_server_id'] = fetchmail_server_id - res = super(mail_mail,self).create(cr, uid, values, context=context) + res = super(mail_mail, self).create(cr, uid, values, context=context) return res def write(self, cr, uid, ids, values, context=None): if context is None: - context={} + context = {} fetchmail_server_id = context.get('fetchmail_server_id') if fetchmail_server_id: - values['fetchmail_server_id'] = server_id - res = super(mail_mail,self).write(cr, uid, ids, values, context=context) + values['fetchmail_server_id'] = fetchmail_server_id + res = super(mail_mail, self).write(cr, uid, ids, values, context=context) return res From acb1156ee5c0da47a251616a61dede91bb1066b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 8 Nov 2012 17:41:38 +0100 Subject: [PATCH 27/41] [FIX] mail: fixed bug adding signature of partners without users, therefore without signature field; fixed message_id of mail.message without model,res_id, that were not granted a message_id, therefore generated when sending a mail.mail, therefore breaking parent relationship based on message_id. Also fixed content_subtype of message coming from message_process. bzr revid: tde@openerp.com-20121108164138-8jp2340t6s2sa9hd --- addons/mail/mail_followers.py | 2 +- addons/mail/mail_message.py | 2 ++ addons/mail/mail_thread.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/mail/mail_followers.py b/addons/mail/mail_followers.py index 7406108229a..375ed9243a7 100644 --- a/addons/mail/mail_followers.py +++ b/addons/mail/mail_followers.py @@ -160,7 +160,7 @@ class mail_notification(osv.Model): pass # print quote_context # body_html = tools.append_content_to_html(body_html, quote_context, plaintext=False) - signature = msg.author_id and msg.author_id.user_ids[0].signature or '' + signature = msg.author_id and msg.author_id.user_id and msg.author_id.user_ids[0].signature or '' if signature: body_html = tools.append_content_to_html(body_html, tools.text2html(signature), plaintext=False) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 08c14dbc4d1..935350fdeb8 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -600,6 +600,8 @@ class mail_message(osv.Model): def create(self, cr, uid, values, context=None): if not values.get('message_id') and values.get('res_id') and values.get('model'): values['message_id'] = tools.generate_tracking_message_id('%(res_id)s-%(model)s' % values) + elif not values.get('message_id'): + values['message_id'] = tools.generate_tracking_message_id('private') newid = super(mail_message, self).create(cr, uid, values, context) self._notify(cr, SUPERUSER_ID, newid, context=context) return newid diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index b3e5423ae4d..1c27c6ce658 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -452,7 +452,7 @@ class mail_thread(osv.AbstractModel): thread_id = model_pool.message_new(cr, user_id, msg, custom_values, context=context) else: model_pool = self.pool.get('mail.thread') - model_pool.message_post_user_api(cr, uid, [thread_id], context=context, **msg) + model_pool.message_post_user_api(cr, uid, [thread_id], context=context, content_subtype='html', **msg) return thread_id def message_new(self, cr, uid, msg_dict, custom_values=None, context=None): From 78959edc483fee88286d8bc147d47fcc97597f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 9 Nov 2012 10:51:22 +0100 Subject: [PATCH 28/41] [IMP] email_template: cleaned a bit tools imports. bzr revid: tde@openerp.com-20121109095122-pifpwr5u1hhyjakw --- addons/email_template/email_template.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/email_template/email_template.py b/addons/email_template/email_template.py index 6965fa0c222..889a1c3c584 100644 --- a/addons/email_template/email_template.py +++ b/addons/email_template/email_template.py @@ -28,8 +28,6 @@ from osv import osv from osv import fields import tools from tools.translate import _ -from tools.mail import html_sanitize -from tools import append_content_to_html from urllib import quote as quote _logger = logging.getLogger(__name__) @@ -292,10 +290,10 @@ class email_template(osv.osv): or False if template.user_signature: signature = self.pool.get('res.users').browse(cr, uid, uid, context).signature - values['body_html'] = append_content_to_html(values['body_html'], signature) + values['body_html'] = tools.append_content_to_html(values['body_html'], signature) if values['body_html']: - values['body'] = html_sanitize(values['body_html']) + values['body'] = tools.html_sanitize(values['body_html']) values.update(mail_server_id=template.mail_server_id.id or False, auto_delete=template.auto_delete, From b1a5db6a912190ab2a39a4bd578ad186d9e14d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 9 Nov 2012 11:09:00 +0100 Subject: [PATCH 29/41] [FIX] message_process: fixed wrong domain for finding parent message based on in-reply-to. bzr revid: tde@openerp.com-20121109100900-ri2126fe0ejb8c8w --- addons/mail/mail_thread.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 1c27c6ce658..bb944a48860 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -336,14 +336,13 @@ class mail_thread(osv.AbstractModel): return [(model, thread_id, custom_values, uid)] # Verify this is a reply to a private message - message_ids = self.pool.get('mail.message').search(cr, uid, [('message_id', 'ilike', in_reply_to)], limit=1, context=context) + message_ids = self.pool.get('mail.message').search(cr, uid, [('message_id', '=', in_reply_to)], limit=1, context=context) if message_ids: message = self.pool.get('mail.message').browse(cr, uid, message_ids[0], context=context) _logger.debug('Routing mail with Message-Id %s: reply to a private message: %s, custom_values: %s, uid: %s', message_id, message.id, custom_values, uid) return [(False, 0, custom_values, uid)] - # 2. Look for a matching mail.alias entry # Delivered-To is a safe bet in most modern MTAs, but we have to fallback on To + Cc values # for all the odd MTAs out there, as there is no standard header for the envelope's `rcpt_to` value. From ae2e2298dc12290e8c06de24cc7e761475c351a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 14 Nov 2012 11:52:52 +0100 Subject: [PATCH 30/41] [REV] mail_followers: context in send email is commented, because not ready yet. bzr revid: tde@openerp.com-20121114105252-3eberdfvobrtthk6 --- addons/mail/mail_followers.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/mail/mail_followers.py b/addons/mail/mail_followers.py index 15cdd3b8b1f..2942dde9b92 100644 --- a/addons/mail/mail_followers.py +++ b/addons/mail/mail_followers.py @@ -151,14 +151,12 @@ class mail_notification(osv.Model): # add the context in the email # TDE FIXME: commented, to be improved in a future branch - quote_context = self.pool.get('mail.message').message_quote_context(cr, uid, msg_id, context=context) + # quote_context = self.pool.get('mail.message').message_quote_context(cr, uid, msg_id, context=context) mail_mail = self.pool.get('mail.mail') # add signature body_html = msg.body - if quote_context: - pass - # print quote_context + # if quote_context: # body_html = tools.append_content_to_html(body_html, quote_context, plaintext=False) signature = msg.author_id and msg.author_id.user_id and msg.author_id.user_ids[0].signature or '' if signature: From 48e3bdb3322a743e1941f3d42dbccac5f0cf20ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 14 Nov 2012 11:53:23 +0100 Subject: [PATCH 31/41] [IMP] mail_thread: incoming messages without model that are reply to a private message shoudl not have any res_id. Assert it. bzr revid: tde@openerp.com-20121114105323-5an5v6m7bdaaomy1 --- addons/mail/mail_thread.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 6d498eab8ad..d18d056e439 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -339,7 +339,7 @@ class mail_thread(osv.AbstractModel): message_ids = self.pool.get('mail.message').search(cr, uid, [('message_id', '=', in_reply_to)], limit=1, context=context) if message_ids: message = self.pool.get('mail.message').browse(cr, uid, message_ids[0], context=context) - _logger.debug('Routing mail with Message-Id %s: reply to a private message: %s, custom_values: %s, uid: %s', + _logger.debug('Routing mail with Message-Id %s: direct reply to a private message: %s, custom_values: %s, uid: %s', message_id, message.id, custom_values, uid) return [(False, 0, custom_values, uid)] @@ -450,6 +450,7 @@ class mail_thread(osv.AbstractModel): else: thread_id = model_pool.message_new(cr, user_id, msg, custom_values, context=context) else: + assert thread_id == 0, "Posting a message without model should be with a null res_id, to create a private message." model_pool = self.pool.get('mail.thread') model_pool.message_post_user_api(cr, uid, [thread_id], context=context, content_subtype='html', **msg) return thread_id From 5afe27095f09d13040e4dcb9d27be9419da1f246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 14 Nov 2012 12:11:04 +0100 Subject: [PATCH 32/41] [FIX] mail_followes: signature addition is back, wrong var name. bzr revid: tde@openerp.com-20121114111104-0jyqh2v0tk7zznc1 --- addons/mail/mail_followers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/mail_followers.py b/addons/mail/mail_followers.py index 2942dde9b92..8d3876ec91f 100644 --- a/addons/mail/mail_followers.py +++ b/addons/mail/mail_followers.py @@ -158,9 +158,9 @@ class mail_notification(osv.Model): body_html = msg.body # if quote_context: # body_html = tools.append_content_to_html(body_html, quote_context, plaintext=False) - signature = msg.author_id and msg.author_id.user_id and msg.author_id.user_ids[0].signature or '' + signature = msg.author_id and msg.author_id.user_ids and msg.author_id.user_ids[0].signature or '' if signature: - body_html = tools.append_content_to_html(body_html, tools.text2html(signature), plaintext=False) + body_html = tools.append_content_to_html(body_html, signature, plaintext=True, container_tag='div') mail_values = { 'mail_message_id': msg.id, From 17c2939ddc764f88797f1a2a3e4b72bc44468daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 14 Nov 2012 12:11:29 +0100 Subject: [PATCH 33/41] [IMP] mail_thread: message_process: plaintext incoming messages are preserved in pre tags. bzr revid: tde@openerp.com-20121114111129-8nkneu1h6ij2lk99 --- addons/mail/mail_thread.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index d18d056e439..81120151de1 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -520,7 +520,7 @@ class mail_thread(osv.AbstractModel): body = tools.ustr(body, encoding, errors='replace') if message.get_content_type() == 'text/plain': # text/plain ->
-                body = tools.append_content_to_html(u'', body)
+                body = tools.append_content_to_html(u'', body, preserve=True)
         else:
             alternative = (message.get_content_type() == 'multipart/alternative')
             for part in message.walk():
@@ -535,7 +535,7 @@ class mail_thread(osv.AbstractModel):
                 # 2) text/plain -> 
                 if part.get_content_type() == 'text/plain' and (not alternative or not body):
                     body = tools.append_content_to_html(body, tools.ustr(part.get_payload(decode=True),
-                                                                         encoding, errors='replace'))
+                                                                         encoding, errors='replace'), preserve=True)
                 # 3) text/html -> raw
                 elif part.get_content_type() == 'text/html':
                     html = tools.ustr(part.get_payload(decode=True), encoding, errors='replace')

From 64277d04c39767f6633c9406a393302c1924d9a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= 
Date: Wed, 14 Nov 2012 12:55:04 +0100
Subject: [PATCH 34/41] [IMP] Addons: messages when installing key apps is not
 of comment subtype, meaning they are effectively pushed.

bzr revid: tde@openerp.com-20121114115504-tvh0j9ks0jde12ed
---
 addons/account_accountant/account_accountant_data.xml | 8 +++-----
 addons/account_voucher/account_voucher_data.xml       | 8 +++-----
 addons/crm/crm_data.xml                               | 5 +++--
 addons/email_template/tests/test_mail.py              | 4 ++--
 addons/hr/hr_data.xml                                 | 8 ++++----
 addons/hr_evaluation/hr_evaluation_data.xml           | 4 ++--
 addons/hr_expense/hr_expense_data.xml                 | 6 +++---
 addons/hr_holidays/hr_holidays_data.xml               | 5 +++--
 addons/hr_recruitment/hr_recruitment_data.xml         | 6 +++---
 addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml | 3 ++-
 addons/mail/data/mail_group_data.xml                  | 1 +
 addons/mrp/mrp_data.xml                               | 8 ++++----
 addons/point_of_sale/point_of_sale_data.xml           | 6 +++---
 addons/project/project_data.xml                       | 8 ++++----
 addons/project_gtd/project_gtd_data.xml               | 5 +++--
 addons/project_issue/project_issue_data.xml           | 5 +++--
 addons/purchase/purchase_data.xml                     | 6 +++---
 addons/sale/sale_data.xml                             | 6 +++---
 addons/stock/stock_data.xml                           | 5 +++--
 19 files changed, 55 insertions(+), 52 deletions(-)

diff --git a/addons/account_accountant/account_accountant_data.xml b/addons/account_accountant/account_accountant_data.xml
index cf143b1bb58..14d8f59a5fe 100644
--- a/addons/account_accountant/account_accountant_data.xml
+++ b/addons/account_accountant/account_accountant_data.xml
@@ -26,12 +26,10 @@
             mail.group
             
             notification
+            
             Accounting and Finance application installed!
-            The accounting features are fully integrated  with other OpenERP applications to automate all your processes:  creation of customer invoices, control of supplier invoices,  point-of-sale integration, automated follow-ups, etc.

- ]]>
+ With OpenERP's accounting, you get instant access to your financial data, and can setup analytic accounting, forecast taxes, control budgets, easily create and send invoices, record bank statements, etc.

+

The accounting features are fully integrated with other OpenERP applications to automate all your processes: creation of customer invoices, control of supplier invoices, point-of-sale integration, automated follow-ups, etc.

]]>
diff --git a/addons/account_voucher/account_voucher_data.xml b/addons/account_voucher/account_voucher_data.xml index 3d4252e697d..fc008e479e9 100644 --- a/addons/account_voucher/account_voucher_data.xml +++ b/addons/account_voucher/account_voucher_data.xml @@ -7,12 +7,10 @@ mail.group notification + eInvoicing & Payments application installed! - You can track customer payments easily and automate follow-ups. You get an overview of the discussion with your customers on each invoice for easier traceability. For advanced accounting features, you should install the "Accounting and Finance" module.

- ]]>
+ OpenERP's electronic invoicing accelerates the creation of invoices and collection of customer payments. Invoices are created in a few clicks and your customers receive them by email. They can pay online and/or import them in their own system.

+

You can track customer payments easily and automate follow-ups. You get an overview of the discussion with your customers on each invoice for easier traceability. For advanced accounting features, you should install the "Accounting and Finance" module.

]]>
diff --git a/addons/crm/crm_data.xml b/addons/crm/crm_data.xml index 9dfbd5f9948..91117d2d83e 100644 --- a/addons/crm/crm_data.xml +++ b/addons/crm/crm_data.xml @@ -58,9 +58,10 @@ mail.group notification + CRM application installed! - From the top Sales menu you can track leads and opportunities, get accurate forecast on your sales pipeline, plan meetings and phonecalls, get realtime statistics and efficiently organize the communication with your prospects. -To manage quotations and sale orders, install the "Sales Management" application. + From the top Sales menu you can track leads and opportunities, get accurate forecast on your sales pipeline, plan meetings and phonecalls, get realtime statistics and efficiently organize the communication with your prospects.

+
To manage quotations and sale orders, install the "Sales Management" application.

]]>
diff --git a/addons/email_template/tests/test_mail.py b/addons/email_template/tests/test_mail.py index 9a7b71a4e42..00dd6dc8727 100644 --- a/addons/email_template/tests/test_mail.py +++ b/addons/email_template/tests/test_mail.py @@ -20,10 +20,10 @@ ############################################################################## import base64 -from openerp.addons.mail.tests import test_mail +from openerp.addons.mail.tests import test_mail_mockup -class test_message_compose(test_mail.TestMailMockups): +class test_message_compose(test_mail_mockup.TestMailMockups): def setUp(self): super(test_message_compose, self).setUp() diff --git a/addons/hr/hr_data.xml b/addons/hr/hr_data.xml index 514cf1f80f6..25c882f2201 100644 --- a/addons/hr/hr_data.xml +++ b/addons/hr/hr_data.xml @@ -6,11 +6,11 @@ mail.group notification + Employee Directory application installed! - Manage your human resources with OpenERP: employees and their hierarchy, HR departments and job positions. - -More HR features are available via extra applications: Recruitment Process (manage job positions and recruitment), Timesheet Validation (record timesheets and attendance), -Leave Management (keep track of employee leaves), Expense Management (manage employee expenses), Employee Appraisals (organize employee surveys, where employees evaluate their subordinates or their manager). + Manage your human resources with OpenERP: employees and their hierarchy, HR departments and job positions.

+

More HR features are available via extra applications: Recruitment Process (manage job positions and recruitment), Timesheet Validation (record timesheets and attendance), +Leave Management (keep track of employee leaves), Expense Management (manage employee expenses), Employee Appraisals (organize employee surveys, where employees evaluate their subordinates or their manager).

]]>
diff --git a/addons/hr_evaluation/hr_evaluation_data.xml b/addons/hr_evaluation/hr_evaluation_data.xml index 01915de76a0..45100b14e2a 100644 --- a/addons/hr_evaluation/hr_evaluation_data.xml +++ b/addons/hr_evaluation/hr_evaluation_data.xml @@ -11,9 +11,9 @@ mail.group notification + Employee Appraisals application installed! - Manage employee reviews: you can define an appraisal campaign with several steps, with specific evaluation surveys according to hierarchy levels. -Evaluations filled by employees may be exported as pdf files. + Manage employee reviews: you can define an appraisal campaign with several steps, with specific evaluation surveys according to hierarchy levels. Evaluations filled by employees may be exported as pdf files.

]]>
diff --git a/addons/hr_expense/hr_expense_data.xml b/addons/hr_expense/hr_expense_data.xml index 2a9f3ae0a56..f54156ac5ec 100644 --- a/addons/hr_expense/hr_expense_data.xml +++ b/addons/hr_expense/hr_expense_data.xml @@ -6,10 +6,10 @@ mail.group notification + Expense Management application installed! - Manage your employees' expenses, after due validation by their manager and the accountant, then generate and pay the corresponding invoices. - -This feature is also linked to analytic accounting and compatible with timesheet invoices, so you will be able to automatically re-invoice project-related expenses to your customers. + Manage your employees' expenses, after due validation by their manager and the accountant, then generate and pay the corresponding invoices.

+

This feature is also linked to analytic accounting and compatible with timesheet invoices, so you will be able to automatically re-invoice project-related expenses to your customers.

]]>
diff --git a/addons/hr_holidays/hr_holidays_data.xml b/addons/hr_holidays/hr_holidays_data.xml index afe2e69e697..5af0c60fc44 100644 --- a/addons/hr_holidays/hr_holidays_data.xml +++ b/addons/hr_holidays/hr_holidays_data.xml @@ -11,9 +11,10 @@ mail.group notification + Leave Management application installed! - Manage employee leaves from the top menu "Human Resources". Employees can create leave requests that are validated by their manager and/or HR officers. -Once validated, they are visible in the employee's calendar. HR officers can define leave types and allocate leaves to employees and employee categories. + Manage employee leaves from the top menu "Human Resources". Employees can create leave requests that are validated by their manager and/or HR officers.

+

Once validated, they are visible in the employee's calendar. HR officers can define leave types and allocate leaves to employees and employee categories.

]]>
diff --git a/addons/hr_recruitment/hr_recruitment_data.xml b/addons/hr_recruitment/hr_recruitment_data.xml index 330c86652dd..f1c8ed46aca 100644 --- a/addons/hr_recruitment/hr_recruitment_data.xml +++ b/addons/hr_recruitment/hr_recruitment_data.xml @@ -6,10 +6,10 @@ mail.group notification + Recruitment Process application installed! - Manage job positions and your company's recruitment process. This application is integrated with the Survey application to help you define interviews for different jobs. - -You can automatically receive job application though an email gateway, see the Human Resources settings. + Manage job positions and your company's recruitment process. This application is integrated with the Survey application to help you define interviews for different jobs.

+

You can automatically receive job application though an email gateway, see the Human Resources settings.

]]>
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml index 87edf949972..095a92c032d 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml @@ -6,8 +6,9 @@ mail.group notification + Timesheet Validation application installed! - From the top menu "Human Resources", enter and validate timesheets and attendances. + From the top menu "Human Resources", enter and validate timesheets and attendances.

]]>
diff --git a/addons/mail/data/mail_group_data.xml b/addons/mail/data/mail_group_data.xml index 2c983d67758..aae30226bf2 100644 --- a/addons/mail/data/mail_group_data.xml +++ b/addons/mail/data/mail_group_data.xml @@ -17,6 +17,7 @@ mail.group notification + Welcome to OpenERP! Your homepage is a summary of messages you received and key information about documents you follow.
The top menu bar contains all applications you installed. You can use this <i>Settings</i> menu to install more applications, activate others features or give access to new users.
diff --git a/addons/mrp/mrp_data.xml b/addons/mrp/mrp_data.xml index 3310bc98899..1d92609eb7e 100644 --- a/addons/mrp/mrp_data.xml +++ b/addons/mrp/mrp_data.xml @@ -6,11 +6,11 @@ mail.group notification + MRP application installed! - Manage your manufacturing process with OpenERP by defining your bills of materials (BoM), routings and work centers. -This application supports complete integration and production scheduling for stockable goods, consumables, and services. - -From the Manufacturing Settings, you can choose to compute production schedules periodically or just-in-time. + Manage your manufacturing process with OpenERP by defining your bills of materials (BoM), routings and work centers.
+This application supports complete integration and production scheduling for stockable goods, consumables, and services.

+

From the Manufacturing Settings, you can choose to compute production schedules periodically or just-in-time.

]]>
diff --git a/addons/point_of_sale/point_of_sale_data.xml b/addons/point_of_sale/point_of_sale_data.xml index 634d2606aa8..01d8dd9ff60 100644 --- a/addons/point_of_sale/point_of_sale_data.xml +++ b/addons/point_of_sale/point_of_sale_data.xml @@ -20,10 +20,10 @@ mail.group notification + Point of Sale application installed! - Record sale orders, register payments, compute change to return, create invoices, and manage refunds through a specific web touch-screen interface. - -If you install the PoS proxy you will be able to interface OpenERP with retail hardware: barcode scanners, printers, cash registers, weighing machines, credit card payment terminals. + Record sale orders, register payments, compute change to return, create invoices, and manage refunds through a specific web touch-screen interface.

+

If you install the PoS proxy you will be able to interface OpenERP with retail hardware: barcode scanners, printers, cash registers, weighing machines, credit card payment terminals.

]]>
diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml index 4f467c89a29..c5980ecddd2 100644 --- a/addons/project/project_data.xml +++ b/addons/project/project_data.xml @@ -125,11 +125,11 @@ mail.group notification + Project Management application installed! - Manage multi-level projects and tasks. You can delegate tasks, track task work, and review your planning. - -You can manage todo lists on tasks by installing the "Todo Lists" application, supporting the Getting Things Done (GTD) methodology. -You can also manage issues/bugs in projects by installing the "Issue Tracker" application. + Manage multi-level projects and tasks. You can delegate tasks, track task work, and review your planning.

+

You can manage todo lists on tasks by installing the "Todo Lists" application, supporting the Getting Things Done (GTD) methodology.

+

You can also manage issues/bugs in projects by installing the "Issue Tracker" application.

]]>
diff --git a/addons/project_gtd/project_gtd_data.xml b/addons/project_gtd/project_gtd_data.xml index 61b2468329c..1536ac4be3f 100644 --- a/addons/project_gtd/project_gtd_data.xml +++ b/addons/project_gtd/project_gtd_data.xml @@ -30,9 +30,10 @@ mail.group notification + Todo Lists application installed! - Add todo items on project tasks, to help you organize your work. -This application supports the Getting Things Done (GTD) methodology, based on David Allen's book. + Add todo items on project tasks, to help you organize your work. +This application supports the Getting Things Done (GTD) methodology, based on David Allen's book.

]]>
diff --git a/addons/project_issue/project_issue_data.xml b/addons/project_issue/project_issue_data.xml index 72f824715a8..d70cd71e240 100644 --- a/addons/project_issue/project_issue_data.xml +++ b/addons/project_issue/project_issue_data.xml @@ -36,10 +36,11 @@ mail.group notification + Issue Tracker application installed! - Manage the issues you might face in a project, such as bugs in a system, client complaints or material breakdowns. + Manage the issues you might face in a project, such as bugs in a system, client complaints or material breakdowns. You can record issues, assign them to a responsible person, and keep track of their status as they evolve over time. -Access all issues from the top Project menu, and access the issues of a specific project via the projects gallery view. +Access all issues from the top Project menu, and access the issues of a specific project via the projects gallery view.

]]>
diff --git a/addons/purchase/purchase_data.xml b/addons/purchase/purchase_data.xml index 693d18eb1ba..fa701c1f179 100644 --- a/addons/purchase/purchase_data.xml +++ b/addons/purchase/purchase_data.xml @@ -7,10 +7,10 @@ mail.group notification + Purchase Management application installed! - From the top menu Purchases, create purchase orders to buy products from your suppliers, enter supplier invoices and manage payments. - -You can also manage purchase requisitions, see also the Purchase Settings. + From the top menu Purchases, create purchase orders to buy products from your suppliers, enter supplier invoices and manage payments.

+

You can also manage purchase requisitions, see also the Purchase Settings.

]]>
diff --git a/addons/sale/sale_data.xml b/addons/sale/sale_data.xml index 6f4ed76614e..d5ed8e810d6 100644 --- a/addons/sale/sale_data.xml +++ b/addons/sale/sale_data.xml @@ -38,10 +38,10 @@ mail.group notification + Sales Management application installed! - This application lets you create and send quotations and process your sales orders; from delivery to invoicing. - -If you need to manage your sales pipeline (leads, opportunities, phonecalls), the <i>CRM</i> application may be useful. Use the Settings menu to install it. + This application lets you create and send quotations and process your sales orders; from delivery to invoicing.

+

If you need to manage your sales pipeline (leads, opportunities, phonecalls), the <i>CRM</i> application may be useful. Use the Settings menu to install it.

]]>
diff --git a/addons/stock/stock_data.xml b/addons/stock/stock_data.xml index 77c82989a21..a1ce136e304 100644 --- a/addons/stock/stock_data.xml +++ b/addons/stock/stock_data.xml @@ -6,9 +6,10 @@ mail.group notification + Warehouse Management application installed! - Manage your product inventoy and stock locations: you can control stock moves history and planning, -watch your stock valuation, and track production lots upstream and downstream (based on serial numbers). + Manage your product inventoy and stock locations: you can control stock moves history and planning, +watch your stock valuation, and track production lots upstream and downstream (based on serial numbers).

]]>
From 8dce388719051edc69646212e19ebb4c139192e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 14 Nov 2012 14:34:22 +0100 Subject: [PATCH 35/41] [REV] portal demo data: demo portal user xml_id back to its former value. bzr revid: tde@openerp.com-20121114133422-3tb28n9rfdyh80d0 --- addons/portal/portal_demo.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/portal/portal_demo.xml b/addons/portal/portal_demo.xml index 5ab4bdd7365..2a641867d83 100644 --- a/addons/portal/portal_demo.xml +++ b/addons/portal/portal_demo.xml @@ -3,14 +3,14 @@ - + Demo Portal User demo@portal.example.com - + portal portal -- @@ -44,7 +44,7 @@ Mr Demo Portal comment - + From 45eadceea6baa199a0ae0c1d975479f4c48526c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 14 Nov 2012 14:34:38 +0100 Subject: [PATCH 36/41] [FIX] email_template: udpated test according to new specs of append_content_to_html. bzr revid: tde@openerp.com-20121114133438-8m1q0r02i4xory0e --- addons/email_template/tests/test_mail.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/email_template/tests/test_mail.py b/addons/email_template/tests/test_mail.py index 00dd6dc8727..7c69295ce9f 100644 --- a/addons/email_template/tests/test_mail.py +++ b/addons/email_template/tests/test_mail.py @@ -52,8 +52,8 @@ class test_message_compose(test_mail_mockup.TestMailMockups): # Mail data _subject1 = 'Pigs' _subject2 = 'Bird' - _body_html1 = 'Fans of Pigs, unite !\n
Admin
\n' - _body_html2 = 'I am angry !\n
Admin
\n' + _body_html1 = 'Fans of Pigs, unite !\n

Admin

\n' + _body_html2 = 'I am angry !\n

Admin

\n' _attachments = [ {'name': 'First', 'datas_fname': 'first.txt', 'datas': base64.b64encode('My first attachment')}, {'name': 'Second', 'datas_fname': 'second.txt', 'datas': base64.b64encode('My second attachment')} From c6bd2c0ee096b8f34e4a47c120c66ae78e02becb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 14 Nov 2012 14:48:03 +0100 Subject: [PATCH 37/41] [REV] mail.compose.message: some of the wizard fields back to invisible mode. bzr revid: tde@openerp.com-20121114134803-hlbmmd14psdc2sk7 --- addons/mail/wizard/mail_compose_message_view.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/mail/wizard/mail_compose_message_view.xml b/addons/mail/wizard/mail_compose_message_view.xml index f9b79b7b282..86b1be6562f 100644 --- a/addons/mail/wizard/mail_compose_message_view.xml +++ b/addons/mail/wizard/mail_compose_message_view.xml @@ -8,11 +8,11 @@ - - - - - + + + + +