其他分享
首页 > 其他分享> > odoo report track 报表中找到追踪字段

odoo report track 报表中找到追踪字段

作者:互联网

 re=self.env['********'].search([('name','=','*******')]) 

 re.message_ids.tracking_value_ids.mapped('new_value_char')  追踪字段新值

 re.message_ids.tracking_value_ids.mapped('old_value_char')    追踪字段旧值

 

 re.message_ids.author_id.mapped('name')     改变追踪字段的用户

 re.message_ids.mapped('date')   改变追踪字段的时间

以上为shell测试,odoo,需要自己写report了。

在扩展的'mail.thread'中。具体相关代码如下

class MailThread(models.AbstractModel):
    message_ids = fields.One2many(
        'mail.message', 'res_id', string='Messages',
        domain=lambda self: [('message_type', '!=', 'user_notification')], auto_join=True)
        
class Message(models.Model):
tracking_value_ids = fields.One2many( 'mail.tracking.value', 'mail_message_id', string='Tracking values', groups="base.group_system", help='Tracked values are stored in a separate model. This field allow to reconstruct ' 'the tracking and to generate statistics on the model.') class MailTracking(models.Model): _name = 'mail.tracking.value' _description = 'Mail Tracking Value' _rec_name = 'field' _order = 'tracking_sequence asc' field = fields.Many2one('ir.model.fields', required=True, readonly=1, ondelete='cascade') field_desc = fields.Char('Field Description', required=True, readonly=1) field_type = fields.Char('Field Type') field_groups = fields.Char(compute='_compute_field_groups') old_value_integer = fields.Integer('Old Value Integer', readonly=1) old_value_float = fields.Float('Old Value Float', readonly=1) old_value_monetary = fields.Float('Old Value Monetary', readonly=1) old_value_char = fields.Char('Old Value Char', readonly=1) old_value_text = fields.Text('Old Value Text', readonly=1) old_value_datetime = fields.Datetime('Old Value DateTime', readonly=1) new_value_integer = fields.Integer('New Value Integer', readonly=1) new_value_float = fields.Float('New Value Float', readonly=1) new_value_monetary = fields.Float('New Value Monetary', readonly=1) new_value_char = fields.Char('New Value Char', readonly=1) new_value_text = fields.Text('New Value Text', readonly=1) new_value_datetime = fields.Datetime('New Value Datetime', readonly=1)

 



 

标签:track,fields,ids,value,readonly,Value,odoo,report,message
来源: https://www.cnblogs.com/jackadam/p/16573502.html