2018-01-16 06:58:15 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
2018-01-16 11:34:37 +01:00
|
|
|
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
2018-01-16 06:58:15 +01:00
|
|
|
|
|
|
|
from werkzeug.urls import url_encode
|
|
|
|
|
2018-01-16 11:34:37 +01:00
|
|
|
from flectra import api, fields, models
|
2018-01-16 06:58:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
class PortalMixin(models.AbstractModel):
|
|
|
|
_name = "portal.mixin"
|
|
|
|
|
|
|
|
portal_url = fields.Char(
|
|
|
|
'Portal Access URL', compute='_compute_portal_url',
|
|
|
|
help='Customer Portal URL')
|
|
|
|
|
|
|
|
@api.multi
|
|
|
|
def _compute_portal_url(self):
|
|
|
|
for record in self:
|
|
|
|
record.portal_url = '#'
|
|
|
|
|
|
|
|
def get_share_url(self):
|
|
|
|
self.ensure_one()
|
|
|
|
params = {
|
|
|
|
'model': self._name,
|
|
|
|
'res_id': self.id,
|
|
|
|
}
|
|
|
|
if hasattr(self, 'access_token') and self.access_token:
|
|
|
|
params['access_token'] = self.access_token
|
|
|
|
if hasattr(self, 'partner_id') and self.partner_id:
|
|
|
|
params.update(self.partner_id.signup_get_auth_param()[self.partner_id.id])
|
|
|
|
|
|
|
|
return '/mail/view?' + url_encode(params)
|