diff --git a/ext/custom-addons/dp_custom/__manifest__.py b/ext/custom-addons/dp_custom/__manifest__.py index adea23a7..200454e6 100644 --- a/ext/custom-addons/dp_custom/__manifest__.py +++ b/ext/custom-addons/dp_custom/__manifest__.py @@ -71,6 +71,7 @@ 'views/res_company_views.xml', 'views/res_users_views.xml', 'views/delivery_view.xml', + 'views/mail_mail_views_bcc.xml', 'security/ir.model.access.csv', ], 'installable': True, diff --git a/ext/custom-addons/dp_custom/models/mail_template.py b/ext/custom-addons/dp_custom/models/mail_template.py index 3c295c53..5d241e44 100644 --- a/ext/custom-addons/dp_custom/models/mail_template.py +++ b/ext/custom-addons/dp_custom/models/mail_template.py @@ -8,6 +8,12 @@ import io from odoo import _, api, fields, models, tools from odoo.tools import pycompat +class MailTemplate(models.Model): + "Templates for sending email" + _inherit = "mail.template" + + email_bcc = fields.Char('Bcc', help="Blind carbon copy recipients (placeholders may be used here)", default='andreas.osim@osim.at') + class MailTemplate(models.Model): @@ -33,6 +39,9 @@ class MailTemplate(models.Model): if fields is None: fields = ['subject', 'body_html', 'email_from', 'email_to', 'partner_to', 'email_cc', 'reply_to', 'scheduled_date'] + if 'email_bcc' not in fields: + fields.append('email_bcc') + res_ids_to_templates = self.get_email_template(res_ids) # templates: res_id -> template; template -> res_ids @@ -100,7 +109,10 @@ class MailTemplate(models.Model): Model = self.env[self.model] record_ids = Model.browse(res_ids) for record_id in record_ids: - passphrase = str(record_id.partner_id.ref)+"!" + if record_id.partner_id.vat: + passphrase = str(record_id.partner_id.vat)[-6:] + else: + passphrase = str(record_id.partner_id.ref)+"!" output.encrypt(passphrase, use_128bit=True) diff --git a/ext/custom-addons/dp_custom/views/mail_mail_views_bcc.xml b/ext/custom-addons/dp_custom/views/mail_mail_views_bcc.xml new file mode 100644 index 00000000..8796ef34 --- /dev/null +++ b/ext/custom-addons/dp_custom/views/mail_mail_views_bcc.xml @@ -0,0 +1,13 @@ + + + + mail.template.form.bcc + mail.template + + + + + + + +