Skip to main content
Odoo Community Association

Thai Localization - Base Utils Thai

Beta License: AGPL-3 OCA/l10n-thailand Translate me on Weblate Try me on Runboat

This module is a utility package for Thailand, providing helper functions commonly used in Thai-specific contexts.

It includes features such as:

  • Conversion between Arabic and Thai numerals

  • Thai month name and Buddhist calendar (Thai year) conversion

  • Thai font support:

    • Font THBaijam

    • Font THChakraPetch

    • Font THCharmofAU

    • Font THCharmonman

    • Font THFahKwang

    • Font THK2DJuly8

    • Font THKodchasal

    • Font THKoHo

    • Font THKrub

    • Font THMaliGrade6

    • Font THNiramitAS

    • Font THSarabun

    • Font THSarabunNew

    • Font THSrisakdi

Table of contents

Configuration

To configure the Thai font, go to Settings > General Settings > Business Documents > Configure Document Layout, then select the desired font and click Save.

Usage

This module provides a utility model thai.utils for Thai localization features such as number and date formatting. You can either call the methods directly via the environment, or inherit the abstract model in your own modules.

Example

thai_utils = self.env["thai.utils"]

# Convert Arabic to Thai numerals
thai_number = thai_utils.to_thai_number("1234567890")  # → ๑๒๓๔๕๖๗๘๙๐

# Convert Thai to Arabic numerals
arabic_number = thai_utils.to_arabic_number("๐๘๙")  # → 089

# Get Thai full month name
month_name = thai_utils.thai_month_name(12)  # → ธันวาคม

# Get Thai abbreviated month name
month_abbr = thai_utils.thai_month_name(12, short=True)  # → ธ.ค.

# Format date to Thai date string
from datetime import date

formatted_date = thai_utils.format_thai_date(date(2025, 7, 2))  # → 2 กรกฎาคม 2568

formatted_date_short_month = thai_utils.format_thai_date(date(2025, 7, 2), month_format="short")  # → 2 ก.ค. 2568

formatted_date_numeric_month = thai_utils.format_thai_date(date(2025, 7, 2), month_format="numeric", format_date="{day:02d}{month}{year}")  # → 02072568

formatted_year_thai = thai_utils.format_thai_date(date(2025, 7, 2), format_date="{year}")  # → 2568

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

Do not contact contributors directly about support or help with technical issues.

Credits

Authors

  • Ecosoft

Contributors

Maintainers

This module is maintained by the OCA.

Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainer:

Saran440

This module is part of the OCA/l10n-thailand project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Metadata

Release files for odoo-addon-l10n-th-base-utils 19.0.2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for odoo-addon-l10n-th-base-utils 19.0.2.0.0
File Interpreter ABI Platform
odoo_addon_l10n_th_base_utils-19.0.2.0.0-py3-none-any.whl Python 3 none any Details

Release files / odoo_addon_l10n_th_base_utils-19.0.2.0.0-py3-none-any.whl

Download URL odoo_addon_l10n_th_base_utils-19.0.2.0.0-py3-none-any.whl
Size 3.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
3fd5a9f84c339c1f9dc671002690d2d3cd4fa22fba88476cf818273205dd8746
BLAKE2b-256 checksum
How to use checksums
47f8772fe3c9d88862c464fa4707bee6560ff512bc885319617fec205d24eb01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

19.0.2.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page