小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

openERP server action,最強大的功能,沒有之一

 gastonfeng 2016-08-22

 Jeffery9@gmail.com 出品

@jeffery-陳帆

原理

ations

OE定義了ir.actions.actions,并從中派生了眾多的子類

  • ir.actions.client
  • ir.actions.act_url
  • ir.actions.act_window
  • ir.actions.act_window_close
  • ir.actions.wizard
  • ir.actions.server

用來執(zhí)行相關(guān)的動作

   

Server action

其中有一個子類 ir.actions.server ,可以用來執(zhí)行服務(wù)器端的動作。

可以執(zhí)行的動作有;

'state': fields.selection([

('client_action','Client Action'),

('dummy','Dummy'),

('loop','Iteration'),

('code','Python Code'),

('trigger','Trigger'),

('email','Email'),

('sms','SMS'),

('object_create','Create Object'),

('object_copy','Copy Object'),

('object_write','Write Object'),

('other','Multi Actions'),

], 'Action Type', required=True, size=32, help="Type of the Action that is to be executed"),

   

   

可以用來干各種事情

   

Automated Action Rules

模塊定義了 自動動作規(guī)則

-針對什么對象

-條件

-動作 ,即server_action定義的動作

   

何時觸發(fā)

  • 定時器觸發(fā)
  • 注入到對象的create/write方法中

   

使用場景

例如,

  • 當有任務(wù)指派時,發(fā)送通知郵件給被指派的人
  • 定時提醒
  • 接收到郵件時,創(chuàng)建對象實例

   

實際操作

建立server_actions.

菜單 Settings/ Technical/ Actions/ Server Actions

   

create一個新的action

object處選擇Task, project.task

Action type選擇Email

其中可以選的action有很多,如下

   

定制郵件內(nèi)容

  • 郵件接收人
  • 郵件主旨
  • 郵件內(nèi)容

   

提示,如果不清楚object的屬性,可以點擊彈出窗口按鍵,彈出Task定義窗口

   

   

設(shè)置好相關(guān)的參數(shù)后,保存

至此,server_action設(shè)置好了。

   

設(shè)置automatic action rule以便可以觸發(fā)動作。

菜單 Settings/ Technical/ Automated Actions/ Automated Actions

   

create一個automatic action rule.

輸入規(guī)則名稱

選擇相應(yīng)的對象,在此選擇task ,即project.task

   

設(shè)置conditions

目的,用來過濾哪些對象可以執(zhí)行服務(wù)器動作

說明;

Timer如果不設(shè)置,則當crete/update Object時觸發(fā)服務(wù)器動作;否則,按照定時器設(shè)定的時間觸發(fā),但是會按照trigger date設(shè)置的參數(shù)篩選相應(yīng)的對象實例。

   

   

設(shè)置actions

點擊Add按鈕,在彈出窗選擇已經(jīng)創(chuàng)建的server action或者建立新的server action.

   

提示;

可以添加多個動作,動作按sequence順序執(zhí)行

   

   

注意;

Fields to change. 是指 change the fields of the object.

Add Followers,是指 為此 instance of object指派 訂閱者(但有條件,具體看代碼 ;))

   

定時任務(wù)

Automatic action rules是由 ir.cron定期執(zhí)行的,如

   

   

附加說明

   

   

注入到對象創(chuàng)建、修改方法的代碼

   

修改create方法

   

修改write方法

   

執(zhí)行動作時,修改 Fields to change 和Add Follower的相關(guān)代碼

   

   

   

總結(jié);

   

  • 如果使用filter. 不要給 filter指定 res.user !!! 否則會有權(quán)限問題發(fā)生?。?!

   

  • 如果設(shè)置了timer. 則不注入到model,不觸發(fā)動作

       

   

   

  • 如果設(shè)置了timer. 時間條件不成熟時,不觸發(fā)動作

       

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多