Odoo Help


How to get the current URL in email template?

on 10/31/16, 9:24 PM 234 views

I want to write the current URL in a email template, for example if I'm inside a sale order or a purchase order, <a href="http://www.uushairextensions.com"> hair extensions </a>I would expect the link that points to that document, how can I do that?


Hilar AK

--Hilar AK--
Hilar AK
| 5 3 8
--Hilar AK--

Hilar AK
On 11/9/16, 5:59 AM

In your sale order just try to write the current url by saving to a field and fetch on email template that field as object.yoururlfieldmake the field a compute field

so the function should contain

def yyy(self):
    from openerp import http
    self.yourfiledname = str(http.request.httprequest).split("'")[1].split("'")[0]

just fetch the field value in your email template


Nilmar Shereef

--Nilmar Shereef--
| 4 4 7
Calicut, India
--Nilmar Shereef--

Python Developer. Android Developer. .Net Developer

Nilmar Shereef
On 11/2/16, 3:27 AM

current_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')

Use the above code to get current URL in python file
Hope this may help you.

On 11/1/16, 12:50 AM

you might see the answers in https://www.odoo.com/forum/help-1/question/how-to-get-current-url-in-odoo-9-110141#answer-110150 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 10/31/16, 9:24 PM
Seen: 234 times
Last updated: 11/9/16, 10:49 PM