This commit is contained in:
2026-11-08 20:08:53 +08:00
parent 7526a5fe4d
commit 9b924747c5
2692 changed files with 394867 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from markupsafe import Markup
from odoo import models
from .mail_message import ELEMENT_LABEL_CLASS
class DiscussChannel(models.Model):
_inherit = 'discuss.channel'
def message_post(self, **kwargs):
labels = self.env.context.get('ai_website_element_labels')
session = self.sudo().ai_session_ids[:1]
if labels and session._is_website_builder_session():
labels_markup = Markup('').join(
Markup('<span class="%s d-none">%s</span>') % (ELEMENT_LABEL_CLASS, label)
for label in labels
)
kwargs['body'] = Markup('%s%s') % (
kwargs.get('body', ''),
labels_markup,
)
return super().message_post(**kwargs)