← Back to team overview

savoirfairelinux-openerp team mailing list archive

[Merge] lp:~savoirfairelinux-openerp/openerp-mgmtsystem/nc-chatter-v7 into lp:openerp-mgmtsystem

 

Sandy Carter (http://www.savoirfairelinux.com) has proposed merging lp:~savoirfairelinux-openerp/openerp-mgmtsystem/nc-chatter-v7 into lp:openerp-mgmtsystem.

Requested reviews:
  Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903)
  Daniel Reis (dreis-pt)

For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/openerp-mgmtsystem/nc-chatter-v7/+merge/184352

Added OpenChatter integration to Audits, Actions, NCs.
Removed old messaging system.
Added automatic follower subscriptions according to blueprint.
Added custom OpenChatter messages where needed, according to blueprint.
Added automatic emails.

Test follower subscriptions with multiple users (including responsible/owners who are not current user).
Test email messages, esp. links that are included.
Test email formats (HTML, plaintext).
Test state changes -> chatter posts.

Nothing was done to Procedures as per discussion with Max.
-- 
https://code.launchpad.net/~savoirfairelinux-openerp/openerp-mgmtsystem/nc-chatter-v7/+merge/184352
Your team Savoir-faire Linux' OpenERP is subscribed to branch lp:~savoirfairelinux-openerp/openerp-mgmtsystem/nc-chatter-v7.
=== modified file 'mgmtsystem_action/mgmtsystem_action.py'
--- mgmtsystem_action/mgmtsystem_action.py	2013-08-25 14:58:18 +0000
+++ mgmtsystem_action/mgmtsystem_action.py	2013-09-06 17:07:42 +0000
@@ -1,6 +1,6 @@
 # -*- encoding: utf-8 -*-
 ##############################################################################
-#    
+#
 #    OpenERP, Open Source Management Solution
 #    Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
 #
@@ -15,13 +15,17 @@
 #    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 <http://www.gnu.org/licenses/>.  
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
 
+from tools.translate import _
+from urllib import urlencode
+from urlparse import urljoin
 from openerp.osv import fields, orm
 from crm import crm
 
+
 class mgmtsystem_action(orm.Model):
     _name = "mgmtsystem.action"
     _description = "Action"
@@ -33,10 +37,6 @@
                                          ('prevention', 'Preventive Action'),
                                          ('improvement', 'Improvement Opportunity')],
                                         'Response Type'),
-        'message_ids': fields.one2many('mail.message',
-                                       'res_id',
-                                       'Messages',
-                                       domain=[('model','=',_name)]),
         'system_id': fields.many2one('mgmtsystem.system', 'System'),
         'company_id': fields.many2one('res.company', 'Company')
         }
@@ -52,4 +52,25 @@
         }, context=context)
         return super(mgmtsystem_action, self).create(cr, uid, vals, context=context)
 
+    def message_auto_subscribe(self, cr, uid, ids, updated_fields, context=None):
+        """Automatically add the responsible user to the follow list."""
+        for o in self.browse(cr, uid, ids, context=context):
+            self.message_subscribe_users(cr, uid, ids, user_ids=[o.user_id.id], subtype_ids=None, context=context)
+        return super(mgmtsystem_action, self).message_auto_subscribe(cr, uid, ids, updated_fields, context=context)
+
+    def case_close(self, cr, uid, ids, context=None):
+        """When Action is closed, post a message on the related NC's chatter"""
+        for o in self.browse(cr, uid, ids, context=context):
+            for nc in o.nonconformity_ids:
+                nc.case_send_note(_('Action "%s" was closed.' % o.name))
+        return super(mgmtsystem_action, self).case_close(cr, uid, ids, context=context)
+
+    def get_action_url(self, cr, uid, ids, context=None):
+        assert len(ids) == 1
+        action = self.browse(cr, uid, ids[0], context=context)
+        base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context)
+        query = {'db': cr.dbname}
+        fragment = {'id': action.id, 'model': self._name}
+        return urljoin(base_url, "?%s#%s" % (urlencode(query), urlencode(fragment)))
+
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'mgmtsystem_action/mgmtsystem_action.xml'
--- mgmtsystem_action/mgmtsystem_action.xml	2013-08-25 15:20:05 +0000
+++ mgmtsystem_action/mgmtsystem_action.xml	2013-09-06 17:07:42 +0000
@@ -57,6 +57,7 @@
                         <button name="case_close" string="Close" states="draft,open" type="object" icon="gtk-jump-to"/>
                         <field name="state" widget="statusbar" statusbar_visible="draft,open,pending,done"/>
                     </header>
