Skip to content

Commit

Permalink
overdue_reminder: link mails to res.partner
Browse files Browse the repository at this point in the history
Advantages:
1) easy access to the history in the chatter of the partner.
2) no problem to access the email by other users (avoid "The requested
   operation cannot be completed due to security restrictions. Please
   contact your system administrator.")

Migration script provided
  • Loading branch information
alexis-via committed Sep 20, 2021
1 parent a6f5b04 commit 8d32b29
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion account_invoice_overdue_reminder/__manifest__.py
Expand Up @@ -5,7 +5,7 @@

{
'name': 'Overdue Invoice Reminder',
'version': '10.0.2.0.1',
'version': '10.0.2.0.2',
'category': 'Accounting',
'license': 'AGPL-3',
'summary': 'Simple mail/letter/phone overdue customer invoice reminder ',
Expand Down
@@ -0,0 +1,17 @@
# Copyright 2020 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


def migrate(cr, version):
if not version:
return

cr.execute("""
UPDATE mail_message SET
res_id=overdue_reminder_action.commercial_partner_id,
model='res.partner'
FROM overdue_reminder_action, mail_mail
WHERE overdue_reminder_action.mail_id=mail_mail.id
AND mail_mail.mail_message_id = mail_message.id
""")
Expand Up @@ -442,8 +442,8 @@ def validate_mail(self):
'subject': self.mail_subject,
'body_html': self.mail_body,
'email_cc': ', '.join(cc_list),
'model': False, # don't link to the wizard !
'res_id': False,
'model': 'res.partner',
'res_id': self.commercial_partner_id.id,
})
mvals.pop('attachment_ids', None)
mvals.pop('attachments', None)
Expand Down

0 comments on commit 8d32b29

Please sign in to comment.