diff --git a/setup/web_decimal_numpad_dot/odoo/addons/web_decimal_numpad_dot b/setup/web_decimal_numpad_dot/odoo/addons/web_decimal_numpad_dot new file mode 120000 index 000000000..ce7ef4a51 --- /dev/null +++ b/setup/web_decimal_numpad_dot/odoo/addons/web_decimal_numpad_dot @@ -0,0 +1 @@ +../../../../web_decimal_numpad_dot \ No newline at end of file diff --git a/setup/web_decimal_numpad_dot/setup.py b/setup/web_decimal_numpad_dot/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/web_decimal_numpad_dot/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_decimal_numpad_dot/README.rst b/web_decimal_numpad_dot/README.rst new file mode 100644 index 000000000..56ee9fa13 --- /dev/null +++ b/web_decimal_numpad_dot/README.rst @@ -0,0 +1,97 @@ +===================================== +Web - Numpad Dot as decimal separator +===================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/14.0/web_decimal_numpad_dot + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_decimal_numpad_dot + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/162/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Allows using numpad dot to enter period decimal separator even in localizations +where comma is used instead of period. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Whenever on a float or monetary input field pressing numpad dot produces the +proper decimal separator for the active localization. + +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 smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* AvanzOSC +* Comunitea +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* Oihane Crucelaegui +* Ana Juaristi +* Omar Castiñeira Saavedra +* Oliver Dony <@odony> +* Wim Audenaert +* `Tecnativa `_: + + * Pedro M. Baeza + * David Vidal + * Jairo Llopis + * Ernesto Tejeda + * João Marques + +* `C2i Change 2 improve `_: + + * Eduardo Magdalena + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_decimal_numpad_dot/__init__.py b/web_decimal_numpad_dot/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/web_decimal_numpad_dot/__manifest__.py b/web_decimal_numpad_dot/__manifest__.py new file mode 100644 index 000000000..7a5660771 --- /dev/null +++ b/web_decimal_numpad_dot/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2015 AvanzOSC - Oihane Crucelaegui +# Copyright 2015 Tecnativa - Pedro M. Baeza +# Copyright 2015 Comunitea - Omar Castiñeira Saavedra +# Copyright 2016 Oliver Dony +# Copyright 2017-18 Tecnativa - David Vidal +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Web - Numpad Dot as decimal separator", + "version": "14.0.1.0.0", + "license": "AGPL-3", + "summary": "Allows using numpad dot to enter period decimal separator", + "depends": ["web"], + "author": "AvanzOSC, " + "Comunitea, " + "Tecnativa, " + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", + "category": "Web", + "data": ["views/web_decimal_numpad_dot.xml"], + "installable": True, +} diff --git a/web_decimal_numpad_dot/i18n/es.po b/web_decimal_numpad_dot/i18n/es.po new file mode 100644 index 000000000..cdd0dca4a --- /dev/null +++ b/web_decimal_numpad_dot/i18n/es.po @@ -0,0 +1,14 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" diff --git a/web_decimal_numpad_dot/i18n/web_decimal_numpad_dot.pot b/web_decimal_numpad_dot/i18n/web_decimal_numpad_dot.pot new file mode 100644 index 000000000..cc93d01ee --- /dev/null +++ b/web_decimal_numpad_dot/i18n/web_decimal_numpad_dot.pot @@ -0,0 +1,13 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" diff --git a/web_decimal_numpad_dot/i18n/zh_CN.po b/web_decimal_numpad_dot/i18n/zh_CN.po new file mode 100644 index 000000000..4159be77e --- /dev/null +++ b/web_decimal_numpad_dot/i18n/zh_CN.po @@ -0,0 +1,14 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" diff --git a/web_decimal_numpad_dot/readme/CONTRIBUTORS.rst b/web_decimal_numpad_dot/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..b04eba99c --- /dev/null +++ b/web_decimal_numpad_dot/readme/CONTRIBUTORS.rst @@ -0,0 +1,16 @@ +* Oihane Crucelaegui +* Ana Juaristi +* Omar Castiñeira Saavedra +* Oliver Dony <@odony> +* Wim Audenaert +* `Tecnativa `_: + + * Pedro M. Baeza + * David Vidal + * Jairo Llopis + * Ernesto Tejeda + * João Marques + +* `C2i Change 2 improve `_: + + * Eduardo Magdalena diff --git a/web_decimal_numpad_dot/readme/DESCRIPTION.rst b/web_decimal_numpad_dot/readme/DESCRIPTION.rst new file mode 100644 index 000000000..9737bec16 --- /dev/null +++ b/web_decimal_numpad_dot/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +Allows using numpad dot to enter period decimal separator even in localizations +where comma is used instead of period. diff --git a/web_decimal_numpad_dot/readme/USAGE.rst b/web_decimal_numpad_dot/readme/USAGE.rst new file mode 100644 index 000000000..b7eab3807 --- /dev/null +++ b/web_decimal_numpad_dot/readme/USAGE.rst @@ -0,0 +1,2 @@ +Whenever on a float or monetary input field pressing numpad dot produces the +proper decimal separator for the active localization. diff --git a/web_decimal_numpad_dot/static/description/icon.png b/web_decimal_numpad_dot/static/description/icon.png new file mode 100644 index 000000000..9c205cbc4 Binary files /dev/null and b/web_decimal_numpad_dot/static/description/icon.png differ diff --git a/web_decimal_numpad_dot/static/description/index.html b/web_decimal_numpad_dot/static/description/index.html new file mode 100644 index 000000000..739ba4525 --- /dev/null +++ b/web_decimal_numpad_dot/static/description/index.html @@ -0,0 +1,444 @@ + + + + + + +Web - Numpad Dot as decimal separator + + + +
+

