[已解决]死活都不触发的 测试 wizard 模块. 谢谢.
-
RT.按 doc.openerp.com 以及自己的理解.写了个 wizard sample ,但死活不执行. 哪位大大看看问题出在哪里? 谢谢
模块 addonstest
addonstest__init__.py
[code]-- encoding: utf-8 --
import wizard
[/code]addonstest__terp__.py
[code]# -- encoding: utf-8 --
{
"name" : "Wizard for test",
"version" : "1.0",
"author" : "mrshelly",
"category" : "Generic Modules/Test Module",
"depends" : ["base"],
"init_xml" : [],
"demo_xml" : [],
"description": """Test Module for wizard.""",
'update_xml': [ 'test_wizard.xml', ],
'installable': True,
'active': False,
}
[/code]addonstesttest_wizard.xml
[code]
<?xml version="1.0" ?>
<openerp>
<data>
<wizard id="wizard_test_test" string="A Test Wizard" model="test.test" name="test.test"/>
<menuitem id="menu_wizard_test_test" type="wizard" action="wizard_test_test" />
</data>
</openerp>
[/code]addonstestwizard__init__.py
[code]-- encoding: utf-8 --
import wizard_test
[/code]addonstestwizardwizard_test.py
[code]-- encoding: utf-8 --
import wizard
test_form = '''
<?xml version="1.0"?>
<form string="Test Form">
<field name="test" />
</form>'''
test_fields = {
'test': {'string':'Hello 001', 'type':'string', 'char':50, 'default':''}
}
ret_form = '''
<?xml version="1.0"?>
<form string="Ye, Its OK!"></form>'''
ret_fields = {}class wizard_test(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type':'form', 'arch':test_form, 'fields':test_fields, 'state':[('end','Cancel'),('next','OK')]}
},
'next': {
'actions': [],
'result': {'type':'form', 'arch':ret_form, 'fields':ret_fields, 'state':'end'}
}
}
wizard_test('test.test')
[/code]在此谢过.
(重新编辑一下. 还不支持 UNIX 的换行代码)[[i] 本帖最后由 mrshelly 于 2010-1-23 10:01 编辑 [/i]]
-
给你的菜单加个父亲,左边菜单栏的菜单项不能直接触发动作,只能弹出子菜单。即XML文件的menuitem改成如下就OK了。只是可能你的Wizard的Form定义还有些问题,只能出来第一个Form,按OK后第二个出不来,报错。
<menuitem id="menu_wizard_test_main" name="Test Wizard" /> <menuitem id="menu_wizard_test_test" type="wizard" action="wizard_test_test" parent="menu_wizard_test_main"/> -
-
立即下载学习,感谢兄弟贡献。
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login