+<<<<<<< TREE
                     <group colspan="4" col="4">
                         <field name="name" colspan="4"/>
                         <field name="type_action" required="True"/>
@@ -68,29 +69,28 @@
                     	<field name="company_id" groups="base.group_multi_company"/>
                     </group>
                     <notebook colspan="4">
+=======
+                    <sheet string="Action">
+                        <group colspan="4" col="4">
+                            <field name="name" colspan="4"/>
+                            <field name="type_action" required="True"/>
+                            <field name="reference"/>
+                            <field name="user_id" string="Responsible" required="1"/>
+                            <field name="date" string="Date"/>
+                            <field name="date_deadline" string="Deadline"/>
+                            <field name="system_id"/>
+                        </group>
+                        <notebook colspan="4">
+>>>>>>> MERGE-SOURCE
                             <page string="Description">
                                 <field name="description" colspan="4" nolabel="1"/>
                             </page>
-                            <page string="History">
-                                <group colspan="4">
-                                    <field colspan="4" name="email_cc" string="Global CC" widget="char"/>
-                                </group>
-                            <field name="message_ids" colspan="4" nolabel="1" mode="tree" readonly="1">
-                                <tree string="History">
-                                        <field name="subject" string="History Information"/>
-                                        <field name="email_from" invisible="1"/>
-                                        <button
-                                            string="Reply" attrs="{'invisible': [('email_from', '=', False)]}"
-                                            name="%(mail.action_email_compose_message_wizard)d"
-                                            context="{'mail.compose.message.mode':'reply', 'message_id':active_id}"
-                                            icon="terp-mail-replied" type="action" />
-                                </tree>
-                            </field>
-                            <button string="Send New Email"
-                                name="%(mail.action_email_compose_message_wizard)d"
-                                icon="terp-mail-message-new" type="action"/>
-                            </page>
-                    </notebook>
+                        </notebook>
+                    </sheet>
+                    <div class="oe_chatter">
+                        <field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
+                        <field name="message_ids" widget="mail_thread"/>
+                    </div>
                 </form>
             </field>
         </record>
@@ -112,4 +112,41 @@
             groups="mgmtsystem.group_mgmtsystem_manager,mgmtsystem.group_mgmtsystem_auditor,base.group_user"/>
 
     </data>
+
+    <data noupdate="1">
+        <!-- Email template for Action Reminders -->
+        <record id="action_email_reminder_action" model="ir.actions.server">
+            <field name="name">Reminder to Responsible</field>
+            <field name="model_id" ref="model_mgmtsystem_action"/>
+            <field name="condition">True</field>
+            <field name="type">ir.actions.server</field>
+            <field name="state">email</field>
+            <field name="email">object.user_id.email</field>
+            <field name="subject">Reminder on Action: "[[object.name]]"</field>
+            <field name="message">
+Hello,
+
+This is an automated message to remind you that the following action is due to be completed in 10 days ([[object.date_deadline]]):
+
+[[object.get_action_url()]]
+
+
+Thank you and have a nice day.
+--
+OpenERP
+            </field>
+        </record>
+
+        <!-- Automated Action: Email reponsible user 10 days before deadline. -->
+        <record id="rule_set_reminder_action" model="base.action.rule">
+            <field name="name">Email Action Reminders 10 days before due date.</field>
+            <field name="model_id" ref="model_mgmtsystem_action"/>
+            <field name="trg_date_id" ref="field_mgmtsystem_action_date_deadline"/>
+            <field name="trg_date_range">-10</field>
+            <field name="trg_date_range_type">day</field>
+            <field name="server_action_ids" eval="[(6, 0, [ref('action_email_reminder_action')])]"/>
+        </record>
+
+    </data>
+
 </openerp>

