Merge lp:~openerp-dev/openobject-addons/trunk-mail-notification-link-tde into lp:openobject-addons

Proposed by Thibault Delavallée (OpenERP)
Status: Merged
Merged at revision: 9374
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-mail-notification-link-tde
Merge into: lp:openobject-addons
Diff against target: 102 lines (+35/-3) (has conflicts)
3 files modified
mail/mail_followers.py (+2/-3)
mail/mail_mail.py (+27/-0)
portal/mail_mail.py (+6/-0)
Text conflict in mail/mail_mail.py
Text conflict in portal/mail_mail.py
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-mail-notification-link-tde
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+216862@code.launchpad.net

Description of the change

[IMP] mail: improved link in notification, now of form
Sent from <company> using <openerp:pub>, about <model document_name>, access in <customer portal:partner only>

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mail/mail_followers.py'
2--- mail/mail_followers.py 2014-04-17 09:41:33 +0000
3+++ mail/mail_followers.py 2014-04-23 11:17:32 +0000
4@@ -109,8 +109,7 @@
5 Administrator
6 </p>
7 <div>
8- <small>Sent by <a ...>Your Company</a> using <a ...>OpenERP</a>.</small> OR
9- <small>Sent by Administrator using <a ...>OpenERP</a>.</small>
10+ <small>Sent from <a ...>Your Company</a> using <a ...>OpenERP</a>.</small>
11 </div>
12 """
13 footer = ""
14@@ -132,7 +131,7 @@
15 company = "<a style='color:inherit' href='%s'>%s</a>" % (website_url, user.company_id.name)
16 else:
17 company = user.company_id.name
18- sent_by = _('Sent by %(company)s using %(openerp)s.')
19+ sent_by = _('Sent from %(company)s using %(openerp)s')
20 signature_company = '<small>%s</small>' % (sent_by % {
21 'company': company,
22 'openerp': "<a style='color:inherit' href='https://www.openerp.com/'>OpenERP</a>"
23
24=== modified file 'mail/mail_mail.py'
25--- mail/mail_mail.py 2014-04-08 12:40:53 +0000
26+++ mail/mail_mail.py 2014-04-23 11:17:32 +0000
27@@ -145,8 +145,16 @@
28 #------------------------------------------------------
29
30 def _get_partner_access_link(self, cr, uid, mail, partner=None, context=None):
31+<<<<<<< TREE
32 """Generate URLs for links in mails: partner has access (is user):
33 link to action_mail_redirect action that will redirect to doc or Inbox """
34+=======
35+ """ Generate URLs for links in mails:
36+ - partner is an user and has read access to the document: direct link to document with model, res_id
37+ """
38+ if context is None:
39+ context = {}
40+>>>>>>> MERGE-SOURCE
41 if partner and partner.user_ids:
42 base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url')
43 # the parameters to encode for the query and fragment part of url
44@@ -159,9 +167,15 @@
45 fragment['message_id'] = mail.mail_message_id.id
46 elif mail.model and mail.res_id:
47 fragment.update(model=mail.model, res_id=mail.res_id)
48+<<<<<<< TREE
49
50 url = urljoin(base_url, "/web?%s#%s" % (urlencode(query), urlencode(fragment)))
51 return _("""<span class='oe_mail_footer_access'><small>Access your messages and documents <a style='color:inherit' href="%s">in OpenERP</a></small></span>""") % url
52+=======
53+
54+ url = urljoin(base_url, "?%s#%s" % (urlencode(query), urlencode(fragment)))
55+ return _("""<span class='oe_mail_footer_access'><small>about <a style='color:inherit' href="%s">%s %s</a></small></span>""") % (url, context.get('model_name', ''), mail.record_name)
56+>>>>>>> MERGE-SOURCE
57 else:
58 return None
59
60@@ -233,10 +247,23 @@
61 email sending process has failed
62 :return: True
63 """
64+ if context is None:
65+ context = {}
66 ir_mail_server = self.pool.get('ir.mail_server')
67+<<<<<<< TREE
68
69+=======
70+>>>>>>> MERGE-SOURCE
71 for mail in self.browse(cr, SUPERUSER_ID, ids, context=context):
72 try:
73+ # TDE note: remove me when model_id field is present on mail.message - done here to avoid doing it multiple times in the sub method
74+ if mail.model:
75+ model_id = self.pool['ir.model'].search(cr, SUPERUSER_ID, [('model', '=', mail.model)], context=context)[0]
76+ model = self.pool['ir.model'].browse(cr, SUPERUSER_ID, model_id, context=context)
77+ else:
78+ model = None
79+ if model:
80+ context['model_name'] = model.name
81 # handle attachments
82 attachments = []
83 for attach in mail.attachment_ids:
84
85=== modified file 'portal/mail_mail.py'
86--- portal/mail_mail.py 2014-03-11 20:53:37 +0000
87+++ portal/mail_mail.py 2014-04-23 11:17:32 +0000
88@@ -39,8 +39,14 @@
89 if partner and not partner.user_ids:
90 contex_signup = dict(context, signup_valid=True)
91 signup_url = partner_obj._get_signup_url_for_action(cr, SUPERUSER_ID, [partner.id],
92+<<<<<<< TREE
93 model=mail.model, res_id=mail.res_id,
94 context=contex_signup)[partner.id]
95 return _("""<span class='oe_mail_footer_access'><small>Access your messages and documents through <a style='color:inherit' href="%s">our Customer Portal</a></small></span>""") % signup_url
96+=======
97+ action='login', model=mail.model, res_id=mail.res_id,
98+ context=contex_signup)[partner.id]
99+ return _("""<span class='oe_mail_footer_access'><small>access %s %s through <a style='color:inherit' href="%s">our Customer Portal</a></small></span>""") % (context.get('model_name', ''), mail.record_name, signup_url)
100+>>>>>>> MERGE-SOURCE
101 else:
102 return super(mail_mail, self)._get_partner_access_link(cr, uid, mail, partner=partner, context=context)

Subscribers

People subscribed via source and target branches

to all changes: