diff --git a/web_decimal_numpad_dot/README.rst b/web_decimal_numpad_dot/README.rst new file mode 100644 index 0000000..82e353e --- /dev/null +++ b/web_decimal_numpad_dot/README.rst @@ -0,0 +1,92 @@ +===================================== +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/12.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-12-0/web-12-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/12.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 + +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 0000000..e69de29 diff --git a/web_decimal_numpad_dot/__manifest__.py b/web_decimal_numpad_dot/__manifest__.py new file mode 100644 index 0000000..1951a3e --- /dev/null +++ b/web_decimal_numpad_dot/__manifest__.py @@ -0,0 +1,26 @@ +# 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": "12.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/ca.po b/web_decimal_numpad_dot/i18n/ca.po new file mode 100644 index 0000000..36c1015 --- /dev/null +++ b/web_decimal_numpad_dot/i18n/ca.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: ca\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/es.po b/web_decimal_numpad_dot/i18n/es.po new file mode 100644 index 0000000..7461f08 --- /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 12.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/es_ES.po b/web_decimal_numpad_dot/i18n/es_ES.po new file mode 100644 index 0000000..d7c4709 --- /dev/null +++ b/web_decimal_numpad_dot/i18n/es_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 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: es_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/pt_BR.po b/web_decimal_numpad_dot/i18n/pt_BR.po new file mode 100644 index 0000000..7971f5f --- /dev/null +++ b/web_decimal_numpad_dot/i18n/pt_BR.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: pt_BR\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/zh_CN.po b/web_decimal_numpad_dot/i18n/zh_CN.po new file mode 100644 index 0000000..4159be7 --- /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 0000000..c8d09bb --- /dev/null +++ b/web_decimal_numpad_dot/readme/CONTRIBUTORS.rst @@ -0,0 +1,11 @@ +* Oihane Crucelaegui +* Ana Juaristi +* Omar Castiñeira Saavedra +* Oliver Dony <@odony> +* Wim Audenaert +* `Tecnativa `_: + + * Pedro M. Baeza + * David Vidal + * Jairo Llopis + * Ernesto Tejeda diff --git a/web_decimal_numpad_dot/readme/DESCRIPTION.rst b/web_decimal_numpad_dot/readme/DESCRIPTION.rst new file mode 100644 index 0000000..9737bec --- /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 0000000..b7eab38 --- /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 0000000..9c205cb 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 0000000..bbadf8a --- /dev/null +++ b/web_decimal_numpad_dot/static/description/index.html @@ -0,0 +1,439 @@ + + + + + + +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 0000000..9516dd6 --- /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 0000000..d481575 --- /dev/null +++ b/web_decimal_numpad_dot/views/web_decimal_numpad_dot.xml @@ -0,0 +1,11 @@ + + + + + +