odoopython

odoo 消息(发送消息,记录备注)

2020-05-27  本文已影响0人  隔壁小红馆

有时需要在表单的下面有操作记录以及某些字段的变化信息展示

image.png

首先就是要继承消息模型

- py文件里
_inherit = ['mail.thread', 'mail.activity.mixin']
- xml 里面
<div class="oe_chatter">
  <field name="message_follower_ids" widget="mail_followers"/>
  <field name="message_ids" widget="mail_thread"/>
</div>

针对某个操作的记录


image.png
image.png
body = u"驳回原因: %s" % (self.reasons_rejection)
self.message_post(body=body, message_type='notification')

message_post的 message_type 有两种参数

reasons_rejection = fields.Text('驳回原因', track_visibility='always')
两种貌似一样的效果
可自行测试,有不同结果的告诉我一下哈。

制作不易,点赞鼓励哈

上一篇下一篇

猜你喜欢

热点阅读