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
Forms
  • Account Json Checkboxes
  • Ace
  • Ace Field
  • Allowed Qweb Expressions
  • Attachment Image
  • Attachment Image Field
  • Badge
  • Badge Field
  • Badge Selection Field
  • Binary
  • Binary
  • Binary
  • Binary Field
  • Boolean
  • Boolean Favorite
  • Boolean Favorite Field
  • Boolean Field
  • Boolean Icon
  • Boolean Icon Field
  • Boolean Toggle
  • Boolean Toggle
  • boolean Toggle Field
  • calendar Properties Field
  • card Properties Field
  • Char
  • Char Field
  • Code
  • Code Ir Ui View
  • Color
  • Color Field
  • Color Picker
  • Color Picker Field
  • Contact Image
  • contact Image Field
  • Contact Statistics
  • Contact Statistics Field
  • Copyclipboardbutton
  • copy Clipboard Button Field
  • Copyclipboardchar
  • copy Clipboard Char Field
  • Copyclipboardurl
  • copy Clipboard URL Field
  • Dashboard Graph
  • date Field
  • date Range Field
  • Date Time Field
  • Domain
  • Domain Field
  • Dynamic Placeholder Popover
  • Email
  • Email
  • Email Field
  • Field Selector
  • Field Selector Field
  • File Uploader
  • Filterable Selection
  • filterable Selection Field
  • Float
  • Float Factor
  • float Factor Field
  • Float Field
  • Float Time
  • Float Time Field
  • Float Toggle
  • Float Toggle Field
  • form Email Field
  • form Phone Field
  • form Url Field
  • Gauge
  • Gauge Field
  • Google Slide Viewer
  • Handle
  • Handle Field
  • Html
  • html Field
  • Iframe Wrapper
  • Iframe Wrapper Field
  • Image
  • Image Field
  • Image Url
  • Image Url Field
  • Integer
  • Integer Field
  • ir Ui View Ace Field
  • Journal Dashboard Graph Field
  • Json
  • Json Checkboxes
  • Json Field
  • Kanban Color Picker
  • kanban Color Picker Field
  • kanban Many2 Many Tags Avatar Field
  • kanban Many2 Many Tags Field
  • Kanban Many2 One
  • Kanban Many2 One Avatar Field
  • kanban Progress Bar Field
  • Label Selection
  • Label Selection Field
  • list Badge Selection Field
  • list Binary Field
  • list Boolean Toggle Field
  • list Date Field
  • list Date Range Field
  • list Date Time Field
  • list Many2 Many Tags Avatar Field
  • list Text Field
  • List X2 Many Field
  • Many2many
  • Many2many
  • Many2many
  • Many2many Binary
  • Many2 Many Binary Field
  • Many2many Checkboxes
  • Many2 Many Checkboxes Field
  • Many2many Tags
  • Many2many Tags
  • Many2many Tags
  • Many2many Tags Avatar
  • Many2many Tags Avatar
  • Many2many Tags Avatar
  • many2 Many Tags Avatar Field
  • Many2many Tags Avatar Popover
  • Many2 Many Tags Field
  • Many2 One
  • Many2one
  • Many2one Avatar
  • Many2one Avatar
  • Many2 One Avatar Field
  • Many2one Barcode
  • Many2 One Barcode Field
  • Many2 One Field
  • Many2one Reference
  • Many2 One Reference Field
  • Many2one Reference Integer
  • Many2 X Autocomplete
  • Monetary
  • Monetary Field
  • One2many
  • One2many
  • One2many
  • Pdf Viewer
  • Pdf Viewer Field
  • Percentage
  • Percentage Field
  • Percentpie
  • Percent Pie Field
  • Phone
  • Phone
  • Phone Field
  • Priority
  • Priority Field
  • Profiling Qweb View
  • Progressbar
  • Progressbar
  • Progress Bar Field
  • Properties
  • Properties
  • Properties
  • Properties
  • Properties Field
  • Property Definition
  • Property Definition Selection
  • Property Tags
  • Property Tags Field
  • Property Text
  • Property Value
  • Radio
  • Radio
  • Radio Field
  • Reference
  • Reference Field
  • Remaining Days
  • Remaining Days Field
  • Res User Group Ids
  • Res User Group Ids Privilege
  • Selection
  • Selection Badge
  • Selection Badge
  • Selection Badge With Filter
  • Selection Field
  • settings Radio Field
  • Signature Field
  • State Selection
  • State Selection Field
  • Statinfo
  • Stat Info Field
  • Statusbar
  • Status Bar Field
  • Text
  • Text
  • Text Field
  • Timezone Mismatch
  • timezone Mismatch Field
  • Translation Button
  • Translation Dialog
  • Upgrade Boolean
  • upgrade Boolean Field
  • Upgrade Dialog
  • Url
  • Url
  • Url Field
  • X2 Many Field
  • X2 Many Field Dialog
  1. Components
  2. Kanban Many2 One
OWL forms

