diff --git a/pos_edit_order_line/README.rst b/pos_edit_order_line/README.rst new file mode 100644 index 0000000000..6f20f0b1bb --- /dev/null +++ b/pos_edit_order_line/README.rst @@ -0,0 +1,115 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +=================== +POS Edit Order Line +=================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:44dde903de0f82d6771fb69606890611023369cf3690d38548eb877a494144cc + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/license-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/19.0/pos_edit_order_line + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-19-0/pos-19-0-pos_edit_order_line + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/pos&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds a button "Edit order lines" in main POS interface to +allow an easier UX for cashier when editing product price, qty and +discount. + +On button click, a popup with order lines allows user to input a clear +value for each field, instead of having to use the default process of +selecting which field to edit, which is not very intuitive and +error-prone. + +|Display Edit Order Line Popup| + +.. |Display Edit Order Line Popup| image:: https://raw.githubusercontent.com/OCA/pos/19.0/pos_edit_order_line/static/description/pos_edit_order_line.png + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +Select PoS > configuration > enable flag "Allow Edit Order Line" To +improve usability when there are more than 3 order lines, we suggest +activating the "Large scrollbars" POS setting. + +Changelog +========= + +14.0.1.0.0 +---------- + +- Initial release + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Ooops +* Cetmix + +Contributors +------------ + +- Ooops404 +- Cetmix +- `Acsone `__: + + - Maxime Franco + +- `Heliconia Solutions Pvt. Ltd. `__ + + - Bhavesh Heliconia + +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/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_edit_order_line/__init__.py b/pos_edit_order_line/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/pos_edit_order_line/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_edit_order_line/__manifest__.py b/pos_edit_order_line/__manifest__.py new file mode 100644 index 0000000000..96f0266a13 --- /dev/null +++ b/pos_edit_order_line/__manifest__.py @@ -0,0 +1,28 @@ +# copyright 2022 Dinar Gabbasov +# Copyright 2022 Ooops404 +# Copyright 2022 Cetmix +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +{ + "name": "POS Edit Order Line", + "version": "19.0.1.0.0", + "summary": "POS Edit Order Line", + "author": "Ooops, Cetmix, Odoo Community Association (OCA)", + "contributors": "Cetmix", + "license": "LGPL-3", + "category": "Point of Sale", + "website": "https://github.com/OCA/pos", + "depends": ["point_of_sale"], + "external_dependencies": {}, + "demo": [], + "data": ["views/res_config_settings_view.xml"], + "assets": { + "point_of_sale._assets_pos": [ + "pos_edit_order_line/static/src/css/pos.css", + "pos_edit_order_line/static/src/js/*.js", + "pos_edit_order_line/static/src/xml/*.xml", + ], + }, + "installable": True, + "application": False, +} diff --git a/pos_edit_order_line/i18n/es.po b/pos_edit_order_line/i18n/es.po new file mode 100644 index 0000000000..75426247e9 --- /dev/null +++ b/pos_edit_order_line/i18n/es.po @@ -0,0 +1,115 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_edit_order_line +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-08-22 18:15+0000\n" +"Last-Translator: Ivorra78 \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" +"X-Generator: Weblate 4.17\n" + +#. module: pos_edit_order_line +#: model:ir.model.fields,field_description:pos_edit_order_line.field_pos_config__allow_edit_order_line +#: model:ir.model.fields,field_description:pos_edit_order_line.field_res_config_settings__pos_allow_edit_order_line +msgid "Allow Edit Order Line" +msgstr "Permitir editar ticket" + +#. module: pos_edit_order_line +#: model_terms:ir.ui.view,arch_db:pos_edit_order_line.res_config_settings_view_form +msgid "Allow edit Order Line in popup" +msgstr "Permitir editar ticket en un popup" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderPopup.js:0 +#, python-format +msgid "Cancel" +msgstr "Cancelar" + +#. module: pos_edit_order_line +#: model:ir.model,name:pos_edit_order_line.model_res_config_settings +msgid "Config Settings" +msgstr "Configuración" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "Discount" +msgstr "Descuento" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderButton.js:0 +#, python-format +msgid "Edit Order Line" +msgstr "Editar ticket" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderButton.xml:0 +#, python-format +msgid "Edit Order Lines" +msgstr "Editar ticket" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderButton.js:0 +#, python-format +msgid "Empty Order" +msgstr "Ticket vacío" + +#. module: pos_edit_order_line +#: model:ir.model,name:pos_edit_order_line.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configuración TPV" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "Price" +msgstr "Precio" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "Product" +msgstr "Producto" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "Quantity" +msgstr "Cantidad" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderPopup.js:0 +#, python-format +msgid "Save" +msgstr "Guardar" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "UoM" +msgstr "UdM" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderButton.js:0 +#, python-format +msgid "You need add some products first" +msgstr "Primero añada productos" diff --git a/pos_edit_order_line/i18n/it.po b/pos_edit_order_line/i18n/it.po new file mode 100644 index 0000000000..68c235a3bb --- /dev/null +++ b/pos_edit_order_line/i18n/it.po @@ -0,0 +1,124 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_edit_order_line +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-03-30 10:23+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\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" +"X-Generator: Weblate 4.14.1\n" + +#. module: pos_edit_order_line +#: model:ir.model.fields,field_description:pos_edit_order_line.field_pos_config__allow_edit_order_line +#: model:ir.model.fields,field_description:pos_edit_order_line.field_res_config_settings__pos_allow_edit_order_line +msgid "Allow Edit Order Line" +msgstr "Abilita la modifica righe ordine con popup" + +#. module: pos_edit_order_line +#: model_terms:ir.ui.view,arch_db:pos_edit_order_line.res_config_settings_view_form +msgid "Allow edit Order Line in popup" +msgstr "Abilita la modifica righe ordine con popup" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderPopup.js:0 +#, python-format +msgid "Cancel" +msgstr "Annulla" + +#. module: pos_edit_order_line +#: model:ir.model,name:pos_edit_order_line.model_res_config_settings +msgid "Config Settings" +msgstr "Impostazioni configurazione" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "Discount" +msgstr "Sconto" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderButton.js:0 +#, python-format +msgid "Edit Order Line" +msgstr "Modifica righe ordine" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderButton.xml:0 +#, python-format +msgid "Edit Order Lines" +msgstr "Modifica righe ordine" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderButton.js:0 +#, python-format +msgid "Empty Order" +msgstr "Svuota ordine" + +#. module: pos_edit_order_line +#: model:ir.model,name:pos_edit_order_line.model_pos_config +msgid "Point of Sale Configuration" +msgstr "Configurazione punto vendita" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "Price" +msgstr "Prezzo" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "Product" +msgstr "Prodotto" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "Quantity" +msgstr "Quantità" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderPopup.js:0 +#, python-format +msgid "Save" +msgstr "Salva" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "UoM" +msgstr "UdM" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderButton.js:0 +#, python-format +msgid "You need add some products first" +msgstr "È necessario aggiungere prima alcuni prodotti" + +#~ msgid "Display Name" +#~ msgstr "Nome visualizzato" + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Ultima modifica il" diff --git a/pos_edit_order_line/i18n/pos_edit_order_line.pot b/pos_edit_order_line/i18n/pos_edit_order_line.pot new file mode 100644 index 0000000000..e33dd9fb22 --- /dev/null +++ b/pos_edit_order_line/i18n/pos_edit_order_line.pot @@ -0,0 +1,112 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_edit_order_line +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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" + +#. module: pos_edit_order_line +#: model:ir.model.fields,field_description:pos_edit_order_line.field_pos_config__allow_edit_order_line +#: model:ir.model.fields,field_description:pos_edit_order_line.field_res_config_settings__pos_allow_edit_order_line +msgid "Allow Edit Order Line" +msgstr "" + +#. module: pos_edit_order_line +#: model_terms:ir.ui.view,arch_db:pos_edit_order_line.res_config_settings_view_form +msgid "Allow edit Order Line in popup" +msgstr "" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderPopup.js:0 +#, python-format +msgid "Cancel" +msgstr "" + +#. module: pos_edit_order_line +#: model:ir.model,name:pos_edit_order_line.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "Discount" +msgstr "" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderButton.js:0 +#, python-format +msgid "Edit Order Line" +msgstr "" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderButton.xml:0 +#, python-format +msgid "Edit Order Lines" +msgstr "" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderButton.js:0 +#, python-format +msgid "Empty Order" +msgstr "" + +#. module: pos_edit_order_line +#: model:ir.model,name:pos_edit_order_line.model_pos_config +msgid "Point of Sale Configuration" +msgstr "" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "Price" +msgstr "" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "Product" +msgstr "" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "Quantity" +msgstr "" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderPopup.js:0 +#, python-format +msgid "Save" +msgstr "" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/xml/EditOrderPopup.xml:0 +#, python-format +msgid "UoM" +msgstr "" + +#. module: pos_edit_order_line +#. odoo-javascript +#: code:addons/pos_edit_order_line/static/src/js/EditOrderButton.js:0 +#, python-format +msgid "You need add some products first" +msgstr "" diff --git a/pos_edit_order_line/models/__init__.py b/pos_edit_order_line/models/__init__.py new file mode 100644 index 0000000000..2b92809a3b --- /dev/null +++ b/pos_edit_order_line/models/__init__.py @@ -0,0 +1,2 @@ +from . import pos_config +from . import res_config_settings diff --git a/pos_edit_order_line/models/pos_config.py b/pos_edit_order_line/models/pos_config.py new file mode 100644 index 0000000000..f3be8adb73 --- /dev/null +++ b/pos_edit_order_line/models/pos_config.py @@ -0,0 +1,14 @@ +# copyright 2022 Dinar Gabbasov +# Copyright 2022 Ooops404 +# Copyright 2022 Cetmix +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from odoo import fields, models + + +class PosConfig(models.Model): + _inherit = "pos.config" + + allow_edit_order_line = fields.Boolean( + default=True, + ) diff --git a/pos_edit_order_line/models/res_config_settings.py b/pos_edit_order_line/models/res_config_settings.py new file mode 100644 index 0000000000..b9944f70fe --- /dev/null +++ b/pos_edit_order_line/models/res_config_settings.py @@ -0,0 +1,14 @@ +# copyright 2023 Dinar Gabbasov +# Copyright 2023 Ooops404 +# Copyright 2023 Cetmix +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + pos_allow_edit_order_line = fields.Boolean( + related="pos_config_id.allow_edit_order_line", + readonly=False, + ) diff --git a/pos_edit_order_line/pyproject.toml b/pos_edit_order_line/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/pos_edit_order_line/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/pos_edit_order_line/readme/CONFIGURE.md b/pos_edit_order_line/readme/CONFIGURE.md new file mode 100644 index 0000000000..88295a93d0 --- /dev/null +++ b/pos_edit_order_line/readme/CONFIGURE.md @@ -0,0 +1,3 @@ +Select PoS \> configuration \> enable flag "Allow Edit Order Line" To +improve usability when there are more than 3 order lines, we suggest +activating the "Large scrollbars" POS setting. diff --git a/pos_edit_order_line/readme/CONTRIBUTORS.md b/pos_edit_order_line/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..8c08378790 --- /dev/null +++ b/pos_edit_order_line/readme/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +- Ooops404 \<\> +- Cetmix \<\> +- [Acsone](https://www.acsone.eu/): + - Maxime Franco +- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) + - Bhavesh Heliconia diff --git a/pos_edit_order_line/readme/DESCRIPTION.md b/pos_edit_order_line/readme/DESCRIPTION.md new file mode 100644 index 0000000000..6d4cd8c2f3 --- /dev/null +++ b/pos_edit_order_line/readme/DESCRIPTION.md @@ -0,0 +1,10 @@ +This module adds a button "Edit order lines" in main POS interface to +allow an easier UX for cashier when editing product price, qty and +discount. + +On button click, a popup with order lines allows user to input a clear +value for each field, instead of having to use the default process of +selecting which field to edit, which is not very intuitive and +error-prone. + +![Display Edit Order Line Popup](../static/description/pos_edit_order_line.png) diff --git a/pos_edit_order_line/readme/HISTORY.md b/pos_edit_order_line/readme/HISTORY.md new file mode 100644 index 0000000000..a6871c38d0 --- /dev/null +++ b/pos_edit_order_line/readme/HISTORY.md @@ -0,0 +1,3 @@ +## 14.0.1.0.0 + +- Initial release diff --git a/pos_edit_order_line/static/description/icon.png b/pos_edit_order_line/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/pos_edit_order_line/static/description/icon.png differ diff --git a/pos_edit_order_line/static/description/index.html b/pos_edit_order_line/static/description/index.html new file mode 100644 index 0000000000..386135adf3 --- /dev/null +++ b/pos_edit_order_line/static/description/index.html @@ -0,0 +1,466 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

