ایجاد یک اکشن کلاینت¶
یک اکشن کلاینت، اکشنی را فعال میکند که کاملاً در سمت کلاینت پیادهسازی شده است. یکی از مزایای استفاده از اکشن کلاینت، توانایی ایجاد رابطهای بسیار سفارشی بهسادگی است. یک اکشن کلاینت معمولاً با یک کامپوننت OWL تعریف میشود؛ همچنین میتوانیم از فریمورک وب و سرویسها، کامپوننتهای اصلی، hookها و... استفاده کنیم.
اکشن کلاینت را ایجاد کنید، فراموش نکنید که آن را قابل دسترسی کنید.
<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>