Skip to Content
Logo of RG Logo of RG
  • Home
  • Shop
  • Events
  • Courses
  • Company
    • News
    • Success Stories
  • Odoo Docs 19
  • Appointment
  • Jobs
  • Contact us
  • 0
  • 0
  • +1 555-555-5556
  • Sign in
Logo of RG Logo of RG
  • 0
  • 0
    • Home
    • Shop
    • Events
    • Courses
    • Company
      • News
      • Success Stories
    • Odoo Docs 19
    • Appointment
    • Jobs
    • Contact us
  • +1 555-555-5556
  • Sign in
Odoo Docs 19
Home Components Guides Classes Search
418 components
Data Display
  • action
  • Action Container
  • Action Helper
  • Action Menus
  • Animated Number
  • Attach Document
  • Attach Document Widget
  • Barcode Video Scanner
  • Base Settings
  • Block UI
  • Block UI
  • Breadcrumbs
  • Burger Menu
  • Button Box
  • calendar
  • Calendar Common Renderer
  • Calendar Controller
  • Calendar Filter Section
  • Calendar Mobile Filter Panel
  • Calendar Quick Create
  • Calendar Renderer
  • Calendar Side Panel
  • Calendar Year Renderer
  • Code Editor
  • Color List
  • Column Progress
  • command
  • Command Palette
  • Control Panel
  • Copy Button
  • Crop Overlay
  • currency
  • Custom Favorite Item
  • Custom Group By Item
  • Debug Menu Basic
  • Default Command Item
  • Demo Data
  • Display Exception
  • Display Notification
  • Documentation Link
  • Domain Selector
  • Dropzone
  • effect
  • emoji
  • Emoji Picker
  • error
  • Error Handler
  • Export All
  • Expression Editor
  • field
  • File Upload
  • File Upload Progress Bar
  • File Upload Progress Container
  • File Upload Progress Record
  • File Viewer
  • form
  • Form Controller
  • Form Label
  • Form Renderer
  • Form Status Indicator
  • Graph Controller
  • Graph Renderer
  • Group Config Menu
  • Highlight Text
  • home
  • hotkey
  • Hotkey Command Item
  • http
  • Input
  • In Range
  • Install Kiosk
  • Install Kiosk Pwa
  • Install Prompt
  • Install Scoped App
  • Install Scoped App
  • kanban
  • Kanban Column Quick Create
  • Kanban Controller
  • Kanban Header
  • Kanban Quick Create Controller
  • Kanban Record
  • Kanban Record Quick Create
  • Kanban Renderer
  • Lazy Component
  • Lazy Session
  • list
  • List Controller
  • List Renderer
  • Loading Indicator
  • Loading Indicator
  • localization
  • Main Components Container
  • menu
  • Model Field Selector
  • Model Selector
  • Multi Record Selector
  • Multi Selection Buttons
  • name
  • Name And Signature
  • Notebook
  • orm
  • Overlay Container
  • Pager
  • Pager Indicator
  • Pager Indicator
  • Pivot Controller
  • Pivot Renderer
  • profiling
  • Profiling Item
  • Properties Group By Item
  • Rainbow Man
  • Range
  • Record Selector
  • reload
  • reload Company
  • Reload Context
  • Report Action
  • Report View Measures
  • Res Config Dev Tool
  • Res Config Edition
  • Res Config Invite Users
  • Resizable Panel
  • Ribbon Widget
  • Search Bar
  • Search Bar Menu
  • Search Bar Toggler
  • Search Panel
  • Select
  • Selection Box
  • Select Menu
  • Setting
  • Settings App
  • Settings Block
  • Settings Page
  • share Target
  • signature
  • Signature Widget
  • Soft Reload
  • sortable
  • Status Bar Buttons
  • swallow All Visitor Errors
  • Switch Company Item
  • Switch Company Menu
  • Switch Company Menu
  • Tags List
  • Time Picker
  • title
  • Transition
  • Tree Editor
  • Tree Processor
  • ui
  • User Invite
  • User Menu
  • User Menu
  • User Switch
  • User Switch
  • view
  • View Button
  • View Scale Selector
  • Web Client
  • Web Ribbon
  • Week Days
  • Widget
  • With Search
  1. Components
  2. action
services data_display

action

Odoo 19 services — action (webclient)

