クライアントアクションを作成¶
クライアントアクションは、クライアント側に完全に実装されたアクションをトリガーします。 クライアントアクションを使用する利点の1つは、高度にカスタマイズされたインターフェイスを簡単に作成できることです。 クライアントアクションは通常、OWLコンポーネントによって定義されます。Webフレームワークを使用し、サービス、コアコンポーネント、フックを使用することもできます。
:ref:`client action <reference/actions/client>`を作成します。
<record model="ir.actions.client" id="my_client_action"> <field name="name">My Client Action</field> <field name="tag">my_module.MyClientAction</field> </record>
クライアントアクションを表すコンポーネントを作成します。
my_client_action.js
¶import { registry } from "@web/core/registry"; import { Component } from "@odoo/owl"; class MyClientAction extends Component { static template = "my_module.clientaction"; } // remember the tag name we put in the first step registry.category("actions").add("my_module.MyClientAction", MyClientAction);
my_client_action.xml
¶<?xml version="1.0" encoding="UTF-8" ?> <templates xml:space="preserve"> <t t-name="awesome_tshirt.clientaction"> Hello world </t> </templates>