Skip to content

Commit f8faad8

Browse files
committed
[ADD] web_date_format_numeric
Adds a **Use Numeric Date Format** field to `res.lang`. When enabled for a language, all `date` and `datetime` fields render in numeric format (e.g. `31/01/2026` instead of `Jan 31, 2026`). Go to **Settings → Translations → Languages**, open a language and toggle **Use Numeric Date Format** on or off.
1 parent aa8c591 commit f8faad8

14 files changed

Lines changed: 666 additions & 0 deletions

File tree

web_date_format_numeric/README.rst

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
5+
=======================
6+
Web Date Format Numeric
7+
=======================
8+
9+
..
10+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11+
!! This file is generated by oca-gen-addon-readme !!
12+
!! changes will be overwritten. !!
13+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14+
!! source digest: sha256:25b94735189b304ab6244a006ac3059a1a8450a7ef3c5ccd68244db07a028bf3
15+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16+
17+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
18+
:target: https://odoo-community.org/page/development-status
19+
:alt: Beta
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
21+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
22+
:alt: License: AGPL-3
23+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
24+
:target: https://github.com/OCA/web/tree/19.0/web_date_format_numeric
25+
:alt: OCA/web
26+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27+
:target: https://translation.odoo-community.org/projects/web-19-0/web-19-0-web_date_format_numeric
28+
:alt: Translate me on Weblate
29+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=19.0
31+
:alt: Try me on Runboat
32+
33+
|badge1| |badge2| |badge3| |badge4| |badge5|
34+
35+
Adds a **Use Numeric Date Format** field to ``res.lang``. When enabled
36+
for a language, all ``date`` and ``datetime`` fields render in numeric
37+
format (e.g. ``31/01/2026`` instead of ``Jan 31, 2026``).
38+
39+
**Table of contents**
40+
41+
.. contents::
42+
:local:
43+
44+
Configuration
45+
=============
46+
47+
Go to **Settings → Translations → Languages**, open a language and
48+
toggle **Use Numeric Date Format** on or off.
49+
50+
Bug Tracker
51+
===========
52+
53+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
54+
In case of trouble, please check there if your issue has already been reported.
55+
If you spotted it first, help us to smash it by providing a detailed and welcomed
56+
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_date_format_numeric%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
57+
58+
Do not contact contributors directly about support or help with technical issues.
59+
60+
Credits
61+
=======
62+
63+
Authors
64+
-------
65+
66+
* Camptocamp
67+
68+
Maintainers
69+
-----------
70+
71+
This module is maintained by the OCA.
72+
73+
.. image:: https://odoo-community.org/logo.png
74+
:alt: Odoo Community Association
75+
:target: https://odoo-community.org
76+
77+
OCA, or the Odoo Community Association, is a nonprofit organization whose
78+
mission is to support the collaborative development of Odoo features and
79+
promote its widespread use.
80+
81+
This module is part of the `OCA/web <https://github.com/OCA/web/tree/19.0/web_date_format_numeric>`_ project on GitHub.
82+
83+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright 2026 Camptocamp SA
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
from . import models
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2026 Camptocamp SA
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
{
5+
"name": "Web Date Format Numeric",
6+
"summary": "Display all date/datetime fields in numeric format",
7+
"version": "19.0.1.0.0",
8+
"author": "Camptocamp, Odoo Community Association (OCA)",
9+
"license": "AGPL-3",
10+
"category": "Website",
11+
"website": "https://github.com/OCA/web",
12+
"depends": ["web"],
13+
"data": [
14+
"views/res_lang_views.xml",
15+
],
16+
"assets": {
17+
"web.assets_backend": [
18+
"web_date_format_numeric/static/src/**/*.js",
19+
],
20+
},
21+
"installable": True,
22+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright 2026 Camptocamp SA
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from . import ir_http, res_lang
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2026 Camptocamp SA
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from odoo import models
5+
6+
7+
class IrHttp(models.AbstractModel):
8+
_inherit = "ir.http"
9+
10+
def session_info(self):
11+
res = super().session_info()
12+
lang = self.env["res.lang"]._lang_get(self.env.user.lang)
13+
res["use_date_format_numeric"] = lang.use_date_format_numeric if lang else True
14+
return res
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2026 Camptocamp SA
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from odoo import fields, models
5+
6+
7+
class ResLang(models.Model):
8+
_inherit = "res.lang"
9+
10+
use_date_format_numeric = fields.Boolean(
11+
string="Use Numeric Date Format",
12+
help="Display dates in numeric format (e.g. 31/01/2026) "
13+
"instead of textual format (e.g. Jan 31, 2026).",
14+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Go to **Settings → Translations → Languages**,
2+
open a language and toggle **Use Numeric Date Format** on or off.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Adds a **Use Numeric Date Format** field to `res.lang`.
2+
When enabled for a language, all `date` and `datetime` fields
3+
render in numeric format (e.g. `31/01/2026` instead of `Jan 31, 2026`).

0 commit comments

Comments
 (0)