2022-03-18 14:21:16 +01:00
|
|
|
from odoo import api, fields, models
|
2021-05-17 11:59:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
class ResConfigSettings(models.TransientModel):
|
2022-03-11 12:11:21 +01:00
|
|
|
_inherit = "res.config.settings"
|
2021-05-17 11:59:44 +02:00
|
|
|
|
|
|
|
show_internal_users_cc = fields.Boolean(
|
2022-03-11 12:11:21 +01:00
|
|
|
related="company_id.show_internal_users_cc",
|
|
|
|
readonly=False,
|
2021-05-17 11:59:44 +02:00
|
|
|
)
|
2022-03-18 14:21:16 +01:00
|
|
|
show_followers_message_sent_to = fields.Html(
|
|
|
|
related="company_id.show_followers_message_sent_to",
|
|
|
|
readonly=False,
|
|
|
|
)
|
|
|
|
show_followers_partner_format = fields.Char(
|
|
|
|
related="company_id.show_followers_partner_format",
|
|
|
|
readonly=False,
|
|
|
|
help="Supported parameters:\n"
|
|
|
|
"%(partner_name)s = Partner Name\n"
|
|
|
|
"%(partner_email)s = Partner Email\n"
|
|
|
|
"%(partner_email_domain)s = Partner Email Domain",
|
|
|
|
)
|
|
|
|
show_followers_message_response_warning = fields.Html(
|
|
|
|
related="company_id.show_followers_message_response_warning",
|
|
|
|
readonly=False,
|
|
|
|
)
|
|
|
|
show_followers_message_preview = fields.Html(
|
|
|
|
string="Message preview",
|
|
|
|
readonly=True,
|
|
|
|
store=False,
|
|
|
|
)
|
|
|
|
|
|
|
|
@api.onchange(
|
|
|
|
"show_followers_message_sent_to",
|
|
|
|
"show_followers_partner_format",
|
|
|
|
"show_followers_message_response_warning",
|
|
|
|
)
|
|
|
|
def onchange_show_followers_message_preview(self):
|
|
|
|
self.show_followers_message_preview = (
|
|
|
|
self.env["mail.mail"]
|
|
|
|
.with_context(
|
|
|
|
# Use current data before
|
|
|
|
partner_format=self.show_followers_partner_format or "",
|
|
|
|
msg_sent_to=self.show_followers_message_sent_to or "",
|
|
|
|
msg_warn=self.show_followers_message_response_warning or "",
|
|
|
|
)
|
|
|
|
._build_cc_text(
|
|
|
|
# Sample partners
|
|
|
|
self.env["res.partner"].search([("email", "!=", False)], limit=3),
|
|
|
|
)
|
|
|
|
)
|