我试图实现一个向导更新表单的向导(如果可能的话,向工作流发送信号以更改对象的状态,但这将在以后进行)。我正在努力尝试,但由于我遇到了这个恼人的错误,我做错了什么!
ValueError:系统中当前没有定义此类外部ID:processos_uc.reformulate_generic_request_wizard
我已经在"向导"中找到了这两个文件。夹: reformulate_wizard.py:
from openerp.osv import osv
from openerp.osv import fields
from openerp.tools.translate import _
class ref_generic_request(osv.osv_memory):
_name='ref.generic.request'
_columns = {
'reformulation_info': fields.text('Reformulation instructions', help='Instructions for the requestor justification the reformulation needs'),
}
def save_info(self, cr, uid, ids, context=None):
if 'active_id' in context:
info=self.browse(cr,uid,ids)[0].reformulation_info
self.pool.get('generic.request').write(cr,uid,context['active_id'],
{'reformulation_info' : reformulation_info})
return {
'type': 'ir.actions.act_window_close',
}
ref_generic_request()
reformulate_wizard.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_reformulate_generic_request_wizard" model="ir.ui.view">
<field name="name">reformulate_generic_request_wizard.form</field>
<field name="model">ref.generic.request</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Insert reformulation info" version="7.0">
<group colspan="4" >
<separator string="bla bla bla here" colspan="4"/>
<field name="reformulation_info" string="Reformulation info"/>
<newline/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" name="save_info" string="Send to reformulation" type="object" />
</group>
</form>
</field>
</record>
<record id="action_reformulate_generic_request" model="ir.actions.act_window">
<field name="name">Reformulate Request</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ref.generic.request</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_reformulate_generic_request_wizard"/>
<field name="target">new</field>
</record>
<act_window id="action_reformulate_generic_request"
name="Reformulate Request"
res_model="generic.request"
view_mode="form"
target="new"
/>
</data>
</openerp>
我并没有忘记__init__.py
使用&#34; import reformulate_wizard&#34;在它。
我从我的xml视图中调用这个向导(我想这就是我得到错误的地方):
<button name="%(reformulate_generic_request_wizard)d" string="Button that calls wizard" type="object" />
在我的基本文件夹中,我导入了__init__.py
:
import parecer
import pedido_generico
import tracing
import wizard
以下是我__openerp__.py
的内容(错误可能来自我加载内容的顺序):
{
'name': 'Processos UC',
'version': '0.1',
'category': 'Tools',
'description': """
OpenERP Module that implements UC's business processes.""",
'author': 'Filipe Castanheira',
'website': 'http://www.uc.pt',
'depends': ['base','web'],
'demo': [],
'test':[],
#'js': [
# 'static/js/custom.js',
#],
'css': [ 'static/css/uc_css.css' ],
'update_xml' : [
'data/action_server.xml',
'security/security.xml',
'security/processos_uc_domain_rules.xml',
'wizard/reformulate_wizard.xml',
'processos_view.xml',
'parecer_wkf.xml',
'pedido_wkf.xml',
],
'data': [
'security/ir.model.access.csv',
'data/owner_groups.xml',
'data/subject_type.xml',
],
'installable': True,
'images': [],
}
以下是来自服务器日志的错误消息。
2014-05-14 16:55:45,182 19742 ERROR may_9 openerp.tools.convert: Parse error in /home/lfc/openerp/v7/addons/processos_uc/processos_view.xml:23:
(...)XML displayed here(...)
Traceback (most recent call last):
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 847, in parse
self._tags[rec.tag](self.cr, rec, n)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 807, in _tag_record
f_val = _eval_xml(self,field, self.pool, cr, self.uid, self.idref)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 154, in _eval_xml
for n in node]), idref)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 148, in _process
idref[id]=self.id_get(cr, id)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 824, in id_get
res = self.model_id_get(cr, id_str)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 833, in model_id_get
return model_data_obj.get_object_reference(cr, self.uid, mod, id_str)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 18, in lookup
r = self.lookup(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 46, in lookup
value = d[key] = self.method(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 869, in get_object_reference
data_id = self._get_id(cr, uid, module, xml_id)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 18, in lookup
r = self.lookup(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 46, in lookup
value = d[key] = self.method(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 862, in _get_id
raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_id))
ValueError: No such external ID currently defined in the system: processos_uc.reformulate_generic_request_wizard
2014-05-14 16:55:45,186 19742 ERROR may_9 openerp.netsvc: No such external ID currently defined in the system: processos_uc.reformulate_generic_request_wizard
Traceback (most recent call last):
File "/opt/openerp/v7/server/openerp/netsvc.py", line 292, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/opt/openerp/v7/server/openerp/service/web_services.py", line 433, in dispatch
return fn(*params)
File "/opt/openerp/v7/server/openerp/service/web_services.py", line 444, in exp_authenticate
res_users = pooler.get_pool(db).get('res.users')
File "/opt/openerp/v7/server/openerp/pooler.py", line 49, in get_pool
return get_db_and_pool(db_name, force_demo, status, update_module)[1]
File "/opt/openerp/v7/server/openerp/pooler.py", line 33, in get_db_and_pool
registry = RegistryManager.get(db_name, force_demo, status, update_module)
File "/opt/openerp/v7/server/openerp/modules/registry.py", line 192, in get
update_module)
File "/opt/openerp/v7/server/openerp/modules/registry.py", line 218, in new
openerp.modules.load_modules(registry.db, force_demo, status, update_module)
File "/opt/openerp/v7/server/openerp/modules/loading.py", line 350, in load_modules
force, status, report, loaded_modules, update_module)
File "/opt/openerp/v7/server/openerp/modules/loading.py", line 256, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/opt/openerp/v7/server/openerp/modules/loading.py", line 187, in load_module_graph
load_update_xml(module_name, idref, mode)
File "/opt/openerp/v7/server/openerp/modules/loading.py", line 74, in <lambda>
load_update_xml = lambda *args: _load_data(cr, *args, kind='update_xml')
File "/opt/openerp/v7/server/openerp/modules/loading.py", line 124, in _load_data
tools.convert_xml_import(cr, module_name, fp, idref, mode, noupdate, report)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 954, in convert_xml_import
obj.parse(doc.getroot())
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 847, in parse
self._tags[rec.tag](self.cr, rec, n)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 807, in _tag_record
f_val = _eval_xml(self,field, self.pool, cr, self.uid, self.idref)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 154, in _eval_xml
for n in node]), idref)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 148, in _process
idref[id]=self.id_get(cr, id)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 824, in id_get
res = self.model_id_get(cr, id_str)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 833, in model_id_get
return model_data_obj.get_object_reference(cr, self.uid, mod, id_str)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 18, in lookup
r = self.lookup(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 46, in lookup
value = d[key] = self.method(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 869, in get_object_reference
data_id = self._get_id(cr, uid, module, xml_id)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 18, in lookup
r = self.lookup(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 46, in lookup
value = d[key] = self.method(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 862, in _get_id
raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_id))
ValueError: No such external ID currently defined in the system: processos_uc.reformulate_generic_request_wizard
非常欢迎任何帮助!
答案 0 :(得分:1)
错误消息告诉您问题出在哪里:您使用的是未在任何地方声明的ID reformulate_generic_request_wizard
。
您的按钮应指向操作ID action_reformulate_generic_request_wizard
。
所以,试试这个:
<button name="%(action_reformulate_generic_request_wizard)d" string="Button that calls wizard" type="object" />