[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'):
|
if not context.get('mail_notrack'):
|
||||||
tracked_fields = self._get_tracked_fields(cr, uid, values.keys(), context=track_ctx)
|
tracked_fields = self._get_tracked_fields(cr, uid, values.keys(), context=track_ctx)
|
||||||
if tracked_fields:
|
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)
|
self.message_track(cr, uid, [thread_id], tracked_fields, initial_values, context=track_ctx)
|
||||||
return thread_id
|
return thread_id
|
||||||
|
|
||||||
|
@ -398,25 +398,24 @@ class mail_thread(osv.AbstractModel):
|
||||||
track_ctx = dict(context)
|
track_ctx = dict(context)
|
||||||
if 'lang' not in track_ctx:
|
if 'lang' not in track_ctx:
|
||||||
track_ctx['lang'] = self.pool.get('res.users').browse(cr, uid, uid, context=context).lang
|
track_ctx['lang'] = self.pool.get('res.users').browse(cr, uid, uid, context=context).lang
|
||||||
|
|
||||||
|
tracked_fields = None
|
||||||
if not context.get('mail_notrack'):
|
if not context.get('mail_notrack'):
|
||||||
tracked_fields = self._get_tracked_fields(cr, uid, values.keys(), context=track_ctx)
|
tracked_fields = self._get_tracked_fields(cr, uid, values.keys(), context=track_ctx)
|
||||||
else:
|
|
||||||
tracked_fields = []
|
|
||||||
if tracked_fields:
|
if tracked_fields:
|
||||||
records = self.browse(cr, uid, ids, context=track_ctx)
|
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
|
# Perform write, update followers
|
||||||
result = super(mail_thread, self).write(cr, uid, ids, values, context=context)
|
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)
|
self.message_auto_subscribe(cr, uid, ids, values.keys(), context=context, values=values)
|
||||||
|
|
||||||
if not context.get('mail_notrack'):
|
# Perform the tracking
|
||||||
# Perform the tracking
|
|
||||||
tracked_fields = self._get_tracked_fields(cr, uid, values.keys(), context=context)
|
|
||||||
else:
|
|
||||||
tracked_fields = None
|
|
||||||
if tracked_fields:
|
if tracked_fields:
|
||||||
self.message_track(cr, uid, ids, tracked_fields, initial_values, context=track_ctx)
|
self.message_track(cr, uid, ids, tracked_fields, initial_values, context=track_ctx)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def unlink(self, cr, uid, ids, context=None):
|
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
|
:return list: a list of (field_name, column_info obj), containing
|
||||||
always tracked fields and modified on_change fields
|
always tracked fields and modified on_change fields
|
||||||
"""
|
"""
|
||||||
lst = []
|
tracked_fields = []
|
||||||
for name, column_info in self._all_columns.items():
|
for name, column_info in self._all_columns.items():
|
||||||
visibility = getattr(column_info.column, 'track_visibility', False)
|
visibility = getattr(column_info.column, 'track_visibility', False)
|
||||||
if visibility == 'always' or (visibility == 'onchange' and name in updated_fields) or name in self._track:
|
if visibility == 'always' or (visibility == 'onchange' and name in updated_fields) or name in self._track:
|
||||||
lst.append(name)
|
tracked_fields.append(name)
|
||||||
if not lst:
|
|
||||||
return lst
|
if tracked_fields:
|
||||||
return self.fields_get(cr, uid, lst, context=context)
|
return self.fields_get(cr, uid, tracked_fields, context=context)
|
||||||
|
return {}
|
||||||
|
|
||||||
def message_track(self, cr, uid, ids, tracked_fields, initial_values, context=None):
|
def message_track(self, cr, uid, ids, tracked_fields, initial_values, context=None):
|
||||||
|
|
||||||
|
@ -1871,4 +1871,4 @@ class mail_thread(osv.AbstractModel):
|
||||||
message_obj.write(cr, uid, msg_ids_comment, {"res_id" : new_res_id, "model" : new_model}, context=context)
|
message_obj.write(cr, uid, msg_ids_comment, {"res_id" : new_res_id, "model" : new_model}, context=context)
|
||||||
message_obj.write(cr, uid, msg_ids_not_comment, {"res_id" : new_res_id, "model" : new_model, "subtype_id" : None}, context=context)
|
message_obj.write(cr, uid, msg_ids_not_comment, {"res_id" : new_res_id, "model" : new_model, "subtype_id" : None}, context=context)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue