[追加]メニューボタンでodooビュー「アクション」:ケース

################################################## ################################# 
#odoo一般的に使用される方法、アクションの[追加]ボタン:バルク・オペレーション・
#の
# ################################################## ################################

インポート再
インポートのJSON
のインポートログ

lxmlのからインポートetree

odooのからインポートAPI 、フィールド、モデル

= logging.getLoggerの_logger(__ name__)





クラスResUser(models.Model):
_inherit = 'res.users' @のapi.multiのDEFのbatch_select_action(セルフ):受注のため自己:"" "機能コードが書かれているあなたが達成したいです。" 「」パス














対応するXMLケース#action
追加ウィザードのプルダウン操作で#を:ケース2:直接実行機能002 ---

<レコードID = model_res_users_submit_action_server」モデル= 「ir.actions.server」>
<フィールド名= 「名前」>マネージャー提出</フィールド>に
<フィールド名= "タイプ"> ir.actions.server </フィールド>
<フィールド名= "MODEL_ID" REF = "model_res_users" />
<フィールド名= "国家">コード</フィールド>
<フィールド名= "コード">
レコードIF:
アクション=レコードbatch_select_action()
</フィールド>
</録音>

<レコードID = "action_ res_users_submit」モデル= "ir.valuesは">
<フィールド名= "名前">マネージャーに提出</フィールド>
<フィールド名= "MODEL_ID" REF = "model_res_users "/> <フィールド名=
"モデル"> res.users </フィールド> <フィールド名=
"キー2"> client_action_multi </フィールド> <フィールドのeval =
" 'ir.actions.server、%D' %model_res_users_submit_action_server"名前= "値" /> </記録>









アクションの製造におけるXMLで#:

00001 --- odoo12の場合、利用可能odoo10ある

「「」
:ウィザードでアクションを追加し、1取り出しウィザードウィザードのアクションのドロップダウンを追加

」action_export_wizard以上= IDを述べたact_window <「
=名前」輸出エクセル「
src_model =」res.users「モデル#
export.test.wizard」#メニューウィザードモデルオープンするres_model =は「
木「view_mode =」= view_type」フォーム「# ビュー
ターゲット=」新しい「/>#新しいをインターフェース

<レコードID = "export_wizard_view"モデル= "ir.ui.view">
<フィールド名= "名前">エクスポートテストウィザード</フィールド>
<フィールド名= "モデル"> export.test.wizard </フィールド>
<フィールド名= "アーチ"タイプ= "XML">
<フォーム文字列= "輸出実績">
<フッタ>
<ボタンの文字列= "確認"クラス= "BTN-プライマリ"名= "action_export"タイプ= "オブジェクト" />
<ボタンの文字列= "キャンセル"クラス= "BTN-デフォルトの"特別な= "キャンセル" />
</フッタ>
</フォーム>
</フィールド>
</録音>


「」「




#1 odoo10が利用可能で、検証するodoo12あり
00002#
ケース2:#ウィザードの作用によって、ドロップダウンを追加する機能を直接実行


<レコードID = 」action_assign_salesman_according_assigned_pa​​rtner「モデル= "ir.actions.server">
<フィールド名= "名前">割り当てセールスマン</フィールド>
<フィールド名= "MODEL_ID" REF = "model_crm_lead" />
<フィールド名= "状態">コード</フィールド>
<フィールド名= "コード">
env.context.get(IF 'active_domain'):
レコード= model.search(env.context [ 'active_domain'])
レコード。assign_salesman_of_assigned_pa​​rtner()
</フィールド>
</記録>

<レコードモデル="ir.values" ID = "ir_assign_salesman_according_assigned_pa​​rtner">
<フィールド名= "MODEL_ID" REF = "model_crm_lead" />
<フィールド名= "名前">割り当てられたパートナーのセールスマンを割り当て</フィールド>
<フィールド名= "キー2"> client_action_multi </フィールド>
<フィールドのeval = " 'ir.actions.server、%D' %action_assign_salesman_according_assigned_pa​​rtner"名= "値" />
<フィールド名= "キー">アクション</フィールド>
<フィールド名= "モデル" > crm.lead </フィールド>
</記録>






おすすめ

転載: www.cnblogs.com/1314520xh/p/11257333.html