[FIX] {base_action_rule,calendar,hr,mail,project_issue}: decorate the method `message_post` to specify signature

This commit is contained in:
Christophe Simonis 2014-07-28 18:07:17 +02:00
parent 6dc94f0c4e
commit 120a2c1ec1
5 changed files with 10 additions and 1 deletions

View File

@ -1,4 +1,5 @@
from openerp.osv import fields, osv from openerp.osv import fields, osv
from openerp import api
AVAILABLE_STATES = [ AVAILABLE_STATES = [
('draft', 'New'), ('draft', 'New'),
@ -25,6 +26,7 @@ class lead_test(osv.Model):
'active' : True, 'active' : True,
} }
@api.cr_uid_ids_context
def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification', subtype=None, parent_id=False, attachments=None, context=None, **kwargs): def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification', subtype=None, parent_id=False, attachments=None, context=None, **kwargs):
pass pass

View File

@ -11,6 +11,7 @@ from datetime import datetime, timedelta
from dateutil import parser from dateutil import parser
from dateutil import rrule from dateutil import rrule
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
from openerp import api
from openerp import tools, SUPERUSER_ID from openerp import tools, SUPERUSER_ID
from openerp.osv import fields, osv from openerp.osv import fields, osv
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
@ -1323,6 +1324,7 @@ class calendar_event(osv.Model):
('user_id', '=', uid), ('user_id', '=', uid),
] ]
@api.cr_uid_ids_context
def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification', subtype=None, parent_id=False, attachments=None, context=None, **kwargs): def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification', subtype=None, parent_id=False, attachments=None, context=None, **kwargs):
if isinstance(thread_id, str): if isinstance(thread_id, str):
thread_id = get_real_ids(thread_id) thread_id = get_real_ids(thread_id)

View File

@ -1,5 +1,5 @@
from openerp import api
from openerp.osv import fields, osv from openerp.osv import fields, osv
from openerp.tools.translate import _
class res_users(osv.Model): class res_users(osv.Model):
@ -52,6 +52,7 @@ class res_users(osv.Model):
thread_id = thread_id[0] thread_id = thread_id[0]
return self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', thread_id)], context=context) return self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', thread_id)], context=context)
@api.cr_uid_ids_context
def message_post(self, cr, uid, thread_id, context=None, **kwargs): def message_post(self, cr, uid, thread_id, context=None, **kwargs):
""" Redirect the posting of message on res.users to the related employee. """ Redirect the posting of message on res.users to the related employee.
This is done because when giving the context of Chatter on the This is done because when giving the context of Chatter on the

View File

@ -20,6 +20,7 @@
############################################################################## ##############################################################################
from openerp.osv import fields, osv from openerp.osv import fields, osv
from openerp import api
from openerp import SUPERUSER_ID from openerp import SUPERUSER_ID
from openerp.tools.translate import _ from openerp.tools.translate import _
import openerp import openerp
@ -115,6 +116,7 @@ class res_users(osv.Model):
thread_id = thread_id[0] thread_id = thread_id[0]
return self.browse(cr, SUPERUSER_ID, thread_id).partner_id.id return self.browse(cr, SUPERUSER_ID, thread_id).partner_id.id
@api.cr_uid_ids_context
def message_post(self, cr, uid, thread_id, context=None, **kwargs): def message_post(self, cr, uid, thread_id, context=None, **kwargs):
""" Redirect the posting of message on res.users to the related partner. """ Redirect the posting of message on res.users to the related partner.
This is done because when giving the context of Chatter on the This is done because when giving the context of Chatter on the

View File

@ -21,6 +21,7 @@
from datetime import datetime from datetime import datetime
from openerp import api
from openerp import SUPERUSER_ID from openerp import SUPERUSER_ID
from openerp import tools from openerp import tools
from openerp.osv import fields, osv, orm from openerp.osv import fields, osv, orm
@ -449,6 +450,7 @@ class project_issue(osv.Model):
res_id = super(project_issue, self).message_new(cr, uid, msg, custom_values=defaults, context=context) res_id = super(project_issue, self).message_new(cr, uid, msg, custom_values=defaults, context=context)
return res_id return res_id
@api.cr_uid_ids_context
def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification', subtype=None, parent_id=False, attachments=None, context=None, content_subtype='html', **kwargs): def message_post(self, cr, uid, thread_id, body='', subject=None, type='notification', subtype=None, parent_id=False, attachments=None, context=None, content_subtype='html', **kwargs):
""" Overrides mail_thread message_post so that we can set the date of last action field when """ Overrides mail_thread message_post so that we can set the date of last action field when
a new message is posted on the issue. a new message is posted on the issue.