Skip to content
Snippets Groups Projects
currency.py 1.33 KiB
Newer Older
##############################################################################
#
#    ICU Format, a module for Odoo
Vincent Hatakeyama's avatar
Vincent Hatakeyama committed
#    Copyright (C) 2021, 2022 XCG Consulting <https://xcg-consulting.fr/>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from typing import Mapping

from odoo import models


class Currency(models.Model):
    """Inject the currency name in the locale."""

    _inherit = "res.currency"

    def icu_format_locale_kwargs(self) -> Mapping[str, str]:
        """Inject the currency in the dict"""
        locale_kwargs = super().icu_format_locale_kwargs()
        locale_kwargs["currency"] = self.name
        return locale_kwargs