Odoo 中文社区

    • 注册
    • 登录
    • 搜索
    • 版块
    • 标签
    • 热门
    • 用户
    • 群组

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

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

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

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

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

    一个workflow的问题

    Odoo 开发与实施交流
    2
    4
    4590
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • M
      mihi 最后由 编辑

      自认为对workflow还是比较熟。(以前做过)但是这次怎么也不成功,请各位老大帮我看看。
      症状是,显示按钮正常(workflow的显示也是正常的),就是点击按钮后,状态不能切换。
      py文件中

      <br /> &#039;state&#039;:fields.selection([<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (&#039;new&#039;,&#039;新义工&#039;),<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (&#039;normal&#039;,&#039;正式义工&#039;),<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (&#039;advanced&#039;,&#039;高级义工&#039;)],&#039;义工级别&#039;,readonly=True,select=True),<br />
      


      workflow.xml

      <br />&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br />&lt;openerp&gt;<br />	&lt;data&gt;<br />	&nbsp; &nbsp; &nbsp; &nbsp; &lt;record id=&quot;aflsyg_volunteer_workflow&quot; model=&quot;workflow&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;name&quot;&gt;aflsyg.volunteer.workflow&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;osv&quot;&gt;aflsyg.volunteer&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;on_create&quot;&gt;True&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/record&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;record id=&quot;act_volunteer_new&quot; model=&quot;workflow.activity&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; 	&lt;field name=&quot;wkf_id&quot; ref=&quot;aflsyg_volunteer_workflow&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; 	&lt;field name=&quot;flow_start&quot;&gt;True&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; 	&lt;field name=&quot;name&quot;&gt;new&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; 	&lt;field name=&quot;kind&quot;&gt;function&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; 	&lt;field name=&quot;action&quot;&gt;write({&#039;state&#039;:&#039;new&#039;})&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/record&gt;<br />&nbsp; &nbsp;  <br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;record id=&quot;act_volunteer_normal&quot; model=&quot;workflow.activity&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; 	&lt;field name=&quot;wkf_id&quot; ref=&quot;aflsyg_volunteer_workflow&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; 	&lt;field name=&quot;name&quot;&gt;normal&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; 	 &lt;field name=&quot;kind&quot;&gt;function&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;field name=&quot;action&quot;&gt;write({&#039;state&#039;:&#039;normal&#039;})&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/record&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;record id=&quot;act_volunteer_advanced&quot; model=&quot;workflow.activity&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; 	&lt;field name=&quot;wkf_id&quot; ref=&quot;aflsyg_volunteer_workflow&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; 	&lt;field name=&quot;name&quot;&gt;advance&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; 	 &lt;field name=&quot;kind&quot;&gt;function&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;field name=&quot;action&quot;&gt;write({&#039;state&#039;:&#039;advanced&#039;})&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;field name=&quot;flow_stop&quot;&gt;True&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/record&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;record id=&quot;trans_new_normal&quot; model=&quot;workflow.transition&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;act_from&quot; ref=&quot;act_volunteer_new&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;act_to&quot; ref=&quot;act_volunteer_normal&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;signal&quot;&gt;be_normal&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/record&gt;<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;record id=&quot;trans_normal_advanced&quot; model=&quot;workflow.transition&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;act_from&quot; ref=&quot;act_volunteer_normal&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;act_to&quot; ref=&quot;act_volunteer_advanced&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;signal&quot;&gt;be_advanced&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/record&gt;&nbsp; &nbsp; &nbsp; &nbsp; &lt;!--&nbsp; --&gt;<br />	&lt;/data&gt;<br />&lt;/openerp&gt;
      


      view.xml中

      <br />	&lt;button name=&quot;be_normal&quot; string=&quot;晋升为正式义工&quot; states=&quot;new&quot; icon=&quot;gtk-convert&quot;/&gt;<br />	&lt;button name=&quot;be_advanced&quot; string=&quot;晋升为高级义工&quot; states=&quot;normal&quot; icon=&quot;gtk-convert&quot;/&gt;<br />	
      

      1 条回复 最后回复 回复 引用 0
      • digitalsatori
        digitalsatori 管理员 最后由 编辑

        把state字段中的readonly属性去掉。(不好意思,楼上的写法没错,selection 字段加readonly属性在这里完全没错)

        楼主最后证实自己的代码完全无误。

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

        1 条回复 最后回复 回复 引用 0
        • M
          mihi 最后由 编辑

          去掉 readonly属性还是不行。
          PS
          现在搞定了,不是程序问题。
          只是以前我对state字段,命名重复了。后来虽说删了,还是影响了。
          这次重新建立数据库之后,就搞定了。
          谢谢校长

          1 条回复 最后回复 回复 引用 0
          • First post
            Last post