From f444fe08765ac817d88b16591110784ec1ffade2 Mon Sep 17 00:00:00 2001 From: "Bhumi Thakkar (Open ERP)" Date: Tue, 21 Aug 2012 16:25:13 +0530 Subject: [PATCH 1/3] [IMP] required=true on alias_id field and create alias_force_id field. bzr revid: bth@tinyerp.com-20120821105513-lq4am6na04rjqncc --- addons/mail/mail_alias.py | 3 ++- addons/mail/mail_group.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/mail/mail_alias.py b/addons/mail/mail_alias.py index 82b20f39480..ea4c91b2435 100644 --- a/addons/mail/mail_alias.py +++ b/addons/mail/mail_alias.py @@ -54,10 +54,11 @@ class mail_alias(osv.Model): def _get_alias_domain(self, cr, uid, ids, name, args, context=None): ir_config_parameter = self.pool.get("ir.config_parameter") - domain = ir_config_parameter.get_param(cr, uid, "mail.catchall.domain", context=context) + domain = ir_config_parameter.get_param(cr, uid, "mail.catchall.domain", context=context) return dict.fromkeys(ids, domain or "") _columns = { + 'alias_force_id': fields.integer('Alias Force Id'), 'alias_name': fields.char('Alias', required=True, help="The name of the email alias, e.g. 'jobs' " "if you want to catch emails for ",), diff --git a/addons/mail/mail_group.py b/addons/mail/mail_group.py index 6a14fef83aa..39a1707bc8a 100644 --- a/addons/mail/mail_group.py +++ b/addons/mail/mail_group.py @@ -98,7 +98,7 @@ class mail_group(osv.Model): "Use this field anywhere a small image is required."), 'last_month_msg_nbr': fields.function(_get_last_month_msg_nbr, type='integer', string='Messages count for last month'), - 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", + 'alias_id': fields.many2one('mail.alias', 'Alias', required=True, ondelete="cascade", help="The email address associated with this group. New emails received will automatically " "create new topics."), } From edb6e7e0d32b8b8300a9fa35777baa0279268889 Mon Sep 17 00:00:00 2001 From: "Bhumi Thakkar (Open ERP)" Date: Wed, 22 Aug 2012 16:51:37 +0530 Subject: [PATCH 2/3] [IMP] Replace field name type with message_type. bzr revid: bth@tinyerp.com-20120822112137-u6i2dujnpisk7t1p --- addons/mail/mail_message.py | 16 ++++++++-------- addons/mail/mail_message_view.xml | 18 +++++++++--------- addons/mail/mail_thread.py | 6 +++--- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 7801a9b42d9..15e9121cee9 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -199,9 +199,9 @@ class mail_message(osv.Model): 'nodestroy': True }) return action_data - + _columns = { - 'type': fields.selection([ + 'message_type': fields.selection([ ('email', 'email'), ('comment', 'Comment'), ('notification', 'System notification'), @@ -235,16 +235,16 @@ class mail_message(osv.Model): help="Parent message, used for displaying as threads with hierarchy"), 'child_ids': fields.one2many('mail.message', 'parent_id', 'Child Messages'), } - + _defaults = { - 'type': 'email', + 'message_type': 'email', 'state': 'received', } - + #------------------------------------------------------ # Email api #------------------------------------------------------ - + def init(self, cr): cr.execute("""SELECT indexname FROM pg_indexes WHERE indexname = 'mail_message_model_res_id_idx'""") if not cr.fetchone(): @@ -356,7 +356,7 @@ class mail_message(osv.Model): 'user_id': uid, 'model': model, 'res_id': res_id, - 'type': type, + 'message_type': type, 'body_text': body if content_subtype != 'html' else False, 'body_html': body if content_subtype == 'html' else False, 'email_from': email_from, @@ -414,7 +414,7 @@ class mail_message(osv.Model): if context is None: context = {} if not ids: - filters = ['&', ('state', '=', 'outgoing'), ('type', '=', 'email')] + filters = ['&', ('state', '=', 'outgoing'), ('message_type', '=', 'email')] if 'filters' in context: filters.extend(context['filters']) ids = self.search(cr, uid, filters, context=context) diff --git a/addons/mail/mail_message_view.xml b/addons/mail/mail_message_view.xml index 0aa5261d7e7..614b70820d0 100644 --- a/addons/mail/mail_message_view.xml +++ b/addons/mail/mail_message_view.xml @@ -30,7 +30,7 @@ - + @@ -75,19 +75,19 @@ - + + domain="[('message_type', '=', 'comment')]"/> + domain="[('message_type', '=', 'notification')]"/> + domain="[('message_type', '=', 'email')]"/> - + @@ -205,9 +205,9 @@ - - - + + + diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 56c7e6b7088..1168a677472 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -440,7 +440,7 @@ class mail_thread(osv.Model): 'body_html': body_html or '', 'parent_id': parent_id, 'date': email_date or fields.datetime.now(), - 'type': type, + 'message_type': type, 'content_subtype': content_subtype, 'state': state, 'message_id': message_id, @@ -491,7 +491,7 @@ class mail_thread(osv.Model): body_text = msg_dict.get('body_text'), body_html= msg_dict.get('body_html'), parent_id = msg_dict.get('parent_id', False), - type = msg_dict.get('type', 'email'), + message_type = msg_dict.get('message_type', 'email'), content_subtype = msg_dict.get('content_subtype'), state = msg_dict.get('state'), partner_ids = msg_dict.get('partner_ids'), @@ -1107,7 +1107,7 @@ class mail_thread(osv.Model): if body_text: body_text += '\n\n----------\nThis email was send automatically by OpenERP, because you have subscribed to a document.' values.update({ - 'type': 'email', + 'message_type': 'email', 'state': 'outgoing', 'email_from': email_from, 'email_to': email_to, From ee8b2cc93467f4b234d161575fafc4fce21591f5 Mon Sep 17 00:00:00 2001 From: "Bhumi Thakkar (Open ERP)" Date: Thu, 23 Aug 2012 13:09:13 +0530 Subject: [PATCH 3/3] [IMP] Remove type field from model=ir.ui.view. bzr revid: bth@tinyerp.com-20120823073913-hqm60kysmk8xwyv8 --- addons/mail/mail_followers_view.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/mail/mail_followers_view.xml b/addons/mail/mail_followers_view.xml index 62e93430675..8b19d51ca2a 100644 --- a/addons/mail/mail_followers_view.xml +++ b/addons/mail/mail_followers_view.xml @@ -6,7 +6,6 @@ mail.followers.tree mail.followers - tree 10