Live preview Interactive
Source excerpt web/static/src/webclient/actions/action_service.js
import { _t } from "@web/core/l10n/translation";
import { browser } from "@web/core/browser/browser";
import { makeContext } from "@web/core/context";
import { useDebugCategory } from "@web/core/debug/debug_context";
import { evaluateExpr } from "@web/core/py_js/py";
import { rpc, rpcBus } from "@web/core/network/rpc";
import { registry } from "@web/core/registry";
import { user } from "@web/core/user";
import { Deferred, KeepLast } from "@web/core/utils/concurrency";
import { useBus, useService } from "@web/core/utils/hooks";
import { View, ViewNotFoundError } from "@web/views/view";
import { ActionDialog } from "./action_dialog";
import { ReportAction } from "./reports/report_action";
import { UPDATE_METHODS } from "@web/core/orm_service";
import { CallbackRecorder } from "@web/search/action_hook";
import { ControlPanel } from "@web/search/control_panel/control_panel";
import { PATH_KEYS, router as _router } from "@web/core/browser/router";

import {
    Component,
    markup,
    onMounted,
    onWillUnmount,
    onError,
    useChildSubEnv,
    xml,
    reactive,
    status,
} from "@odoo/owl";
import { downloadReport, getReportUrl } from "./reports/utils";
import { zip } from "@web/core/utils/arrays";
import { isHtmlEmpty } from "@web/core/utils/html";
import { omit, pick, shallowEqual } from "@web/core/utils/objects";
import { session } from "@web/session";
import { exprToBoolean } from "@web/core/utils/strings";

class BlankComponent extends Component {
    static props = ["onMounted", "withControlPanel", "*"];
    static template = "web.BlankComponent";
    static components = { ControlPanel };

    setup() {
        useChildSubEnv({ config: { breadcrumbs: [], noBreadcrumbs: true } });
        onMounted(() => this.props.onMounted());
    }
}

const actionHandlersRegistry = registry.category("action_handlers");
const actionRegistry = registry.category("actions");

/** @typedef {number|false} ActionId */
/** @typedef {Object} ActionDescription */
/** @typedef {"current" | "fullscreen" | "new" | "main" | "self"} ActionMode */
/** @typedef {string} ActionTag */
/** @typedef {string} ActionXMLId */
/** @typedef {Object} Context */
/** @typedef {Function} CallableFunction */
/** @typedef {string} ViewType */

/** @typedef {ActionId|ActionXMLId|ActionTag|ActionDescription} ActionRequest */

/**
 * @typedef {Object} ActionOptions
 * @property {Context} [additionalContext]
 * @property {boolean} [clearBreadcrumbs]
 * @property {CallableFunction} [onClose]
 * @property {Object} [props]
 * @property {ViewType} [viewType]
 * @property {"replaceCurrentAction" | "replacePreviousAction"} [stackPosition]
 * @property {number} [index]
 * @property {boolean} [newWindow]
 * @property {boolean} [forceLeave]
 */

export async function clearUncommittedChanges(env, { forceLeave } = {}) {
    const callbacks = [];
    env.bus.trigger("CLEAR-UNCOMMITTED-CHANGES", callbacks);
    const res = await Promise.all(callbacks.map((fn) => fn({ forceLeave })));
    return !res.includes(false);
}

export const standardActionServiceProps = {
    action: Object, // prop added by _getActionInfo
    actionId: { type: Number, optional: true }, // prop added by _getActionInfo
    className: { type: String, optional: true }, // prop added by the ActionContainer
    globalState: { type: Object, optional: true }, // prop added by _updateUI
    state: { type: Object, optional: true }, // prop added by _updateUI
    resId: { type: [Number, Boolean], optional: true },
    updateActionState: { type: Function, optional: true },
};

function parseActiveIds(ids) {
    const activeIds = [];
    if (typeof ids === "string") {
        activeIds.push(...ids.split(",").map(Number));
    } else if (typeof ids === "number") {
        activeIds.push(ids);
    }
    return activeIds;
}

const DIALOG_SIZES = {
    "extra-large": "xl",
    large: "lg",
    medium: "md",
    small: "sm",
};

// -----------------------------------------------------------------------------
// Errors
// -----------------------------------------------------------------------------

export class ControllerNotFoundError extends Error {}

export class InvalidButtonParamsError extends Error {}

// -----------------------------------------------------------------------------
// ActionManager (Service)
// -----------------------------------------------------------------------------
Registry / API
Registry name
action
Category
services
Module
web
Slug
action
Nav group
data_display
Follow us

250 Executive Park Blvd, Suite 3400
San Francisco CA 94134

  • +1 555-555-5556
  • info@yourcompany.example.com
Copyright © Company name
Powered by Odoo - The #1 Open Source eCommerce