[15.0][ADD] mail_last_message_date#1794
Conversation
14a83b2 to
3de01b3
Compare
ddf0778 to
28352cc
Compare
AungKoKoLin1997
left a comment
There was a problem hiding this comment.
@nobuQuartile I’m not comfortable with the current design because other modules will need to depend on it, and the current module would also require an additional mixin model.
I believe we should create a generic module that can be reused across multiple use cases.
My idea is to add a new field on mail.thread rather than using a mixin, and then update that field when a message is created, based on the configuration we set.
We’ll also need to add configuration options in Settings and in the message subtype to control which subtypes and which models should use this feature.
How do you think that?
|
@AungKoKoLin1997 CC: @yostashiro When I discussed it directly with Yoshi last time, we agreed that we could create a new field in the mail.thread, it would end up adding a field — which may or may not be used — to all models that inherit from mail.thread. As a result, we concluded that it would be better to implement it as a mixin module and add the field only to the models that actually need it. Do you agree with this approach? |
| continue | ||
| record = self.env[message.model].browse(message.res_id) | ||
| if ( | ||
| not record.exists() |
There was a problem hiding this comment.
Do you have an example of how this condition is needed?
|
Module name suggestion: mail_last_message_date |
28352cc to
c5d9ace
Compare
yostashiro
left a comment
There was a problem hiding this comment.
Just a quick one. I will come back to this PR for more later. Please update the PR title accordingly.
c5d9ace to
f7b276b
Compare
| class PurchaseOrder(models.Model): | ||
| _inherit = ["purchase.order", "mail.last.message.date.mixin"] | ||
|
|
||
| def _get_tracked_message_types(self): |
There was a problem hiding this comment.
Since mixin model is returning []. I think there is no reason to call super().
| def _get_tracked_message_types(self): | ||
| message_types = super()._get_tracked_message_types() | ||
| message_types.append("email") | ||
| return message_types |
| _name = "test.mail.last.message.date" | ||
| _inherit = ["mail.thread", "mail.last.message.date.mixin"] |
There was a problem hiding this comment.
Please also add description to avoid CI error when we do the future migration.
We sometimes need to know the last time a record’s chatter was updated (e.g., in automated actions).
Added a last_chatter_update datetime field to chatter-enabled models and implemented automatic updates on message creation.
@qrtl QT5890