=== modified file 'mgmtsystem_audit/mgmtsystem_audit.py'
--- mgmtsystem_audit/mgmtsystem_audit.py	2013-08-25 15:20:05 +0000
+++ mgmtsystem_audit/mgmtsystem_audit.py	2013-09-06 17:07:42 +0000
@@ -19,12 +19,16 @@
 #
 ##############################################################################
 
+from tools.translate import _
 from openerp.osv import fields, orm
+from urllib import urlencode
+from urlparse import urljoin
 
 
 class mgmtsystem_audit(orm.Model):
     _name = "mgmtsystem.audit"
     _description = "Audit"
+    _inherit = "crm.claim"
     _columns = {
         'name': fields.char('Name', size=50),
         'reference': fields.char('Reference', size=64, required=True, readonly=True),
@@ -54,8 +58,31 @@
         return super(mgmtsystem_audit, self).create(cr, uid, vals, context)
 
     def button_close(self, cr, uid, ids, context=None):
+        """When Audit is closed, post a message to followers' chatter."""
+        self.message_post(cr, uid, ids, _("Audit closed"), context=context)
         return self.write(cr, uid, ids, {'state': 'done'})
 
+    def message_auto_subscribe(self, cr, uid, ids, updated_fields, context=None):
+        """Automatically add the Auditors, Auditees and Audit Manager to the follow list"""
+        for o in self.browse(cr, uid, ids, context=context):
+            user_ids = [o.user_id.id]
+            user_ids += [a.id for a in o.auditor_user_ids]
+            user_ids += [a.id for a in o.auditee_user_ids]
+            self.message_subscribe_users(cr, uid, ids, user_ids=user_ids, subtype_ids=None, context=context)
+        return super(mgmtsystem_audit, self).message_auto_subscribe(cr, uid, ids, updated_fields, context=context)
+
+    def get_audit_url(self, cr, uid, ids, context=None):
+        """
+        Return a short link to the audit form view
+        eg. http://localhost:8069/?db=prod#id=1&model=mgmtsystem.audit
+        """
+        assert len(ids) == 1
+        audit = self.browse(cr, uid, ids[0], context=context)
+        base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context)
+        query = {'db': cr.dbname}
+        fragment = {'id': audit.id, 'model': self._name}
+        return urljoin(base_url, "?%s#%s" % (urlencode(query), urlencode(fragment)))
+
 
 class mgmtsystem_verification_line(orm.Model):
     _name = "mgmtsystem.verification.line"

=== modified file 'mgmtsystem_audit/mgmtsystem_audit.xml'
--- mgmtsystem_audit/mgmtsystem_audit.xml	2013-08-25 15:20:05 +0000
+++ mgmtsystem_audit/mgmtsystem_audit.xml	2013-09-06 17:07:42 +0000
@@ -112,6 +112,7 @@
                         <button name="button_close" string="Close" states="open" type="object" icon="gtk-jump-to"/>
                         <field name="state" widget="statusbar" select="1" readonly="1"/>
                     </header>
+<<<<<<< TREE
                     <group col="8" colspan="6">
                         <field name="name" attrs="{'readonly':[('state','=','done')]}"/>
                         <field name="reference"/>
@@ -142,6 +143,44 @@
                             <field name="nonconformity_ids" nolabel="1" attrs="{'readonly':[('state','=','done')]}"/>
                         </page>
                     </notebook>
