diff --git a/barcode_capturing_sale_purchase/README.rst b/barcode_capturing_sale_purchase/README.rst new file mode 100644 index 000000000..a60232943 --- /dev/null +++ b/barcode_capturing_sale_purchase/README.rst @@ -0,0 +1,50 @@ +.. 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 + +Scan Product Barcode for Sale & Purchase +======================================== +This module captures barcode of products through system camera and add product +to order line. + +Configuration +============= +* No additional configurations are required + +Company +======= +* `Cybrosys Techno Solutions `__ + +License +======= +GNU LESSER GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +======= +* Developers: (V18) Manasa T P, + (V17) Subina , + (V16) RAHUL C K, + 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 https://www.cybrosys.com. + +Further information +=================== +HTML Description: ``__ diff --git a/barcode_capturing_sale_purchase/__init__.py b/barcode_capturing_sale_purchase/__init__.py new file mode 100644 index 000000000..df8674813 --- /dev/null +++ b/barcode_capturing_sale_purchase/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Manasa T 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/barcode_capturing_sale_purchase/__manifest__.py b/barcode_capturing_sale_purchase/__manifest__.py new file mode 100644 index 000000000..05c564836 --- /dev/null +++ b/barcode_capturing_sale_purchase/__manifest__.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Manasa T 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': "Scan Product Barcode for Sale & Purchase", + 'version': '18.0.1.0.0', + 'category': 'Extra Tools', + 'summary': """Scan Barcode from Camera in sale and purchase orders.""", + 'description': """Products can be added to sale or purchase orders by + scanning barcode of products through system camera. Products will be + automatically added to order line once the barcode is identified.""", + 'author': "Cybrosys Techno Solutions", + 'company': "Cybrosys Techno Solutions", + 'maintainer': "Cybrosys Techno Solutions", + 'website': "https://www.cybrosys.com", + 'depends': ['sale_management', 'purchase'], + 'data': [ + 'views/sale_order_views.xml', + 'views/purchase_order_views.xml' + ], + 'assets': { + 'web.assets_backend': [ + 'https://cdn.jsdelivr.net/npm/quagga@0.12.1/dist/quagga.min.js', + 'barcode_capturing_sale_purchase/static/src/js/registry_barcode_sale.js', + 'barcode_capturing_sale_purchase/static/src/js/registry_barcode_purchase.js', + 'barcode_capturing_sale_purchase/static/src/js/sale_barcode.js', + 'barcode_capturing_sale_purchase/static/src/js/purchase_barcode.js', + 'barcode_capturing_sale_purchase/static/src/js/barcode_dialog.js', + 'barcode_capturing_sale_purchase/static/src/css/styles.css', + 'barcode_capturing_sale_purchase/static/src/xml/purchase_web_form_templates.xml', + 'barcode_capturing_sale_purchase/static/src/xml/sale_web_form_templates.xml', + 'barcode_capturing_sale_purchase/static/src/xml/barcode_dialog_templates.xml', + ], + }, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/barcode_capturing_sale_purchase/doc/RELEASE_NOTES.md b/barcode_capturing_sale_purchase/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..25c0c07c7 --- /dev/null +++ b/barcode_capturing_sale_purchase/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 09.04.2025 +#### Version 18.0.1.0.0 +#### ADD + +- Initial commit for Scan Product Barcode for Sale & Purchase diff --git a/barcode_capturing_sale_purchase/models/__init__.py b/barcode_capturing_sale_purchase/models/__init__.py new file mode 100644 index 000000000..fc062869a --- /dev/null +++ b/barcode_capturing_sale_purchase/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Manasa T 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 purchase_order +from . import sale_order diff --git a/barcode_capturing_sale_purchase/models/purchase_order.py b/barcode_capturing_sale_purchase/models/purchase_order.py new file mode 100644 index 000000000..6b474ea55 --- /dev/null +++ b/barcode_capturing_sale_purchase/models/purchase_order.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Manasa T 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 odoo import api, models + + +class PurchaseOrder(models.Model): + """Module is inherited and function is created to create a purchase + order line with the scanned barcode of product""" + _inherit = 'purchase.order' + + @api.model + def barcode_search(self, last_code, order_id): + """Purchase Order line is created and product is added by checking + the barcode. args contains the barcode of product and purchase order + id""" + product = self.env['product.product'].search([('barcode', '=', + last_code)]) + if not product: + return True + else: + purchase_order = self.browse(order_id) + if purchase_order.order_line: + for rec in purchase_order.order_line: + if rec.product_id == product: + rec.product_qty += 1 + return { + 'type': 'ir.actions.client', + 'tag': 'reload', + } + purchase_order.order_line.create({ + 'order_id': purchase_order.id, + 'product_id': product.id, + 'product_uom_qty': 1 + }) + return { + 'type': 'ir.actions.client', + 'tag': 'reload', + } diff --git a/barcode_capturing_sale_purchase/models/sale_order.py b/barcode_capturing_sale_purchase/models/sale_order.py new file mode 100644 index 000000000..d0492dc05 --- /dev/null +++ b/barcode_capturing_sale_purchase/models/sale_order.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +################################################################################ +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies(). +# Author: Manasa T 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 odoo import api, models + + +class SaleOrder(models.Model): + """Module is inherited and function is created to create a sale + order line with the scanned barcode of product""" + _inherit = 'sale.order' + + @api.model + def barcode_search(self, last_code, order_id): + """Sale Order line is created and product is added by checking + the barcode. args contains the barcode of product and sale order id.""" + product = self.env['product.product'].search([('barcode', '=', + last_code)]) + if not product: + return True + else: + sale_order = self.browse(order_id) + if sale_order.order_line: + for rec in sale_order.order_line: + if rec.product_id == product: + rec.product_uom_qty += 1 + return + sale_order.order_line.create({ + 'order_id': sale_order.id, + 'product_id': product.id, + 'product_uom_qty': 1 + }) diff --git a/barcode_capturing_sale_purchase/static/description/assets/cybro-icon.png b/barcode_capturing_sale_purchase/static/description/assets/cybro-icon.png new file mode 100644 index 000000000..06e73e11d Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/cybro-icon.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/cybro-odoo.png b/barcode_capturing_sale_purchase/static/description/assets/cybro-odoo.png new file mode 100644 index 000000000..ed02e07a4 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/cybro-odoo.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/h2.png b/barcode_capturing_sale_purchase/static/description/assets/h2.png new file mode 100644 index 000000000..0bfc4707d Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/h2.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/arrows-repeat.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/arrows-repeat.svg new file mode 100755 index 000000000..1d7efabc5 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/arrows-repeat.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/banner-1.png b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-1.png new file mode 100755 index 000000000..c180db172 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-1.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/banner-2.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-2.svg new file mode 100755 index 000000000..e606d97d9 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-2.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/banner-bg.png b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-bg.png new file mode 100755 index 000000000..a8238d3c0 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-bg.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/banner-bg.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-bg.svg new file mode 100755 index 000000000..b1378103e --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-bg.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/banner-call.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-call.svg new file mode 100755 index 000000000..96c687e81 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-call.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/banner-mail.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-mail.svg new file mode 100755 index 000000000..cbf0d158d --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-mail.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/banner-pattern.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-pattern.svg new file mode 100755 index 000000000..9c1c7e101 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-pattern.svg @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/banner-promo.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-promo.svg new file mode 100755 index 000000000..d52791b11 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/banner-promo.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/brand-pair.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/brand-pair.svg new file mode 100755 index 000000000..d8db7fc1e --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/brand-pair.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/check.png b/barcode_capturing_sale_purchase/static/description/assets/icons/check.png new file mode 100755 index 000000000..c8e85f51d Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/check.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/chevron.png b/barcode_capturing_sale_purchase/static/description/assets/icons/chevron.png new file mode 100755 index 000000000..2089293d6 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/chevron.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/close-icon.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/close-icon.svg new file mode 100755 index 000000000..df8cce37a --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/close-icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/cogs.png b/barcode_capturing_sale_purchase/static/description/assets/icons/cogs.png new file mode 100755 index 000000000..95d0bad62 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/cogs.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/collabarate-icon.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/collabarate-icon.svg new file mode 100755 index 000000000..dd4e10518 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/collabarate-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/consultation.png b/barcode_capturing_sale_purchase/static/description/assets/icons/consultation.png new file mode 100755 index 000000000..8319d4baa Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/consultation.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/cybro-logo.png b/barcode_capturing_sale_purchase/static/description/assets/icons/cybro-logo.png new file mode 100755 index 000000000..ff4b78220 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/cybro-logo.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/down.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/down.svg new file mode 100755 index 000000000..f21c36271 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/ecom-black.png b/barcode_capturing_sale_purchase/static/description/assets/icons/ecom-black.png new file mode 100755 index 000000000..a9385ff13 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/ecom-black.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/education-black.png b/barcode_capturing_sale_purchase/static/description/assets/icons/education-black.png new file mode 100755 index 000000000..3eb09b27b Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/education-black.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/faq.png b/barcode_capturing_sale_purchase/static/description/assets/icons/faq.png new file mode 100755 index 000000000..4250b5b81 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/faq.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/feature-icon.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/feature-icon.svg new file mode 100755 index 000000000..fa0ea6850 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/feature-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/feature.png b/barcode_capturing_sale_purchase/static/description/assets/icons/feature.png new file mode 100755 index 000000000..ac7a785c0 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/feature.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/gear.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/gear.svg new file mode 100755 index 000000000..0cc66b6ea --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/gear.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/hero.gif b/barcode_capturing_sale_purchase/static/description/assets/icons/hero.gif new file mode 100644 index 000000000..c9048c1ab Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/hero.gif differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/hire-odoo.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/hire-odoo.svg new file mode 100755 index 000000000..e1ac089b0 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/hire-odoo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/hotel-black.png b/barcode_capturing_sale_purchase/static/description/assets/icons/hotel-black.png new file mode 100755 index 000000000..130f613be Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/hotel-black.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/license.png b/barcode_capturing_sale_purchase/static/description/assets/icons/license.png new file mode 100755 index 000000000..a5869797e Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/license.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/life-ring-icon.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/life-ring-icon.svg new file mode 100755 index 000000000..3ae6e1d89 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/life-ring-icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/lifebuoy.png b/barcode_capturing_sale_purchase/static/description/assets/icons/lifebuoy.png new file mode 100755 index 000000000..658d56ccc Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/lifebuoy.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/mail.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/mail.svg new file mode 100755 index 000000000..1eedde695 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/mail.svg @@ -0,0 +1,3 @@ + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/manufacturing-black.png b/barcode_capturing_sale_purchase/static/description/assets/icons/manufacturing-black.png new file mode 100755 index 000000000..697eb0e9f Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/manufacturing-black.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/notes.png b/barcode_capturing_sale_purchase/static/description/assets/icons/notes.png new file mode 100755 index 000000000..ee5e95404 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/notes.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/notification icon.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/notification icon.svg new file mode 100755 index 000000000..053189973 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/notification icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/odoo-consultancy.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/odoo-consultancy.svg new file mode 100755 index 000000000..e05f65bde --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/odoo-consultancy.svg @@ -0,0 +1,4 @@ + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/odoo-licencing.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/odoo-licencing.svg new file mode 100755 index 000000000..2606c88b0 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/odoo-licencing.svg @@ -0,0 +1,3 @@ + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/odoo-logo.png b/barcode_capturing_sale_purchase/static/description/assets/icons/odoo-logo.png new file mode 100755 index 000000000..0e4d0eb5a Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/odoo-logo.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/patter.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/patter.svg new file mode 100755 index 000000000..25c9c0a8f --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/patter.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/pattern1.png b/barcode_capturing_sale_purchase/static/description/assets/icons/pattern1.png new file mode 100755 index 000000000..09ab0fb2d Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/pattern1.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/pos-black.png b/barcode_capturing_sale_purchase/static/description/assets/icons/pos-black.png new file mode 100755 index 000000000..97c0f90c1 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/pos-black.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/puzzle-piece-icon.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/puzzle-piece-icon.svg new file mode 100755 index 000000000..3e9ad9373 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/puzzle-piece-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/puzzle.png b/barcode_capturing_sale_purchase/static/description/assets/icons/puzzle.png new file mode 100755 index 000000000..65cf854e7 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/puzzle.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/replace-icon.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/replace-icon.svg new file mode 100755 index 000000000..d0e3a7af1 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/replace-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/restaurant-black.png b/barcode_capturing_sale_purchase/static/description/assets/icons/restaurant-black.png new file mode 100755 index 000000000..4a35eb939 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/restaurant-black.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/screenshot-main.png b/barcode_capturing_sale_purchase/static/description/assets/icons/screenshot-main.png new file mode 100755 index 000000000..575f8e676 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/screenshot-main.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/screenshot.png b/barcode_capturing_sale_purchase/static/description/assets/icons/screenshot.png new file mode 100755 index 000000000..cef272529 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/screenshot.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/service-black.png b/barcode_capturing_sale_purchase/static/description/assets/icons/service-black.png new file mode 100755 index 000000000..301ab51cb Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/service-black.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/skype-fill.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/skype-fill.svg new file mode 100755 index 000000000..c17423639 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/skype-fill.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/skype.png b/barcode_capturing_sale_purchase/static/description/assets/icons/skype.png new file mode 100755 index 000000000..51b409fb3 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/skype.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/skype.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/skype.svg new file mode 100755 index 000000000..df3dad39b --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/skype.svg @@ -0,0 +1,3 @@ + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/star-1.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/star-1.svg new file mode 100755 index 000000000..7e55ab162 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/star-1.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/star-2.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/star-2.svg new file mode 100755 index 000000000..5ae9f507a --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/star-2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/support.png b/barcode_capturing_sale_purchase/static/description/assets/icons/support.png new file mode 100755 index 000000000..4f18b8b82 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/support.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/test-1 - Copy.png b/barcode_capturing_sale_purchase/static/description/assets/icons/test-1 - Copy.png new file mode 100755 index 000000000..f6a902663 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/test-1 - Copy.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/test-1.png b/barcode_capturing_sale_purchase/static/description/assets/icons/test-1.png new file mode 100755 index 000000000..0908add2b Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/test-1.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/test-2.png b/barcode_capturing_sale_purchase/static/description/assets/icons/test-2.png new file mode 100755 index 000000000..4671fe91e Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/test-2.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/trading-black.png b/barcode_capturing_sale_purchase/static/description/assets/icons/trading-black.png new file mode 100755 index 000000000..9398ba2f1 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/trading-black.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/training.png b/barcode_capturing_sale_purchase/static/description/assets/icons/training.png new file mode 100755 index 000000000..884ca024d Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/training.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/translate.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/translate.svg new file mode 100755 index 000000000..af9c8a1aa --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/translate.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/update.png b/barcode_capturing_sale_purchase/static/description/assets/icons/update.png new file mode 100755 index 000000000..ecbc5a01a Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/update.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/user.png b/barcode_capturing_sale_purchase/static/description/assets/icons/user.png new file mode 100755 index 000000000..6ffb23d9f Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/user.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/video.png b/barcode_capturing_sale_purchase/static/description/assets/icons/video.png new file mode 100755 index 000000000..576705b17 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/video.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/whatsapp.png b/barcode_capturing_sale_purchase/static/description/assets/icons/whatsapp.png new file mode 100755 index 000000000..d513a5356 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/whatsapp.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/wrench-icon.svg b/barcode_capturing_sale_purchase/static/description/assets/icons/wrench-icon.svg new file mode 100755 index 000000000..174b5a465 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/assets/icons/wrench-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/description/assets/icons/wrench.png b/barcode_capturing_sale_purchase/static/description/assets/icons/wrench.png new file mode 100755 index 000000000..6c04dea0f Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/icons/wrench.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/modules/1.gif b/barcode_capturing_sale_purchase/static/description/assets/modules/1.gif new file mode 100644 index 000000000..ae3a880a2 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/modules/1.gif differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/modules/1.jpg b/barcode_capturing_sale_purchase/static/description/assets/modules/1.jpg new file mode 100644 index 000000000..3cb15fe01 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/modules/1.jpg differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/modules/2.gif b/barcode_capturing_sale_purchase/static/description/assets/modules/2.gif new file mode 100644 index 000000000..d19e2b352 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/modules/2.gif differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/modules/2.jpg b/barcode_capturing_sale_purchase/static/description/assets/modules/2.jpg new file mode 100644 index 000000000..662cadcc3 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/modules/2.jpg differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/modules/3.jpg b/barcode_capturing_sale_purchase/static/description/assets/modules/3.jpg new file mode 100644 index 000000000..717a00443 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/modules/3.jpg differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/modules/3.png b/barcode_capturing_sale_purchase/static/description/assets/modules/3.png new file mode 100644 index 000000000..8513873ea Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/modules/3.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/modules/4.png b/barcode_capturing_sale_purchase/static/description/assets/modules/4.png new file mode 100644 index 000000000..00ebf54ad Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/modules/4.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/modules/5.jpg b/barcode_capturing_sale_purchase/static/description/assets/modules/5.jpg new file mode 100644 index 000000000..7c67e2eec Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/modules/5.jpg differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/modules/5.png b/barcode_capturing_sale_purchase/static/description/assets/modules/5.png new file mode 100644 index 000000000..0e311ca87 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/modules/5.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/modules/6.gif b/barcode_capturing_sale_purchase/static/description/assets/modules/6.gif new file mode 100644 index 000000000..a35ece8df Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/modules/6.gif differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/modules/6.jpg b/barcode_capturing_sale_purchase/static/description/assets/modules/6.jpg new file mode 100644 index 000000000..67c7f7062 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/modules/6.jpg differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/screenshots/1.png b/barcode_capturing_sale_purchase/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..1564b6ed7 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/screenshots/1.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/screenshots/2.png b/barcode_capturing_sale_purchase/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..72549acbe Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/screenshots/2.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/screenshots/3.png b/barcode_capturing_sale_purchase/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..ba5cfa171 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/screenshots/3.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/screenshots/4.png b/barcode_capturing_sale_purchase/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..86c2471e0 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/screenshots/4.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/screenshots/5.png b/barcode_capturing_sale_purchase/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..9b639ce35 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/screenshots/5.png differ diff --git a/barcode_capturing_sale_purchase/static/description/assets/y18.jpg b/barcode_capturing_sale_purchase/static/description/assets/y18.jpg new file mode 100644 index 000000000..eea1714f2 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/assets/y18.jpg differ diff --git a/barcode_capturing_sale_purchase/static/description/banner.jpg b/barcode_capturing_sale_purchase/static/description/banner.jpg new file mode 100644 index 000000000..fd148c2d5 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/banner.jpg differ diff --git a/barcode_capturing_sale_purchase/static/description/icon.png b/barcode_capturing_sale_purchase/static/description/icon.png new file mode 100644 index 000000000..41faceb31 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/description/icon.png differ diff --git a/barcode_capturing_sale_purchase/static/description/index.html b/barcode_capturing_sale_purchase/static/description/index.html new file mode 100644 index 000000000..ac0608de1 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/description/index.html @@ -0,0 +1,1088 @@ + + + + + + Scan Product Barcode for Sale & Purchase + + + + + + + + + + +
+
+ + + +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+
+

