From dcec209805e58208eda50eb929b5355bc28fc05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 18 Oct 2018 10:51:09 +0000 Subject: [FIX] mass_mailing: fix tracking link creation in mass mailing When using only mass mailing two issues arise when trying to send mass mailings containing links * a link.tracker is created for each link to shorten; however rights are given currently only in website_links for website designers and not to marketing users that use mass mailing. This commit adds the rights for link.tracker model to those people; * a link.tracker.code is created to hold the shortened versions of the links. As it is a technical model it is now done as superuser as rights on link.tracked model has already been granted and adding rights on such a technical model is not necessary; A test is added that checks what is done with links when sending mass mailings. It helped spotting the hereabove issue. This commit is linked to task ID 1889703 and PR #27526. --- addons/link_tracker/models/link_tracker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/link_tracker/models/link_tracker.py') diff --git a/addons/link_tracker/models/link_tracker.py b/addons/link_tracker/models/link_tracker.py index 584894b4322..ae52a6966f2 100644 --- a/addons/link_tracker/models/link_tracker.py +++ b/addons/link_tracker/models/link_tracker.py @@ -185,7 +185,7 @@ class link_tracker(models.Model): link = super(link_tracker, self).create(create_vals) code = self.env['link.tracker.code'].get_random_code_string() - self.env['link.tracker.code'].create({'code': code, 'link_id': link.id}) + self.env['link.tracker.code'].sudo().create({'code': code, 'link_id': link.id}) return link -- cgit v1.2.3