[MERGE] merge from trunk
bzr revid: ged@openerp.com-20140507151631-qvkun5z9wvew6069
This commit is contained in:
commit
59f8fe0267
|
@ -385,7 +385,7 @@ class mail_thread(osv.AbstractModel):
|
|||
if not context.get('mail_notrack'):
|
||||
tracked_fields = self._get_tracked_fields(cr, uid, values.keys(), context=track_ctx)
|
||||
if tracked_fields:
|
||||
initial_values = {thread_id: dict((item, False) for item in tracked_fields)}
|
||||
initial_values = {thread_id: dict.fromkeys(tracked_fields, False)}
|
||||
self.message_track(cr, uid, [thread_id], tracked_fields, initial_values, context=track_ctx)
|
||||
return thread_id
|
||||
|
||||
|
@ -398,25 +398,24 @@ class mail_thread(osv.AbstractModel):
|
|||
track_ctx = dict(context)
|
||||
if 'lang' not in track_ctx:
|
||||
track_ctx['lang'] = self.pool.get('res.users').browse(cr, uid, uid, context=context).lang
|
||||
|
||||
tracked_fields = None
|
||||
if not context.get('mail_notrack'):
|
||||
tracked_fields = self._get_tracked_fields(cr, uid, values.keys(), context=track_ctx)
|
||||
else:
|
||||
tracked_fields = []
|
||||
|
||||
if tracked_fields:
|
||||
records = self.browse(cr, uid, ids, context=track_ctx)
|
||||
initial_values = dict((this.id, dict((key, getattr(this, key)) for key in tracked_fields.keys())) for this in records)
|
||||
initial_values = dict((record.id, dict((key, getattr(record, key)) for key in tracked_fields))
|
||||
for record in records)
|
||||
|
||||
# Perform write, update followers
|
||||
result = super(mail_thread, self).write(cr, uid, ids, values, context=context)
|
||||
self.message_auto_subscribe(cr, uid, ids, values.keys(), context=context, values=values)
|
||||
|
||||
if not context.get('mail_notrack'):
|
||||
# Perform the tracking
|
||||
tracked_fields = self._get_tracked_fields(cr, uid, values.keys(), context=context)
|
||||
else:
|
||||
tracked_fields = None
|
||||
if tracked_fields:
|
||||
self.message_track(cr, uid, ids, tracked_fields, initial_values, context=track_ctx)
|
||||
|
||||
return result
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
|
@ -453,14 +452,15 @@ class mail_thread(osv.AbstractModel):
|
|||
:return list: a list of (field_name, column_info obj), containing
|
||||
always tracked fields and modified on_change fields
|
||||
"""
|
||||
lst = []
|
||||
tracked_fields = []
|
||||
for name, column_info in self._all_columns.items():
|
||||
visibility = getattr(column_info.column, 'track_visibility', False)
|
||||
if visibility == 'always' or (visibility == 'onchange' and name in updated_fields) or name in self._track:
|
||||
lst.append(name)
|
||||
if not lst:
|
||||
return lst
|
||||
return self.fields_get(cr, uid, lst, context=context)
|
||||
tracked_fields.append(name)
|
||||
|
||||
if tracked_fields:
|
||||
return self.fields_get(cr, uid, tracked_fields, context=context)
|
||||
return {}
|
||||
|
||||
def message_track(self, cr, uid, ids, tracked_fields, initial_values, context=None):
|
||||
|
||||
|
|
Loading…
Reference in New Issue