Kanban Many2 One

Odoo 19 OWL component — Kanban Many2 One (views)

Live preview Interactive
Source excerpt web/static/src/views/fields/many2one/many2one.js
import { Component, toRaw, useRef, useState } from "@odoo/owl";
import * as BarcodeScanner from "@web/core/barcode/barcode_dialog";
import { isBarcodeScannerSupported } from "@web/core/barcode/barcode_video_scanner";
import { isMobileOS } from "@web/core/browser/feature_detection";
import { makeContext } from "@web/core/context";
import { _t } from "@web/core/l10n/translation";
import { usePopover } from "@web/core/popover/popover_hook";
import { evaluateBooleanExpr } from "@web/core/py_js/py";
import { useService } from "@web/core/utils/hooks";
import { getFieldDomain } from "@web/model/relational_model/utils";
import { Many2XAutocomplete, useOpenMany2XRecord } from "../relational_utils";

///////////////////////////////////////////////////////////////////////////////
// UTILS
///////////////////////////////////////////////////////////////////////////////

function extractData(record) {
    let name;
    if ("display_name" in record) {
        name = record.display_name;
    } else if ("name" in record) {
        name = record.name.id ? record.name.display_name : record.name;
    }
    return { id: record.id, display_name: name };
}

export function computeM2OProps(fieldProps) {
    const computeLinkCssClass = () => {
        const evalContext = fieldProps.record.evalContextWithVirtualIds;
        for (const decorationName in fieldProps.decorations) {
            if (evaluateBooleanExpr(fieldProps.decorations[decorationName], evalContext)) {
                return `text-${decorationName}`;
            }
        }
        return "";
    };

    return {
        canCreate: fieldProps.canCreate,
        canCreateEdit: fieldProps.canCreateEdit,
        canOpen: fieldProps.canOpen,
        canQuickCreate: fieldProps.canQuickCreate,
        canScanBarcode: fieldProps.canScanBarcode,
        canWrite: fieldProps.canWrite,
        context: fieldProps.context,
        domain: () => getFieldDomain(fieldProps.record, fieldProps.name, fieldProps.domain),
        id: fieldProps.id,
        linkCssClass: computeLinkCssClass(),
        nameCreateField: fieldProps.nameCreateField,
        openActionContext: () => {
            const { context, name, openActionContext, record } = fieldProps;
            return makeContext(
                [openActionContext || context, record.fields[name].context],
                record.evalContext
            );
        },
        placeholder: fieldProps.placeholder,
        readonly: fieldProps.readonly,
        relation: fieldProps.record.fields[fieldProps.name].relation,
        searchThreshold: fieldProps.searchThreshold,
        preventMemoization: fieldProps.preventMemoization,
        string: fieldProps.string || fieldProps.record.fields[fieldProps.name].string || "",
        update: (value, options = {}) =>
            fieldProps.record.update({ [fieldProps.name]: value }, options),
        value: toRaw(fieldProps.record.data[fieldProps.name]),
    };
}

///////////////////////////////////////////////////////////////////////////////
// Components
///////////////////////////////////////////////////////////////////////////////

export class Many2One extends Component {
    static template = "web.Many2One";
    static components = { Many2XAutocomplete };
    static props = {
        canCreate: { type: Boolean, optional: true },
        canCreateEdit: { type: Boolean, optional: true },
        canOpen: { type: Boolean, optional: true },
        canQuickCreate: { type: Boolean, optional: true },
        canScanBarcode: { type: Boolean, optional: true },
        canWrite: { type: Boolean, optional: true },
        context: { type: Object, optional: true },
        createAction: { type: Function, optional: true },
        cssClass: { type: String, optional: true },
        domain: { type: Function, optional: true },
        id: { type: String, optional: true },
        linkCssClass: { type: String, optional: true },
        nameCreateField: { type: String, optional: true },
        openActionContext: { type: Function, optional: true },
        openRecordAction: { type: Function, optional: true },
        otherSources: { type: Array, optional: true },
        placeholder: { type: String, optional: true },
        readonly: { type: Boolean, optional: true },
        relation: { type: String },
        searchMoreLabel: { type: String, optional: true },
        searchThreshold: { type: Number, optional: true },
        preventMemoization: { type: Boolean, optional: true },
        slots: { type: Object, optional: true },
        specification: { type: Object, optional: true },
        string: { type: String, optional: true },
        update: { type: Function },
        value: { type: [Array, Object, { value: false }], optional: true },
    };
    static defaultProps = {
        canCreate: true,
        canCreateEdit: true,
        canOpen: true,
        canQuickCreate: true,
        canScanBarcode: false,
        canWrite: true,
        context: {},
        domain: [],
        linkCssClass: "",
        nameCreateField: "name",
        otherSources: [],
        placeholder: "",
        readonly: false,
        string: "",
    };
Registry / API
Registry name
KanbanMany2One
Category
—
Module
web
Slug
kanban-many2-one
Nav group
forms
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