[IMP] hr_holidays: updated to new need_action_user_id
bzr revid: tde@openerp.com-20120228171450-tweynl073wf34z9m
This commit is contained in:
@@ -358,6 +358,14 @@ class hr_holidays(osv.osv):
|
||||
# OpenChatter and notifications
|
||||
# -----------------------------
|
||||
|
||||
def get_needaction_user_id(self, cr, uid, ids, name, arg, context=None):
|
||||
result = {}
|
||||
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
|
||||
return result
|
||||
|
||||
def message_get_subscribers(self, cr, uid, ids, context=None):
|
||||
sub_ids = self._message_get_subscribers_ids(cr, uid, ids, context=context);
|
||||
# add the employee and its manager if specified to the subscribed users
|
||||
@@ -377,12 +385,10 @@ class hr_holidays(osv.osv):
|
||||
for obj in self.browse(cr, uid, ids):
|
||||
self.message_append_note(cr, uid, [obj.id], _('System notification'),
|
||||
_("The %s request '%s' has been confirmed and is waiting for validation by the manager.")
|
||||
% ('leave' if obj.type == 'remove' else 'allocation', obj.name,), type='notification',
|
||||
need_action_user_id = obj.employee_id.parent_id.user_id.id if obj.employee_id.parent_id else False)
|
||||
% ('leave' if obj.type == 'remove' else 'allocation', obj.name,), type='notification')
|
||||
|
||||
def holidays_validate_notificate(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids):
|
||||
self.message_mark_done(cr, uid, [obj.id], context=context)
|
||||
if obj.holiday_status_id.double_validation:
|
||||
self.message_append_note(cr, uid, [obj.id], _('System notification'),
|
||||
_("The %s request '%s' has been validated. A second validation is necessary and is now pending.")
|
||||
|
||||
@@ -95,6 +95,9 @@
|
||||
<button string="Approved" name="second_validate" states="validate1" type="workflow" icon="gtk-apply" groups="base.group_hr_user"/>
|
||||
<button string="Set to Draft" name="set_to_draft" states="refuse,validate" type="object" icon="gtk-convert" groups="base.group_hr_user"/>
|
||||
</group>
|
||||
<separator string="Temp Need Action" colspan="4"/>
|
||||
<field name="need_action"/>
|
||||
<field name="need_action_user_id"/>
|
||||
<field name="message_ids_social" colspan="4" widget="ThreadView" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
|
||||
@@ -31,7 +31,40 @@ class mail_needaction(osv.osv):
|
||||
_name = 'mail.needaction'
|
||||
_description = 'Need action Engine'
|
||||
|
||||
def get_needaction_user_id(self, cr, uid, ids, name, arg, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
result = {}
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
result[obj.id] = False
|
||||
return result
|
||||
|
||||
#def set_needaction_user_id(self, cr, uid, id, name, value, arg, context=None):
|
||||
#"""
|
||||
#@param name: Name of field
|
||||
#@param value: Value of field
|
||||
#@param arg: User defined argument
|
||||
#"""
|
||||
#if context is None:
|
||||
#context = {}
|
||||
#return self.write(cr, uid, [id], {name: value}, context=context)
|
||||
|
||||
def get_needaction_user_id_wrapper(self, cr, uid, ids, name, arg, context=None):
|
||||
return self.get_needaction_user_id(cr, uid, ids, name, arg, context=context)
|
||||
|
||||
def set_needaction_user_id_wrapper(self, cr, uid, id, name, value, arg, context=None):
|
||||
return self.set_needaction_user_id(cr, uid, id, name, value, arg, context=context)
|
||||
|
||||
_columns = {
|
||||
'need_action': fields.boolean('Need action'),
|
||||
'need_action_user_id': fields.function(get_needaction_user_id_wrapper,
|
||||
#fnct_inv=set_needaction_user_id_wrapper,
|
||||
type='many2one', relation='res.users', store=True, string='User'),
|
||||
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'need_action': False,
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -184,7 +184,6 @@ class mail_message(osv.osv):
|
||||
('comment', 'Comment'),
|
||||
('notification', 'System notification'),
|
||||
], 'Type', help="Message type: e-mail for e-mail message, notification for system message, comment for other messages such as user replies"),
|
||||
'need_action_user_id': fields.many2one('res.users', 'Action by user', help="User requested to perform an action"),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
||||
Reference in New Issue
Block a user