0
我試圖編輯我的假期工作流程並向上做'驗證'狀態它工作正常。但是隨後我添加了帶有轉換的新節點,然後轉換按鈕不會驗證工作流程。請幫助我,相關代碼如下。Openerp工作流程不顯示最後一個轉換按鈕
最後兩個節點 - hr_holidays_workflow.xml
<record model="workflow.activity" id="act_validate"> <!-- accepted -->
<field name="wkf_id" ref="wkf_holidays" />
<field name="name">validate</field>
<field name="kind">function</field>
<field name="action">holidays_validate()</field>
</record>
<record model="workflow.activity" id="act_new_validate"> <!-- last -->
<field name="wkf_id" ref="wkf_holidays" />
<field name="name">new_validate</field>
<field name="kind">function</field>
<field name="action">action_new_function()</field>
</record>
最後過渡
<record model="workflow.transition" id="holiday_new_validate">
<field name="act_from" ref="act_validate" />
<field name="act_to" ref="act_new_validate" />
<field name="signal">signal_last_validate</field>
<field name="group_id" ref="base.group_hr_user"/>
</record>
轉移按鈕 - HR_ holidyas_view.xml
<button string="Approved" type="workflow" name="last_validate" states="new_validate" class="oe_highlight"/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirm,validate,new_validate" statusbar_colors='{"confirm":"blue","validate1":"blue","new_validate":"blue","refuse":"red"}'/>
國家申報 - hr_holidays.py
'state': fields.selection([('draft', 'To Submit'), ('cancel', 'Cancelled'),('confirm', 'To Approve'), ('refuse', 'Refused'), ('validate2', 'First Approval'),('validate1', 'Second Approval'), ('validate', 'Approval'),('new_validate','Appl')],
'Status', readonly=True, #track_visibility='onchange',
功能 - hr_holidays.py
def action_new_function(self, cr, uid, ids, context=None):
res = self.write(cr, uid, ids, {'state': 'last_validate'}, context=context)
return res
UI 只有拒絕按鈕是不存在的「signal_last_validate」按鈕