Odoo Hilfe

0

0
2 Answers
0
Yourpos
10.03.19, 05:36

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.

1 Kommentar
Niyas Raphy
10.03.19, 06:14

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

0
Avatar

Niyas Raphy

--Niyas Raphy--
24372
| 7 7 11
Wayanad, Indien
--Niyas Raphy--

Odoo Techno Functionalist

Feel free to connect :  niyasraphyk@gmail.com

Twitter:https://twitter.com/niyasraphy
LinkedIn: https://www.linkedin.com/in/niyasraphy/
FB:https://www.facebook.com/niyasraphy123

Happy to help :)

Niyas Raphy
09.03.19, 20:49

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

Fragen Sie
Writer
Keep Informed
1 Verfolger
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now