This question has been flagged
2 Replies
4728 Views

Hello,

i would like my employees to sign documents together with the costumer on a tablet. i can't find a way to start document signing directly without sending an email to the costumer, i found out the link structure to access the portal and start signing. 

i would like to create an field named "x_portalurl" which contains:
('https://odoo-portal-link/'+sign_request.id+'/'+sign_request.access_token) 
the i can put this field in a view with wiidget 'URL'

hope someone can help.

Avatar
Discard
Author Best Answer

Hello Niyas,

thnx for reply. i'm not sure i'm doing this the right way....

i made an field in sign_request model named "x_portalurl" and pasted the code in the calculate field of x_portalurl but nothing is happening.

Avatar
Discard

Update the code in Question, make the URL field as a computed one and compute the URL from it

Best Answer

Hi,

See the sample in survey module, how the public URL for the survey is created.

from werkzeug import urls
from odoo.addons.http_routing.models.ir_http import slug


def _compute_survey_url(self):
""" Computes a public URL for the survey """
base_url = '/' if self.env.context.get('relative_url') else \
self.env['ir.config_parameter'].sudo().get_param('web.base.url')
for survey in self:
survey.public_url = urls.url_join(base_url, "survey/start/%s" % (slug(survey)))


In the above code, base_url will give the URL of your instance and in the below line, you can make necessary changes,

survey.public_url = urls.url_join(base_url, "survey/start/%s" % (slug(survey)))


like,

survey.public_url = urls.url_join(base_url, "%s/%s" % (slug(sign_request.id, sign_request.access_token)))


Thanks

Avatar
Discard