Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
11434 Lượt xem

Hi, 

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 :

1) http://192.168.2.141:8086db=testes_0503#view_type=form&id=11&action=vi_resource_reservation.action_resource_reservation&login=user2&type=signup&model=resource.reservation

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

2) http://192.168.2.141:8086/?db=testes_0503#id=2&view_type=form&model=resource.reservation&action=606

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

thanks 

 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

http://192.168.2.141:8086/db=testes_0503#view_type=form&id=11

&action=vi_resource_reservation.action_resource_reservation&login=user2&type=signup&model=resource.reservation

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

Ảnh đại diện
Huỷ bỏ
Tác giả

the 2) works. Thanks =)

Câu trả lời hay nhất

.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 7 21
19738
5
thg 1 24
16234
1
thg 5 25
853
0
thg 12 24
9567
0
thg 11 24
1466