从控制器的所有可用功能模块,我用
sudo()
这样门户用户就不会获得任何访问权限问题。
创建新时间表时,控制器直接调用
create()
函数,当delete调用
unlink()
但是当用户想要编辑时间表时,我将用户重定向到另一个页面,在该页面上,有一个编辑表单,但是当门户用户导航到该页面时,它会显示403禁止的错误消息。
这个问题只有在我创建一个新的门户用户时才会出现,它允许已经在odoo中的Joel Willis。
我补充说
sudo()
在那个编辑时间表模板,但它没有工作。
这样地。。
class EditTimesheet(http.Controller):
@http.route(['/edit_timesheet/<model("account.analytic.line"):timesheet>'], type='http', auth="public", website=True)
def _edit_timesheet(self, timesheet, category='', search='', **kwargs):
self.sudo().edit_timesheet(timesheet, category='', search='', **kwargs)
def edit_timesheet(self, timesheet, category='', search='', **kwargs):
return request.render("timesheet_module.edit_timesheet",{'timesheet':timesheet.sudo()})
记录器出错。
Traceback (most recent call last):
File "/home/milan/workspace/odoo/odoo12/odoo/api.py", line 1049, in get
value = self._data[key][field][record._ids[0]]
KeyError: 6
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/milan/workspace/odoo/odoo12/odoo/fields.py", line 1012, in __get__
value = record.env.cache.get(record, self)
File "/home/milan/workspace/odoo/odoo12/odoo/api.py", line 1051, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('account.analytic.line(6,).display_name', None)
odoo.exceptions.AccessError: ('The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: Analytic Line, Operation: read) - (Records: [6], User: 8)', None)