[FIX]: override write method into hr module..

bzr revid: atp@tinyerp.com-20120926184445-3o03o0n4oxgprern
This commit is contained in:
Atul Patel (OpenERP) 2012-09-27 00:14:45 +05:30
parent 97fdf97be2
commit d050d743ee
8 changed files with 24 additions and 4 deletions

View File

@ -790,7 +790,7 @@ class crm_lead(base_stage, format_address, osv.osv):
vals['probability'] = stage.probability
for lead in self.browse(cr, uid, ids, context=context):
if lead.section_id:
vals.update({'message_follower_ids': [(4, follower.id) for follower in lead.section_id.message_follower_ids]})
vals['message_follower_ids'] = [(4, follower.id) for follower in lead.section_id.message_follower_ids]
return super(crm_lead,self).write(cr, uid, ids, vals, context)
# ----------------------------------------

View File

@ -266,6 +266,9 @@ class hr_evaluation(osv.osv):
return True
def write(self, cr, uid, ids, vals, context=None):
for evalutation in self.browse(cr, uid, ids, context=context):
if evalutation.employee_id and evalutation.employee_id.parent_id and evalutation.employee_id.parent_id.user_id:
vals['message_follower_ids'] = [(4, evalutation.employee_id.parent_id.user_id.partner_id.id)]
if 'date' in vals:
new_vals = {'date_deadline': vals.get('date')}
obj_hr_eval_iterview = self.pool.get('hr.evaluation.interview')

View File

@ -100,6 +100,12 @@ class hr_expense_expense(osv.osv):
'currency_id': _get_currency,
}
def write(self, cr, uid, ids, vals, context=None):
for expense in self.browse(cr, uid, ids):
if expense.employee_id and expense.employee_id.parent_id.user_id:
vals['message_follower_ids'] = [(4, expense.employee_id.parent_id.user_id.partner_id.id)]
return super(hr_expense_expense, self).write(cr, uid, ids, vals, context=context)
def onchange_currency_id(self, cr, uid, ids, currency_id=False, company_id=False, context=None):
res = {'value': {'journal_id': False}}
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type','=','purchase'), ('currency','=',currency_id), ('company_id', '=', company_id)], context=context)

View File

@ -307,6 +307,14 @@ class hr_holidays(osv.osv):
self.holidays_confirm_notificate(cr, uid, ids, context=context)
return self.write(cr, uid, ids, {'state':'confirm'})
def write(self, cr, uid, ids, vals, context=None):
for holiday in self.browse(cr, uid, ids):
if holiday.employee_id and holiday.employee_id.parent_id.user_id:
vals['message_follower_ids'] = [(4, holiday.employee_id.parent_id.user_id.partner_id.id)]
return super(hr_holidays, self).write(cr, uid, ids, vals, context=context)
def holidays_refuse(self, cr, uid, ids, context=None):
obj_emp = self.pool.get('hr.employee')
ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)])

View File

@ -252,6 +252,9 @@ class hr_timesheet_sheet(osv.osv):
return super(hr_timesheet_sheet, self).create(cr, uid, vals, *args, **argv)
def write(self, cr, uid, ids, vals, *args, **argv):
for timesheet in self.browse(cr, uid, ids):
if timesheet.employee_id and timesheet.employee_id.parent_id.user_id:
vals['message_follower_ids'] = [(4, timesheet.employee_id.parent_id.user_id.partner_id.id)]
if 'employee_id' in vals:
new_user_id = self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).user_id.id or False
if not new_user_id:

View File

@ -1116,7 +1116,7 @@ class task(base_stage, osv.osv):
ids = [ids]
for t in self.browse(cr, uid, ids, context=context):
if t.project_id:
vals.update({'message_follower_ids': [(4, follower.id) for follower in t.project_id.message_follower_ids]})
vals['message_follower_ids'] = [(4, follower.id) for follower in t.project_id.message_follower_ids]
if vals and not 'kanban_state' in vals and 'stage_id' in vals:
new_stage = vals.get('stage_id')

View File

@ -366,7 +366,7 @@ class project_issue(base_stage, osv.osv):
vals['date_action_last'] = time.strftime('%Y-%m-%d %H:%M:%S')
for issue in self.browse(cr, uid, ids, context=context):
if issue.project_id:
vals.update({'message_follower_ids': [(4, follower.id) for follower in issue.project_id.message_follower_ids]})
vals['message_follower_ids'] = [(4, follower.id) for follower in issue.project_id.message_follower_ids]
return super(project_issue, self).write(cr, uid, ids, vals, context)
def onchange_task_id(self, cr, uid, ids, task_id, context=None):

View File

@ -41,7 +41,7 @@ class sale_order(osv.osv):
def write(self, cr, uid, ids, vals, context=None):
for order in self.browse(cr, uid, ids, context=context):
if order.section_id:
vals.update({'message_follower_ids': [(4, follower.id) for follower in order.section_id.message_follower_ids]})
vals['message_follower_ids'] = [(4, follower.id) for follower in order.section_id.message_follower_ids]
return super(sale_order, self).write(cr, uid, ids, vals, context=context)
sale_order()