跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • 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

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

  1. 主页
  2. 版块
  3. Odoo 开发与实施交流
  4. 一个workflow的问题

一个workflow的问题

已定时 已固定 已锁定 已移动 Odoo 开发与实施交流
4 帖子 2 发布者 4.8k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • M 离线
    M 离线
    mihi
    写于 最后由 编辑
    #1

    自认为对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
    • digitalsatoriD 离线
      digitalsatoriD 离线
      digitalsatori 管理员
      写于 最后由 编辑
      #2

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

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

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

      1 条回复 最后回复
      0
      • M 离线
        M 离线
        mihi
        写于 最后由 编辑
        #3

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

        1 条回复 最后回复
        0

        • 登录

        • 没有帐号? 注册

        • 登录或注册以进行搜索。
        • 第一个帖子
          最后一个帖子
        0
        • 版块
        • 标签
        • 热门
        • 用户
        • 群组