Use [] to find tag! Example: [flutter, javascript]

Odoo - Action Window

Odoo - Action Window

Artikel ini dibukukan pada buku Odoo ERP Development
access_time 22 January 2025 remove_red_eye 450 Kali spellcheck 286 Kata, 2278 Karakter
#odoo #action #ir.act.window

    ir.act.window, often known as “Action,” is one of the core components in the Odoo framework. This component is used to direct users to a specific view in the user interface. With ir.act.window, developers can define how data from a model will be displayed to the user, whether in the form of a list, form, kanban, diagram, or other types of views.

    ir.act.window Usage

    ir.act.window works for:

    1. Defines how data from the model is displayed.
    2. Linking the menu to the model view.
    3. Set the relevant context, domain, or filter for the model.

    This action provides developers with flexibility in creating interactive and efficient navigation across application modules.

    ir.act.window Attribute Structure

    1. Name (name)

    The name of the action that will be visible in the user interface.

    Example: "Product List"

    2. Model (res_model)

    The model whose data will be displayed by this action.

    Example: "product.product"

    3. View Mode (view_mode)

    The type of display to be used, such as:

    1. tree for list.
    2. form for form.
    3. kanban for kanban UI.
    4. Example: "tree,form"

    4. Domain (domain)

    Filters applied to display specific data.

    1. Example: [('active', '=', True)]

    5. Context (context)

    Additional parameters applied to the view or model.

    1. Example: {'default_type': 'service'}

    6. View ID (view_id)

    A reference to a specific view to use.

    1. example: ref('module_name.view_form_product')

    7. Target (target)

    How the view will open:

    1. current: Change the current view.
    2. new: Opens the view in pop-up or dialog mode.
    3. Example: "current"

    XML Implementation Example

    Here is an example of how ir.act.window is defined in an XML file:

    <record id="action_product_list" model="ir.actions.act_window">
        <field name="name">Product List</field>
        <field name="res_model">product.product</field>
        <field name="view_mode">tree,form</field>
        <field name="domain">[("active", "=", True)]</field>
        <field name="context">{}</field>
        <field name="target">current</field>
    </record>

    Explanatin:

    1. ID: action_product_list is a unique identifier for this action.
    2. Model: Data is taken from the product.product model.
    3. View Mode: Display in the form of a list (tree) and form.
    4. Domain: Only display active products 
    5. Target: The display replaces the active screen
Artikel ini dibukukan pada buku Odoo ERP Development
Navigasi Konten