odoo 在原有工作流中新增審批流

2022-05-03 00:54:06 字數 3402 閱讀 3452

odoo 在原有工作流中新增審批流

步驟:1、加入所需的工作流節點以及相連的線(即所新增的審批流),**如下:

1

<?xml version="

1.0" encoding="

utf-8

"?>23

4"" model="

workflow.activity

">5"

wkf_id

"ref="

sale.wkf_sale

"/>6"

name7"

kind

">function8"

action

">start_base_workflow()910

11"" model="

workflow.transition

">12"

act_from

"ref="

sale.act_draft

"/>13"

act_to

"ref="

"/>14"

signal

151617"

" model="

workflow.transition

">18"

act_from

"ref="

"/>19"

act_to

"ref="

sale.act_router

"/>20"

condition21"

signal

"/>22"

group_id

"ref=""/>

232425"

sale.trans_sent_router

" model="

workflow.transition

">26"

act_from

"ref="

sale.act_sent

"/>27"

act_to

"ref="

"/>28"

signal

2930

31

效果如下,

2、新增審批流的相關按鈕

5、在state中新增等待審批狀態

6、start_base_workflow函式啟動審批流

7、重寫相關審批流按鈕,根據自己所需來重寫

1

# 取消

[email protected]

3def action_cancel(self):

4for rec in

self:

5 rec.state = '

cancel'6

7# 完成

[email protected]

9def action_done(self):

10for rec in

self:

11 rec.state = '

done'12

13# 批准邏輯

[email protected]

1516

for rec in

self:

17 rec.state = '

'18 self.signal_workflow('')

1920

# 拒絕邏輯

[email protected]

22def action_refuse(self):

23for rec in

self:

24 rec.state = '

draft'25

26# 批准訂單

[email protected]

2829 requisition_order =self.browse(requisition_id)

30 requisition_order.write()

3132

# 拒絕訂單

[email protected]

3435 requisition_order =self.browse(requisition_id)

36requisition_order.action_refuse()

3738

# 拒絕按鈕邏輯

[email protected]

40def order_refuse_task(self):

41if

42 wkf_task_obj = self.env['

hrp.base.wkf.task']

43refuse')

44else:45

return

true

4647

# 審批按鈕邏輯

[email protected]

4950

if51 wkf_task_obj = self.env['

hrp.base.wkf.task']

52')53

else:54

return true

8、action_button_confirm方法為提交訂單按鈕,按下後將跳到審批流執行審批

1     def action_button_confirm(self, cr, uid, ids, context=none):

2 self.signal_workflow(cr, uid, ids, '')

3 self.write(cr, uid, ids, )

4return true

self.write(cr, uid, ids, ) :將state狀態改寫為'confirmed'

odoo 在原有工作流中新增審批流

odoo 在原有工作流中新增審批流 步驟 1 加入所需的工作流節點以及相連的線 即所新增的審批流 如下 1 1.0 encoding utf 8 23 4 model workflow.activity 5 wkf id ref sale.wkf sale 6 name7 kind function...

工作流和審批流

審批流是工作流比較簡單的應用。審批流的特點是乙個審批流模板相應一種單據。在審批流中僅處理單據的狀態,如審批通過 審批不通過 審批流中會用到單據資料,如條件中 各種須要引用單據變數的地方。審批流沒有涉及到多個單據之間的處理,因此審批流是相對簡單的。從業界的大多數工作流來看,也不過實現了審批流而已,比方...

Activiti 工作流引擎 獲取審批記錄

審批意見儲存在act hi comment表中 審批狀態儲存在act hi varinst表中,為任務變數 historyservice historyservice this.gethistoryservice taskservice taskservice this.gettaskservice...