+=======
+                    <sheet string="Audit">
+                        <group col="4" colspan="2">
+                            <field name="name" attrs="{'readonly':[('state','=','done')]}"/>
+                            <field name="reference"/>
+                            <field name="date" attrs="{'readonly':[('state','=','done')]}"/>
+                            <field name="user_id" string="Audit Manager" required="1"/>
+                            <field name="system_id"/>
+                        </group>
+                        <notebook colspan="4">
+                            <page string="Auditors">
+                                <field name="auditor_user_ids" nolabel="1" attrs="{'readonly':[('state','=','done')]}"/>
+                            </page>
+                            <page string="Auditees">
+                                <field name="auditee_user_ids" nolabel="1" attrs="{'readonly':[('state','=','done')]}"/>
+                            </page>
+                            <page string="Verification List">
+                                <field name="line_ids" nolabel="1" attrs="{'readonly':[('state','=','done')]}"/>
+                            </page>
+                            <page string="Strong Points">
+                                <field name="strong_points" nolabel="1" attrs="{'readonly':[('state','=','done')]}"/>
+                            </page>
+                            <page string="To Improve Points">
+                                <field name="to_improve_points" nolabel="1" attrs="{'readonly':[('state','=','done')]}"/>
+                            </page>
+                            <page string="Improvement Opportunities">
+                                <field name="imp_opp_ids" domain="[('type_action','=','improvement')]" nolabel="1" attrs="{'readonly':[('state','=','done')]}"/>
+                            </page>
+                            <page string="Nonconformities">
+                                <field name="nonconformity_ids" nolabel="1" attrs="{'readonly':[('state','=','done')]}"/>
+                            </page>
+                        </notebook>
+                    </sheet>
+                    <div class="oe_chatter">
+                        <field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
+                        <field name="message_ids" widget="mail_thread"/>
+                    </div>
+>>>>>>> MERGE-SOURCE
                 </form>
             </field>
         </record>
@@ -190,7 +229,84 @@
                  </notebook>
 
             </field>
-        </record>
-
-    </data>
+<<<<<<< TREE
+        </record>
+
+    </data>
+=======
+        </record>
+
+    </data>
+
+    <data noupdate="1">
+        <!-- Email template for "Prepare to audit" message to all auditors. -->
+        <record id="action_email_prepare_to_audit" model="ir.actions.server">
+            <field name="name">Prepare to audit</field>
+            <field name="model_id" ref="model_mgmtsystem_audit"/>
+            <field name="condition">True</field>
+            <field name="type">ir.actions.server</field>
+            <field name="state">email</field>
+            <field name="email">",".join(set([ i.email for i in object.auditor_user_ids ]))</field>
+            <field name="subject">Prepare to Audit: "[[object.name]]"</field>
+            <field name="message">
+Hello,
+
+The audit "[[object.name]]" is scheduled in 2 weeks.
+Please prepare the verification list:
+
+[[object.get_audit_url()]]
+
+
+Thank you.
+--
+OpenERP
+            </field>
+        </record>
+        <!-- Automated Action: Email all auditors 2 weeks before Audit. -->
+        <record id="rule_set_prepare_to_audit" model="base.action.rule">
+            <field name="name">Email all auditors 2 weeks before audit.</field>
+            <field name="model_id" ref="model_mgmtsystem_audit"/>
+            <field name="trg_date_id" ref="field_mgmtsystem_audit_date"/>
+            <field name="trg_date_range">14</field>
+            <field name="trg_date_range_type">day</field>
+            <field name="server_action_ids" eval="[(6, 0, [ref('action_email_prepare_to_audit')])]"/>
+        </record>
+    </data>
+
+    <data noupdate="1">
+        <!-- Email template for "Send verification list" message to all followers -->
+        <record id="action_email_send_verification_list" model="ir.actions.server">
+            <field name="name">Send Verification List</field>
+            <field name="model_id" ref="model_mgmtsystem_audit"/>
+            <field name="condition">True</field>
+            <field name="type">ir.actions.server</field>
+            <field name="state">email</field>
+            <field name="email">",".join(set([i.email for i in object.auditor_user_ids] + [i.email for i in object.auditee_user_ids] + [object.user_id.email]))</field>
+            <field name="subject">Send Verification List: "[[object.name]]"</field>
+            <field name="message">
+Hello,
+
+The audit "[[object.name]]" is scheduled in 1 week.
+Please finish the verification list and send it to the auditees:
+
+[[object.get_audit_url()]]
+
+
+Thank you.
+--
+OpenERP
+            </field>
+        </record>
+        <!-- Automated Action: Email all followers 1 weeks before Audit. -->
+        <record id="rule_set_send_verification_list" model="base.action.rule">
+            <field name="name">Email all followers 1 week before audit.</field>
+            <field name="model_id" ref="model_mgmtsystem_audit"/>
+            <field name="trg_date_id" ref="field_mgmtsystem_audit_date"/>
+            <field name="trg_date_range">7</field>
+            <field name="trg_date_range_type">day</field>
+            <field name="server_action_ids" eval="[(6, 0, [ref('action_email_send_verification_list')])]"/>
+        </record>
+    </data>
+
+>>>>>>> MERGE-SOURCE
 </openerp>

