diff --git a/pos_auto_print_kitchen_receipt/__init__.py b/pos_auto_print_kitchen_receipt/__init__.py new file mode 100644 index 0000000..f5ba686 --- /dev/null +++ b/pos_auto_print_kitchen_receipt/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import models \ No newline at end of file diff --git a/pos_auto_print_kitchen_receipt/__manifest__.py b/pos_auto_print_kitchen_receipt/__manifest__.py new file mode 100644 index 0000000..21f8135 --- /dev/null +++ b/pos_auto_print_kitchen_receipt/__manifest__.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +{ + 'name': "POS auto print kitchen receipt", + 'support': "support@easyerps.com", + 'license': "LGPL-3", + 'summary': """ + Auto print kitchen receipt after validate + """, + 'author': "EasyERPS", + 'website': "https://easyerps.com", + # Categories can be used to filter modules in modules listing + # Check https://github.com/odoo/odoo/blob/14.0/odoo/addons/base/data/ir_module_category_data.xml + # for the full list + 'category': 'Point of Sale', + 'version': '16.1.1', + # any module necessary for this one to work correctly + 'data': [ + 'views/views.xml', + ], + 'depends': ['base', 'point_of_sale', 'pos_restaurant'], + 'assets': { + 'point_of_sale.assets': [ + 'EasyERPS_pos_auto_print_kitchen_receipt/static/src/js/ReceiptScreen.js', + 'EasyERPS_pos_auto_print_kitchen_receipt/static/src/js/Models.js', + 'EasyERPS_pos_auto_print_kitchen_receipt/static/src/xml/*.xml', + ], + }, + 'images': ['images/main_screenshot.png'], + +} diff --git a/pos_auto_print_kitchen_receipt/images/main_screenshot.png b/pos_auto_print_kitchen_receipt/images/main_screenshot.png new file mode 100644 index 0000000..a3c9508 Binary files /dev/null and b/pos_auto_print_kitchen_receipt/images/main_screenshot.png differ diff --git a/pos_auto_print_kitchen_receipt/models/__init__.py b/pos_auto_print_kitchen_receipt/models/__init__.py new file mode 100644 index 0000000..7060bd4 --- /dev/null +++ b/pos_auto_print_kitchen_receipt/models/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import pos \ No newline at end of file diff --git a/pos_auto_print_kitchen_receipt/models/pos.py b/pos_auto_print_kitchen_receipt/models/pos.py new file mode 100644 index 0000000..9e3ba77 --- /dev/null +++ b/pos_auto_print_kitchen_receipt/models/pos.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +from odoo import models, fields, api + + +class PosConfig(models.Model): + _inherit = 'pos.config' + + kitchen_print = fields.Boolean(string='Enable kitchen receipt Printing Button', default=False) + kitchen_print_auto = fields.Boolean(string='Automatic kitchen receipt Printing', default=False) + + @api.onchange('pos_module_pos_restaurant') + def _onchange_pos_module_pos_restaurant(self): + if not self.pos_module_pos_restaurant: + self.update({'kitchen_print_auto': False, 'kitchen_print': False}) + + @api.onchange('pos_is_order_printer') + def _onchange_pos_is_order_printer(self): + if not self.pos_is_order_printer: + self.update({'kitchen_print': False}) + +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' + + kitchen_print = fields.Boolean(related='pos_config_id.kitchen_print', readonly=False) + kitchen_print_auto = fields.Boolean(related='pos_config_id.kitchen_print_auto', readonly=False) + + @api.onchange('pos_module_pos_restaurant') + def _onchange_pos_module_pos_restaurant(self): + if not self.pos_module_pos_restaurant: + self.update({'kitchen_print_auto': False, 'kitchen_print': False}) + + @api.onchange('pos_is_order_printer') + def _onchange_pos_is_order_printer(self): + if not self.pos_is_order_printer: + self.update({'kitchen_print': False}) \ No newline at end of file diff --git a/pos_auto_print_kitchen_receipt/static/description/icon.png b/pos_auto_print_kitchen_receipt/static/description/icon.png new file mode 100644 index 0000000..cf15584 Binary files /dev/null and b/pos_auto_print_kitchen_receipt/static/description/icon.png differ diff --git a/pos_auto_print_kitchen_receipt/static/description/img.png b/pos_auto_print_kitchen_receipt/static/description/img.png new file mode 100644 index 0000000..803424d Binary files /dev/null and b/pos_auto_print_kitchen_receipt/static/description/img.png differ diff --git a/pos_auto_print_kitchen_receipt/static/description/img_1.png b/pos_auto_print_kitchen_receipt/static/description/img_1.png new file mode 100644 index 0000000..1a2f0e0 Binary files /dev/null and b/pos_auto_print_kitchen_receipt/static/description/img_1.png differ diff --git a/pos_auto_print_kitchen_receipt/static/description/img_2.png b/pos_auto_print_kitchen_receipt/static/description/img_2.png new file mode 100644 index 0000000..b7b324f Binary files /dev/null and b/pos_auto_print_kitchen_receipt/static/description/img_2.png differ diff --git a/pos_auto_print_kitchen_receipt/static/description/index.html b/pos_auto_print_kitchen_receipt/static/description/index.html new file mode 100644 index 0000000..ec8b401 --- /dev/null +++ b/pos_auto_print_kitchen_receipt/static/description/index.html @@ -0,0 +1,50 @@ + + + + + Title + + +
+
+

POS auto print kitchen receipt

+

Auto print kitchen receipt after validate

+

طباعة ايصال المطبخ تلقائيا بعد اعتماد الطلب

+
+
+
+
+
+

+ + Features + +

+
+
+
+
    +
  • Auto print kitchen receipt after validate
  • +
  • Button to print kitchen receipt
  • +
+
+
+
+
+
+
+ + + +
+ +
+ +
+
+   support@easyerps.com +   Whatsapp: https://wa.me/966554477623 +
+
+ + \ No newline at end of file diff --git a/pos_auto_print_kitchen_receipt/static/src/js/Models.js b/pos_auto_print_kitchen_receipt/static/src/js/Models.js new file mode 100644 index 0000000..fe7bb16 --- /dev/null +++ b/pos_auto_print_kitchen_receipt/static/src/js/Models.js @@ -0,0 +1,60 @@ +odoo.define('EasyERPS_pos_auto_print_kitchen_receipt.Models', function (require) { +"use strict"; + +const { PosGlobalState, Order, Orderline, Payment } = require('point_of_sale.models'); +const Registries = require('point_of_sale.Registries'); +const Printer = require('point_of_sale.Printer').Printer; +const core = require('web.core'); +const QWeb = core.qweb; + +const PosAutoPrintChange = (Order) => class PosRestaurantOrder extends Order { + + async printChanges(){ + let isPrintSuccessful = true; + const d = new Date(); + let hours = '' + d.getHours(); + hours = hours.length < 2 ? ('0' + hours) : hours; + let minutes = '' + d.getMinutes(); + minutes = minutes.length < 2 ? ('0' + minutes) : minutes; + + + for (const printer of this.pos.unwatched.printers) { + const changes = this._getPrintingCategoriesChanges(printer.config.product_categories_ids); + if (changes['new'].length > 0 || changes['cancelled'].length > 0) { + const printingChanges = { + new: changes['new'], + cancelled: changes['cancelled'], + table_name: this.pos.config.iface_floorplan ? this.getTable().name : false, + floor_name: this.pos.config.iface_floorplan ? this.getTable().floor.name : false, + name: this.name || 'unknown order', + time: { + hours, + minutes, + }, + }; + const receipt = QWeb.render('OrderChangeReceipt', { changes: printingChanges,widget:this, pos: this.pos, receipt: this.export_for_printing() }); + const result = await printer.print_receipt(receipt); + if (!result.successful) { + isPrintSuccessful = false; + } + } + } + return isPrintSuccessful; + } + + is_printChanges(){ + for (const printer of this.pos.unwatched.printers) { + const changes = this._getPrintingCategoriesChanges(printer.config.product_categories_ids); + if (changes['new'].length > 0 || changes['cancelled'].length > 0) { + return true + } + } + return false + } + +} +Registries.Model.extend(Order, PosAutoPrintChange); + + +}); + diff --git a/pos_auto_print_kitchen_receipt/static/src/js/ReceiptScreen.js b/pos_auto_print_kitchen_receipt/static/src/js/ReceiptScreen.js new file mode 100644 index 0000000..83b5e22 --- /dev/null +++ b/pos_auto_print_kitchen_receipt/static/src/js/ReceiptScreen.js @@ -0,0 +1,82 @@ +odoo.define('EasyERPS_pos_auto_print_kitchen_receipt.ReceiptScreen', function (require) { + 'use strict'; + + const ReceiptScreen = require('point_of_sale.ReceiptScreen'); + const Registries = require('point_of_sale.Registries'); + const { onMounted, useRef, status } = owl; + + const customReceiptScreen = ReceiptScreen => + class extends ReceiptScreen { + + setup() { + super.setup(); + + onMounted(() => { + var self = this; + setTimeout(async () => { + if (!self.env.pos.config.iface_print_auto){ + await self.handleAutoPrintChanges(); + } + }, 0); + }); + } + + + // constructor() { + // super(...arguments); + // var self = this; + // // let order = this.env.pos.get_order(); + // // this.handleAutoPrintChanges(); + // } + + + // mounted() { + // var self = this; + // setTimeout(async () => { + // if (!self.env.pos.config.iface_print_auto){ + // await self.handleAutoPrintChanges(); + // } + // + // }, 0); + // super.mounted(); + // } + + + async handleAutoPrint() { + var self = this; + if (!this.env.pos.config.kitchen_print_auto) return super.handleAutoPrint(); + if (this._shouldAutoPrint()) { + await this.printReceipt(); + await this.handleAutoPrintChanges(); + if (this.currentOrder._printed && this._shouldCloseImmediately()) { + this.whenClosing(); + } + } + } + + async printReceiptAndKitchen(){ + await this.printReceipt(); + await this.PrintChanges(); + } + + async handleAutoPrintChanges() { + if (this.env.pos.config.kitchen_print_auto){ + await this.PrintChanges() + } + } + + async PrintChanges() { + if (!this.is_changePrint){ + let order = this.env.pos.get_order(); + await order.printChanges(); + this.is_changePrint = true + this.render(); + } + } + + }; + + Registries.Component.extend(ReceiptScreen, customReceiptScreen); + + return ReceiptScreen; +}); \ No newline at end of file diff --git a/pos_auto_print_kitchen_receipt/static/src/xml/ReceiptScreen.xml b/pos_auto_print_kitchen_receipt/static/src/xml/ReceiptScreen.xml new file mode 100644 index 0000000..edfdb1d --- /dev/null +++ b/pos_auto_print_kitchen_receipt/static/src/xml/ReceiptScreen.xml @@ -0,0 +1,20 @@ + + + + + +
+ +
+ Print Receipt and Kitchen +
+
+ Print Kitchen Receipt +
+
+
+
+ +
+ +
diff --git a/pos_auto_print_kitchen_receipt/views/views.xml b/pos_auto_print_kitchen_receipt/views/views.xml new file mode 100644 index 0000000..eebf796 --- /dev/null +++ b/pos_auto_print_kitchen_receipt/views/views.xml @@ -0,0 +1,25 @@ + + + + res.config.settings.form.inherit.pos + res.config.settings + + + +
+
+ Print Kitchen receipts automatically once the payment is registered +
+
+
+ +
+
+ Show Print kitchen receipt Button on Receipt Screen +
+
+
+
+
+
+
\ No newline at end of file diff --git a/pos_edit_order_line/README.rst b/pos_edit_order_line/README.rst new file mode 100644 index 0000000..61dca0f --- /dev/null +++ b/pos_edit_order_line/README.rst @@ -0,0 +1,97 @@ +=================== +POS Edit Order Line +=================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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-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/16.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-16-0/pos-16-0-pos_edit_order_line + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/184/16.0 + :alt: Try me on Runbot + +|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. + +.. image:: https://raw.githubusercontent.com/OCA/pos/16.0/pos_edit_order_line/static/description/pos_edit_order_line.png + :alt: Display Edit Order Line Popup + +**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 smashing 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 + +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 0000000..0650744 --- /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 0000000..ead354b --- /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": "16.0.1.0.1", + "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_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 0000000..dc94085 --- /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-03-06 18:23+0000\n" +"Last-Translator: Fernando \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.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 "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 "" + +#. 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 "" + +#. 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 0000000..68c235a --- /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 0000000..e33dd9f --- /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 0000000..2b92809 --- /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 0000000..f3be8ad --- /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 0000000..b9944f7 --- /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/readme/CONFIGURE.rst b/pos_edit_order_line/readme/CONFIGURE.rst new file mode 100644 index 0000000..53df67d --- /dev/null +++ b/pos_edit_order_line/readme/CONFIGURE.rst @@ -0,0 +1,2 @@ +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.rst b/pos_edit_order_line/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..f5d6f94 --- /dev/null +++ b/pos_edit_order_line/readme/CONTRIBUTORS.rst @@ -0,0 +1,5 @@ +* Ooops404 +* Cetmix +* `Acsone `_: + + * Maxime Franco diff --git a/pos_edit_order_line/readme/DESCRIPTION.rst b/pos_edit_order_line/readme/DESCRIPTION.rst new file mode 100644 index 0000000..74d5845 --- /dev/null +++ b/pos_edit_order_line/readme/DESCRIPTION.rst @@ -0,0 +1,6 @@ +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. + +.. image:: ../static/description/pos_edit_order_line.png + :alt: Display Edit Order Line Popup diff --git a/pos_edit_order_line/readme/HISTORY.rst b/pos_edit_order_line/readme/HISTORY.rst new file mode 100644 index 0000000..f838e0c --- /dev/null +++ b/pos_edit_order_line/readme/HISTORY.rst @@ -0,0 +1,4 @@ +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 0000000..3a0328b 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 0000000..7082920 --- /dev/null +++ b/pos_edit_order_line/static/description/index.html @@ -0,0 +1,446 @@ + + + + + + +POS Edit Order Line + + + +
+

POS Edit Order Line

+ + +

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

+

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 smashing 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 0000000..a4fd719 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 0000000..87ada57 --- /dev/null +++ b/pos_edit_order_line/static/src/css/pos.css @@ -0,0 +1,61 @@ +/* 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; + display: list-item; +} + +.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.js b/pos_edit_order_line/static/src/js/EditOrderButton.js new file mode 100644 index 0000000..8805d17 --- /dev/null +++ b/pos_edit_order_line/static/src/js/EditOrderButton.js @@ -0,0 +1,75 @@ +odoo.define("pos_edit_order_line.EditOrderButton", function (require) { + "use strict"; + + const PosComponent = require("point_of_sale.PosComponent"); + const ProductScreen = require("point_of_sale.ProductScreen"); + const {useListener} = require("@web/core/utils/hooks"); + const Registries = require("point_of_sale.Registries"); + const {_lt} = require("web.core"); + + class EditOrderButton extends PosComponent { + setup() { + super.setup(); + useListener("click", this.onClick); + } + async onClick() { + var self = this; + var order = this.env.pos.get_order(); + var order_lines = order.get_orderlines(); + if (!order_lines.length) { + return this.showPopup("ErrorPopup", { + title: _lt("Empty Order"), + body: _lt("You need add some products first"), + }); + } + var array = []; + _.each(order_lines, function (line) { + array.push({ + id: line.id, + discount: line.discount, + price: line.get_unit_price(), + quantity: line.quantity, + uom: self.env.pos.units_by_id[line.product.uom_id[0]].name, + name: line.get_full_product_name(), + }); + }); + const {confirmed, payload} = await this.showPopup("EditOrderPopup", { + title: this.env._t("Edit Order Line"), + array: array, + }); + if (confirmed) { + await self.apply_changes(payload); + } + } + async apply_changes(payload) { + var order = this.env.pos.get_order(); + _.each(payload, function (changes, id) { + var line = order.get_orderline(parseInt(id, 10)); + _.each(changes, function (value, key) { + if (key === "quantity") { + line.set_quantity(value); + } else if (key === "price") { + line.set_unit_price(value); + } else if (key === "discount") { + line.set_discount(value); + } + }); + }); + if (!_.isEmpty(payload)) { + this.env.posbus.trigger("change"); + } + } + } + EditOrderButton.template = "EditOrderButton"; + + ProductScreen.addControlButton({ + component: EditOrderButton, + condition: function () { + return this.env.pos.config.allow_edit_order_line; + }, + }); + + Registries.Component.add(EditOrderButton); + + return EditOrderButton; +}); diff --git a/pos_edit_order_line/static/src/js/EditOrderLineInput.js b/pos_edit_order_line/static/src/js/EditOrderLineInput.js new file mode 100644 index 0000000..735cbc0 --- /dev/null +++ b/pos_edit_order_line/static/src/js/EditOrderLineInput.js @@ -0,0 +1,44 @@ +odoo.define("pos_edit_order_line.EditOrderLineInput", function (require) { + "use strict"; + + const {useState} = owl; + const PosComponent = require("point_of_sale.PosComponent"); + const Registries = require("point_of_sale.Registries"); + + class EditOrderLineInput extends PosComponent { + setup() { + super.setup(); + 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() { + const id = this.props.item.id; + const value = parseFloat(event.target.value.trim()); + if (isNaN(value)) { + $(event.target).addClass("required"); + } else { + $(event.target).removeClass("required"); + } + if (this.props.item[event.target.name] !== value) { + this.changes[event.target.name] = value; + this.trigger("onchange", {id, changes: this.changes}); + } + } + onFocus(event) { + $(event.target).select(); + } + } + EditOrderLineInput.template = "EditOrderLineInput"; + + Registries.Component.add(EditOrderLineInput); + + return EditOrderLineInput; +}); diff --git a/pos_edit_order_line/static/src/js/EditOrderPopup.js b/pos_edit_order_line/static/src/js/EditOrderPopup.js new file mode 100644 index 0000000..24effa5 --- /dev/null +++ b/pos_edit_order_line/static/src/js/EditOrderPopup.js @@ -0,0 +1,71 @@ +odoo.define("pos_edit_order_line.EditOrderPopup", function (require) { + "use strict"; + + const {useState} = owl; + const AbstractAwaitablePopup = require("point_of_sale.AbstractAwaitablePopup"); + const Registries = require("point_of_sale.Registries"); + const {_lt} = require("@web/core/l10n/translation"); + + class EditOrderPopup extends AbstractAwaitablePopup { + setup() { + super.setup(); + this._id = 0; + this.state = useState({array: this._initialize(this.props.array)}); + this.changes = {}; + } + _nextId() { + return this._id++; + } + _emptyItem() { + return { + text: "", + _id: this._nextId(), + }; + } + _initialize(array) { + // If no array is provided, we initialize with one empty item. + if (array.length === 0) return [this._emptyItem()]; + // Put _id for each item. It will serve as unique identifier of each item. + return array.map((item) => + Object.assign( + {}, + {_id: this._nextId()}, + typeof item === "object" ? item : {text: item} + ) + ); + } + _onchange(event) { + const {id, changes} = event.detail; + this.changes[id] = changes; + } + getPayload() { + return this.changes; + } + async confirm() { + var allowConfirmChanges = true; + _.each(Object.values(this.changes), (updates) => + _.each(Object.values(updates), (value) => { + if (isNaN(value)) { + allowConfirmChanges = false; + } + }) + ); + if (allowConfirmChanges) { + this.env.posbus.trigger("close-popup", { + popupId: this.props.id, + response: {confirmed: true, payload: await this.getPayload()}, + }); + } + } + } + EditOrderPopup.template = "EditOrderPopup"; + EditOrderPopup.defaultProps = { + confirmText: _lt("Save"), + cancelText: _lt("Cancel"), + array: [], + }; + + Registries.Component.add(EditOrderPopup); + + return EditOrderPopup; +}); 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 0000000..8fd295d --- /dev/null +++ b/pos_edit_order_line/static/src/xml/EditOrderButton.xml @@ -0,0 +1,12 @@ + + + + + + + + Edit Order Lines + + + + 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 0000000..29a440a --- /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 0000000..30f2026 --- /dev/null +++ b/pos_edit_order_line/static/src/xml/EditOrderPopup.xml @@ -0,0 +1,57 @@ + + + + + + + + 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 0000000..df43fe9 --- /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 + + +
+
+
+ +
+
+
+
+
+
+
+
diff --git a/pos_order_remove_line/README.rst b/pos_order_remove_line/README.rst new file mode 100644 index 0000000..c79070b --- /dev/null +++ b/pos_order_remove_line/README.rst @@ -0,0 +1,84 @@ +===================== +POS Order Remove Line +===================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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-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/16.0/pos_order_remove_line + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_order_remove_line + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/184/16.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +The module adds the possibility to delete a POS Order Line from the POS interface. + +**Table of contents** + +.. contents:: + :local: + +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 +~~~~~~~ + +* Roberto Fichera + +Contributors +~~~~~~~~~~~~ + +* Roberto Fichera +* Iván Todorovich +* Foram Shah +* Juan Bonilla + +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. + +.. |maintainer-robyf70| image:: https://github.com/robyf70.png?size=40px + :target: https://github.com/robyf70 + :alt: robyf70 + +Current `maintainer `__: + +|maintainer-robyf70| + +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_order_remove_line/__init__.py b/pos_order_remove_line/__init__.py new file mode 100644 index 0000000..bd06eb1 --- /dev/null +++ b/pos_order_remove_line/__init__.py @@ -0,0 +1,2 @@ +# Copyright 2023 LevelPrime +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) diff --git a/pos_order_remove_line/__manifest__.py b/pos_order_remove_line/__manifest__.py new file mode 100644 index 0000000..d7d2f67 --- /dev/null +++ b/pos_order_remove_line/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2023 LevelPrime +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + +{ + "name": "POS Order Remove Line", + "summary": "Add button to remove POS order line.", + "author": "Roberto Fichera, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/pos", + "category": "Point of Sale", + "maintainers": ["robyf70"], + "version": "16.0.1.1.0", + "license": "LGPL-3", + "depends": ["point_of_sale"], + "assets": { + "point_of_sale.assets": [ + "pos_order_remove_line/static/src/js/*.js", + "pos_order_remove_line/static/src/css/*.scss", + "pos_order_remove_line/static/src/xml/*xml", + ] + }, +} diff --git a/pos_order_remove_line/i18n/it.po b/pos_order_remove_line/i18n/it.po new file mode 100644 index 0000000..7338855 --- /dev/null +++ b/pos_order_remove_line/i18n/it.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 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\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" diff --git a/pos_order_remove_line/i18n/pos_order_remove_line.pot b/pos_order_remove_line/i18n/pos_order_remove_line.pot new file mode 100644 index 0000000..78d58d5 --- /dev/null +++ b/pos_order_remove_line/i18n/pos_order_remove_line.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 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" diff --git a/pos_order_remove_line/readme/CONTRIBUTORS.rst b/pos_order_remove_line/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..5db6b87 --- /dev/null +++ b/pos_order_remove_line/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* Roberto Fichera +* Iván Todorovich +* Foram Shah +* Juan Bonilla diff --git a/pos_order_remove_line/readme/DESCRIPTION.rst b/pos_order_remove_line/readme/DESCRIPTION.rst new file mode 100644 index 0000000..450df8d --- /dev/null +++ b/pos_order_remove_line/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +The module adds the possibility to delete a POS Order Line from the POS interface. diff --git a/pos_order_remove_line/static/description/icon.png b/pos_order_remove_line/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/pos_order_remove_line/static/description/icon.png differ diff --git a/pos_order_remove_line/static/description/index.html b/pos_order_remove_line/static/description/index.html new file mode 100644 index 0000000..ad171d0 --- /dev/null +++ b/pos_order_remove_line/static/description/index.html @@ -0,0 +1,424 @@ + + + + + + +POS Order Remove Line + + + +
+

POS Order Remove Line

+ + +

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

+

The module adds the possibility to delete a POS Order Line from the POS interface.

+

Table of contents

+ +
+

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

+
    +
  • Roberto Fichera
  • +
+
+ +
+

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.

+

Current maintainer:

+

robyf70

+

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_order_remove_line/static/src/css/orderline.scss b/pos_order_remove_line/static/src/css/orderline.scss new file mode 100644 index 0000000..3c441b4 --- /dev/null +++ b/pos_order_remove_line/static/src/css/orderline.scss @@ -0,0 +1,11 @@ +/* + * Copyright 2023 LevelPrime + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + */ + +.remove-line-button { + float: right; + padding: 0 5px 0 10px; + cursor: pointer; + margin-left: 6px; +} diff --git a/pos_order_remove_line/static/src/js/orderline.esm.js b/pos_order_remove_line/static/src/js/orderline.esm.js new file mode 100644 index 0000000..bf342e6 --- /dev/null +++ b/pos_order_remove_line/static/src/js/orderline.esm.js @@ -0,0 +1,32 @@ +/** @odoo-module **/ +/* + * Copyright 2023 LevelPrime + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) + */ + +import Orderline from "point_of_sale.Orderline"; +import Registries from "point_of_sale.Registries"; + +const PosOrderline = (Orderline) => + class extends Orderline { + async removeLine(ev) { + const order = this.env.pos.get_order(); + if (order) { + ev.stopPropagation(); + ev.preventDefault(); + this.selectLine(); + const selected_line = order.get_selected_orderline(); + selected_line.set_quantity("remove"); + order.remove_orderline(selected_line); + this.checkRewardLines(order); + } + } + // Dependecy-less suport to pos_loyalty + checkRewardLines(order) { + const anyRewardLine = order.orderlines.some((line) => line.is_reward_line); + if (anyRewardLine) { + order._updateRewards(); + } + } + }; +Registries.Component.extend(Orderline, PosOrderline); diff --git a/pos_order_remove_line/static/src/xml/orderline.xml b/pos_order_remove_line/static/src/xml/orderline.xml new file mode 100644 index 0000000..b06f5cc --- /dev/null +++ b/pos_order_remove_line/static/src/xml/orderline.xml @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/pos_product_sequence-16.0.1.0.zip b/pos_product_sequence-16.0.1.0.zip deleted file mode 100644 index 5191b5a..0000000 Binary files a/pos_product_sequence-16.0.1.0.zip and /dev/null differ diff --git a/pos_user_restrict/README.rst b/pos_user_restrict/README.rst new file mode 100644 index 0000000..c64aeec --- /dev/null +++ b/pos_user_restrict/README.rst @@ -0,0 +1,30 @@ +================================================================== +Restriction of POS User +================================================================== + +Allows setting the allowed Points of Sale for POS users and restricts access for other Points. + + + +Restrictions work only for users with role **Point of Sale / User**. + +After configuration, users will be able to see only the allowed Points of Sale, POS orders, and POS payments that related to these Points. + +Users with role **Point of Sale / Manager** can view all Points of Sale, POS orders, and Pos payments. + + +Configuration +============= + +Goto **Settings** \> **Users and Companies** \> **Users**. + +Choose a user and set allowed Points of Sale on the tab **Access Rights**. + + +Support and development +======================= + +Contact us: + +* support@garazd.biz +* https://garazd.biz/page/contactus diff --git a/pos_user_restrict/__init__.py b/pos_user_restrict/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/pos_user_restrict/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_user_restrict/__manifest__.py b/pos_user_restrict/__manifest__.py new file mode 100644 index 0000000..29b61ed --- /dev/null +++ b/pos_user_restrict/__manifest__.py @@ -0,0 +1,29 @@ +# Copyright © 2018 Garazd Creation (https://garazd.biz) +# @author: Yurii Razumovskyi (support@garazd.biz) +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.html). + +{ + 'name': 'Restriction of POS User', + 'version': '16.0.1.0.0', + 'category': 'Point of Sale', + 'author': 'Garazd Creation', + 'website': 'https://garazd.biz/shop', + 'license': 'LGPL-3', + 'summary': 'Only allowed points of sale for POS users', + 'images': ['static/description/banner.png', 'static/description/icon.png'], + 'depends': [ + 'point_of_sale', + ], + 'data': [ + 'security/pos_user_restrict_security.xml', + 'views/res_users_views.xml', + ], + 'demo': [ + 'demo/point_of_sale_demo.xml', + 'demo/res_users_demo.xml', + ], + 'support': 'support@garazd.biz', + 'application': False, + 'installable': True, + 'auto_install': False, +} diff --git a/pos_user_restrict/demo/point_of_sale_demo.xml b/pos_user_restrict/demo/point_of_sale_demo.xml new file mode 100644 index 0000000..6bd12c1 --- /dev/null +++ b/pos_user_restrict/demo/point_of_sale_demo.xml @@ -0,0 +1,10 @@ + + + + + Shop 2 + + True + + + diff --git a/pos_user_restrict/demo/res_users_demo.xml b/pos_user_restrict/demo/res_users_demo.xml new file mode 100644 index 0000000..9c63c23 --- /dev/null +++ b/pos_user_restrict/demo/res_users_demo.xml @@ -0,0 +1,24 @@ + + + + + POS User + + 3575 Buena Vista Avenue + Kharkiv + 61000 + + Europe/Kiev + pos.user@example.com + (057)-123-2334 + + + + + pos + pos + + + + + diff --git a/pos_user_restrict/doc/changelog.rst b/pos_user_restrict/doc/changelog.rst new file mode 100644 index 0000000..0f102bd --- /dev/null +++ b/pos_user_restrict/doc/changelog.rst @@ -0,0 +1,11 @@ +.. _changelog: + +Changelog +========= + +`16.0.1.0.0` +------------ + +- Migration from 15.0. + + diff --git a/pos_user_restrict/models/__init__.py b/pos_user_restrict/models/__init__.py new file mode 100644 index 0000000..8835165 --- /dev/null +++ b/pos_user_restrict/models/__init__.py @@ -0,0 +1 @@ +from . import res_users diff --git a/pos_user_restrict/models/res_users.py b/pos_user_restrict/models/res_users.py new file mode 100644 index 0000000..d386bb9 --- /dev/null +++ b/pos_user_restrict/models/res_users.py @@ -0,0 +1,22 @@ +# Copyright © 2018 Garazd Creation () +# @author: Yurii Razumovskyi () +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.html). + +from odoo import fields, models + + +class ResUsers(models.Model): + _inherit = 'res.users' + + pos_config_ids = fields.Many2many( + comodel_name='pos.config', + string='Allowed POS', + help="Allowed Points of Sales for the user. " + "POS managers can use all POS.", + ) + + def write(self, values): + res = super(ResUsers, self).write(values) + if self.ids and 'pos_config_ids' in values: + self.env['ir.rule'].clear_caches() + return res diff --git a/pos_user_restrict/security/pos_user_restrict_security.xml b/pos_user_restrict/security/pos_user_restrict_security.xml new file mode 100644 index 0000000..ae3bc3c --- /dev/null +++ b/pos_user_restrict/security/pos_user_restrict_security.xml @@ -0,0 +1,60 @@ + + + + + + + Show only allowed POS configs for User + + [('id', 'in', user.pos_config_ids.ids)] + + + + All POS configs for Manager. + + [(1, '=', 1)] + + + + + Show POS Sessions only for allowed POS configs. + + [('config_id', 'in', user.pos_config_ids.ids)] + + + + Show All POS Sessions for Manager. + + [(1, '=', 1)] + + + + + Show POS Orders only for allowed POS configs. + + [('config_id', 'in', user.pos_config_ids.ids)] + + + + Show All POS Orders for Manager. + + [(1, '=', 1)] + + + + + Show POS Payments only for allowed POS configs. + + [('session_id.config_id', 'in', user.pos_config_ids.ids)] + + + + Show All POS Payments for Manager. + + [(1, '=', 1)] + + + + diff --git a/pos_user_restrict/static/description/banner.png b/pos_user_restrict/static/description/banner.png new file mode 100644 index 0000000..9a02ab1 Binary files /dev/null and b/pos_user_restrict/static/description/banner.png differ diff --git a/pos_user_restrict/static/description/banner_facebook_shop.png b/pos_user_restrict/static/description/banner_facebook_shop.png new file mode 100644 index 0000000..051f91c Binary files /dev/null and b/pos_user_restrict/static/description/banner_facebook_shop.png differ diff --git a/pos_user_restrict/static/description/banner_website_sale_facebook_pixel.png b/pos_user_restrict/static/description/banner_website_sale_facebook_pixel.png new file mode 100644 index 0000000..3acb598 Binary files /dev/null and b/pos_user_restrict/static/description/banner_website_sale_facebook_pixel.png differ diff --git a/pos_user_restrict/static/description/banner_website_sale_google_analytics_4.png b/pos_user_restrict/static/description/banner_website_sale_google_analytics_4.png new file mode 100644 index 0000000..8ca9af4 Binary files /dev/null and b/pos_user_restrict/static/description/banner_website_sale_google_analytics_4.png differ diff --git a/pos_user_restrict/static/description/icon.png b/pos_user_restrict/static/description/icon.png new file mode 100644 index 0000000..e64570c Binary files /dev/null and b/pos_user_restrict/static/description/icon.png differ diff --git a/pos_user_restrict/static/description/index.html b/pos_user_restrict/static/description/index.html new file mode 100644 index 0000000..4cb982d --- /dev/null +++ b/pos_user_restrict/static/description/index.html @@ -0,0 +1,277 @@ +
+
+ +
+
Community
+
+
+
Enterprise
+
+
+
Odoo.sh
+
+ +
+
Odoo.sh
+
Enterprise
+
Community
+
+ +
+
+ +
+
+

Manage POS user's access rights to Points, Sessions, and Orders.

+
+
+ +
+
+
+
Description
+
+

In cases, when your business needs to restrict access to some Points of Sales for your employees, this module allows solving these requirements.

+
    +
  • Restrictions work only for users with the role "Point of Sale / User".
  • +
  • After configuration, users will be able to see only allowed Points of Sale, POS orders and payments related to them.
  • +
  • Users with the role "Point of Sale / Manager" have full access to all Points of Sale, POS orders, sessions and payments.
  • +
  • Simply configurable from the user settings form.
  • +
+
+
+
+
+ +
+
+
+
Features
+
+
+
+
+
+
+ +
+
Easy & Simple
+

Easy to activate and configure

+
+
+
+
+
+
+
+ +
+
Tested
+

Include unit tests

+
+
+
+
+
+
+
+ +
+
Support
+

Free 30 days support and 180 days bug-fixing

+
+
+
+
+
+
+
+ +
+
Try me
+

Demo & Test. Click on the "Live Preview" button

+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+

Configuration

+
+ +

To configure please follow these steps:

+ +
    +
  • Go to the Settings - Users menu.
  • +
  • Set up the Allowed POS in the user form.
  • +
  • Changes will be applied immediately after saving.
  • +
+ +
+ Restrict POS Users to allowed Points of Sale in Odoo 16.0 Restriction of POS User configuration +
+ +
+
+
+ +
+ +
+ +
+
+ +
+
Contact Us
+
Support, customizations, and development
+ +
+ + Skype: + GarazdCreation +
+ +
+ +
+
Our expertise
+
+
+ Odoo Learning Partner +
+
+ OCA Member +
+
+ With Odoo since 2014 +
+
+ Over 7,000 app downloads and purchases +
+
+
+ +
+
Explore our apps
+ +
Watch and subscribe
+ +
+
+ +
+ +
+
+
Version: 16.0.1.0.0
+ + + +
Module design is reserved
Copyright © Garazd Creation
+ +
+
+
    +
  • + +
    +
    16.0.1.0.0 2022-09-14
    +
    Migration from 15.0.
    +
    +
  • +
+
+
+
+
+ +
+
+
+ + + Rate the app + - support us to do more! + + +
+
+
+ diff --git a/pos_user_restrict/static/description/user_settings_pos.jpg b/pos_user_restrict/static/description/user_settings_pos.jpg new file mode 100644 index 0000000..36dca13 Binary files /dev/null and b/pos_user_restrict/static/description/user_settings_pos.jpg differ diff --git a/pos_user_restrict/tests/__init__.py b/pos_user_restrict/tests/__init__.py new file mode 100644 index 0000000..2ab7b51 --- /dev/null +++ b/pos_user_restrict/tests/__init__.py @@ -0,0 +1 @@ +from . import test_user_restriction diff --git a/pos_user_restrict/tests/test_user_restriction.py b/pos_user_restrict/tests/test_user_restriction.py new file mode 100644 index 0000000..2c6ae1a --- /dev/null +++ b/pos_user_restrict/tests/test_user_restriction.py @@ -0,0 +1,30 @@ +from odoo import Command +from odoo.tests.common import TransactionCase +from odoo.tests import tagged +from odoo.exceptions import AccessError + + +@tagged('post_install', '-at_install') +class TestPosUser(TransactionCase): + + def setUp(self): + super(TestPosUser, self).setUp() + self.user_pos = self.env.ref('pos_user_restrict.user_pos') + self.user_demo = self.env.ref('base.user_demo') + self.user_admin = self.env.ref('base.user_demo') + self.pos_1 = self.env.ref('point_of_sale.pos_config_main') + self.pos_2 = self.env.ref('pos_user_restrict.pos_config_second') + + def test_01_no_allowed_pos(self): + with self.assertRaises(AccessError): + self.pos_1.with_user(self.user_pos).read(['name']) + with self.assertRaises(AccessError): + self.pos_2.with_user(self.user_pos).read(['name']) + + def test_02_pos_1_allowed(self): + self.user_pos.pos_config_ids = [Command.link(self.pos_1.id)] + # Check the access to POS 1 + self.pos_1.with_user(self.user_pos).read(['name']) + # Check the access to POS 2 + with self.assertRaises(AccessError): + self.pos_2.with_user(self.user_pos).read(['name']) diff --git a/pos_user_restrict/views/res_users_views.xml b/pos_user_restrict/views/res_users_views.xml new file mode 100644 index 0000000..98fc0ce --- /dev/null +++ b/pos_user_restrict/views/res_users_views.xml @@ -0,0 +1,20 @@ + + + + + res.users.form.inherit.pos.user.restrict + res.users + + + + + + + + + + +