+ Scan Barcode of Products Through Camera in Sale + and Purchase. +

+

Scan Product Barcode for Sale & Purchase +

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

Key + Highlights

+
+
+
+
+ +
+
+ Effortless Product Addition +
+

+ Products can be seamlessly added to the + order line simply by scanning their barcode, + streamlining the sales and purchase + workflow.

+
+
+
+
+
+ +
+
+ Camera-Based Barcode Scanning +
+

+ Barcodes can be scanned directly using a + device's camera, eliminating the need for a + dedicated barcode scanner. +

+
+
+
+
+
+ +
+
+ Barcode Configuration +
+

+ Easily set and manage product barcodes + within the product form, ensuring accurate + identification and smooth operations. +

+
+
+ +
+
+ +
+
+
+ Scan Product Barcode for Sale & Purchase +

+ Are you ready to make your business more + organized? +
Improve now! +

+ +
+
+ +
+
+
+ + + + +
+
+ +
+
+
+
+ acc_bg +
+ +
+
+
+
+

+ Barcode for Product +

+
+
+

+ Add the Barcode in the product + form +

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

+ Print Label +

+
+
+

+ The label of barcode can be + printed by clicking the 'PRINT + LABELS' button in product form. +

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

+ Scan Barcode Button +

+
+
+

