diff --git a/pos_return_barcode/README.rst b/pos_return_barcode/README.rst new file mode 100644 index 000000000..7c3f6929a --- /dev/null +++ b/pos_return_barcode/README.rst @@ -0,0 +1,46 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +POS Return Barcode +================== +This module is used to return products by scanning the barcode in pos session. + +Configuration +============= +* Set global refund security from settings + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +* Developer: (V16) Vishnu KP Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/pos_return_barcode/__init__.py b/pos_return_barcode/__init__.py new file mode 100644 index 000000000..a720c4329 --- /dev/null +++ b/pos_return_barcode/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Vishnu K P(odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from . import models diff --git a/pos_return_barcode/__manifest__.py b/pos_return_barcode/__manifest__.py new file mode 100644 index 000000000..211c53424 --- /dev/null +++ b/pos_return_barcode/__manifest__.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Vishnu K P (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +{ + 'name': 'POS Return Barcode', + 'version': '16.0.1.0.0', + 'summary': """This module in Odoo 17 allows to return product effortless + via receipt barcode scanning.""", + 'description': """The POS Return Barcode module in Odoo 17 streamlines the + return process by enabling users to return products through the scanning + of the receipt barcode""", + 'category': 'Point of Sale', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['point_of_sale'], + 'data': [ + 'views/res_config_settings_views.xml', + 'views/pos_order_views.xml', + ], + 'assets': { + 'point_of_sale.assets': [ + 'pos_return_barcode/static/src/js/ProductScreen.js', + 'pos_return_barcode/static/src/js/order.js', + 'pos_return_barcode/static/src/js/barcode_popup.js', + 'pos_return_barcode/static/src/js/success_popup.js', + 'pos_return_barcode/static/src/xml/return_product_template.xml', + 'pos_return_barcode/static/src/xml/order_receipt.xml', + 'pos_return_barcode/static/src/xml/barcode_popup.xml', + 'pos_return_barcode/static/src/xml/success_popup.xml', + ], + }, + 'images': ['static/description/banner.jpg'], + 'license': "AGPL-3", + 'installable': True, + 'application': False, + 'auto_install': False, +} diff --git a/pos_return_barcode/doc/RELEASE_NOTES.md b/pos_return_barcode/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..197123c13 --- /dev/null +++ b/pos_return_barcode/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 02.05.2024 +#### Version 17.0.1.0.0 +#### ADD +- Initial commit for POS Return Barcode diff --git a/pos_return_barcode/models/__init__.py b/pos_return_barcode/models/__init__.py new file mode 100755 index 000000000..8d094927f --- /dev/null +++ b/pos_return_barcode/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Vishnu KP (odoo@cybrosys.com) +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import pos_order +from . import res_config_settings diff --git a/pos_return_barcode/models/pos_order.py b/pos_return_barcode/models/pos_order.py new file mode 100644 index 000000000..4059fde21 --- /dev/null +++ b/pos_return_barcode/models/pos_order.py @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Vishnu KP (odoo@cybrosys.com) +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, fields, models + + +class PosOrder(models.Model): + """Inherited pos order to add some fields""" + _inherit = "pos.order" + + barcode = fields.Char(string="Barcode", readonly=True, + help='to get barcode number of this particular order') + is_return = fields.Boolean(string='Return orders', default=False, related='is_refunded', + store=True, + helps='differentiate the pos order and return/ ' + 'refund order') + + @api.model + def create(self, vals): + """Override the create function to add barcode number in order""" + res = super().create(vals) + res.barcode = res.pos_reference.replace("Order", "").replace( + " ", "").replace("-", "") + return res + + def action_barcode_return(self, barcode): + """This fn is to search the pos order based on the barcode passed + from the js and returns true or false""" + order = self.env['pos.order'].search([('barcode', '=', barcode), + ('is_return', '=', False)]) + if order and order.is_refunded is False: + refund_id = order.refund()['res_id'] + refund = self.browse(refund_id) + return {'order': refund, 'exist': True} + return {'order': len(order), 'exist': False} + + def _prepare_refund_values(self, current_session): + """Override this function to pass that the order is return """ + res = super()._prepare_refund_values(current_session) + res.update({ + 'is_return': True + }) + return res + + def find_order(self, barcode): + order = self.env['pos.order'].search([('barcode', '=', barcode), + ('is_return', '=', False)]) + returned_order = self.env['pos.order'].search([('barcode', '=', barcode), + ('is_return', '=', True)]) + if order: + return order.id + else: + if returned_order: + return False + else: + return "error" diff --git a/pos_return_barcode/models/res_config_settings.py b/pos_return_barcode/models/res_config_settings.py new file mode 100644 index 000000000..bb9647211 --- /dev/null +++ b/pos_return_barcode/models/res_config_settings.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Vishnu KP (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + """Adding a new field to res_config_settings model.""" + _inherit = 'res.config.settings' + + point_of_sale_barcode = fields.Boolean( + string='Use Barcode on ticket', + config_parameter='pos_return_barcode.receipt_barcode', + help="Add a Barcode on the ticket, which the user can scan to request " + "the invoice linked to its order.") diff --git a/pos_return_barcode/static/description/assets/icons/check.png b/pos_return_barcode/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/check.png differ diff --git a/pos_return_barcode/static/description/assets/icons/chevron.png b/pos_return_barcode/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/chevron.png differ diff --git a/pos_return_barcode/static/description/assets/icons/cogs.png b/pos_return_barcode/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/cogs.png differ diff --git a/pos_return_barcode/static/description/assets/icons/consultation.png b/pos_return_barcode/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/consultation.png differ diff --git a/pos_return_barcode/static/description/assets/icons/ecom-black.png b/pos_return_barcode/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/ecom-black.png differ diff --git a/pos_return_barcode/static/description/assets/icons/education-black.png b/pos_return_barcode/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/education-black.png differ diff --git a/pos_return_barcode/static/description/assets/icons/hotel-black.png b/pos_return_barcode/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/hotel-black.png differ diff --git a/pos_return_barcode/static/description/assets/icons/license.png b/pos_return_barcode/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/license.png differ diff --git a/pos_return_barcode/static/description/assets/icons/lifebuoy.png b/pos_return_barcode/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/lifebuoy.png differ diff --git a/pos_return_barcode/static/description/assets/icons/manufacturing-black.png b/pos_return_barcode/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/manufacturing-black.png differ diff --git a/pos_return_barcode/static/description/assets/icons/pos-black.png b/pos_return_barcode/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/pos-black.png differ diff --git a/pos_return_barcode/static/description/assets/icons/puzzle.png b/pos_return_barcode/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/puzzle.png differ diff --git a/pos_return_barcode/static/description/assets/icons/restaurant-black.png b/pos_return_barcode/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/restaurant-black.png differ diff --git a/pos_return_barcode/static/description/assets/icons/service-black.png b/pos_return_barcode/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/service-black.png differ diff --git a/pos_return_barcode/static/description/assets/icons/trading-black.png b/pos_return_barcode/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/trading-black.png differ diff --git a/pos_return_barcode/static/description/assets/icons/training.png b/pos_return_barcode/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/training.png differ diff --git a/pos_return_barcode/static/description/assets/icons/update.png b/pos_return_barcode/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/update.png differ diff --git a/pos_return_barcode/static/description/assets/icons/user.png b/pos_return_barcode/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/user.png differ diff --git a/pos_return_barcode/static/description/assets/icons/wrench.png b/pos_return_barcode/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/pos_return_barcode/static/description/assets/icons/wrench.png differ diff --git a/pos_return_barcode/static/description/assets/misc/categories.png b/pos_return_barcode/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/categories.png differ diff --git a/pos_return_barcode/static/description/assets/misc/check-box.png b/pos_return_barcode/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/check-box.png differ diff --git a/pos_return_barcode/static/description/assets/misc/compass.png b/pos_return_barcode/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/compass.png differ diff --git a/pos_return_barcode/static/description/assets/misc/corporate.png b/pos_return_barcode/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/corporate.png differ diff --git a/pos_return_barcode/static/description/assets/misc/customer-support.png b/pos_return_barcode/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/customer-support.png differ diff --git a/pos_return_barcode/static/description/assets/misc/cybrosys-logo.png b/pos_return_barcode/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/cybrosys-logo.png differ diff --git a/pos_return_barcode/static/description/assets/misc/features.png b/pos_return_barcode/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/features.png differ diff --git a/pos_return_barcode/static/description/assets/misc/logo.png b/pos_return_barcode/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/logo.png differ diff --git a/pos_return_barcode/static/description/assets/misc/pictures.png b/pos_return_barcode/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/pictures.png differ diff --git a/pos_return_barcode/static/description/assets/misc/pie-chart.png b/pos_return_barcode/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/pie-chart.png differ diff --git a/pos_return_barcode/static/description/assets/misc/right-arrow.png b/pos_return_barcode/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/right-arrow.png differ diff --git a/pos_return_barcode/static/description/assets/misc/star.png b/pos_return_barcode/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/star.png differ diff --git a/pos_return_barcode/static/description/assets/misc/support.png b/pos_return_barcode/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/support.png differ diff --git a/pos_return_barcode/static/description/assets/misc/whatsapp.png b/pos_return_barcode/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/pos_return_barcode/static/description/assets/misc/whatsapp.png differ diff --git a/pos_return_barcode/static/description/assets/modules/1.png b/pos_return_barcode/static/description/assets/modules/1.png new file mode 100644 index 000000000..6cc0986f2 Binary files /dev/null and b/pos_return_barcode/static/description/assets/modules/1.png differ diff --git a/pos_return_barcode/static/description/assets/modules/2.png b/pos_return_barcode/static/description/assets/modules/2.png new file mode 100644 index 000000000..7b0ac4b33 Binary files /dev/null and b/pos_return_barcode/static/description/assets/modules/2.png differ diff --git a/pos_return_barcode/static/description/assets/modules/3.png b/pos_return_barcode/static/description/assets/modules/3.png new file mode 100644 index 000000000..ae32f480b Binary files /dev/null and b/pos_return_barcode/static/description/assets/modules/3.png differ diff --git a/pos_return_barcode/static/description/assets/modules/4.png b/pos_return_barcode/static/description/assets/modules/4.png new file mode 100644 index 000000000..d9374733c Binary files /dev/null and b/pos_return_barcode/static/description/assets/modules/4.png differ diff --git a/pos_return_barcode/static/description/assets/modules/5.png b/pos_return_barcode/static/description/assets/modules/5.png new file mode 100644 index 000000000..c3a620a56 Binary files /dev/null and b/pos_return_barcode/static/description/assets/modules/5.png differ diff --git a/pos_return_barcode/static/description/assets/modules/6.png b/pos_return_barcode/static/description/assets/modules/6.png new file mode 100644 index 000000000..a29119785 Binary files /dev/null and b/pos_return_barcode/static/description/assets/modules/6.png differ diff --git a/pos_return_barcode/static/description/assets/screenshots/create_payment.png b/pos_return_barcode/static/description/assets/screenshots/create_payment.png new file mode 100644 index 000000000..9ba17dde8 Binary files /dev/null and b/pos_return_barcode/static/description/assets/screenshots/create_payment.png differ diff --git a/pos_return_barcode/static/description/assets/screenshots/hero.gif b/pos_return_barcode/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..7c8f024b7 Binary files /dev/null and b/pos_return_barcode/static/description/assets/screenshots/hero.gif differ diff --git a/pos_return_barcode/static/description/assets/screenshots/refund.png b/pos_return_barcode/static/description/assets/screenshots/refund.png new file mode 100644 index 000000000..c41bd3077 Binary files /dev/null and b/pos_return_barcode/static/description/assets/screenshots/refund.png differ diff --git a/pos_return_barcode/static/description/assets/screenshots/retn_prdcts.png b/pos_return_barcode/static/description/assets/screenshots/retn_prdcts.png new file mode 100644 index 000000000..ff58150cc Binary files /dev/null and b/pos_return_barcode/static/description/assets/screenshots/retn_prdcts.png differ diff --git a/pos_return_barcode/static/description/assets/screenshots/s1.png b/pos_return_barcode/static/description/assets/screenshots/s1.png new file mode 100644 index 000000000..90fe77be9 Binary files /dev/null and b/pos_return_barcode/static/description/assets/screenshots/s1.png differ diff --git a/pos_return_barcode/static/description/assets/screenshots/s2.png b/pos_return_barcode/static/description/assets/screenshots/s2.png new file mode 100644 index 000000000..ef7f21b5a Binary files /dev/null and b/pos_return_barcode/static/description/assets/screenshots/s2.png differ diff --git a/pos_return_barcode/static/description/assets/screenshots/s3.png b/pos_return_barcode/static/description/assets/screenshots/s3.png new file mode 100644 index 000000000..24291e7dd Binary files /dev/null and b/pos_return_barcode/static/description/assets/screenshots/s3.png differ diff --git a/pos_return_barcode/static/description/assets/screenshots/s4.png b/pos_return_barcode/static/description/assets/screenshots/s4.png new file mode 100644 index 000000000..7db7c3de4 Binary files /dev/null and b/pos_return_barcode/static/description/assets/screenshots/s4.png differ diff --git a/pos_return_barcode/static/description/assets/screenshots/s5.png b/pos_return_barcode/static/description/assets/screenshots/s5.png new file mode 100644 index 000000000..23399e31f Binary files /dev/null and b/pos_return_barcode/static/description/assets/screenshots/s5.png differ diff --git a/pos_return_barcode/static/description/assets/screenshots/s6.png b/pos_return_barcode/static/description/assets/screenshots/s6.png new file mode 100644 index 000000000..233664b04 Binary files /dev/null and b/pos_return_barcode/static/description/assets/screenshots/s6.png differ diff --git a/pos_return_barcode/static/description/assets/screenshots/s7.png b/pos_return_barcode/static/description/assets/screenshots/s7.png new file mode 100644 index 000000000..97c0487bd Binary files /dev/null and b/pos_return_barcode/static/description/assets/screenshots/s7.png differ diff --git a/pos_return_barcode/static/description/banner.png b/pos_return_barcode/static/description/banner.png new file mode 100644 index 000000000..519192ca2 Binary files /dev/null and b/pos_return_barcode/static/description/banner.png differ diff --git a/pos_return_barcode/static/description/icon.png b/pos_return_barcode/static/description/icon.png new file mode 100644 index 000000000..fac65117d Binary files /dev/null and b/pos_return_barcode/static/description/icon.png differ diff --git a/pos_return_barcode/static/description/index.html b/pos_return_barcode/static/description/index.html new file mode 100644 index 000000000..ae3e6fc5a --- /dev/null +++ b/pos_return_barcode/static/description/index.html @@ -0,0 +1,652 @@ +
+ +
+ +
+
+ Enterprise +
+
+ Enterprise +
+
+ Odoo.sh +
+ +
+
+ +
+
+
+ +

+ POS RETURN BARCODE +

+

+ POS Return Barcode Odoo 16

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

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ This module allows you to create a barcode in the POS receipt. So that + the user can easily return the order with the barcode scanning. Also + after return the user can make return payment from the pos order +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ + In this module + we can add barcode in pos receipt +
+
+ + Can return product by scanning the receipt barcode +
+ +
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+ +
+

+ Barcode Enable option in the settings +

+ +
+ +
+

After payment, we can see the barcode in the receipt. + +

+ +
+ +
+

+ Return Option in the numpad +

+ +
+ +
+

+ Create return with barcode of the sale order +

+ +
+ +
+

+ After confirmation order details will update in pos

+ +
+ +
+

+ Create payment for the return order

+ +
+
+

+ Refund order payment

+ +
+
+
+ + +
+
+ +
+

+ Related + Products +

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

+ Our Services +

+
+ +
+
+
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+ +
+ + + + + +
+
+ +
+

+ Our + Industries +

+
+ +
+
+
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

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

+ Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? + Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+ +91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
diff --git a/pos_return_barcode/static/src/js/ProductScreen.js b/pos_return_barcode/static/src/js/ProductScreen.js new file mode 100644 index 000000000..58f8f2c8d --- /dev/null +++ b/pos_return_barcode/static/src/js/ProductScreen.js @@ -0,0 +1,34 @@ +/** @odoo-module **/ +//Extended Component to add a button in pos session and for its working to scan barcode and show the products in the orderlines +import { _t } from 'web.core'; +import PosComponent from 'point_of_sale.PosComponent'; +import ProductScreen from "point_of_sale.ProductScreen"; +import Registries from "point_of_sale.Registries"; +import { useListener } from "@web/core/utils/hooks"; +var rpc = require('web.rpc'); + +class ReturnProductButton extends PosComponent { + setup() { + super.setup(); + useListener('click', this.onClick); + this.pos = this.env.pos + this.pos_orders = null + this.pos_orderline = [] + this.pos.receipt_barcode_reader= null + } + async onClick() { + const { confirmed, payload: inputbarcode} = await this.showPopup( + 'BarcodePopup', { + title: _t('Scan barcode'), + startingValue: this.env.pos.get_order().get_barcode_reader() + }); + } +} +ReturnProductButton.template = 'ReturnProduct'; +ProductScreen.addControlButton({ + component: ReturnProductButton, + condition: function() { + return true; + }, + }); +Registries.Component.add(ReturnProductButton); diff --git a/pos_return_barcode/static/src/js/barcode_popup.js b/pos_return_barcode/static/src/js/barcode_popup.js new file mode 100644 index 000000000..e24d31862 --- /dev/null +++ b/pos_return_barcode/static/src/js/barcode_popup.js @@ -0,0 +1,185 @@ +/** @odoo-module **/ +import Registries from 'point_of_sale.Registries'; +const { Order } = require('point_of_sale.models'); +const { _lt } = require('@web/core/l10n/translation'); +import { useListener } from "@web/core/utils/hooks"; +const { useRef, onMounted, useState} = owl; +import TicketScreen from 'point_of_sale.TicketScreen'; + +class BarcodePopup extends TicketScreen { + setup() { + super.setup(); + this.state = useState({ + barcodeValue: this.props.startingValue + }); + useListener('do-refund-edit', this._onDoRefundbarcode); + this.pos = this.env.pos; + this.pos_orders = null; + this.pos_orderline = []; + this.pos.receipt_barcode_reader = null; + this.barcode = useRef('barcode'); + onMounted(this.onMounted); + } + + async _onDoRefundbarcode(ev) { + const input_barcode = this.state.barcodeValue; + let order = false; + var self = this + + const return_order = await this.rpc({ + model: 'pos.order', + method: 'find_order', + args: [,input_barcode], + }).then(async function(data){ + if(data === false){ + self.cancel(); + self.alert_popup(); + } + else if (data === "error"){ + self.cancel(); + self.error_popup(); + } + const fetchedOrders = await self.rpc({ + model: 'pos.order', + method: 'export_for_ui', + args: [parseInt(data)], + context: self.env.session.user_context, + }).then(async function(result){ + await self.env.pos._loadMissingProducts(result); + await self.env.pos._loadMissingPartners(result); + let for_fetch; + result.forEach((order) => { + for_fetch = Order.create({}, { pos: self.env.pos, json: order }); + }); + order = for_fetch; + order.orderlines.forEach((lines) => { self._getToRefundDetailbarcode(lines) }); + if (!order) { + self._state.ui.highlightHeaderNote = !self._state.ui.highlightHeaderNote; + return; + } + if (self._doesOrderHaveSoleItem(order)) { + if (!self._prepareAutoRefundOnOrder(order)) { + // Don't proceed on refund if preparation returned false. + return; + } + } + const partner = order.get_partner(); + const allToRefundDetails = self._getRefundableDetails(partner); + if (allToRefundDetails.length == 0) { + self._state.ui.highlightHeaderNote = !self._state.ui.highlightHeaderNote; + return; + } + // The order that will contain the refund orderlines. + // Use the destinationOrder from props if the order to refund has the same + // partner as the destinationOrder. + const destinationOrder = + self.props.destinationOrder && + partner === self.props.destinationOrder.get_partner() && + !self.env.pos.doNotAllowRefundAndSales() + ? self.props.destinationOrder + : self._getEmptyOrder(partner); + + // Add a check to see if the fiscal position exists in the pos + + if (order.fiscal_position_not_found) { + self.showPopup('ErrorPopup', { + title: self.env._t('Fiscal Position not found'), + body: self.env._t('The fiscal position used in the original order is not loaded. Make sure it is loaded by adding it in the pos configuration.') + }); + return; + } + + // Add orderline for each toRefundDetail to the destinationOrder. + for (const refundDetail of allToRefundDetails) { + const product = self.env.pos.db.get_product_by_id(refundDetail.orderline.productId); + const options = self._prepareRefundOrderlineOptions(refundDetail); + await destinationOrder.add_product(product, options); + refundDetail.destinationOrderUid = destinationOrder.uid; + } + destinationOrder.fiscal_position = order.fiscal_position; + + // Set the partner to the destinationOrder. + if (partner && !destinationOrder.get_partner()) { + destinationOrder.set_partner(partner); + destinationOrder.updatePricelist(partner); + } + if (self.env.pos.get_order().cid !== destinationOrder.cid) { + self.env.pos.set_order(destinationOrder); + } + self.env.posbus.trigger('close-popup', { + popupId: self.props.id, + response: { confirmed: true, payload: await self.getPayload() }, + }); + }); + }); + } + _getToRefundDetailbarcode(orderline) { + if (orderline.id in this.env.pos.toRefundLines) { + return this.env.pos.toRefundLines[orderline.id]; + } else { + const partner = orderline.order.get_partner(); + const orderPartnerId = partner ? partner.id : false; + const newToRefundDetail = { + qty: orderline.quantity, + orderline: { + id: orderline.id, + productId: orderline.product.id, + price: orderline.price, + qty: orderline.quantity, + refundedQty: orderline.refunded_qty, + orderUid: orderline.order.uid, + orderBackendId: orderline.order.backendId, + orderPartnerId, + tax_ids: orderline.get_taxes().map(tax => tax.id), + discount: orderline.discount, + }, + destinationOrderUid: false, + }; + this.env.pos.toRefundLines[orderline.id] = newToRefundDetail; + return newToRefundDetail; + } + } + alert_popup() { + let title = 'Alert' + let body= 'This order has already been returned' + let popup = 'SuccessPopup' + this.showPopup(popup, { + title: this.env._t(title), + body: this.env._t(body), + }); + } + error_popup() { + let title = 'Invalid Barcode!' + let body= 'Sorry Please Enter a Valid Barcode' + let popup = 'ErrorPopup' + this.showPopup(popup, { + title: this.env._t(title), + body: this.env._t(body), + }); + } + onMounted() { + this.barcode.el.focus(); + } + getPayload() { + return { + barcodeValue: this.state.barcodeValue, + } + } + confirm() { + this.trigger('do-refund-edit'); + } + cancel() { + this.env.posbus.trigger('close-popup', { + popupId: this.props.id, + response: { confirmed: false}, + }); + } +} +BarcodePopup.template = 'pos_return_barcode.BarcodePopup'; +BarcodePopup.defaultProps = { + confirmText: _lt('Confirm'), + cancelText: _lt('Cancel'), + title: '', + body: '', +}; +Registries.Component.add(BarcodePopup); \ No newline at end of file diff --git a/pos_return_barcode/static/src/js/order.js b/pos_return_barcode/static/src/js/order.js new file mode 100644 index 000000000..c005cb829 --- /dev/null +++ b/pos_return_barcode/static/src/js/order.js @@ -0,0 +1,57 @@ +/** @odoo-module **/ +import { Order } from 'point_of_sale.models'; +import models from 'point_of_sale.models'; +import Registries from "point_of_sale.Registries"; +var rpc = require('web.rpc'); +var { Orderline} = require('point_of_sale.models'); + +const PosReturnOrder = (Order) => class PosReturnOrder extends Order { + constructor() { + super(...arguments); + this.barcode_reader = this.barcode_reader || null; + this.is_barcode = false + this.barcode = false + } + set_barcode_reader(barcode_reader) { + this.comment_feedback = barcode_reader.Value; + } + get_barcode_reader() { + return this.barcode_reader; + } + export_as_JSON() { + const json = super.export_as_JSON(...arguments); + json.barcode_reader = this.barcode_reader; + return json; + } + init_from_JSON(json) { + super.init_from_JSON(...arguments); + this.barcode_reader = json.barcode_reader; + } + async get_barcode(){ + this.is_barcode = await rpc.query({ + model: "ir.config_parameter", + method: 'get_param', + args: ['pos_return_barcode.receipt_barcode'], + }) + const order = await rpc.query({ + model: 'pos.order', + method: 'search_read', + domain: [['pos_reference', '=', this.name]], + fields:['name','barcode'] + }); + if(this.is_barcode){ + order.map(element => this.barcode = element.barcode) + } + return this.barcode + } + export_for_printing() { + this.get_barcode() + return { + ...super.export_for_printing(...arguments), + is_barcode: this.is_barcode, + barcode: this.barcode, + }; + } +} +Registries.Model.extend(Order, PosReturnOrder); + diff --git a/pos_return_barcode/static/src/js/success_popup.js b/pos_return_barcode/static/src/js/success_popup.js new file mode 100644 index 000000000..e69cde545 --- /dev/null +++ b/pos_return_barcode/static/src/js/success_popup.js @@ -0,0 +1,18 @@ +/** @odoo-module **/ +const AbstractAwaitablePopup = require('point_of_sale.AbstractAwaitablePopup'); +import Registries from 'point_of_sale.Registries'; +const { _lt } = require('@web/core/l10n/translation'); + +class SuccessPopup extends AbstractAwaitablePopup { + setup() { + super.setup(); + } + } +SuccessPopup.template = 'pos_return_barcode.SuccessPopup'; +SuccessPopup.defaultProps = { + confirmText: _lt('Back'), + title: '', + body: '', +}; +Registries.Component.add(SuccessPopup); +return SuccessPopup; diff --git a/pos_return_barcode/static/src/xml/barcode_popup.xml b/pos_return_barcode/static/src/xml/barcode_popup.xml new file mode 100644 index 000000000..ccc149f25 --- /dev/null +++ b/pos_return_barcode/static/src/xml/barcode_popup.xml @@ -0,0 +1,24 @@ + + + + +