Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions datetime_formatter/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=====================
Date & Time Formatter
=====================

This module was written to extend the functionality of Odoo language engine to
support formatting `Date`, `Time` and `Datetime` fields easily and allow you to
print them in the best format for the user.

Usage
=====

This module adds a technical programming feature, and it should be used by
addon developers, not by end users. This means that you must not expect to see
any changes if you are a user and install this, but if you find you have it
already installed, it's probably because you have another modules that depend
on this one.

If you are a developer, to use this module, you need to:

* Call anywhere in your code::

formatted_string = self.env["res.lang"].datetime_formatter(datetime_value)

* If you use Qweb::

<t t-esc="env['res.lang'].datetime_formatter(datetime_value)"/>

* If you call it from a record that has a `lang` field::

formatted_string = record.lang.datetime_formatter(record.datetime_field)

* ``models.ResLang.datetime_formatter`` docstring explains its usage.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/9.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/server-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.

Credits
=======

Contributors
------------

* Jairo Llopis <[email protected]>
* Vicent Cubells <[email protected]>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

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.

To contribute to this module, please visit http://odoo-community.org.
5 changes: 5 additions & 0 deletions datetime_formatter/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# © 2016 Tecnativa, S.L. - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models
20 changes: 20 additions & 0 deletions datetime_formatter/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# © 2016 Tecnativa, S.L. - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Date & Time Formatter",
"summary": "Helper functions to give correct format to date[time] fields",
"version": "9.0.1.0.0",
"category": "Tools",
"website": "https://tecnativa.com",
"author": "Grupo ESOC Ingeniería de Servicios, "
"Tecnativa,"
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": [
"base",
],
}
12 changes: 12 additions & 0 deletions datetime_formatter/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# © 2015 Grupo ESOC Ingeniería de Servicios, S.L.U. - Jairo Llopis
# © 2016 Tecnativa, S.L. - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import _, exceptions


class BestMatchedLanguageNotFoundError(exceptions.MissingError):
def __init__(self, lang):
msg = (_("Best matched language (%s) not found.") % lang)
super(BestMatchedLanguageNotFoundError, self).__init__(msg)
self.lang = lang
30 changes: 30 additions & 0 deletions datetime_formatter/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * datetime_formatter
#
# Translators:
# Rudolf Schnapka <[email protected]>, 2016
msgid ""
msgstr ""
"Project-Id-Version: server-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-19 14:44+0000\n"
"PO-Revision-Date: 2016-01-18 14:00+0000\n"
"Last-Translator: Rudolf Schnapka <[email protected]>\n"
"Language-Team: German (http://www.transifex.com/oca/OCA-server-tools-8-0/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: datetime_formatter
#: code:addons/datetime_formatter/exceptions.py:9
#, python-format
msgid "Best matched language (%s) not found."
msgstr "Sprache (%s) mit bester Übereinstimmung nicht gefunden"

#. module: datetime_formatter
#: model:ir.model,name:datetime_formatter.model_res_lang
msgid "Languages"
msgstr "Sprachen"
30 changes: 30 additions & 0 deletions datetime_formatter/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * datetime_formatter
#
# Translators:
# Antonio Trueba, 2016
msgid ""
msgstr ""
"Project-Id-Version: server-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-19 14:44+0000\n"
"PO-Revision-Date: 2016-02-10 16:46+0000\n"
"Last-Translator: Antonio Trueba\n"
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-server-tools-8-0/language/es/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: datetime_formatter
#: code:addons/datetime_formatter/exceptions.py:9
#, python-format
msgid "Best matched language (%s) not found."
msgstr ""

#. module: datetime_formatter
#: model:ir.model,name:datetime_formatter.model_res_lang
msgid "Languages"
msgstr "Idiomas"
30 changes: 30 additions & 0 deletions datetime_formatter/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * datetime_formatter
#
# Translators:
# Christophe CHAUVET <[email protected]>, 2016
msgid ""
msgstr ""
"Project-Id-Version: server-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-21 06:45+0000\n"
"PO-Revision-Date: 2016-08-21 07:41+0000\n"
"Last-Translator: Christophe CHAUVET <[email protected]>\n"
"Language-Team: French (http://www.transifex.com/oca/OCA-server-tools-8-0/language/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#. module: datetime_formatter
#: code:addons/datetime_formatter/exceptions.py:9
#, python-format
msgid "Best matched language (%s) not found."
msgstr ""

#. module: datetime_formatter
#: model:ir.model,name:datetime_formatter.model_res_lang
msgid "Languages"
msgstr "Langues"
30 changes: 30 additions & 0 deletions datetime_formatter/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * datetime_formatter
#
# Translators:
# Paolo Valier, 2016
msgid ""
msgstr ""
"Project-Id-Version: server-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-17 15:37+0000\n"
"PO-Revision-Date: 2016-03-13 09:34+0000\n"
"Last-Translator: Paolo Valier\n"
"Language-Team: Italian (http://www.transifex.com/oca/OCA-server-tools-8-0/language/it/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: it\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: datetime_formatter
#: code:addons/datetime_formatter/exceptions.py:9
#, python-format
msgid "Best matched language (%s) not found."
msgstr ""

#. module: datetime_formatter
#: model:ir.model,name:datetime_formatter.model_res_lang
msgid "Languages"
msgstr "Lingue"
30 changes: 30 additions & 0 deletions datetime_formatter/i18n/sl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * datetime_formatter
#
# Translators:
# Matjaž Mozetič <[email protected]>, 2015
msgid ""
msgstr ""
"Project-Id-Version: server-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-11-27 14:01+0000\n"
"PO-Revision-Date: 2015-11-27 04:11+0000\n"
"Last-Translator: Matjaž Mozetič <[email protected]>\n"
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-server-tools-8-0/language/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"

#. module: datetime_formatter
#: code:addons/datetime_formatter/exceptions.py:9
#, python-format
msgid "Best matched language (%s) not found."
msgstr "Najbolj ujemajoč jezik (%s) ni najden."

#. module: datetime_formatter
#: model:ir.model,name:datetime_formatter.model_res_lang
msgid "Languages"
msgstr "Jeziki"
30 changes: 30 additions & 0 deletions datetime_formatter/i18n/tr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * datetime_formatter
#
# Translators:
# Ahmet Altınışık <[email protected]>, 2016
msgid ""
msgstr ""
"Project-Id-Version: server-tools (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-01-19 14:44+0000\n"
"PO-Revision-Date: 2016-01-31 12:31+0000\n"
"Last-Translator: Ahmet Altınışık <[email protected]>\n"
"Language-Team: Turkish (http://www.transifex.com/oca/OCA-server-tools-8-0/language/tr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: tr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#. module: datetime_formatter
#: code:addons/datetime_formatter/exceptions.py:9
#, python-format
msgid "Best matched language (%s) not found."
msgstr "En iyi eşleşen dil (%s) bulunamadı."

#. module: datetime_formatter
#: model:ir.model,name:datetime_formatter.model_res_lang
msgid "Languages"
msgstr "Diller"
Loading