Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add log for deletion or creation of signature
- Loading branch information
Showing
4 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
"category": 'Web', | ||
'depends': [ | ||
'web', | ||
'mail', | ||
], | ||
'data': [ | ||
'views/web_digital_sign_view.xml', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2004-2010 OpenERP SA (<http://www.openerp.com>) | ||
# Copyright 2011-2015 Serpent Consulting Services Pvt. Ltd. | ||
# Copyright 2017 Tecnativa - Vicent Cubells | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
import base64 | ||
from openerp import _, models, fields | ||
|
||
|
||
class MailThread(models.Model): | ||
_inherit = "mail.thread" | ||
|
||
def _track_signature(self, values, field): | ||
This comment has been minimized.
Sorry, something went wrong. |
||
if field in values: | ||
attachments = [] | ||
messages = [] | ||
if values.get(field): | ||
content = base64.b64decode(values.get(field)) | ||
attachments = [('signature', content)] | ||
messages.append(_('Signature has been created.')) | ||
messages.append( | ||
_('Signature date: %s' % fields.Datetime.now())) | ||
else: | ||
messages.append(_('Signature has been deleted.')) | ||
messages.append(_('Deletion date: %s' % fields.Datetime.now())) | ||
msg_body = '<ul>' | ||
for message in messages: | ||
msg_body += '<li>' | ||
msg_body += message | ||
msg_body += '</li>' | ||
msg_body += '</ul>' | ||
self.message_post(body=msg_body, attachments=attachments) |
Include a comment indicating which is its purpose and how to use it. You should override write and create anyway.