一个workflow的问题
-
自认为对workflow还是比较熟。(以前做过)但是这次怎么也不成功,请各位老大帮我看看。
症状是,显示按钮正常(workflow的显示也是正常的),就是点击按钮后,状态不能切换。
py文件中<br /> 'state':fields.selection([<br /> ('new','新义工'),<br /> ('normal','正式义工'),<br /> ('advanced','高级义工')],'义工级别',readonly=True,select=True),<br />
workflow.xml<br /><?xml version="1.0" encoding="UTF-8"?><br /><openerp><br /> <data><br /> <record id="aflsyg_volunteer_workflow" model="workflow"><br /> <field name="name">aflsyg.volunteer.workflow</field><br /> <field name="osv">aflsyg.volunteer</field><br /> <field name="on_create">True</field><br /> </record><br /> <br /> <record id="act_volunteer_new" model="workflow.activity"><br /> <field name="wkf_id" ref="aflsyg_volunteer_workflow"/><br /> <field name="flow_start">True</field><br /> <field name="name">new</field><br /> <field name="kind">function</field><br /> <field name="action">write({'state':'new'})</field><br /> </record><br /> <br /> <record id="act_volunteer_normal" model="workflow.activity"><br /> <field name="wkf_id" ref="aflsyg_volunteer_workflow"/><br /> <field name="name">normal</field><br /> <field name="kind">function</field><br /> <field name="action">write({'state':'normal'})</field><br /> </record><br /> <br /> <record id="act_volunteer_advanced" model="workflow.activity"><br /> <field name="wkf_id" ref="aflsyg_volunteer_workflow"/><br /> <field name="name">advance</field><br /> <field name="kind">function</field><br /> <field name="action">write({'state':'advanced'})</field><br /> <field name="flow_stop">True</field><br /> </record><br /> <br /> <record id="trans_new_normal" model="workflow.transition"><br /> <field name="act_from" ref="act_volunteer_new"/><br /> <field name="act_to" ref="act_volunteer_normal"/><br /> <field name="signal">be_normal</field><br /> </record><br /><br /> <record id="trans_normal_advanced" model="workflow.transition"><br /> <field name="act_from" ref="act_volunteer_normal"/><br /> <field name="act_to" ref="act_volunteer_advanced"/><br /> <field name="signal">be_advanced</field><br /> </record> <!-- --><br /> </data><br /></openerp>
view.xml中<br /> <button name="be_normal" string="晋升为正式义工" states="new" icon="gtk-convert"/><br /> <button name="be_advanced" string="晋升为高级义工" states="normal" icon="gtk-convert"/><br />
-
把state字段中的readonly属性去掉。(不好意思,楼上的写法没错,selection 字段加readonly属性在这里完全没错)
楼主最后证实自己的代码完全无误。