Odoo Help


This community 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.


How to send url of a record by email ?

Anabela Damas
on 3/5/15, 9:53 AM 849 views


I've a object that has a user_id ('user_id': fields.many2one('res.users', u'Responsável', required=True,),), and this user recive an email when someone changes the state of the record. 

I've this function to give the url: 

      def get_signup_url(self, cr, uid, ids, context=None):
        document = self.browse(cr, uid, ids, context=context)
        res= False
        base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url')
        query = {'db': cr.dbname}
        fragment = {'action': 'vi_resource_reservation.action_resource_reservation',
                    'type': "signup",
                    'view_type' : 'form',
                    'model' : 'resource.reservation',
                    'id': document.id,
                    'login': document.user_id.login,
        res = urljoin(base_url, "?%s#%s" % (urlencode(query), urlencode(fragment)))
        print res
        return res

It return the following link, with the id 11 :


But when I write the link 1) in the browser it redirects to the first id in the database of the model (id 2 ):


Do you have any ideia why? What I'm doing wrong?



Mariusz Mizgier
On 3/5/15, 10:36 AM

1) Your URL is wrong, as it should be like:


2) If point 1 doesn't work, try passing the link without action parameter.

the 2) works. Thanks =)

Versão Integral, Anabela Damas
on 3/5/15, 1:07 PM

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 3/5/15, 9:53 AM
Seen: 849 times
Last updated: 3/16/15, 8:10 AM