我是odoo的新人,很抱歉,如果这是一个noob问题。
如何确定未登记网站用户对模型的读取权限?
哪个是网站用户组?
为什么odoo 8.0文档这么差?
我制作了一个模块website_downloads:
模型:
class Files(models.Model):
_name = 'website_downloads.files'
name = fields.Char()
file = fields.Binary('File')
filename = fields.Char()
CONTROLER:
class website_downloads(http.Controller):
@http.route('/downloads/', auth='public', website=True)
def index(self, **kw):
files = http.request.env['website_downloads.files']
return http.request.render('website_downloads.index', {
'files': files.search([]),
})
网站模板:
<template id="index" name="Website Downloads Index">
<t t-call="website.layout">
<div id="wrap" style="margin-top:50px;margin-bottom:50px">
<div class="container text-center">
<table class="table table-striped">
<t t-foreach="files" t-as="f">
<tr>
<td align="left"><t t-esc="f.name"/></td>
<td><t t-esc="f.filename"/></td>
<td><a t-attf-href="/web/binary/saveas?model=website_downloads.files&field=file&filename_field=filename&id={{ f.id }}"> <i class="fa fa-download"></i> Download</a></td>
</tr>
</t>
</table>
</div>
</div>
</t>
</template>
安全
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_website_downloads_user,website_downloads.files,model_website_downloads_files,base.group_user,1,0,0,0
access_website_downloads_manager,website_downloads.files,model_website_downloads_files,base.group_sale_manager,1,1,1,1
答案 0 :(得分:1)
&#34; base.group_public&#34;
我解决了将此添加到安全文件
socket.end("hello");