2017-08-13 69 views
0

當我嘗試選擇從記錄(例如)res.user這樣的:Odoo - 錯誤查詢外的http請求

with api.Environment.manage(): 
    registry = RegistryManager.get(db_name) 
    with registry.cursor() as cursor: 
     environment = api.Environment(cursor, None, {}) 
     environment['res.user'].search([]) 

我得到一個異常

Traceback (most recent call last): 
    ... 
    File "/opt/odoo10/odoo/models.py", line 4200, in _generate_order_by 
    order_by_elements = self._generate_order_by_inner(self._table, order_spec, query) 
    File "/opt/odoo10/odoo/models.py", line 4167, in _generate_order_by_inner 
    raise ValueError(_("Sorting field %s not found on model %s") % (order_field, self._name)) 
ValueError: Sorting field model_id not found on model ir.rule 

因此,它與任何情況楷模。但是,一切都很好,如果我做的控制器方法或模型的方法的請求

回答

0

能不能請你:

with api.Environment.manage(): 
    registry = RegistryManager.get(db_name) 
    with registry.cursor() as cursor: 
     environment = api.Environment(cursor, SUPERUSER_ID, {}) 
     environment['res.user'].search([]) 

我只是包括superuserid,希望這是防止模型的訪問