+ A new button is added to scan + barcode in sale order and + purchase order. +

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

+ Scan Barcode + +

+
+
+

+ When the barcode button is + clicked a window with a video + screen pops out. Show the + barcode image on the camera to + scan it. +

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

+ Added Product to Order line + + +

+
+
+

+ The scanned product will be + added to the order line. +

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

+ Quickly populate sale or + purchase order lines by scanning + product barcodes.

+
+ +
+
+
+
+
+
+ +
+

+ Easily access the barcode + scanning tool with a visible + icon in sale and purchase order + screens.

+
+
+
+
+
+
+
+ +
+

+ Barcode of product can be set in + product form.

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

+ This module allows + users to add + products to sales or + purchase orders by + scanning barcodes, + with device's + camera. +

+
+
+ +
+ +
+

+ You can set up + barcodes directly in + the product form + under the "Barcode" + field. +

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

+ Latest Release 18.0.1.0.0 +

+ + 24th January, 2025 + +
+
+
+
+
+ Add +
+
+
+
    +
  • + Initial Commit +
  • + +
+
+
+
+
+
+
+
+
+
+ + + +
+

+ Related Products +

+ +
+ + +
+

+ Our Services

+ +
+ +
+
+ .... +
+
+ +
+ + +
+
+ + + + + + diff --git a/barcode_capturing_sale_purchase/static/src/audio/beep_scan.mp3 b/barcode_capturing_sale_purchase/static/src/audio/beep_scan.mp3 new file mode 100644 index 000000000..2b2143673 Binary files /dev/null and b/barcode_capturing_sale_purchase/static/src/audio/beep_scan.mp3 differ diff --git a/barcode_capturing_sale_purchase/static/src/css/styles.css b/barcode_capturing_sale_purchase/static/src/css/styles.css new file mode 100644 index 000000000..0fd22e8ad --- /dev/null +++ b/barcode_capturing_sale_purchase/static/src/css/styles.css @@ -0,0 +1,3 @@ +.btn-close{ + display:none; +} diff --git a/barcode_capturing_sale_purchase/static/src/js/barcode_dialog.js b/barcode_capturing_sale_purchase/static/src/js/barcode_dialog.js new file mode 100644 index 000000000..8fda7cbe3 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/src/js/barcode_dialog.js @@ -0,0 +1,181 @@ +/** @odoo-module */ +import { browser } from "@web/core/browser/browser"; +import { Dialog } from "@web/core/dialog/dialog"; +import { _t } from "@web/core/l10n/translation"; +import { useChildRef, useService } from "@web/core/utils/hooks"; +import { Component, useRef, onWillUnmount } from "@odoo/owl"; +var beep = new Audio('/barcode_capturing_sale_purchase/static/src/audio/beep_scan.mp3'); + +//BarcodeDialog is a component that captures barcode input through the device's camera, +// processes the scanned barcode, and interacts with the Odoo backend to perform +// actions based on the scanned data. +export class BarcodeDialog extends Component { + async setup() { + super.setup(); + this.env.dialogData.dismiss = () => this._cancel(); + this.orm = useService('orm'); + this.notificationService = useService("notification"); + this.modalRef = useChildRef(); + this.videoPreviewRef = useRef("videoPreview"); + this.isMounted = true; + + // Cleanup function to stop video stream when component unmounts + onWillUnmount(() => { + this.isMounted = false; + this._stopVideoStream(); + }); + + if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { + this.stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: false }); + } else { + // Handle case where camera access is not available + this.notificationService.add(_t("Camera access is not available"), { + title: _t("Error"), + type: "danger", + }); + this.props.close(); + return; + } + this.videoPreviewRef.el.srcObject = this.stream; + this.videoPreviewRef.el.play(); + Quagga.init({ + inputStream: { + name: "Live", + type: "LiveStream", + target: this.videoPreviewRef.el, + constraints: { + width: 640, + height: 480, + facingMode: "environment" // Use the rear camera + } + }, + decoder: { + readers: [ + "code_128_reader", + "ean_reader", + "ean_8_reader", + "upc_reader", + "upc_e_reader" + ] + } + }, (err) => { + if (err) { + return; + } + Quagga.start(); + }); + Quagga.onDetected((result) => { + if (!this.isMounted) return; + var barcode = result.codeResult.code; + Quagga.offDetected(); + Quagga.stop(); + this.scan_product(barcode); + }); + } + // Handles the cancellation of the dialog. + async _cancel() { + return this.execButton(this.props.cancel); + } + // Handles the confirmation of the dialog. + async _dialogConfirm() { + return this.execButton(this.props.confirm); + } + // Processes the scanned product by barcode. + async scan_product(barcode) { + if (!this.isMounted) return; + var last_code = barcode; + var last_result = []; + last_result.push(last_code); + last_result = []; + beep.play(); + Quagga.stop(); + var order_id = this.props.order_id; + var method = this.props.model === "sale.order" ? "sale.order" : "purchase.order"; + try { + const data = await this.orm.call(method, "barcode_search", [last_code, order_id]); + if (!this.isMounted) return; + + if (data === true) { + this.notificationService.add(_t("Product with the scanned Barcode Not Found in the system"), { + title: _t("Product Not Found!"), + type: "danger", + }); + } else { + location.reload(); // Ensure the page reloads after adding a product + } + } catch (error) { + if (this.isMounted) { + console.error("Error scanning product: ", error); + } + } + + this._stopVideoStream(); + this.props.close(); + } + // Stops the video stream if it is active. + _stopVideoStream() { + if (this.videoPreviewRef.el && this.videoPreviewRef.el.srcObject) { + const tracks = this.videoPreviewRef.el.srcObject.getTracks(); + tracks.forEach((track) => track.stop()); + } + } + // sets button disabled + setButtonsDisabled(disabled) { + this.isProcess = disabled; + if (!this.modalRef.el) { + return; + } + for (const button of [...this.modalRef.el.querySelectorAll(".modal-footer button")]) { + button.disabled = disabled; + } + } + + async execButton(callback) { + if (this.isProcess) { + return; + } + this.setButtonsDisabled(true); + if (callback) { + let shouldClose; + try { + shouldClose = await callback(); + } catch (e) { + this.props.close(); + throw e; + } + if (shouldClose === false) { + this.setButtonsDisabled(false); + return; + } + } + this.props.close(); + } +} + +BarcodeDialog.template = "BarcodeDialog"; +BarcodeDialog.components = { Dialog }; +BarcodeDialog.props = { + close: Function, + order_id: Number, + model: String, + title: { + validate: (m) => { + return ( + typeof m === "string" || (typeof m === "object" && typeof m.toString === "function") + ); + }, + optional: true, + }, + body: String, + confirm: { type: Function, optional: true }, + confirmLabel: { type: String, optional: true }, + confirmClass: { type: String, optional: true }, + cancel: { type: Function, optional: true }, + cancelLabel: { type: String, optional: true }, +}; +BarcodeDialog.defaultProps = { + confirmLabel: _t("Ok"), + cancelLabel: _t("Cancel"), + confirmClass: "btn-primary", + title: _t("Confirmation"), +}; diff --git a/barcode_capturing_sale_purchase/static/src/js/purchase_barcode.js b/barcode_capturing_sale_purchase/static/src/js/purchase_barcode.js new file mode 100644 index 000000000..264e63d20 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/src/js/purchase_barcode.js @@ -0,0 +1,64 @@ +/** @odoo-module **/ +import { FormController } from "@web/views/form/form_controller"; +import { Dialog } from "@web/core/dialog/dialog"; +import { BarcodeDialog } from "./barcode_dialog.js"; +import { useChildRef, useService } from "@web/core/utils/hooks"; +import { Component, onWillUnmount, EventBus } from "@odoo/owl"; +import { _t } from "@web/core/l10n/translation"; + +var beep = new Audio('/barcode_capturing_sale_purchase/static/src/audio/beep_scan.mp3'); +// Extends FormController for rendering the purchase order form with barcode scanning functionality. +export class ComPurchaseOrderRender extends FormController { + setup() { + this.bus = new EventBus(); + this.modalRef = useChildRef(); + this.isProcess = false; + this.dialog = useService("dialog"); + this.notificationService = useService("notification"); + onWillUnmount(() => { + if (this.stream) { + this.stream.getTracks().forEach((track) => track.stop()); + this.stream = null; + } + }); + super.setup(); + } + // Opens a dialog for barcode scanning. + async PurchaseBarcodeDialog() { + var self = this; + var load_params = self.model.config; + var model = this.props.resModel + if(load_params.resId){ + var order_id = load_params.resId; + } + else{ + if(load_params.resIds[0]){ + var order_id = load_params.resIds[0]; + } + else{ + this.notificationService.add(_t("Create or Save Purchase Order to start barcode scan"), { + title: _t("Create/save Order"), + type: "danger", + }); + return + } + } + // Opens a Dialog box for scanning barcode + const constraints = { + video: { facingMode: this.props.facingMode }, + audio: false, + }; + try { + this.dialog.add(BarcodeDialog, { + title: _t("Barcode Scanner"), + body: _t("An administrator needs to configure Google Synchronization before you can use it!"), + close: true, + order_id: order_id, + model: model, + }); + } catch (err) { + window.alert('Failed to detect webcam.Please ensure that your browser has the required permissions to access your webcam.') + } + } +} +ComPurchaseOrderRender.template = "barcode_capturing_sale_purchase.purchase_scanner"; diff --git a/barcode_capturing_sale_purchase/static/src/js/registry_barcode_purchase.js b/barcode_capturing_sale_purchase/static/src/js/registry_barcode_purchase.js new file mode 100644 index 000000000..fca84d9c9 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/src/js/registry_barcode_purchase.js @@ -0,0 +1,11 @@ +/** @odoo-module **/ +import { formView } from '@web/views/form/form_view'; +import { FormController } from '@web/views/form/form_controller'; +import { registry } from "@web/core/registry"; +import { ComPurchaseOrderRender } from '@barcode_capturing_sale_purchase/js/purchase_barcode'; +//JsClassBarcodePurchase constant is added to views registry +export const JsClassBarcodePurchase = { + ...formView, + Controller: ComPurchaseOrderRender, +}; +registry.category("views").add("purchase_order_barcode", JsClassBarcodePurchase); diff --git a/barcode_capturing_sale_purchase/static/src/js/registry_barcode_sale.js b/barcode_capturing_sale_purchase/static/src/js/registry_barcode_sale.js new file mode 100644 index 000000000..a11e12601 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/src/js/registry_barcode_sale.js @@ -0,0 +1,11 @@ +/** @odoo-module **/ +import { formView } from '@web/views/form/form_view'; +import { FormController } from '@web/views/form/form_controller'; +import { registry } from "@web/core/registry"; +import { ComSaleOrderRender } from '@barcode_capturing_sale_purchase/js/sale_barcode'; +//JsClassBarcodePurchase constant is added to views registry +export const JsClassBarcodeSale = { + ...formView, + Controller: ComSaleOrderRender, +}; +registry.category("views").add("sale_order_barcode", JsClassBarcodeSale); diff --git a/barcode_capturing_sale_purchase/static/src/js/sale_barcode.js b/barcode_capturing_sale_purchase/static/src/js/sale_barcode.js new file mode 100644 index 000000000..b0ccd7a9a --- /dev/null +++ b/barcode_capturing_sale_purchase/static/src/js/sale_barcode.js @@ -0,0 +1,64 @@ +/** @odoo-module **/ +import { FormController } from "@web/views/form/form_controller"; +import { Dialog } from "@web/core/dialog/dialog"; +import { BarcodeDialog } from "./barcode_dialog.js"; +import { useChildRef, useService } from "@web/core/utils/hooks"; +import { Component, onWillUnmount, EventBus } from "@odoo/owl"; +import { _t } from "@web/core/l10n/translation"; + +var beep = new Audio('/barcode_capturing_sale_purchase/static/src/audio/beep_scan.mp3'); +// Extends FormController for rendering the Sale order form with barcode scanning functionality. +export class ComSaleOrderRender extends FormController { + setup() { + this.bus = new EventBus(); + this.modalRef = useChildRef(); + this.isProcess = false; + this.dialog = useService("dialog"); + this.notificationService = useService("notification"); + onWillUnmount(() => { + if (this.stream) { + this.stream.getTracks().forEach((track) => track.stop()); + this.stream = null; + } + }); + super.setup(); + } +// Opens a dialog for barcode scanning. + async SaleBarcodeDialog() { + var self = this; + var load_params = self.model.config; + var model = this.props.resModel + if(load_params.resId){ + var order_id = load_params.resId; + } + else{ + if(load_params.resIds[0]){ + var order_id = load_params.resIds[0]; + } + else{ + this.notificationService.add(_t("Create or Save Purchase Order to start barcode scan"), { + title: _t("Create/save Order"), + type: "danger", + }); + return + } + } + // Opens a Dialog box for scanning barcode + const constraints = { + video: { facingMode: this.props.facingMode }, + audio: false, + }; + try { + this.dialog.add(BarcodeDialog, { + title: _t("Barcode Scanner"), + body: _t("An administrator needs to configure Google Synchronization before you can use it!"), + close: true, + order_id: order_id, + model: model, + }); + } catch (err) { + window.alert('Failed to detect webcam.Please ensure that your browser has the required permissions to access your webcam.') + } + } +} +ComSaleOrderRender.template = "barcode_capturing_sale_purchase.sale_scanner"; diff --git a/barcode_capturing_sale_purchase/static/src/xml/barcode_dialog_templates.xml b/barcode_capturing_sale_purchase/static/src/xml/barcode_dialog_templates.xml new file mode 100644 index 000000000..f6342bd30 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/src/xml/barcode_dialog_templates.xml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/src/xml/purchase_web_form_templates.xml b/barcode_capturing_sale_purchase/static/src/xml/purchase_web_form_templates.xml new file mode 100644 index 000000000..ba70b2f88 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/src/xml/purchase_web_form_templates.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/barcode_capturing_sale_purchase/static/src/xml/sale_web_form_templates.xml b/barcode_capturing_sale_purchase/static/src/xml/sale_web_form_templates.xml new file mode 100644 index 000000000..edd46ee26 --- /dev/null +++ b/barcode_capturing_sale_purchase/static/src/xml/sale_web_form_templates.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/barcode_capturing_sale_purchase/views/purchase_order_views.xml b/barcode_capturing_sale_purchase/views/purchase_order_views.xml new file mode 100644 index 000000000..4924d8449 --- /dev/null +++ b/barcode_capturing_sale_purchase/views/purchase_order_views.xml @@ -0,0 +1,14 @@ + + + + + purchase.order.inherit.view.form.barcode.capturing.sale.purchase + purchase.order + + + + purchase_order_barcode + + + + diff --git a/barcode_capturing_sale_purchase/views/sale_order_views.xml b/barcode_capturing_sale_purchase/views/sale_order_views.xml new file mode 100644 index 000000000..9d6dfa098 --- /dev/null +++ b/barcode_capturing_sale_purchase/views/sale_order_views.xml @@ -0,0 +1,14 @@ + + + + + sale.order.view.form.inherit.barcode.capturing.sale.purchase + sale.order + + + + sale_order_barcode + + + +