=== modified file 'mgmtsystem_nonconformity/mgmtsystem_nonconformity.py'
--- mgmtsystem_nonconformity/mgmtsystem_nonconformity.py	2013-08-25 14:58:18 +0000
+++ mgmtsystem_nonconformity/mgmtsystem_nonconformity.py	2013-09-06 17:07:42 +0000
@@ -22,6 +22,7 @@
 from tools.translate import _
 import netsvc as netsvc
 from openerp.osv import fields, orm
+from openerp.addons.base_status.base_state import base_state
 
 import time
 from tools import DEFAULT_SERVER_DATETIME_FORMAT as DATETIME_FORMAT
@@ -129,7 +130,8 @@
     ]
 _STATES_DICT =  dict(_STATES)
 
-class mgmtsystem_nonconformity(orm.Model):
+
+class mgmtsystem_nonconformity(base_state, orm.Model):
     """
     Management System - Nonconformity 
     """
@@ -161,7 +163,6 @@
         'state': fields.selection(_STATES, 'State', readonly=True),
         'state_name': fields.function(_state_name, string='State Description', type='char', size=40),
         'system_id': fields.many2one('mgmtsystem.system', 'System'),
-        'message_ids': fields.one2many('mail.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
         #2. Root Cause Analysis
         'cause_ids': fields.many2many('mgmtsystem.nonconformity.cause','mgmtsystem_nonconformity_cause_rel', 'nonconformity_id', 'cause_id', 'Cause'),
         'severity_id': fields.many2one('mgmtsystem.nonconformity.severity', 'Severity'),
@@ -199,10 +200,28 @@
         })
         return super(mgmtsystem_nonconformity, self).create(cr, uid, vals, context)
 
+    def message_auto_subscribe(self, cr, uid, ids, updated_fields, context=None):
+        """Add the reponsible, manager and OpenChatter follow list."""
+        o = self.browse(cr, uid, ids, context=context)[0]
+        user_ids = [o.responsible_user_id.id, o.manager_user_id.id, o.author_user_id.id]
+        self.message_subscribe_users(cr, uid, ids, user_ids=user_ids, subtype_ids=None, context=context)
+        return super(mgmtsystem_nonconformity, self).message_auto_subscribe(cr, uid, ids, updated_fields=updated_fields, context=context)
+
+    def case_send_note(self, cr, uid, ids, text, context=None):
+        for id in ids:
+            pre = self.case_get_note_msg_prefix(cr, uid, id, context=context)
+            msg = '%s <b>%s</b>' % (pre, text)
+            self.message_post(cr, uid, [id], body=msg, context=context)
+        return True
+
     def wkf_analysis(self, cr, uid, ids, context=None):
         """Change state from draft to analysis"""
-        self.message_post(cr, uid, self.browse(cr, uid, ids), _('Analysis'))
-        return self.write(cr, uid, ids, {'state': 'analysis', 'analysis_date': None, 'analysis_user_id': None}, context=context)
+        self.case_send_note(cr, uid, ids, _('Analysis'), context=context)
+        data = {
+            'state': 'analysis',
+            'analysis_date': None,
+            'analysis_user_id': None}
+        return self.write(cr, uid, ids, data, context=context)
 
     def action_sign_analysis(self, cr, uid, ids, context=None):
         """Sign-off the analysis"""
@@ -215,16 +234,23 @@
             raise orm.except_orm(_('Error !'), _('Please provide an analysis before approving.'))
         vals = {'analysis_date': time.strftime(DATETIME_FORMAT), 'analysis_user_id': uid }
         self.write(cr, uid, ids, vals, context=context)
