[IMP] need action new implementation
bzr revid: fp@openerp.com-20120815102919-w3iuspeoz5fmz97u
This commit is contained in:
parent
c5dc5cef00
commit
8b61ed737c
|
@ -70,6 +70,10 @@ class crm_meeting(base_state, osv.Model):
|
|||
# OpenChatter
|
||||
# ----------------------------------------
|
||||
|
||||
# shows events of the day for this user
|
||||
def needaction_domain_get(self, cr, uid, domain=[], context={}):
|
||||
return [('date','<=',time.strftime('%Y-%M-%D 23:59:59')), ('date_deadline','>=', time.strftime('%Y-%M-%D 00:00:00')), ('user_id','=',uid)]
|
||||
|
||||
def case_get_note_msg_prefix(self, cr, uid, id, context=None):
|
||||
return 'Meeting'
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class crm_phonecall(base_state, osv.osv):
|
|||
_name = "crm.phonecall"
|
||||
_description = "Phonecall"
|
||||
_order = "id desc"
|
||||
_inherit = ['ir.needaction_mixin', 'mail.thread']
|
||||
_inherit = ['mail.thread']
|
||||
_columns = {
|
||||
# base_state required fields
|
||||
'date_action_last': fields.datetime('Last Action', readonly=1),
|
||||
|
|
|
@ -347,24 +347,22 @@ class hr_holidays(osv.osv):
|
|||
if leaves_rest < record.number_of_days_temp:
|
||||
raise osv.except_osv(_('Warning!'), _('There are not enough %s allocated for employee %s; please create an allocation request for this leave type.') % (record.holiday_status_id.name, record.employee_id.name))
|
||||
return True
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# OpenChatter and notifications
|
||||
# -----------------------------
|
||||
|
||||
def get_needaction_user_ids(self, cr, uid, ids, context=None):
|
||||
result = super(hr_holidays, self).get_needaction_user_ids(cr, uid, ids, context=context)
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
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':
|
||||
# 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 needaction_domain_get(self, cr, uid, ids, context=None):
|
||||
# to be tested, otherwise convert into employee_id in ...
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
empids = emp_obj.search(cr, uid, [('parent_id.user_id','=',uid)], context=context)
|
||||
dom = [
|
||||
'&', ('state','=','confirm'),('employee_id', 'in', empids)
|
||||
]
|
||||
# if this user is a hr.manager, he should do second validations
|
||||
if self.pool.get('res.users').has_group(cr, uid, 'base.group_hr_manager'):
|
||||
dom = ['|'] + dom + [ ('state','=','validate1') ]
|
||||
return dom
|
||||
|
||||
def message_get_subscribers(self, cr, uid, ids, context=None):
|
||||
""" Override to add employee and its manager. """
|
||||
|
|
|
@ -732,12 +732,8 @@ class purchase_order(osv.osv):
|
|||
# OpenChatter methods and notifications
|
||||
# --------------------------------------
|
||||
|
||||
def get_needaction_user_ids(self, cr, uid, ids, context=None):
|
||||
result = super(purchase_order, self).get_needaction_user_ids(cr, uid, ids, context=context)
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
if obj.state == 'approved':
|
||||
result[obj.id].append(obj.validator.id)
|
||||
return result
|
||||
def needaction_domain_get(self, cr, uid, ids, context=None):
|
||||
return [('state','=','draft')]
|
||||
|
||||
def create_send_note(self, cr, uid, ids, context=None):
|
||||
return self.message_append_note(cr, uid, ids, body=_("Request for quotation <b>created</b>."), context=context)
|
||||
|
|
|
@ -1022,12 +1022,8 @@ class sale_order(osv.osv):
|
|||
# OpenChatter methods and notifications
|
||||
# ------------------------------------------------
|
||||
|
||||
def get_needaction_user_ids(self, cr, uid, ids, context=None):
|
||||
result = super(sale_order, self).get_needaction_user_ids(cr, uid, ids, context=context)
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
if (obj.state == 'manual' or obj.state == 'progress'):
|
||||
result[obj.id].append(obj.user_id.id)
|
||||
return result
|
||||
def needaction_domain_get(self, cr, uid, ids, context=None):
|
||||
return [('state', '=', 'draft'), ('user_id','=',uid)]
|
||||
|
||||
def create_send_note(self, cr, uid, ids, context=None):
|
||||
for obj in self.browse(cr, uid, ids, context=context):
|
||||
|
|
Loading…
Reference in New Issue