POS Edit Order Line

+ +

Beta License: LGPL-3 OCA/pos Translate me on Weblate Try me on Runboat

+

This module adds a button “Edit order lines” in main POS interface to +allow an easier UX for cashier when editing product price, qty and +discount.

+

On button click, a popup with order lines allows user to input a clear +value for each field, instead of having to use the default process of +selecting which field to edit, which is not very intuitive and +error-prone.

+

Display Edit Order Line Popup

+

Table of contents

+ +
+

Configuration

+

Select PoS > configuration > enable flag “Allow Edit Order Line” To +improve usability when there are more than 3 order lines, we suggest +activating the “Large scrollbars” POS setting.

+
+
+

Changelog

+
+

14.0.1.0.0

+
    +
  • Initial release
  • +
+
+
+
+

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

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Ooops
  • +
  • Cetmix
  • +
+
+
+

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/pos project on GitHub.

+

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

+
+
+
+
+ + diff --git a/pos_edit_order_line/static/description/pos_edit_order_line.png b/pos_edit_order_line/static/description/pos_edit_order_line.png new file mode 100644 index 0000000000..a4fd719e15 Binary files /dev/null and b/pos_edit_order_line/static/description/pos_edit_order_line.png differ diff --git a/pos_edit_order_line/static/src/css/pos.css b/pos_edit_order_line/static/src/css/pos.css new file mode 100644 index 0000000000..024911f610 --- /dev/null +++ b/pos_edit_order_line/static/src/css/pos.css @@ -0,0 +1,60 @@ +/* The Edit Order Line Popup */ +.pos .edit-order-popup .popup { + max-width: 600px; +} + +.pos .edit-order-popup .full-content { + overflow: auto; +} + +.pos .edit-order-popup .order-line-list { + font-size: 16px; + width: 100%; +} + +.pos .edit-order-popup .order-line-list th, +.pos .edit-order-popup .order-line-list td { + padding: 12px 8px; +} + +.pos .edit-order-popup .order-line-list tr { + transition: all 150ms linear; + background: rgb(230, 230, 230); +} + +.pos .edit-order-popup .order-line-list thead > tr, +.pos .edit-order-popup .order-line-list tr:nth-child(even) { + background: rgb(247, 247, 247); +} + +.pos .edit-order-popup .order-line-list tr.highlight { + transition: all 150ms linear; + background: rgb(110, 200, 155) !important; + color: white; +} + +.pos .edit-order-popup .order-line-list tr.lowlight { + transition: all 150ms linear; + background: rgb(216, 238, 227); +} + +.pos .edit-order-popup .order-line-list tr.lowlight:nth-child(even) { + transition: all 150ms linear; + background: rgb(227, 246, 237); +} + +.pos .edit-order-popup .subwindow .subwindow-container { + height: 250px; +} + +.pos .edit-order-popup input.required { + outline: none; + box-shadow: 0px 0px 0px 2px red; +} + +@media screen and (max-width: 768px) { + .pos .edit-order-popup .order-line-list td { + overflow: hidden; + white-space: nowrap; + } +} diff --git a/pos_edit_order_line/static/src/js/EditOrderButton.esm.js b/pos_edit_order_line/static/src/js/EditOrderButton.esm.js new file mode 100644 index 0000000000..57b6fdefbb --- /dev/null +++ b/pos_edit_order_line/static/src/js/EditOrderButton.esm.js @@ -0,0 +1,34 @@ +/** @odoo-module **/ +import {ControlButtons} from "@point_of_sale/app/screens/product_screen/control_buttons/control_buttons"; +import {_t} from "@web/core/l10n/translation"; +import {patch} from "@web/core/utils/patch"; +import {makeAwaitable} from "@point_of_sale/app/utils/make_awaitable_dialog"; +import {AlertDialog} from "@web/core/confirmation_dialog/confirmation_dialog"; +import {EditOrderPopup} from "./EditOrderPopup.esm"; + +patch(ControlButtons.prototype, { + async onClickEditOrder() { + const order_lines = this.pos.getOrder().lines; + if (order_lines?.length) { + var array = []; + order_lines.forEach((line) => { + array.push({ + id: line.id, + discount: line.discount || false, + price: line.unitPrices.total_excluded_currency, + quantity: line.qty, + uom: line.product_id.uom_id.name, + name: line.product_id.name, + }); + }); + await makeAwaitable(this.dialog, EditOrderPopup, { + array: array, + }); + } else { + this.dialog.add(AlertDialog, { + title: _t("Empty Order"), + body: _t("You need add some products first."), + }); + } + }, +}); diff --git a/pos_edit_order_line/static/src/js/EditOrderLineInput.esm.js b/pos_edit_order_line/static/src/js/EditOrderLineInput.esm.js new file mode 100644 index 0000000000..a98a5917d2 --- /dev/null +++ b/pos_edit_order_line/static/src/js/EditOrderLineInput.esm.js @@ -0,0 +1,40 @@ +import {Component, useState} from "@odoo/owl"; +import {usePos} from "@point_of_sale/app/hooks/pos_hook"; + +export class EditOrderLineInput extends Component { + static template = "EditOrderLineInput"; + setup() { + super.setup(); + this.pos = usePos(); + this.state = useState({ + quantityInput: this.props.item.quantity, + priceInput: this.props.item.price, + discountInput: this.props.item.discount, + }); + this.changes = { + quantityInput: this.props.item.quantity, + priceInput: this.props.item.price, + discountInput: this.props.item.discount, + }; + } + onChange(event) { + const id = this.props.item.id; + const value = parseFloat(event.target.value.trim()); + const targetElement = event.target; + if (isNaN(value)) { + targetElement.classList.add("required"); + } else { + targetElement.classList.remove("required"); + } + if (this.props.item[targetElement.name] !== value) { + this.changes[targetElement.name] = value; + if (this.props.onchange) { + this.props.onchange({id, changes: this.changes}); + } + } + } + onFocus(event) { + // Select the text inside the input element + event.target.select(); + } +} diff --git a/pos_edit_order_line/static/src/js/EditOrderPopup.esm.js b/pos_edit_order_line/static/src/js/EditOrderPopup.esm.js new file mode 100644 index 0000000000..4b6b6051ed --- /dev/null +++ b/pos_edit_order_line/static/src/js/EditOrderPopup.esm.js @@ -0,0 +1,70 @@ +import {Component, useState} from "@odoo/owl"; +import {Dialog} from "@web/core/dialog/dialog"; +import {usePos} from "@point_of_sale/app/hooks/pos_hook"; +import {EditOrderLineInput} from "./EditOrderLineInput.esm"; + +export class EditOrderPopup extends Component { + static template = "EditOrderPopup"; + static components = {Dialog, EditOrderLineInput}; + + setup() { + super.setup(); + this._id = 0; + this.state = useState({array: this._initialize(this.props.array)}); + this.changes = {}; + this.pos = usePos(); + this.handleChange = this.handleChange.bind(this); + } + _nextId() { + return this._id++; + } + _emptyItem() { + return { + text: "", + _id: this._nextId(), + }; + } + _initialize(array) { + if (array.length === 0) return [this._emptyItem()]; + return array.map((item) => + Object.assign( + {}, + {_id: this._nextId()}, + typeof item === "object" ? item : {text: item} + ) + ); + } + handleChange({id, changes}) { + this.changes[id] = changes; + } + + async confirm() { + var allowConfirmChanges = true; + Object.values(this.changes).forEach((updates) => { + Object.values(updates).forEach((value) => { + if (isNaN(value)) { + allowConfirmChanges = false; + } + }); + }); + if (allowConfirmChanges) { + this.apply_changes(this.changes); + this.props.close(); + } + } + async apply_changes(payload) { + var order = this.pos.getOrder(); + Object.entries(payload).forEach(([id, changes]) => { + var line = order.getOrderline(id); + Object.entries(changes).forEach(([key, value]) => { + if (key === "quantity") { + line.setQuantity(value); + } else if (key === "price") { + line.setUnitPrice(value); + } else if (key === "discount") { + line.setDiscount(value); + } + }); + }); + } +} diff --git a/pos_edit_order_line/static/src/xml/EditOrderButton.xml b/pos_edit_order_line/static/src/xml/EditOrderButton.xml new file mode 100644 index 0000000000..b920263b37 --- /dev/null +++ b/pos_edit_order_line/static/src/xml/EditOrderButton.xml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/pos_edit_order_line/static/src/xml/EditOrderLineInput.xml b/pos_edit_order_line/static/src/xml/EditOrderLineInput.xml new file mode 100644 index 0000000000..71e1cb0de6 --- /dev/null +++ b/pos_edit_order_line/static/src/xml/EditOrderLineInput.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pos_edit_order_line/static/src/xml/EditOrderPopup.xml b/pos_edit_order_line/static/src/xml/EditOrderPopup.xml new file mode 100644 index 0000000000..543a602370 --- /dev/null +++ b/pos_edit_order_line/static/src/xml/EditOrderPopup.xml @@ -0,0 +1,61 @@ + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + +
ProductQuantityUoMPrice excl. VATDiscount
+
+
+
+
+ + + + +
+
+
+ +
diff --git a/pos_edit_order_line/views/res_config_settings_view.xml b/pos_edit_order_line/views/res_config_settings_view.xml new file mode 100644 index 0000000000..8a33fc275c --- /dev/null +++ b/pos_edit_order_line/views/res_config_settings_view.xml @@ -0,0 +1,23 @@ + + + + res.config.settings.view.form + res.config.settings + + + +
+
+ +
+
+
+
+
+
+
+