Odoo 中文社区

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

    Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn

    由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

    本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

    开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

    如果您登录系统碰到问题,请在微信公众号留言:

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

    Odoo 开发与实施交流
    4
    7
    6016
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mrshelly
      mrshelly last edited by

      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 Reply Quote 0
      • N
        NewZN last edited by

        给你的菜单加个父亲,左边菜单栏的菜单项不能直接触发动作,只能弹出子菜单。即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 Reply Quote 0
        • mrshelly
          mrshelly last edited by

          晕哦.真的是介样子的.

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

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

          再次感谢

          1 Reply Last reply Reply Quote 0
          • mrshelly
            mrshelly last edited by

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

            1 Reply Last reply Reply Quote 0
            • digitalsatori
              digitalsatori 管理员 last edited by

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

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

              1 Reply Last reply Reply Quote 0
              • L
                linyaohui last edited by

                实践出真知,学习

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post