Skip to content
  • Categories
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse

Odoo 中文社区

  1. Home
  2. Categories
  3. Odoo 开发与实施交流
  4. [已解决]死活都不触发的 测试 wizard 模块. 谢谢.

[已解决]死活都不触发的 测试 wizard 模块. 谢谢.

Scheduled Pinned Locked Moved Odoo 开发与实施交流
7 Posts 4 Posters 6.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mrshellyM Offline
    mrshellyM Offline
    mrshelly
    wrote on last edited by
    #1

    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]]

    1 Reply Last reply
    0
    • N Offline
      N Offline
      NewZN
      wrote on last edited by
      #2

      给你的菜单加个父亲,左边菜单栏的菜单项不能直接触发动作,只能弹出子菜单。即XML文件的menuitem改成如下就OK了。只是可能你的Wizard的Form定义还有些问题,只能出来第一个Form,按OK后第二个出不来,报错。

          &lt;menuitem id="menu_wizard_test_main" name="Test Wizard" /&gt;
          &lt;menuitem id="menu_wizard_test_test" type="wizard" action="wizard_test_test" parent="menu_wizard_test_main"/&gt;
      
      1 Reply Last reply
      0
      • mrshellyM Offline
        mrshellyM Offline
        mrshelly
        wrote on last edited by
        #3

        晕哦.真的是介样子的.

        不动手玩玩 肯定不会发现这些问题. 谢谢

        也真是的. doc.openerp.com 中好象也没有提及到这些注意事项...

        再次感谢

        1 Reply Last reply
        0
        • mrshellyM Offline
          mrshellyM Offline
          mrshelly
          wrote on last edited by
          #4

          算是一个 wizard sample 吧.
          有需要写 wizard 的同志可以下载参考玩.

          1 Reply Last reply
          0
          • digitalsatoriD Offline
            digitalsatoriD Offline
            digitalsatori 管理员
            wrote on last edited by
            #5

            立即下载学习,感谢兄弟贡献。

            【上海先安科技】(tony AT openerp.cn)

            1 Reply Last reply
            0
            • L Offline
              L Offline
              linyaohui
              wrote on last edited by
              #6

              实践出真知,学习

              1 Reply Last reply
              0

              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Tags
              • Popular
              • Users
              • Groups