From 1f71463cfc1261415d2c42044b396aa173688498 Mon Sep 17 00:00:00 2001 From: "Darshan Kalola (OpenERP)" Date: Wed, 19 Feb 2014 16:22:46 +0530 Subject: [PATCH 1/8] [IMP] extract subtype ordering from lp:~openerp-dev/openobject-addons/trunk-visibility-hr_holidays-darshan. bzr revid: dka@tinyerp.com-20140219105246-qmm78w81erhfvhlc --- addons/mail/mail_message_subtype.py | 2 ++ addons/mail/mail_thread.py | 3 ++- addons/mail/static/src/css/mail.css | 4 ++++ addons/mail/static/src/js/mail_followers.js | 8 ++++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/addons/mail/mail_message_subtype.py b/addons/mail/mail_message_subtype.py index bef6e427c3b..427f3396c35 100644 --- a/addons/mail/mail_message_subtype.py +++ b/addons/mail/mail_message_subtype.py @@ -50,7 +50,9 @@ class mail_message_subtype(osv.osv): help="Model the subtype applies to. If False, this subtype applies to all models."), 'default': fields.boolean('Default', help="Activated by default when subscribing."), + 'sequence': fields.integer('Sequence'), } + _order = 'sequence' _defaults = { 'default': True, } diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 9a8adee31c3..94c6bbca788 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -19,6 +19,7 @@ # ############################################################################## +from collections import OrderedDict import base64 import datetime import dateutil @@ -186,7 +187,7 @@ class mail_thread(osv.AbstractModel): # find current model subtypes, add them to a dictionary subtype_obj = self.pool.get('mail.message.subtype') subtype_ids = subtype_obj.search(cr, uid, ['|', ('res_model', '=', self._name), ('res_model', '=', False)], context=context) - subtype_dict = dict((subtype.name, dict(default=subtype.default, followed=False, id=subtype.id)) for subtype in subtype_obj.browse(cr, uid, subtype_ids, context=context)) + subtype_dict = OrderedDict((subtype.name, OrderedDict(default=subtype.default, followed=False, parent_model=subtype.parent_id.res_model, id=subtype.id)) for subtype in subtype_obj.browse(cr, uid, subtype_ids, context=context)) for id in ids: res[id]['message_subtype_data'] = subtype_dict.copy() diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index bfae7571a9c..fee73a7e08d 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -757,4 +757,8 @@ .openerp .oe_sidebar_suggestion .oe_suggest_items:hover a.oe_suggestion_remove_item { visibility: visible; } +.subtype-border { + border-bottom: 1px solid #dddddd; + margin-bottom: 10px; +} diff --git a/addons/mail/static/src/js/mail_followers.js b/addons/mail/static/src/js/mail_followers.js index 938d6a01f6d..2986b700560 100644 --- a/addons/mail/static/src/js/mail_followers.js +++ b/addons/mail/static/src/js/mail_followers.js @@ -267,7 +267,15 @@ openerp_mail_followers = function(session, mail) { var records = data[id].message_subtype_data; this.records_length = $.map(records, function(value, index) { return index; }).length; if (this.records_length > 1) { self.display_followers(); } + var old_model = ''; _(records).each(function (record, record_name) { + if (old_model != record.parent_model){ + if (old_model != ''){ + var index = $($list).find('.oe_subtype').length; + $($($list).find('.oe_subtype')[index-1]).addClass('subtype-border'); + } + old_model = record.parent_model; + } record.name = record_name; record.followed = record.followed || undefined; $(session.web.qweb.render('mail.followers.subtype', {'record': record})).appendTo($list); From b3722090cc0647f3b6a11708d50299defed8ad13 Mon Sep 17 00:00:00 2001 From: "Darshan Kalola (OpenERP)" Date: Wed, 19 Feb 2014 16:38:45 +0530 Subject: [PATCH 2/8] [IMP]add help in sequence field. bzr revid: dka@tinyerp.com-20140219110845-r8r90mzkw73otdx1 --- addons/mail/mail_message_subtype.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/mail_message_subtype.py b/addons/mail/mail_message_subtype.py index 427f3396c35..a15cf1a79a7 100644 --- a/addons/mail/mail_message_subtype.py +++ b/addons/mail/mail_message_subtype.py @@ -50,7 +50,7 @@ class mail_message_subtype(osv.osv): help="Model the subtype applies to. If False, this subtype applies to all models."), 'default': fields.boolean('Default', help="Activated by default when subscribing."), - 'sequence': fields.integer('Sequence'), + 'sequence': fields.integer('Sequence', help="Used to order subtypes."), } _order = 'sequence' _defaults = { From 09c90c3a5309cb1d666818da983d5a91616adb8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 21 Feb 2014 11:28:23 +0100 Subject: [PATCH 3/8] [ADD] mail: mail_message_subtype: add a hidden field, to hide some subtypes from the followers widget. This will be used to hide the created subtype on the task or issues for example, while still available on the related project. The subtype on the task is necessary to trigger the various autosubscription and notification mechanisms but its display on task/issue is not. bzr revid: tde@openerp.com-20140221102823-ca1bvw3qi9kf61uq --- addons/mail/mail_message_subtype.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mail/mail_message_subtype.py b/addons/mail/mail_message_subtype.py index a15cf1a79a7..941011934e8 100644 --- a/addons/mail/mail_message_subtype.py +++ b/addons/mail/mail_message_subtype.py @@ -51,8 +51,10 @@ class mail_message_subtype(osv.osv): 'default': fields.boolean('Default', help="Activated by default when subscribing."), 'sequence': fields.integer('Sequence', help="Used to order subtypes."), + 'hidden': fields.boolean('Hidden', help="Hide the subtype in the follower options") } _order = 'sequence' _defaults = { 'default': True, + 'sequence': 1, } From 41f91e2bef47d82942f30005413431171182b8db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 21 Feb 2014 12:26:43 +0100 Subject: [PATCH 4/8] [IMP] sale_crm: subtypes: added sequence bzr revid: tde@openerp.com-20140221112643-thzam5r0db5cfiq6 --- addons/sale_crm/sale_crm_data.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/sale_crm/sale_crm_data.xml b/addons/sale_crm/sale_crm_data.xml index 519af2a976b..1996f367202 100644 --- a/addons/sale_crm/sale_crm_data.xml +++ b/addons/sale_crm/sale_crm_data.xml @@ -5,12 +5,14 @@ Quotation Send + 20 crm.case.section section_id Sales Order Confirmed + 21 crm.case.section section_id From 3a2d8d1496c50a9d68a418a4670ce37536931b14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 21 Feb 2014 12:27:04 +0100 Subject: [PATCH 5/8] [IMP] project, project_issue: added sequence on subtypes bzr revid: tde@openerp.com-20140221112704-lqd4o5bnljn84yxs --- addons/project/project_data.xml | 5 +++++ addons/project_issue/project_issue_data.xml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml index 7ddc983bf1c..95a76d8988e 100644 --- a/addons/project/project_data.xml +++ b/addons/project/project_data.xml @@ -78,6 +78,7 @@ Task Created project.task + Task created @@ -101,6 +102,7 @@ Task Created + 10 project.project @@ -108,6 +110,7 @@ Task Assigned + 11 project.project @@ -115,12 +118,14 @@ Task Blocked + 12 project.project project_id Task Stage Changed + 13 project.project project_id diff --git a/addons/project_issue/project_issue_data.xml b/addons/project_issue/project_issue_data.xml index 25a336d4094..d60106dffd2 100644 --- a/addons/project_issue/project_issue_data.xml +++ b/addons/project_issue/project_issue_data.xml @@ -33,6 +33,7 @@ Access all issues from the top Project menu, and access the issues of a specific Issue Created project.issue + Issue created @@ -56,6 +57,7 @@ Access all issues from the top Project menu, and access the issues of a specific Issue Created + 20 project.project @@ -63,6 +65,7 @@ Access all issues from the top Project menu, and access the issues of a specific Issue Assigned + 21 project.project @@ -70,12 +73,14 @@ Access all issues from the top Project menu, and access the issues of a specific Issue Blocked + 22 project.project project_id Issue Stage Changed + 23 project.project Stage changed From e2eb37efe2fd9c352c80ed43cb75fb11a027051d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 21 Feb 2014 12:28:16 +0100 Subject: [PATCH 6/8] [IMP] mail: do not fetch hidden subtypes in follower widgets bzr revid: tde@openerp.com-20140221112816-xhtc97az72ip355o --- addons/mail/mail_thread.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index e8197e52335..55e3ce67579 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -186,8 +186,17 @@ class mail_thread(osv.AbstractModel): # find current model subtypes, add them to a dictionary subtype_obj = self.pool.get('mail.message.subtype') - subtype_ids = subtype_obj.search(cr, uid, ['|', ('res_model', '=', self._name), ('res_model', '=', False)], context=context) - subtype_dict = OrderedDict((subtype.name, OrderedDict(default=subtype.default, followed=False, parent_model=subtype.parent_id.res_model, id=subtype.id)) for subtype in subtype_obj.browse(cr, uid, subtype_ids, context=context)) + subtype_ids = subtype_obj.search( + cr, uid, [ + '&', ('hidden', '=', False), '|', ('res_model', '=', self._name), ('res_model', '=', False) + ], context=context) + subtype_dict = OrderedDict( + (subtype.name, { + 'default': subtype.default, + 'followed': False, + 'parent_model': subtype.parent_id and subtype.parent_id.res_model or self._name, + 'id': subtype.id} + ) for subtype in subtype_obj.browse(cr, uid, subtype_ids, context=context)) for id in ids: res[id]['message_subtype_data'] = subtype_dict.copy() From 6813592da8981eeb7b1f76503bc341c57a2317fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 21 Feb 2014 12:29:04 +0100 Subject: [PATCH 7/8] [IMP] mail: subtype model: cleaning + improved form view to add the new fields bzr revid: tde@openerp.com-20140221112904-ijgkqy5zhco5a9i4 --- addons/mail/mail_message_subtype.py | 4 +++- addons/mail/mail_message_subtype.xml | 19 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/addons/mail/mail_message_subtype.py b/addons/mail/mail_message_subtype.py index 941011934e8..bae4d941a52 100644 --- a/addons/mail/mail_message_subtype.py +++ b/addons/mail/mail_message_subtype.py @@ -29,6 +29,8 @@ class mail_message_subtype(osv.osv): on the Wall. """ _name = 'mail.message.subtype' _description = 'Message subtypes' + _order = 'sequence, id' + _columns = { 'name': fields.char('Message Type', required=True, translate=True, help='Message subtype gives a more precise type on the message, '\ @@ -53,7 +55,7 @@ class mail_message_subtype(osv.osv): 'sequence': fields.integer('Sequence', help="Used to order subtypes."), 'hidden': fields.boolean('Hidden', help="Hide the subtype in the follower options") } - _order = 'sequence' + _defaults = { 'default': True, 'sequence': 1, diff --git a/addons/mail/mail_message_subtype.xml b/addons/mail/mail_message_subtype.xml index a79f5815bd1..efcb81b5794 100644 --- a/addons/mail/mail_message_subtype.xml +++ b/addons/mail/mail_message_subtype.xml @@ -9,6 +9,7 @@ + @@ -22,12 +23,18 @@
- - - - - - + + + + + + + + + + + +
From d3ea25c0bac0467dcdd4adf91e2a7c906b986054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 21 Feb 2014 12:29:15 +0100 Subject: [PATCH 8/8] [IMP] crm: added sequence on subtypes bzr revid: tde@openerp.com-20140221112915-1o9pk3gjohtl558w --- addons/crm/crm_lead_data.xml | 5 +++++ addons/mail/data/mail_data.xml | 1 + 2 files changed, 6 insertions(+) diff --git a/addons/crm/crm_lead_data.xml b/addons/crm/crm_lead_data.xml index 6bb8e2700d4..1abcdac9712 100644 --- a/addons/crm/crm_lead_data.xml +++ b/addons/crm/crm_lead_data.xml @@ -146,6 +146,7 @@ Lead Created + crm.lead Lead created @@ -171,6 +172,7 @@ Lead Created + 10 crm.case.section @@ -178,18 +180,21 @@ Opportunity Stage Changed + 11 crm.case.section section_id Opportunity Won + 12 crm.case.section section_id Opportunity Lost + 13 crm.case.section diff --git a/addons/mail/data/mail_data.xml b/addons/mail/data/mail_data.xml index e1ca797670b..4a2dc6d06f0 100644 --- a/addons/mail/data/mail_data.xml +++ b/addons/mail/data/mail_data.xml @@ -54,6 +54,7 @@ Discussions +