[IMP]: Manager should able to follow his employee requests
authorAtul Patel (OpenERP) <atp@tinyerp.com>
Mon, 24 Sep 2012 10:38:12 +0000 (16:08 +0530)
committerAtul Patel (OpenERP) <atp@tinyerp.com>
Mon, 24 Sep 2012 10:38:12 +0000 (16:08 +0530)
bzr revid: atp@tinyerp.com-20120924103812-eg1nflvk68cble4m

addons/hr_evaluation/hr_evaluation.py
addons/hr_evaluation/hr_evaluation_view.xml
addons/hr_expense/hr_expense.py
addons/hr_holidays/hr_holidays.py
addons/hr_timesheet_sheet/hr_timesheet_sheet.py
addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml

index 3508dc3..a40b210 100644 (file)
@@ -141,6 +141,7 @@ hr_employee()
 
 class hr_evaluation(osv.osv):
     _name = "hr_evaluation.evaluation"
+    _inherit = "mail.thread"
     _description = "Employee Appraisal"
     _rec_name = 'employee_id'
     _columns = {
@@ -242,8 +243,10 @@ class hr_evaluation(osv.osv):
     def button_final_validation(self, cr, uid, ids, context=None):
         request_obj = self.pool.get('hr.evaluation.interview')
         self.write(cr, uid, ids, {'state':'progress'}, context=context)
-        for id in self.browse(cr, uid, ids, context=context):
-            if len(id.survey_request_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', id.id),('state', 'in', ['done','cancel'])], context=context)):
+        for evaluation in self.browse(cr, uid, ids, context=context):
+            if evaluation.employee_id and evaluation.employee_id.parent_id and evaluation.employee_id.parent_id.user_id:
+                self.message_subscribe(cr, uid, [evaluation.id], [evaluation.employee_id.parent_id.user_id.id], context=context)
+            if len(evaluation.survey_request_ids) != len(request_obj.search(cr, uid, [('evaluation_id', '=', evaluation.id),('state', 'in', ['done','cancel'])], context=context)):
                 raise osv.except_osv(_('Warning!'),_("You cannot change state, because some appraisal(s) are in waiting answer or draft state."))
         return True
 
index 29d68d7..8d51b17 100644 (file)
                         <field nolabel="1" name="note_summary" placeholder="Action Plan..."/>
                     </group>
               </sheet>
+                 <div class="oe_chatter">
+                     <field name="message_ids" widget="mail_thread"/>
+                     <field name="message_follower_ids" widget="mail_followers"/>
+                 </div>
               </form>
             </field>
         </record>
index 83f986e..a46f225 100644 (file)
@@ -118,6 +118,9 @@ class hr_expense_expense(osv.osv):
         return {'value': {'department_id': department_id, 'company_id': company_id}}
 
     def expense_confirm(self, cr, uid, ids, *args):
+        for expense in self.browse(cr, uid, ids, context=context):
+            if expense.employee_id and expense.employee_id.parent_id and expense.employee_id.parent_id.user_id:
+                self.message_subscribe(cr, uid, [expense.id], [expense.employee_id.parent_id.user_id.id], context=context)
         self.write(cr, uid, ids, {
             'state':'confirm',
             'date_confirm': time.strftime('%Y-%m-%d')
index 7591702..770552b 100644 (file)
@@ -303,7 +303,7 @@ class hr_holidays(osv.osv):
         self.check_holidays(cr, uid, ids, context=context)
         for record in self.browse(cr, uid, ids, context=context):
             if record.employee_id and record.employee_id.parent_id and record.employee_id.parent_id.user_id:
-                self.message_subscribe(cr, uid, [record.id], user_ids=[record.employee_id.parent_id.user_id.id], context=context)
+                self.message_subscribe(cr, uid, [record.id], [record.employee_id.parent_id.user_id.id], context=context)
         self.holidays_confirm_notificate(cr, uid, ids, context=context)
         return self.write(cr, uid, ids, {'state':'confirm'})
 
index fcdbfda..3e7d712 100644 (file)
@@ -103,6 +103,7 @@ class one2many_mod(fields.one2many):
 
 class hr_timesheet_sheet(osv.osv):
     _name = "hr_timesheet_sheet.sheet"
+    _inherit = "mail.thread"
     _table = 'hr_timesheet_sheet_sheet'
     _order = "id desc"
     _description="Timesheet"
@@ -265,6 +266,8 @@ class hr_timesheet_sheet(osv.osv):
 
     def button_confirm(self, cr, uid, ids, context=None):
         for sheet in self.browse(cr, uid, ids, context=context):
+            if sheet.employee_id and sheet.employee_id.parent_id and sheet.employee_id.parent_id.user_id:
+                self.message_subscribe(cr, uid, [sheet.id], [sheet.employee_id.parent_id.user_id.id], context=context)
             self.check_employee_attendance_state(cr, uid, sheet.id, context=context)
             di = sheet.user_id.company_id.timesheet_max_difference
             if (abs(sheet.total_difference) < di) or not di:
index 6c92e28..a554776 100644 (file)
                         </page>
                     </notebook>
                 </sheet>
+                <div class="oe_chatter">
+                    <field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
+                    <field name="message_follower_ids" widget="mail_followers"/>
+                </div>
                 </form>
             </field>
         </record>