- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
这是一个非常奇怪的行为,它正在工作,现在我正要将我的模块安装到另一个数据库上,突然出现关于外部 ID 的错误。
这是我在模型中的代码:
def _static_location(self):
return self.env.ref('fleet_stock.location_stock')
然后我从字段中调用这个函数:
x_location_dest_id = fields.Many2one('stock.location', string=u'Ubicacion Destino de Productos', required=True,
readonly=False, default=_static_location,
help="Location where the system will look for components.")
location_stock
属性位于数据文件夹的 xml 文件中,声明如下:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="location_stock" model="stock.location">
<field name="name">ReparacionUnidades</field>
<field name="location_id" ref="stock.stock_location_locations_virtual"/>
<field name="usage">production</field>
<field name="company_id"></field>
</record>
</data>
</openerp>
在 __openerp__.py
文件上:
"data": [
'data/location_data.xml',
'data/fleet_stock_data.xml',
'views/fleet_vehicle_log_services.xml',
],
当我尝试安装它时,会抛出这个:
Traceback (most recent call last):
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 648, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 685, in dispatch
result = self._call_function(**self.params)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 321, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 314, in checked_call
result = self.endpoint(*a, **kw)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 964, in __call__
return self.method(*args, **kw)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/http.py", line 514, in response_wrap
response = f(*args, **kw)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/web/controllers/main.py", line 892, in call_button
action = self._call_kw(model, method, args, {})
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/web/controllers/main.py", line 880, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/base/module/module.py", line 459, in button_immediate_install
return self._button_immediate_function(cr, uid, ids, self.button_install, context=context)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/base/module/module.py", line 534, in _button_immediate_function
registry = openerp.modules.registry.RegistryManager.new(cr.dbname, update_module=True)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/modules/registry.py", line 386, in new
openerp.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/modules/loading.py", line 338, in load_modules
loaded_modules, update_module)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/modules/loading.py", line 237, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/modules/loading.py", line 137, in load_module_graph
init_module_models(cr, package.name, models)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/modules/module.py", line 300, in init_module_models
result = obj._auto_init(cr, {'module': module_name})
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/models.py", line 2643, in _auto_init
self._set_default_value_on_column(cr, k, context=context)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/models.py", line 2399, in _set_default_value_on_column
default = default(self, cr, SUPERUSER_ID, context)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 354, in old_api
result = method(recs, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/fields.py", line 82, in <lambda>
return api.model(lambda model: field.convert_to_write(value(model)))
File "/home/kristian/odoov9/danisan/fleet_stock/models/fleet_vehicle_services.py", line 122, in _static_location
return self.env.ref('fleet_stock.location_stock')
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 792, in ref
return self['ir.model.data'].xmlid_to_object(xml_id, raise_if_not_found=raise_if_not_found)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 248, in wrapper
return new_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 490, in new_api
result = method(self._model, cr, uid, *args, **old_kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/base/ir/ir_model.py", line 1019, in xmlid_to_object
t = self.xmlid_to_res_model_res_id(cr, uid, xmlid, raise_if_not_found)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/base/ir/ir_model.py", line 1005, in xmlid_to_res_model_res_id
return self.xmlid_lookup(cr, uid, xmlid)[1:3]
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "<string>", line 2, in xmlid_lookup
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/tools/cache.py", line 85, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/kristian/odoov9/odoo-9.0c-20161106/openerp/addons/base/ir/ir_model.py", line 995, in xmlid_lookup
raise ValueError('External ID not found in the system: %s' % (xmlid))
ValueError: External ID not found in the system: fleet_stock.location_stock
但这完全荒谬,这是有效的,它是我的模块,该模块称为 fleet_stock
,它是什么?
是__openerp__.py
文件中data
列的顺序吗?
有什么想法吗?
最佳答案
可能位置不是从您的 xml 文件创建的。
您可以尝试以下方法:
从您的 xml 文件中删除 noupdate="1" 属性并重新启动 Odoo 服务器并升级您的自定义模块。
然后转到“位置”菜单并检查是否创建了 ReparacionUnidades。如果它创建了,那么我们可以在 xml 文件中放回 noupdate="1" 属性。
现在,检查您的 x_location_dest_id 值。它应该会给你想要的输出。
关于python - 在系统中找不到外部 ID - Odoo v9 社区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42545268/
例如,我有一个父类Author: class Author { String name static hasMany = [ fiction: Book,
代码如下: dojo.query(subNav.navClass).forEach(function(node, index, arr){ if(dojo.style(node, 'd
我有一个带有 Id 和姓名的学生表和一个带有 Id 和 friend Id 的 Friends 表。我想加入这两个表并找到学生的 friend 。 例如,Ashley 的 friend 是 Saman
我通过互联网浏览,但仍未找到问题的答案。应该很容易: class Parent { String name Child child } 当我有一个 child 对象时,如何获得它的 paren
我正在尝试创建一个以 Firebase 作为我的后端的社交应用。现在我正面临如何(在哪里?)找到 friend 功能的问题。 我有每个用户的邮件地址。 我可以访问用户的电话也预订。 在传统的后端中,我
我主要想澄清以下几点: 1。有人告诉我,在 iOS 5 及以下版本中,如果您使用 Game Center 设置多人游戏,则“查找 Facebook 好友”(如与好友争夺战)的功能不是内置的,因此您需要
关于redis docker镜像ENTRYPOINT脚本 docker-entrypoint.sh : #!/bin/sh set -e # first arg is `-f` or `--some-
我是一名优秀的程序员,十分优秀!