diff options
| author | Thibault Delavallée <tde@openerp.com> | 2015-08-26 15:18:36 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2015-08-28 17:36:16 +0200 |
| commit | 59c5ff08beb07d455f1e0d5eaa072c784949d3be (patch) | |
| tree | 9e42938fe355285c755ac963464c4d8731b1d59a /addons/website_project_issue/models/project_issue.py | |
| parent | 01ab75f597d6ff8f3f570b4c316179654caf7b1c (diff) | |
[IMP] various: action buttons in notifications
Main addons updated :
- crm: Conversion and Won / Lost actions
- hr_holidays: Approve / Refuse for hr users / officers
- project: Assign / New (task and issues)
- forum, website_project_issue, website_portal_sale: go to the
website view
Diffstat (limited to 'addons/website_project_issue/models/project_issue.py')
| -rw-r--r-- | addons/website_project_issue/models/project_issue.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/addons/website_project_issue/models/project_issue.py b/addons/website_project_issue/models/project_issue.py new file mode 100644 index 00000000000..9344157422c --- /dev/null +++ b/addons/website_project_issue/models/project_issue.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from openerp import _, api, models + + +class Issue(models.Model): + _name = "project.issue" + _inherit = ['project.issue'] + + @api.one + def get_access_action(self): + """ Override method that generated the link to access the document. Instead + of the classic form view, redirect to the post on the website directly """ + return { + 'type': 'ir.actions.act_url', + 'url': '/my/issues/%s' % self.id, + 'target': 'self', + 'res_id': self.id, + } + + @api.multi + def _notification_get_recipient_groups(self, message, recipients): + """ Override to set the access button: everyone can see an access button + on their notification email. It will lead on the website view of the + post. """ + res = super(Issue, self)._notification_get_recipient_groups(message, recipients) + access_action = self._notification_link_helper('view', model=message.model, res_id=message.res_id) + for category, data in res.iteritems(): + res[category]['button_access'] = {'url': access_action, 'title': _('View Issue')} + return res |
