OdooWiki OCA HUB

Thai Localization - Base Utils Thai

l10n_th_base_utils folder_open OCA/l10n-thailand open_in_new
Tools License: AGPL-3

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

auto_awesome What this module does

AI-generated from the code · Odoo 19.0

Adds Thai fonts to Odoo reports and provides helpers to convert numbers, months and dates into Thai format, including Buddhist calendar years.

This module is a utility package for Thai localization. It does not add new menus or screens; instead it extends existing configuration and adds reusable conversion helpers.

  • On the company settings, a new font selection is available with many Thai fonts (for example THSarabun, THSarabunNew, THNiramitAS, THKrub, THFahKwang, THChakraPetch), each with bold and italic variants where provided. These fonts are loaded into the common report assets, so they can be used in printed documents and reports.
  • A technical helper model thai.utils provides four conversion methods: converting Arabic digits to Thai digits, converting Thai digits back to Arabic digits, getting the Thai name of a month (full or abbreviated), and formatting a date or datetime into a Thai-style string. The date formatter can use full month names, short month names or numeric months, can switch between Buddhist year (พ.ศ., year + 543) and Christian year, can use a custom date pattern, and can optionally append a time.

The module touches res.company (adding the font field) and the abstract model thai.utils. It depends on the web module and is meant as a base for other Thai localization modules rather than for direct end-user interaction.

Depends on

web
Models and fields (2)
  • thai.utils · new model
  • res.company · extends an existing modelfont

Text generated by AI (DeepSeek) from reading the Odoo 19.0 code on GitHub; it may contain mistakes, so check the code before deciding. View the code on GitHub

Availability by version

Reviewed: 2026-11-03
Confirmed (verified in repository and branch) Estimated (unverified) No information

Confirmation status: 2 confirmed, 7 with no information of 9 versions.

Sources · Odoo 19.0

Confirmed on 2026-11-03 in branch 19.0 of OCA/l10n-thailand.

terminal Installation and usage

OCA documentation · Odoo 19.0

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

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

No verified information in OCA: Installation.

info

Data imported from GitHub: this sheet reflects the latest catalog review, not a live lookup. Always check the module documentation and staging before installing in production.