From 3476daf79fad6a05feefd76379c262bfd9d4a4a7 Mon Sep 17 00:00:00 2001 From: "Foram Katharotiya (OpenERP)" Date: Wed, 5 Sep 2012 15:01:35 +0530 Subject: [PATCH] [IMP]Add mail_subtype.rst file in mail bzr revid: fka@tinyerp.com-20120905093135-ydsqq62gnkcifqyv --- addons/mail/doc/index.rst.inc | 1 + addons/mail/doc/mail_subtype.rst | 70 ++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 addons/mail/doc/mail_subtype.rst diff --git a/addons/mail/doc/index.rst.inc b/addons/mail/doc/index.rst.inc index c4b87cc18f9..4b01d3ec7bd 100644 --- a/addons/mail/doc/index.rst.inc +++ b/addons/mail/doc/index.rst.inc @@ -11,3 +11,4 @@ Mail Module documentation topics mail_needaction_howto mail_partner mail_state + mail_subtype diff --git a/addons/mail/doc/mail_subtype.rst b/addons/mail/doc/mail_subtype.rst new file mode 100644 index 00000000000..e63b67936cd --- /dev/null +++ b/addons/mail/doc/mail_subtype.rst @@ -0,0 +1,70 @@ +.. _mail_message_subtype: + +OpenChatter Pi (3.1415): Message Subtype +======================================== + + To overcome the problems of crowdy walls in system notification, We have added features of **Message Subtype** in mail. + +mail.message.subtype +++++++++++++++++++++ +``mail.message.subtype`` has following fields: + + - ``Name``: fields.char(' Message Subtype ', size = 128,required = True,help = 'Subtype Of Message'), + - ``model_ids``: fields.many2many('ir.model','mail_message_subtyp_message_rel','message_subtype_id', 'model_id', 'Model',help = "link some subtypes to several models, for projet/task"), + - ``default``: fields.boolean('Default', help = "When subscribing to the document, users will receive by default messages related to this subtype unless they uncheck this subtype"), + +mail.followers +++++++++++++++ + +In ``mail.followers`` we have added additional many2many field subtype ids : + + - ``subtype_ids``: fields.many2many('mail.message.subtype','mail_message_subtyp_rel','subscription_id', 'subtype_id', 'Subtype',help = "linking some subscription to several subtype for projet/task") + +mail.message +++++++++++++ + +In mail_message we have added additional field subtype_id which Indicates the Type of Message + + - ``subtype_id``: fields.many2one('mail.message.subtype', 'Subtype') + +mail.thread ++++++++++++ + + - In **message_post** method add the *subtype_id* field as parameter and set as default subtype 'Other'. + + def message_post(self, cr, uid, thread_id, body='', subject=False, msg_type='notification', parent_id=False, attachments=None, subtype='other', context=None, ``**kwargs``): + + - In **message_subscribe** method add the *subtype_ids* field as parameter.In this method if subtype_ids is None, it fatch the default true subtypes in mail.message.subtypes otherwise pass selected subtypes. + For update subtypes call **message_subscribe_udpate_subtypes** method + + def message_subscribe(self, cr, uid, ids, partner_ids,subtype_ids = None, context=None): + + - Add **message_subscribe_udpate_subtypes** method to update the subtype_ids in followers. + + def message_subscribe_udpate_subtypes(self, cr, uid, ids, user_id, subtype_ids,context=None): + followers_obj = self.pool.get('mail.followers') + followers_ids = followers_obj.search(cr, uid, [('res_model', '=', self._name), ('res_id', 'in', ids)]) + return followers_obj.write(cr, uid, followers_ids, {'subtype_ids': [(6, 0 , subtype_ids)]}, context = context) + +For Each Addons: +++++++++++++++++ + + - Add data of subtypes for each addons module. + - Add subtype field as parameter in **message_post** Method for each addons module. + +How It Works: ++++++++++++++ + + - In addons module when we Follow a Perticular document It display under the followers button. + - In sybtypes there are 3 default subtypes for each addons + 1) Email + 2) Comment + 3) Other + - In document display a default subtypes(which are true) related a perticular model_ids wise. + + Example:- + If I have open crm.lead, It display only subtypes of crm.lead + + - When we select subtype it update subtype_ids(which are checked) in mail.follower where match res_model & res_id of the current documents. + - when message created update subtype_id of that message in mail.message. + - In Feeds display only those notifications of documents which subtypes are selected