summaryrefslogtreecommitdiff
path: root/addons/mail
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2012-08-14 10:45:10 +0200
committerThibault Delavallée <tde@openerp.com>2012-08-14 10:45:10 +0200
commit54cce9916effd7464233ed8d5646e2dbb3aef574 (patch)
tree6d5d20a88657e3885c363ffa2afe27e56e48567d /addons/mail
parentcd04752f66d238e7eaa5277f4102c7e8849cd684 (diff)
parent8d2c35cc7514f0485d372c7799c22a465189dad3 (diff)
[MERGE] This 'A Brand New Not-Chatter Branch for Bender' branch fixes some of the warnings / issues :
- mail_thread warnings about hasattr(user_id) -> now checks if user_id in columns - this has trigerred a bug about needaction_user_ids -> called in mail_thread only if defined, all mail_thread objects are not inheriting from need action - base_calendar: xml files holding values for fields that does not exist - crm: fixed some warning due to categ_id that became categ_ids; it could have been interesting to check the categ_id(s) behavior before merging - crm lead demo data: message subtype is now content_subtype since one of the Chatter merge - misc addons: product.product does not have any 'product_image' field anymore, but an 'image' field bzr revid: tde@openerp.com-20120814084510-ay2ul0ceru12nkyh
Diffstat (limited to 'addons/mail')
-rw-r--r--addons/mail/mail_thread.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py
index f0dd023bf06..af50bed3aa0 100644
--- a/addons/mail/mail_thread.py
+++ b/addons/mail/mail_thread.py
@@ -189,7 +189,7 @@ class mail_thread(osv.Model):
notif_user_ids += self.message_parse_users(cr, uid, body, context=context)
# add users requested to perform an action (need_action mechanism)
- if hasattr(self, 'get_needaction_user_ids'):
+ if hasattr(self, 'get_needaction_user_ids') and self._columns.get('user_id'):
user_ids_dict = self.get_needaction_user_ids(cr, uid, thread_ids, context=context)
for id, user_ids in user_ids_dict.iteritems():
notif_user_ids += user_ids
@@ -330,7 +330,7 @@ class mail_thread(osv.Model):
data = {
'subject': subject,
- 'body_text': body_text or (hasattr(thread, 'description') and thread.description or ''),
+ 'body_text': body_text or thread._model._columns.get('description') and thread.description or '',
'body_html': body_html or '',
'parent_id': parent_id,
'date': email_date or fields.datetime.now(),
@@ -353,7 +353,7 @@ class mail_thread(osv.Model):
data.update({
'email_to': email_to,
'email_from': email_from or \
- (hasattr(thread, 'user_id') and thread.user_id and thread.user_id.user_email),
+ thread._model._columns.get('user_id') and thread.user_id and thread.user_id.user_email,
'email_cc': email_cc,
'email_bcc': email_bcc,
'references': references,
@@ -805,7 +805,7 @@ class mail_thread(osv.Model):
forward_to = [i for i in message_followers_emails if (i and (i not in message_recipients))]
if forward_to:
# TODO: we need an interface for this for all types of objects, not just leads
- if hasattr(res, 'section_id'):
+ if model_pool._columns.get('section_id'):
del msg['reply-to']
msg['reply-to'] = res.section_id.reply_to
@@ -1047,14 +1047,14 @@ class mail_thread(osv.Model):
""" When creating a new message, set as unread if uid is not the
object responsible. """
for obj in self.browse(cr, uid, ids, context=context):
- if obj.message_state and hasattr(obj, 'user_id') and (not obj.user_id or obj.user_id.id != uid):
+ if obj.message_state and self._columns.get('user_id') and (not obj.user_id or obj.user_id.id != uid):
self.message_mark_as_unread(cr, uid, [obj.id], context=context)
def message_check_and_set_unread(self, cr, uid, ids, context=None):
""" Set unread if uid is the object responsible or if the object has
no responsible. """
for obj in self.browse(cr, uid, ids, context=context):
- if obj.message_state and hasattr(obj, 'user_id') and (not obj.user_id or obj.user_id.id == uid):
+ if obj.message_state and self._columns.get('user_id') and (not obj.user_id or obj.user_id.id == uid):
self.message_mark_as_unread(cr, uid, [obj.id], context=context)
def message_mark_as_unread(self, cr, uid, ids, context=None):
@@ -1064,7 +1064,7 @@ class mail_thread(osv.Model):
def message_check_and_set_read(self, cr, uid, ids, context=None):
""" Set read if uid is the object responsible. """
for obj in self.browse(cr, uid, ids, context=context):
- if not obj.message_state and hasattr(obj, 'user_id') and obj.user_id and obj.user_id.id == uid:
+ if not obj.message_state and self._columns.get('user_id') and obj.user_id and obj.user_id.id == uid:
self.message_mark_as_read(cr, uid, [obj.id], context=context)
def message_mark_as_read(self, cr, uid, ids, context=None):