Files
odoo_source/addons/website_project_issue/models/project_issue.py
T
Thibault Delavallée 6dfcc5f9c8 [FIX] various: get_access_action form one to multi
As this method is overided in several modules, the mix of new and
old API makes it difficult to handle. Indeed in some cases we
receive the expected dictionary, sometimes in a list, sometimes
in a list of list, due to api.one decorator.

This is a change in the method API, however it is currently completely
buggy. Moreover this method is used internally and should not be
used as an external API. Lastly, this method is new from v9.
2015-10-30 15:44:15 +01:00

33 lines
1.2 KiB
Python

# -*- 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.multi
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 """
self.ensure_one()
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