[FIX] some fixes

bzr revid: fp@openerp.com-20121002233602-0k7ommk5dkikvt1l
This commit is contained in:
Fabien Pinckaers 2012-10-03 01:36:02 +02:00
commit fc3edda719
5 changed files with 13 additions and 13 deletions

View File

@ -359,9 +359,6 @@ class base_stage(object):
"""
return ''
def find_subtype(self, cr, uid, ids, name, context=None):
return "mail.mt_comment"
def stage_set_send_note(self, cr, uid, ids, stage_id, context=None):
""" Send a notification when the stage changes. This method has
to be overriden, because each document will have its particular
@ -373,22 +370,19 @@ class base_stage(object):
def case_open_send_note(self, cr, uid, ids, context=None):
for id in ids:
msg = _('%s has been <b>opened</b>.') % (self.case_get_note_msg_prefix(cr, uid, id, context=context))
xml_id = self.find_subtype(cr, uid, ids, context=context)
self.message_post(cr, uid, [id], body=msg, subtype=xml_id, context=context)
self.message_post(cr, uid, [id], body=msg, context=context)
return True
def case_close_send_note(self, cr, uid, ids, context=None):
for id in ids:
msg = _('%s has been <b>closed</b>.') % (self.case_get_note_msg_prefix(cr, uid, id, context=context))
xml_id = self.find_subtype(cr, uid, ids, context=context)
self.message_post(cr, uid, [id], body=msg, subtype=xml_id, context=context)
self.message_post(cr, uid, [id], body=msg, context=context)
return True
def case_cancel_send_note(self, cr, uid, ids, context=None):
for id in ids:
msg = _('%s has been <b>cancelled</b>.') % (self.case_get_note_msg_prefix(cr, uid, id, context=context))
xml_id = self.find_subtype(cr, uid, ids, context=context)
self.message_post(cr, uid, [id], body=msg, subtype=xml_id, context=context)
self.message_post(cr, uid, [id], body=msg, context=context)
return True
def case_pending_send_note(self, cr, uid, ids, context=None):

View File

@ -90,6 +90,7 @@ class hr_job(osv.osv):
_name = "hr.job"
_description = "Job Description"
_inherit = ['mail.thread']
_columns = {
'name': fields.char('Job Name', size=128, required=True, select=True),
'expected_employees': fields.function(_no_of_employee, string='Total Employees',

View File

@ -362,6 +362,10 @@
<field name="requirements"/>
</div>
</sheet>
<div class="oe_chatter">
<field name="message_ids" widget="mail_thread"/>
<field name="message_follower_ids" widget="mail_followers"/>
</div>
</form>
</field>
</record>

View File

@ -706,7 +706,7 @@ class mail_thread(osv.AbstractModel):
""" Wrapper on message_subscribe, using users. If user_ids is not
provided, subscribe uid instead. """
if not user_ids:
user_ids = [uid]
return False
partner_ids = [user.partner_id.id for user in self.pool.get('res.users').browse(cr, uid, user_ids, context=context)]
return self.message_subscribe(cr, uid, ids, partner_ids, subtype_ids=subtype_ids, context=context)
@ -719,8 +719,8 @@ class mail_thread(osv.AbstractModel):
subtype_ids = subtype_obj.search(cr, uid, [('default', '=', True), '|', ('res_model', '=', self._name), ('res_model', '=', False)], context=context)
# update the subscriptions
fol_obj = self.pool.get('mail.followers')
fol_ids = fol_obj.search(cr, uid, [('res_model', '=', self._name), ('res_id', 'in', ids), ('partner_id', 'in', partner_ids)], context=context)
fol_obj.write(cr, uid, fol_ids, {'subtype_ids': [(6, 0, subtype_ids)]}, context=context)
fol_ids = fol_obj.search(cr, 1, [('res_model', '=', self._name), ('res_id', 'in', ids), ('partner_id', 'in', partner_ids)], context=context)
fol_obj.write(cr, 1, fol_ids, {'subtype_ids': [(6, 0, subtype_ids)]}, context=context)
return True
def message_unsubscribe_users(self, cr, uid, ids, user_ids=None, context=None):

View File

@ -1099,7 +1099,8 @@ class task(base_stage, osv.osv):
task_record = self.browse(cr, uid, task_id, context=context)
if task_record.project_id:
project_follower_ids = [follower.id for follower in task_record.project_id.message_follower_ids]
self.message_subscribe(cr, uid, [task_id], project_follower_ids, context=context)
self.message_subscribe(cr, uid, [task_id], project_follower_ids,
context=context)
self._store_history(cr, uid, [task_id], context=context)
self.create_send_note(cr, uid, [task_id], context=context)
return task_id