mirror of https://github.com/OCA/social.git
Merge pull request #311 from vauxoo-dev/12.0-mail_track_diff_only
[Add] mail_track_diff_onlypull/321/head
commit
7360d3b0b0
|
@ -0,0 +1 @@
|
||||||
|
from . import models
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"name": "Mail track diff only",
|
||||||
|
"version": "12.0.1.0.0",
|
||||||
|
"author": "Vauxoo, Odoo Community Association (OCA)",
|
||||||
|
"category": "Discuss",
|
||||||
|
"website": "http://www.vauxoo.com/",
|
||||||
|
"license": "AGPL-3",
|
||||||
|
"depends": [
|
||||||
|
"mail",
|
||||||
|
],
|
||||||
|
"demo": [],
|
||||||
|
"data": [],
|
||||||
|
"installable": True,
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
from . import mail_thread
|
|
@ -0,0 +1,33 @@
|
||||||
|
from odoo import models, api
|
||||||
|
|
||||||
|
|
||||||
|
class MailThread(models.AbstractModel):
|
||||||
|
_inherit = 'mail.thread'
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def _message_track(self, tracked_fields, initial):
|
||||||
|
"""For a given record, fields to check (column name, column info)
|
||||||
|
and initial values, return a structure that is a tuple containing :
|
||||||
|
|
||||||
|
- a set of updated column names
|
||||||
|
- a list of changes (old value, new value, column name, column info)
|
||||||
|
"""
|
||||||
|
changes = super(MailThread, self)._message_track(
|
||||||
|
tracked_fields, initial)[0]
|
||||||
|
tracking_value_ids = []
|
||||||
|
track_obj = self.env['mail.tracking.value']
|
||||||
|
|
||||||
|
for col_name, col_info in tracked_fields.items():
|
||||||
|
initial_value = initial[col_name]
|
||||||
|
new_value = getattr(self, col_name)
|
||||||
|
|
||||||
|
if new_value != initial_value and (new_value or initial_value):
|
||||||
|
track_sequence = getattr(
|
||||||
|
self._fields[col_name], 'track_sequence', 100)
|
||||||
|
tracking = track_obj.create_tracking_values(
|
||||||
|
initial_value, new_value, col_name,
|
||||||
|
col_info, track_sequence)
|
||||||
|
if tracking:
|
||||||
|
tracking_value_ids.append([0, 0, tracking])
|
||||||
|
|
||||||
|
return changes, tracking_value_ids
|
|
@ -0,0 +1,2 @@
|
||||||
|
* José Manuel Robles <josemanuel@vauxoo.com>
|
||||||
|
* Hugo Adan <hugo@vauxoo.com>
|
|
@ -0,0 +1,2 @@
|
||||||
|
This module shows only the values changed of an object on email, instead of all
|
||||||
|
tracked values, even if it has track_visibility set as always.
|
Loading…
Reference in New Issue