Web - Numpad Dot as decimal separator

+ + +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runbot

+

Allows using numpad dot to enter period decimal separator even in localizations +where comma is used instead of period.

+

Table of contents

+ +
+

Usage

+

Whenever on a float or monetary input field pressing numpad dot produces the +proper decimal separator for the active localization.

+
+
+

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 smashing it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • AvanzOSC
  • +
  • Comunitea
  • +
  • Tecnativa
  • +
+
+
+

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.

+

This module is part of the OCA/web project on GitHub.

+

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

+
+
+
+ + diff --git a/web_decimal_numpad_dot/static/src/js/numpad_dot.js b/web_decimal_numpad_dot/static/src/js/numpad_dot.js new file mode 100644 index 000000000..99db82858 --- /dev/null +++ b/web_decimal_numpad_dot/static/src/js/numpad_dot.js @@ -0,0 +1,44 @@ +/* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ + +odoo.define("web_decimal_numpad_dot.FieldFloat", function (require) { + "use strict"; + + var basic_fields = require("web.basic_fields"); + var translation = require("web.translation"); + + var NumpadDotReplaceMixin = { + l10n_decimal_point: function () { + return this.formatType === "float_time" + ? ":" + : translation._t.database.parameters.decimal_point; + }, + + _replaceAt: function (cur_val, from, to, replacement) { + return cur_val.substring(0, from) + replacement + cur_val.substring(to); + }, + + _onKeydown: function (event) { + // Only act on numpad dot key + if (event.keyCode !== 110) { + return this._super.apply(this, arguments); + } + event.preventDefault(); + var from = this.$input.prop("selectionStart"), + to = this.$input.prop("selectionEnd"), + cur_val = this.$input.val(), + point = this.l10n_decimal_point(); + var new_val = this._replaceAt(cur_val, from, to, point); + this.$input.val(new_val); + // Put user caret in place + to = from + point.length; + this.$input.prop("selectionStart", to).prop("selectionEnd", to); + }, + }; + + basic_fields.FieldFloat.include(NumpadDotReplaceMixin); + basic_fields.FieldMonetary.include(NumpadDotReplaceMixin); + + return { + NumpadDotReplaceMixin: NumpadDotReplaceMixin, + }; +}); diff --git a/web_decimal_numpad_dot/views/web_decimal_numpad_dot.xml b/web_decimal_numpad_dot/views/web_decimal_numpad_dot.xml new file mode 100644 index 000000000..67a7d02ec --- /dev/null +++ b/web_decimal_numpad_dot/views/web_decimal_numpad_dot.xml @@ -0,0 +1,15 @@ + + +