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
Overlay
  • Accordion Item
  • Barcode Dialog
  • Bottom Sheet
  • Calendar Common Popover
  • Calendar Year Popover
  • Confirmation Dialog
  • Date Time Picker Popover
  • dialog
  • Domain Selector Dialog
  • Dropdown
  • Dropdown Group
  • Dropdown Item
  • Dropdown Popover
  • Error504 Dialog
  • Error Dialog
  • Export Data Dialog
  • Expression Editor Dialog
  • Form Error Dialog
  • Form View Dialog
  • Kanban Column Examples Dialog
  • Kanban Cover Image Dialog
  • Kanban Dropdown Menu Wrapper
  • List Confirmation Dialog
  • Model Field Selector Popover
  • Multi Create Popover
  • Multi Currency Popover
  • popover
  • Redirect Warning Dialog
  • Res User Group Ids Popover
  • Scss Error Display
  • Select Create
  • Select Create Dialog
  • Session Expired Dialog
  • Signature Dialog
  • Warning Dialog
  1. Components
  2. Multi Currency Popover
OWL overlay

Multi Currency Popover

Odoo 19 OWL component — Multi Currency Popover (views)

Live preview Interactive
Source excerpt web/static/src/views/view_components/multi_currency_popover.js
import { Component, onWillStart, useExternalListener, useState } from "@odoo/owl";
import { getCurrency, getCurrencyRates } from "@web/core/currency";
import { user } from "@web/core/user";
import { useService } from "@web/core/utils/hooks";
import { formatMonetary } from "../fields/formatters";

export class MultiCurrencyPopover extends Component {
    static template = "web.MultiCurrencyPopover";
    static props = {
        close: Function,
        currencyIds: Array,
        target: HTMLElement,
        value: Number,
    };

    setup() {
        this.orm = useService("orm");
        this.defaultCurrency = user.activeCompany.currency_id;
        this.state = useState({ rates: null });
        onWillStart(async () => {
            this.state.rates = await getCurrencyRates();
        });
        useExternalListener(window, "mouseover", (ev) => {
            if (ev.target !== this.props.target) {
                this.props.close();
            }
        });
    }

    get currencies() {
        return this.props.currencyIds.reduce((currencies, currencyId) => {
            if (currencyId !== this.defaultCurrency) {
                currencies.push({
                    ...getCurrency(currencyId),
                    id: currencyId,
                    rate: this.state.rates[currencyId],
                    value: this.props.value / this.state.rates[currencyId],
                });
            }
            return currencies;
        }, []);
    }

    formatedValue(value, currencyId) {
        return formatMonetary(value, { currencyId });
    }
}
Registry / API
Registry name
MultiCurrencyPopover
Category
—
Module
web
Slug
multi-currency-popover
Nav group
overlay
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