OdooWiki OCA HUB

Thai Localization - Convert Amount Text to Thai

l10n_th_amount_to_text folder_open OCA/l10n-thailand open_in_new
Localization License: AGPL-3

Odoo's core functionality includes the amount_to_text function, which converts numerical amounts into text based on the user's language settings or context. However, this conversion may produce incorrect results for Thai.

Example:

  • Amount: 45.75 Baht
  • User Language: Thai → สี่สิบห้า Baht และ เจ็ดสิบห้า Satang
  • User Language: English → Forty-Five Baht and Seventy-Five Satang

These results are inaccurate for Thai language formatting. This module provides a base for accurately converting numbers to Thai text.

auto_awesome What this module does

AI-generated from the code · Odoo 20.0

Converts a monetary amount into Thai words (Baht and Satang) when the user's language is Thai, so printed documents show the amount spelled out correctly in Thai instead of a wrong translation.

This module improves how Odoo writes amounts in words when the user's language is Thai. It changes the currency model (res.currency) so that the standard amount-in-words function produces proper Thai text.

  • When the language is Thai, a Thai Baht amount is spelled out using Thai number words in currency form, for example the whole Baht part followed by the Satang part.
  • For other currencies (such as US Dollars or Euros), the currency name and subunit name are translated into Thai (Dollars, Euros, Cents) before being added after the spelled-out number.
  • If the amount has no fraction (no Satang or cents), the subunit part is left out.
  • When the language is not Thai, the module does nothing and Odoo's normal behaviour is kept.

On installation, the module automatically activates the Thai language in Odoo if it exists but was switched off, so the conversion can work right away.

There are no new menus, screens or buttons. The change is visible wherever Odoo prints an amount in words, such as reports that show the total spelled out. It only touches the currency model and relies on the Thai language being available in the system.

Depends on

base
Models and fields (1)
  • res.currency · extends an existing model

Text generated by AI (DeepSeek) from reading the Odoo 20.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: 8 confirmed, 1 with no information of 9 versions.

Sources · Odoo 20.0

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

terminal Installation and usage

OCA documentation · Odoo 20.0

The amount_to_text function in the res.currency model allows you to convert amounts into text. Below is an example of how to use it in a QWEB report:

Example Usage:

<t t-foreach="docs" t-as="o">
    <t t-set="currency" t-value="o.currency_id"/>


    <t t-out="currency.with_context({'lang': 'th_TH'}).amount_to_text(45.75)"/>


    <t t-out="currency.amount_to_text(45.75)"/>
</t>

Results Based on Context:

  • When lang=th_TH context is sent:
  • Currency: THB → สี่สิบห้าบาทเจ็ดสิบห้าสตางค์
  • Currency: EUR → สี่สิบห้ายูโรเจ็ดสิบห้าเซนต์
  • Currency: USD → สี่สิบห้าดอลลาร์เจ็ดสิบห้าเซนต์
  • When no context is sent: Odoo's default logic will handle the conversion.

Important Notes:

Ensure the Thai language (th_TH) is activated in your system before using the lang='th_TH' context.

Before sending the context with th_TH language, If it is not activated, combining the th_TH language context with non-THB currencies may result in errors.

No verified information in OCA: Installation, Configuration.

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.