日安!我有这个问题,我在我的Odoo网站网站招聘中创建了一个链接
使用url链接
str_url = 'http://localhost:8069'+'/web/binary/saveas?model=ir.attachment&field=datas&filename_field=name&id='+str(attachment.id)但我想要的'http://localhost:8069‘是确切的url地址。因为当我在其他机器上运行这段代码时,它会引发一个错误。
有没有办法获得确切的URL地址?
再次感谢。
发布于 2016-02-18 13:54:51
我发现答案就是用了
request.httprequest.host_url它会是这样的
str_url = request.httprequest.host_url +'web/binary/saveas?model=ir.attachment&field=datas&filename_field=name&id='+str(attachment.id)希望我能帮上忙:
https://stackoverflow.com/questions/35473619
复制相似问题