From 904e18d1bf315fd6dfa573c1f0949be41ed14dc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 15 Mar 2012 12:00:42 +0100 Subject: [PATCH] [IMP] hr.holidays: modified get_needaction_user_id -> get_needaction_user_ids to match the new API. Fixed a removed field still present on view. Fixed small sentences. bzr revid: tde@openerp.com-20120315110042-t3tk2w0524gvn3pw --- addons/hr_holidays/hr_holidays.py | 28 +++++++++++++++---------- addons/hr_holidays/hr_holidays_view.xml | 3 --- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 8d34509dd02..230528777cc 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -358,12 +358,18 @@ class hr_holidays(osv.osv): # OpenChatter and notifications # ----------------------------- - def get_needaction_user_id(self, cr, uid, ids, name, arg, context=None): - result = {} + def get_needaction_user_ids(self, cr, uid, ids, context=None): + result = dict.fromkeys(ids, []) for obj in self.browse(cr, uid, ids, context=context): - result[obj.id] = False - if (obj.state == 'confirm' and obj.employee_id.parent_id): - result[obj.id] = obj.employee_id.parent_id.user_id.id + if obj.state == 'confirm' and obj.employee_id.parent_id: + result[obj.id] = [obj.employee_id.parent_id.user_id.id] + elif obj.state == 'validate1' or obj.state == 'validate': + # get group_hr_manager: everyone will be warned of second validation + res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'group_hr_manager') or False + obj_id = res and res[1] or False + if obj_id: + hr_manager_group = self.pool.get('res.groups').read(cr, uid, [obj_id], ['users'], context=context)[0] + result[obj.id] = hr_manager_group['users'] return result def message_get_subscribers(self, cr, uid, ids, context=None): @@ -377,37 +383,37 @@ class hr_holidays(osv.osv): def create_notificate(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): self.message_append_note(cr, uid, ids, _('System notification'), - _("The %s request has been created and is waiting confirmation") + _("The %s request has been created and is waiting confirmation") % ('leave' if obj.type == 'remove' else 'allocation',), type='notification', context=context) return True def holidays_confirm_notificate(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids): self.message_append_note(cr, uid, [obj.id], _('System notification'), - _("The %s request has been confirmed and is waiting for validation by the manager.") + _("The %s request has been confirmed and is waiting for validation by the manager.") % ('leave' if obj.type == 'remove' else 'allocation',), type='notification') def holidays_validate_notificate(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids): if obj.holiday_status_id.double_validation: self.message_append_note(cr, uid, [obj.id], _('System notification'), - _("The %s request has been validated. A second validation is necessary and is now pending.") + _("The %s request has been validated. A second validation is necessary and is now pending.") % ('leave' if obj.type == 'remove' else 'allocation',), type='notification', context=context) else: self.message_append_note(cr, uid, [obj.id], _('System notification'), - _("The %s request has been validated. The validation process is now over.") + _("The %s request has been validated. The validation process is now over.") % ('leave' if obj.type == 'remove' else 'allocation',), type='notification', context=context) def holidays_valid2_notificate(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids): self.message_append_note(cr, uid, [obj.id], _('System notification'), - _("The %s request has been double validated. The validation process is now over.") + _("The %s request has been double validated. The validation process is now over.") % ('leave' if obj.type == 'remove' else 'allocation',), type='notification', context=context) def holidays_refuse_notificate(self, cr, uid, ids, approval, context=None): for obj in self.browse(cr, uid, ids): self.message_append_note(cr, uid, [obj.id], _('System notification'), - _("The %s request has been refused. The validation process is now over.") + _("The %s request has been refused. The validation process is now over.") % ('leave' if obj.type == 'remove' else 'allocation',), type='notification', context=context) hr_holidays() diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index 34e2cb9bb14..2096ae2bc61 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -95,9 +95,6 @@