-        self.message_post(cr, uid, self.browse(cr, uid, ids, context=context), _('Analysis Approved'))
+        note = _('Analysis Approved')
+        self.case_send_note(cr, uid, ids, note, context=context)
         return True
 
     def wkf_review(self, cr, uid, ids, context=None):
         """Change state from analysis to pending approval"""
         o = self.browse(cr, uid, ids, context=context)[0]
         if not o.analysis_date:
-            raise orm.except_orm(_('Error !'), _('Analysis must be performed before submiting to approval.'))
-        self.message_post(cr, uid, self.browse(cr, uid, ids, context=context), _('Pending Approval'))
-        return self.write(cr, uid, ids, {'state': 'pending', 'actions_date': None, 'actions_user_id': None}, context=context)
+            err = _('Analysis must be performed before submiting to approval.')
+            raise orm.except_orm(_('Error !'), err)
+        self.case_send_note(cr, uid, ids, _('Pending Approval'),
+            context=context)
+        vals = {
+            'state': 'pending',
+            'actions_date': None,
+            'actions_user_id': None}
+        return self.write(cr, uid, ids, vals, context=context)
 
     def action_sign_actions(self, cr, uid, ids, context=None):
         """Sign-off the action plan"""
@@ -237,7 +263,8 @@
             raise orm.except_orm(_('Error !'), _('Analysis approved before the review confirmation.'))
         vals = {'actions_date': time.strftime(DATETIME_FORMAT), 'actions_user_id': uid }
         self.write(cr, uid, ids, vals, context=context)
-        self.message_post(cr, uid, self.browse(cr, uid, ids, context=context), _('Action Plan Approved'))
+        note = _('Action Plan Approved')
+        self.case_send_note(cr, uid, ids, note, context=context)
         return True
 
     def wkf_open(self, cr, uid, ids, context=None):
@@ -245,7 +272,7 @@
         o = self.browse(cr, uid, ids, context=context)[0]
         if not o.actions_date:
             raise orm.except_orm(_('Error !'), _('Action plan must be approved before opening.'))
-        self.message_post(cr, uid, self.browse(cr, uid, ids, context=context), _('In Progress'))
+        self.case_open_send_note(cr, uid, ids, context=context)
         #Open related Actions
         if o.immediate_action_id and o.immediate_action_id.state == 'draft':
             o.immediate_action_id.case_open()
@@ -261,12 +288,13 @@
             raise orm.except_orm(_('Error !'), _('This action can only be done in the In Progress state.'))
         vals = {'evaluation_date': time.strftime(DATETIME_FORMAT), 'evaluation_user_id': uid }
         self.write(cr, uid, ids, vals, context=context)
-        self.message_post(cr, uid, self.browse(cr, uid, ids, context=context), _('Effectiveness Evaluation Approved'))
+        note = _('Effectiveness Evaluation Approved')
+        self.case_send_note(cr, uid, ids, note, context=context)
         return True
 
     def wkf_cancel(self, cr, uid, ids, context=None):
         """Change state to cancel"""
-        self.message_post(cr, uid, self.browse(cr, uid, ids, context=context), _('Cancel'))
+        self.case_cancel_send_note(cr, uid, ids, context=context)
         return self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
 
     def wkf_close(self, cr, uid, ids, context=None):
@@ -274,7 +302,7 @@
         o = self.browse(cr, uid, ids, context=context)[0]
         if not o.evaluation_date:
             raise orm.except_orm(_('Error !'), _('Effectiveness evaluation must be performed before closing.'))
-        self.message_post(cr, uid, self.browse(cr, uid, ids, context=context), _('Close'))
+        self.case_close_send_note(cr, uid, ids, context=context)
         return self.write(cr, uid, ids, {'state': 'done'}, context=context)
 
     def case_reset(self, cr, uid, ids, context=None, *args):
@@ -282,7 +310,7 @@
         wf_service = netsvc.LocalService("workflow")
         for id in ids:
             res = wf_service.trg_create(uid, self._name, id, cr)
