0
需要在我的模塊post_load
之後獲得'bus.bus'模型。但是,我得到一個異常:獲取http請求之外的odoo 10環境
Traceback (most recent call last):
File "/path/to/file.py", line 19, in __call__
self.event_bus.sendone('channel', 'message')
File "/opt/odoo10/addons/bus/models/bus.py", line 70, in sendone
self.sendmany([[channel, message]])
File "/opt/odoo10/addons/bus/models/bus.py", line 54, in sendmany
self.sudo().create(values)
File "/opt/odoo10/odoo/models.py", line 4870, in sudo
return self.with_env(self.env(user=user))
File "/opt/odoo10/odoo/api.py", line 781, in __call__
return Environment(cr, uid, context)
File "/opt/odoo10/odoo/api.py", line 726, in __new__
env, envs = None, cls.envs
File "/opt/odoo10/odoo/tools/func.py", line 111, in __get__
return self.fget.__get__(None, owner)()
File "/opt/odoo10/odoo/api.py", line 699, in envs
return cls._local.environments
File "/opt/odoo10/venv/local/lib/python2.7/site-packages/werkzeug/local.py", line 72, in __getattr__
raise AttributeError(name)
AttributeError: environments
我嘗試讓環境是這樣的:
registry = RegistryManager.get(db_name)
cursor = registry.cursor()
return Environment(cursor, None, context={})
所以,我怎麼能得到正確的環境http請求外?
好的,但我怎麼能得到SUPERUSER_ID? – triplustri
如果你不'噸有超級用戶ID然後通過Environment.uid –
我使用odoo 10 - AttributeError:類型對象'環境'沒有屬性'uid'從odoo導入 – triplustri