Encrypt PDF-Attachments when documents are sent by mail
Change password, allow email_bcc for templatesdevelop
parent
80dee9d3f0
commit
b52f2b0ffe
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="email_template_form_bcc" model="ir.ui.view">
|
||||
<field name="name">mail.template.form.bcc</field>
|
||||
<field name="model">mail.template</field>
|
||||
<field name="inherit_id" ref="mail.email_template_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="email_cc" position="after">
|
||||
<field name="email_bcc"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Loading…
Reference in New Issue