-        self.message_post(cr, uid, self.browse(cr, uid, ids, context=context), _('Draft'))
+        self.case_reset_send_note(cr, uid, ids, context=context)
         vals = {
             'state': 'draft',
             'analysis_date': None, 'analysis_user_id': None, 

=== modified file 'mgmtsystem_nonconformity/mgmtsystem_nonconformity.xml'
--- mgmtsystem_nonconformity/mgmtsystem_nonconformity.xml	2013-08-25 15:20:05 +0000
+++ mgmtsystem_nonconformity/mgmtsystem_nonconformity.xml	2013-09-06 17:07:42 +0000
@@ -97,9 +97,9 @@
 	            		<field name="company_id" group="base.group_multi_company"/>
                     	</group>
                     </group>
-                    
+
                     <notebook>
-                    
+
                         <page string="Description">
                             <field name="description" placeholder="Add a description ..." attrs="{'readonly':[('state','not in',['draft','analysis'])]}"/>
                         </page>
@@ -157,36 +157,14 @@
                                 </group>
                             </group>
                         </page>
-                        
-                        <!-- Communication History -->
-                        <!-- TODO: REMOVE and migrate to Chatter -->
-                        <page string="Communication &amp; History">
-                            <field name="message_ids" colspan="4" nolabel="1" mode="tree" readonly="1">
-                                <tree string="History">
-                                    <field name="subject" string="History Information"/>
-                                    <field name="email_from" invisible="1"/>
-                                    <button
-                                        string="Reply" attrs="{'invisible': [('email_from', '=', False)]}"
-                                        name="%(mail.action_email_compose_message_wizard)d"
-                                        context="{'mail.compose.message.mode':'reply', 'message_id':active_id}"
-                                        icon="terp-mail-replied" type="action" />
-                                </tree>
-                            </field>
-                           <separator colspan="4"/>
-                            <button string="Send New Email"
-                                name="%(mail.action_email_compose_message_wizard)d"
-                                icon="terp-mail-message-new" type="action"/>
-                        </page>
 
                     </notebook>
                 </sheet>
 
-                <!-- TODO: migrate to Chatter
                 <div class="oe_chatter">
                     <field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
                     <field name="message_ids" widget="mail_thread"/>
                 </div>
-                -->
 
                 </form>
             </field>
@@ -267,7 +245,7 @@
             groups="mgmtsystem.group_mgmtsystem_manager"/>
 
         <!-- Cause -->
-        
+
         <record id="view_mgmtsystem_nonconformity_cause_form" model="ir.ui.view">
             <field name="name">mgmtsystem.nonconformity.cause.form</field>
             <field name="type">form</field>
@@ -323,7 +301,7 @@
             parent="menu_mgmtsystem_configuration_nonconformities"
             sequence="30" 
             groups="mgmtsystem.group_mgmtsystem_manager"/>
-       
+
         <!-- Severity -->
         <record id="view_mgmtsystem_nonconformity_severity_form" model="ir.ui.view">
             <field name="name">mgmtsystem.nonconformity.severity.form</field>

=== modified file 'mgmtsystem_nonconformity_deptm/mgmtsystem_nonconformity.py'
--- mgmtsystem_nonconformity_deptm/mgmtsystem_nonconformity.py	2013-04-12 15:10:42 +0000
+++ mgmtsystem_nonconformity_deptm/mgmtsystem_nonconformity.py	2013-09-06 17:07:42 +0000
@@ -37,5 +37,11 @@
                 result['superior_user_id'] = deptm.parent_id.manager_id.user_id.id
         return {'value': result}
 
+    def message_auto_subscribe(self, cr, uid, ids, updated_fields, context=None):
+        """Add the Top Manager to OpenChatter follow list."""
+        o = self.browse(cr, uid, ids, context=context)[0]
+        user_ids = [o.superior_user_id.id]
+        self.message_subscribe_users(cr, uid, ids, user_ids=user_ids, subtype_ids=None, context=context)
+        return super(mgmtsystem_nonconformity, self).message_auto_subscribe(cr, uid, ids, updated_fields=updated_fields, context=context)
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: