diff --git a/bill_digitization/README.rst b/bill_digitization/README.rst new file mode 100755 index 000000000..d33ee0c6c --- /dev/null +++ b/bill_digitization/README.rst @@ -0,0 +1,48 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Bill Digitization +================= +This module creates bill from scanned bill document. + +Configuration +============= +* Install the python packages PIL (pip3 install PIL),pytesseract (pip3 install pytesseract),tesseract-ocr (sudo apt-get install tesseract-ocr) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: (V17) Dhanya Babu, + (V18) Nivedhya T , +* Contact: odoo@cybrosys.com + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +License +------- +GNU AFFERO GENERAL PUBLIC LICENSE, Version 3 (AGPLv3) +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +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/bill_digitization/__init__.py b/bill_digitization/__init__.py new file mode 100644 index 000000000..7c4a1a2d4 --- /dev/null +++ b/bill_digitization/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import models +from . import wizard diff --git a/bill_digitization/__manifest__.py b/bill_digitization/__manifest__.py new file mode 100644 index 000000000..e6217daf9 --- /dev/null +++ b/bill_digitization/__manifest__.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': 'Bill Digitization', + 'version': '18.0.1.0.0', + 'category': 'Accounting', + 'summary': """Converting traditional paper-based bills into digital + formats.""", + 'description': """Reading scanned documents with extension .jpg, .jpeg and + .png using specialized hardware and converting them into + vendor bills in odoo. It makes use of the Optical Character + Recognition (OCR) technology to convert scanned images into + editable text""", + 'author': "Cybrosys Techno Solutions", + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['base', 'base_accounting_kit', 'web'], + 'data': [ + 'security/ir.model.access.csv', + 'views/res_config_settings_views.xml', + 'wizard/digitize_bill_views.xml', + ], + 'assets': { + 'web.assets_backend': [ + 'bill_digitization/static/src/js/list_controller.js', + 'bill_digitization/static/src/xml/list_controller.xml', + ], + }, + 'external_dependencies': { + 'python': ['PIL', 'pytesseract'] + }, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False +} diff --git a/bill_digitization/doc/RELEASE_NOTES.md b/bill_digitization/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..974cee965 --- /dev/null +++ b/bill_digitization/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 02.04.2025 +#### Version 18.0.1.0.0 +#### ADD +- Initial commit for Bill Digitization diff --git a/bill_digitization/models/__init__.py b/bill_digitization/models/__init__.py new file mode 100644 index 000000000..e7a2583f6 --- /dev/null +++ b/bill_digitization/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import res_config_settings diff --git a/bill_digitization/models/res_config_settings.py b/bill_digitization/models/res_config_settings.py new file mode 100644 index 000000000..795353b57 --- /dev/null +++ b/bill_digitization/models/res_config_settings.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + """ Class to add a boolean in config settings """ + _inherit = "res.config.settings" + + digitize_bill = fields.Boolean( + string="Digitize Bill", + config_parameter='bill_digitization.digitize_bill', + help="Enable the button to digitize bills") diff --git a/bill_digitization/security/ir.model.access.csv b/bill_digitization/security/ir.model.access.csv new file mode 100644 index 000000000..1ee85687a --- /dev/null +++ b/bill_digitization/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +access_digitize_bill_user,access.digitize.bill.user,model_digitize_bill,base.group_user,1,1,1,1 diff --git a/bill_digitization/static/description/assets/cybro-icon.png b/bill_digitization/static/description/assets/cybro-icon.png new file mode 100644 index 000000000..06e73e11d Binary files /dev/null and b/bill_digitization/static/description/assets/cybro-icon.png differ diff --git a/bill_digitization/static/description/assets/cybro-odoo.png b/bill_digitization/static/description/assets/cybro-odoo.png new file mode 100644 index 000000000..ed02e07a4 Binary files /dev/null and b/bill_digitization/static/description/assets/cybro-odoo.png differ diff --git a/bill_digitization/static/description/assets/icons/arrows-repeat.svg b/bill_digitization/static/description/assets/icons/arrows-repeat.svg new file mode 100644 index 000000000..1d7efabc5 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/arrows-repeat.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/banner-1.png b/bill_digitization/static/description/assets/icons/banner-1.png new file mode 100644 index 000000000..c180db172 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/banner-1.png differ diff --git a/bill_digitization/static/description/assets/icons/banner-2.svg b/bill_digitization/static/description/assets/icons/banner-2.svg new file mode 100644 index 000000000..e606d97d9 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/banner-2.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/banner-bg.png b/bill_digitization/static/description/assets/icons/banner-bg.png new file mode 100644 index 000000000..a8238d3c0 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/banner-bg.png differ diff --git a/bill_digitization/static/description/assets/icons/banner-bg.svg b/bill_digitization/static/description/assets/icons/banner-bg.svg new file mode 100644 index 000000000..b1378103e --- /dev/null +++ b/bill_digitization/static/description/assets/icons/banner-bg.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/banner-call.svg b/bill_digitization/static/description/assets/icons/banner-call.svg new file mode 100644 index 000000000..96c687e81 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/banner-call.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/bill_digitization/static/description/assets/icons/banner-mail.svg b/bill_digitization/static/description/assets/icons/banner-mail.svg new file mode 100644 index 000000000..cbf0d158d --- /dev/null +++ b/bill_digitization/static/description/assets/icons/banner-mail.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/bill_digitization/static/description/assets/icons/banner-pattern.svg b/bill_digitization/static/description/assets/icons/banner-pattern.svg new file mode 100644 index 000000000..9c1c7e101 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/banner-pattern.svg @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/banner-promo.svg b/bill_digitization/static/description/assets/icons/banner-promo.svg new file mode 100644 index 000000000..d52791b11 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/banner-promo.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/brand-pair.svg b/bill_digitization/static/description/assets/icons/brand-pair.svg new file mode 100644 index 000000000..d8db7fc1e --- /dev/null +++ b/bill_digitization/static/description/assets/icons/brand-pair.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/check.png b/bill_digitization/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/bill_digitization/static/description/assets/icons/check.png differ diff --git a/bill_digitization/static/description/assets/icons/chevron.png b/bill_digitization/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/chevron.png differ diff --git a/bill_digitization/static/description/assets/icons/close-icon.svg b/bill_digitization/static/description/assets/icons/close-icon.svg new file mode 100644 index 000000000..df8cce37a --- /dev/null +++ b/bill_digitization/static/description/assets/icons/close-icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/bill_digitization/static/description/assets/icons/cogs.png b/bill_digitization/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/cogs.png differ diff --git a/bill_digitization/static/description/assets/icons/collabarate-icon.svg b/bill_digitization/static/description/assets/icons/collabarate-icon.svg new file mode 100644 index 000000000..dd4e10518 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/collabarate-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/bill_digitization/static/description/assets/icons/consultation.png b/bill_digitization/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/bill_digitization/static/description/assets/icons/consultation.png differ diff --git a/bill_digitization/static/description/assets/icons/cybro-logo.png b/bill_digitization/static/description/assets/icons/cybro-logo.png new file mode 100644 index 000000000..ff4b78220 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/cybro-logo.png differ diff --git a/bill_digitization/static/description/assets/icons/down.svg b/bill_digitization/static/description/assets/icons/down.svg new file mode 100644 index 000000000..f21c36271 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/bill_digitization/static/description/assets/icons/ecom-black.png b/bill_digitization/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/ecom-black.png differ diff --git a/bill_digitization/static/description/assets/icons/education-black.png b/bill_digitization/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/bill_digitization/static/description/assets/icons/education-black.png differ diff --git a/bill_digitization/static/description/assets/icons/faq.png b/bill_digitization/static/description/assets/icons/faq.png new file mode 100644 index 000000000..4250b5b81 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/faq.png differ diff --git a/bill_digitization/static/description/assets/icons/feature-icon.svg b/bill_digitization/static/description/assets/icons/feature-icon.svg new file mode 100644 index 000000000..fa0ea6850 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/feature-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/feature.png b/bill_digitization/static/description/assets/icons/feature.png new file mode 100644 index 000000000..ac7a785c0 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/feature.png differ diff --git a/bill_digitization/static/description/assets/icons/gear.svg b/bill_digitization/static/description/assets/icons/gear.svg new file mode 100644 index 000000000..0cc66b6ea --- /dev/null +++ b/bill_digitization/static/description/assets/icons/gear.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/hero.gif b/bill_digitization/static/description/assets/icons/hero.gif new file mode 100644 index 000000000..a8a48f7ba Binary files /dev/null and b/bill_digitization/static/description/assets/icons/hero.gif differ diff --git a/bill_digitization/static/description/assets/icons/hire-odoo.svg b/bill_digitization/static/description/assets/icons/hire-odoo.svg new file mode 100644 index 000000000..e1ac089b0 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/hire-odoo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/hotel-black.png b/bill_digitization/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/bill_digitization/static/description/assets/icons/hotel-black.png differ diff --git a/bill_digitization/static/description/assets/icons/license.png b/bill_digitization/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/bill_digitization/static/description/assets/icons/license.png differ diff --git a/bill_digitization/static/description/assets/icons/life-ring-icon.svg b/bill_digitization/static/description/assets/icons/life-ring-icon.svg new file mode 100644 index 000000000..3ae6e1d89 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/life-ring-icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/lifebuoy.png b/bill_digitization/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/bill_digitization/static/description/assets/icons/lifebuoy.png differ diff --git a/bill_digitization/static/description/assets/icons/mail.svg b/bill_digitization/static/description/assets/icons/mail.svg new file mode 100644 index 000000000..1eedde695 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/mail.svg @@ -0,0 +1,3 @@ + + + diff --git a/bill_digitization/static/description/assets/icons/manufacturing-black.png b/bill_digitization/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/bill_digitization/static/description/assets/icons/manufacturing-black.png differ diff --git a/bill_digitization/static/description/assets/icons/notes.png b/bill_digitization/static/description/assets/icons/notes.png new file mode 100644 index 000000000..ee5e95404 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/notes.png differ diff --git a/bill_digitization/static/description/assets/icons/notification icon.svg b/bill_digitization/static/description/assets/icons/notification icon.svg new file mode 100644 index 000000000..053189973 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/notification icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/odoo-consultancy.svg b/bill_digitization/static/description/assets/icons/odoo-consultancy.svg new file mode 100644 index 000000000..e05f65bde --- /dev/null +++ b/bill_digitization/static/description/assets/icons/odoo-consultancy.svg @@ -0,0 +1,4 @@ + + + + diff --git a/bill_digitization/static/description/assets/icons/odoo-licencing.svg b/bill_digitization/static/description/assets/icons/odoo-licencing.svg new file mode 100644 index 000000000..2606c88b0 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/odoo-licencing.svg @@ -0,0 +1,3 @@ + + + diff --git a/bill_digitization/static/description/assets/icons/odoo-logo.png b/bill_digitization/static/description/assets/icons/odoo-logo.png new file mode 100644 index 000000000..0e4d0eb5a Binary files /dev/null and b/bill_digitization/static/description/assets/icons/odoo-logo.png differ diff --git a/bill_digitization/static/description/assets/icons/patter.svg b/bill_digitization/static/description/assets/icons/patter.svg new file mode 100644 index 000000000..25c9c0a8f --- /dev/null +++ b/bill_digitization/static/description/assets/icons/patter.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/pattern1.png b/bill_digitization/static/description/assets/icons/pattern1.png new file mode 100644 index 000000000..09ab0fb2d Binary files /dev/null and b/bill_digitization/static/description/assets/icons/pattern1.png differ diff --git a/bill_digitization/static/description/assets/icons/pos-black.png b/bill_digitization/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/pos-black.png differ diff --git a/bill_digitization/static/description/assets/icons/puzzle-piece-icon.svg b/bill_digitization/static/description/assets/icons/puzzle-piece-icon.svg new file mode 100644 index 000000000..3e9ad9373 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/puzzle-piece-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/puzzle.png b/bill_digitization/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/puzzle.png differ diff --git a/bill_digitization/static/description/assets/icons/replace-icon.svg b/bill_digitization/static/description/assets/icons/replace-icon.svg new file mode 100644 index 000000000..d0e3a7af1 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/replace-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/restaurant-black.png b/bill_digitization/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/restaurant-black.png differ diff --git a/bill_digitization/static/description/assets/icons/screenshot-main.png b/bill_digitization/static/description/assets/icons/screenshot-main.png new file mode 100644 index 000000000..575f8e676 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/screenshot-main.png differ diff --git a/bill_digitization/static/description/assets/icons/screenshot.png b/bill_digitization/static/description/assets/icons/screenshot.png new file mode 100644 index 000000000..cef272529 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/screenshot.png differ diff --git a/bill_digitization/static/description/assets/icons/service-black.png b/bill_digitization/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/bill_digitization/static/description/assets/icons/service-black.png differ diff --git a/bill_digitization/static/description/assets/icons/skype-fill.svg b/bill_digitization/static/description/assets/icons/skype-fill.svg new file mode 100644 index 000000000..c17423639 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/skype-fill.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/skype.png b/bill_digitization/static/description/assets/icons/skype.png new file mode 100644 index 000000000..51b409fb3 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/skype.png differ diff --git a/bill_digitization/static/description/assets/icons/skype.svg b/bill_digitization/static/description/assets/icons/skype.svg new file mode 100644 index 000000000..df3dad39b --- /dev/null +++ b/bill_digitization/static/description/assets/icons/skype.svg @@ -0,0 +1,3 @@ + + + diff --git a/bill_digitization/static/description/assets/icons/star-1.svg b/bill_digitization/static/description/assets/icons/star-1.svg new file mode 100644 index 000000000..7e55ab162 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/star-1.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/star-2.svg b/bill_digitization/static/description/assets/icons/star-2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/bill_digitization/static/description/assets/icons/star-2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/support.png b/bill_digitization/static/description/assets/icons/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/support.png differ diff --git a/bill_digitization/static/description/assets/icons/test-1 - Copy.png b/bill_digitization/static/description/assets/icons/test-1 - Copy.png new file mode 100644 index 000000000..f6a902663 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/test-1 - Copy.png differ diff --git a/bill_digitization/static/description/assets/icons/test-1.png b/bill_digitization/static/description/assets/icons/test-1.png new file mode 100644 index 000000000..0908add2b Binary files /dev/null and b/bill_digitization/static/description/assets/icons/test-1.png differ diff --git a/bill_digitization/static/description/assets/icons/test-2.png b/bill_digitization/static/description/assets/icons/test-2.png new file mode 100644 index 000000000..4671fe91e Binary files /dev/null and b/bill_digitization/static/description/assets/icons/test-2.png differ diff --git a/bill_digitization/static/description/assets/icons/trading-black.png b/bill_digitization/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/trading-black.png differ diff --git a/bill_digitization/static/description/assets/icons/training.png b/bill_digitization/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/bill_digitization/static/description/assets/icons/training.png differ diff --git a/bill_digitization/static/description/assets/icons/translate.svg b/bill_digitization/static/description/assets/icons/translate.svg new file mode 100644 index 000000000..af9c8a1aa --- /dev/null +++ b/bill_digitization/static/description/assets/icons/translate.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/update.png b/bill_digitization/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/bill_digitization/static/description/assets/icons/update.png differ diff --git a/bill_digitization/static/description/assets/icons/user.png b/bill_digitization/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/bill_digitization/static/description/assets/icons/user.png differ diff --git a/bill_digitization/static/description/assets/icons/video.png b/bill_digitization/static/description/assets/icons/video.png new file mode 100644 index 000000000..576705b17 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/video.png differ diff --git a/bill_digitization/static/description/assets/icons/whatsapp.png b/bill_digitization/static/description/assets/icons/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/bill_digitization/static/description/assets/icons/whatsapp.png differ diff --git a/bill_digitization/static/description/assets/icons/wrench-icon.svg b/bill_digitization/static/description/assets/icons/wrench-icon.svg new file mode 100644 index 000000000..174b5a465 --- /dev/null +++ b/bill_digitization/static/description/assets/icons/wrench-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/bill_digitization/static/description/assets/icons/wrench.png b/bill_digitization/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/bill_digitization/static/description/assets/icons/wrench.png differ diff --git a/bill_digitization/static/description/assets/modules/b1.png b/bill_digitization/static/description/assets/modules/b1.png new file mode 100644 index 000000000..3cb15fe01 Binary files /dev/null and b/bill_digitization/static/description/assets/modules/b1.png differ diff --git a/bill_digitization/static/description/assets/modules/b2.png b/bill_digitization/static/description/assets/modules/b2.png new file mode 100644 index 000000000..00ebf54ad Binary files /dev/null and b/bill_digitization/static/description/assets/modules/b2.png differ diff --git a/bill_digitization/static/description/assets/modules/b3.png b/bill_digitization/static/description/assets/modules/b3.png new file mode 100644 index 000000000..32e89fee9 Binary files /dev/null and b/bill_digitization/static/description/assets/modules/b3.png differ diff --git a/bill_digitization/static/description/assets/modules/b4.png b/bill_digitization/static/description/assets/modules/b4.png new file mode 100644 index 000000000..662660527 Binary files /dev/null and b/bill_digitization/static/description/assets/modules/b4.png differ diff --git a/bill_digitization/static/description/assets/modules/b5.png b/bill_digitization/static/description/assets/modules/b5.png new file mode 100644 index 000000000..6ec7368cb Binary files /dev/null and b/bill_digitization/static/description/assets/modules/b5.png differ diff --git a/bill_digitization/static/description/assets/modules/b6.png b/bill_digitization/static/description/assets/modules/b6.png new file mode 100644 index 000000000..a0702b94d Binary files /dev/null and b/bill_digitization/static/description/assets/modules/b6.png differ diff --git a/bill_digitization/static/description/assets/screenshots/sample_bill1.jpg b/bill_digitization/static/description/assets/screenshots/sample_bill1.jpg new file mode 100644 index 000000000..784a45868 Binary files /dev/null and b/bill_digitization/static/description/assets/screenshots/sample_bill1.jpg differ diff --git a/bill_digitization/static/description/assets/screenshots/screenshot1.png b/bill_digitization/static/description/assets/screenshots/screenshot1.png new file mode 100644 index 000000000..7c89b49e3 Binary files /dev/null and b/bill_digitization/static/description/assets/screenshots/screenshot1.png differ diff --git a/bill_digitization/static/description/assets/screenshots/screenshot2.png b/bill_digitization/static/description/assets/screenshots/screenshot2.png new file mode 100644 index 000000000..ba4f6cb5b Binary files /dev/null and b/bill_digitization/static/description/assets/screenshots/screenshot2.png differ diff --git a/bill_digitization/static/description/assets/screenshots/screenshot3.png b/bill_digitization/static/description/assets/screenshots/screenshot3.png new file mode 100644 index 000000000..037a11bae Binary files /dev/null and b/bill_digitization/static/description/assets/screenshots/screenshot3.png differ diff --git a/bill_digitization/static/description/assets/screenshots/screenshot5.png b/bill_digitization/static/description/assets/screenshots/screenshot5.png new file mode 100644 index 000000000..67e943247 Binary files /dev/null and b/bill_digitization/static/description/assets/screenshots/screenshot5.png differ diff --git a/bill_digitization/static/description/banner.jpg b/bill_digitization/static/description/banner.jpg new file mode 100644 index 000000000..923694061 Binary files /dev/null and b/bill_digitization/static/description/banner.jpg differ diff --git a/bill_digitization/static/description/icon.png b/bill_digitization/static/description/icon.png new file mode 100644 index 000000000..e5e01d46b Binary files /dev/null and b/bill_digitization/static/description/icon.png differ diff --git a/bill_digitization/static/description/index.html b/bill_digitization/static/description/index.html new file mode 100644 index 000000000..8f9c6a0cb --- /dev/null +++ b/bill_digitization/static/description/index.html @@ -0,0 +1,995 @@ + + + + + + Bill Digitization + + + + + + + + + + +
+
+ + + +
+
+ Community +
+
+
+ +
+
+
+
+

+ Creating Vendor Bill from Scanned Document. +

+

Bill Digitization +

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

Key + Highlights

+
+
+
+
+ +
+
+ Bill Digitization allows user to create vendor bill from scanned documents. +
+

+

+
+
+
+
+
+ +
+
+ User can read .jpg, .jpeg and .png scanned files. +
+

+

+
+
+
+
+
+ +
+
+ A Button on Vendor Bill Tree View to Read Documents. +
+

+

+
+
+
+
+
+ +
+
+ A View that Shows the Vendor Bill with All the Fetched Data. +
+

+

+
+
+
+
+ +
+
+
+ Bill Digitization +

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

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

+ Enable + + digitization bill +

+
+
+

+ This allows the user to choose digitization.

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

+ Button to read scanned + + documents +

+
+
+

+ Button to read scanned documents. +

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

+ Wizard to upload + + document +

+
+
+

+ A wizard that allows to read document. +

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

+ Sample + + bill +

+
+
+

+ +

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

+ Vendor bill with + + scanned document data +

+
+
+

+ Vendor bill with scanned document data.(The example format for scanned document is added in the module.) +

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

+ A Button on Vendor Bill Tree View to Read Documents.

+
+ +
+
+
+
+
+
+ +
+

+ A View that Shows the Vendor Bill with All the Fetched Data.

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

+ The Bill Digitization + module allows users to + scan and process vendor + bills from images (.jpg, .jpeg, .png) + using Optical Character Recognition (OCR) + technology, converting them into + editable text in Odoo. +

+
+
+ +
+ +
+

+ The module uses OCR + technology to analyze + scanned bills, + extract relevant data such as + vendor details, amounts, and line items, + and automatically create vendor bills in Odoo. +

+
+
+ +
+ +
+

+ No, this module specifically processes scanned images in .jpg, .jpeg, and .png formats. +

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

+ Latest Release 18.0.1.0.0 +

+ + 2nd April, 2025 + +
+
+
+
+
+ Add +
+
+
+
    +
  • + Initial Commit +
  • +
+
+
+
+
+
+
+
+
+
+ + + +
+

+ Related Products +

+ +
+ +
+

+ Our Services

+ +
+ +
+
+ .... +
+
+ +
+ +
+
+
+ + + + + diff --git a/bill_digitization/static/src/js/list_controller.js b/bill_digitization/static/src/js/list_controller.js new file mode 100644 index 000000000..317682e58 --- /dev/null +++ b/bill_digitization/static/src/js/list_controller.js @@ -0,0 +1,37 @@ +/** @odoo-module */ +import { ListController } from '@web/views/list/list_controller'; +import { useService } from "@web/core/utils/hooks"; +import { patch } from "@web/core/utils/patch"; +import { useState } from "@odoo/owl"; +import { _t } from "@web/core/l10n/translation"; +patch(ListController.prototype, { +/** + * This function will used to hide the selected options from the list view +*/ + async setup() { + super.setup(...arguments); + this.state = useState({ + button_state : false + }) + this.actionService = useService("action"); + this.orm = useService("orm"); + const digitizeBillParam = await this.env.services.orm.silent.call( + 'ir.config_parameter', 'get_param', + ["bill_digitization.digitize_bill"], + ); + this.state.button_state = digitizeBillParam + }, + /* Opening a wizard on button click */ + onClickDigitize() { + this.actionService.doAction({ + name: _t("Upload Bill"), + type: "ir.actions.act_window", + res_model: "digitize.bill", + view_type : 'form', + view_mode : 'form', + views: [[false, "form"]], + target: 'new', + }); + }, +}); + diff --git a/bill_digitization/static/src/xml/list_controller.xml b/bill_digitization/static/src/xml/list_controller.xml new file mode 100644 index 000000000..aa34fc99e --- /dev/null +++ b/bill_digitization/static/src/xml/list_controller.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/bill_digitization/views/res_config_settings_views.xml b/bill_digitization/views/res_config_settings_views.xml new file mode 100644 index 000000000..b05daec43 --- /dev/null +++ b/bill_digitization/views/res_config_settings_views.xml @@ -0,0 +1,28 @@ + + + + + res.config.settings.view.form.inherit.bill.digitization + res.config.settings + + + +
+
+ +
+
+
+
+
+
+
+
diff --git a/bill_digitization/wizard/__init__.py b/bill_digitization/wizard/__init__.py new file mode 100644 index 000000000..6dc73fe49 --- /dev/null +++ b/bill_digitization/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import digitize_bill diff --git a/bill_digitization/wizard/digitize_bill.py b/bill_digitization/wizard/digitize_bill.py new file mode 100644 index 000000000..0fc631e95 --- /dev/null +++ b/bill_digitization/wizard/digitize_bill.py @@ -0,0 +1,400 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +import io +import pytesseract +import re +from PIL import Image +from odoo import Command, fields, models, _ +from odoo.exceptions import ValidationError + + +class DigitizeBill(models.TransientModel): + """ To read documents and to convert into vendor bills """ + _name = "digitize.bill" + _description = "Digitize Bill" + + bill = fields.Binary(string="Document", required=True, + help="Choose a scanned document") + file_name = fields.Char(string="File Name", help="Name of the file") + + def record_lines(self, product_lines_newline_name_qty_price_amount, + product_lines_name_qty_amount, + product_lines_qty_name_amount, + product_lines_name_qty_price_amount1, + product_lines_name_price_qty_amount_with_dollar, + product_lines_name_price_qty_amount, + product_lines_name_amount, + product_lines_name_qty_price_amount2, + product_lines_double_line_name, + product_lines_code_name, + product_lines_quantity_part, + product_lines_vendor_bill_pattern, + product_lines_quantity_price_amount_pattern, + product_lines_quantity_price_amount_pattern2, + product_line_name_with_extra_line): + """ Function to extract bill data from text read by pytesseract """ + products = [] + price = [] + subtotal = [] + quantity = [] + if (product_lines_newline_name_qty_price_amount or + product_lines_name_qty_price_amount1 or + product_lines_name_qty_price_amount2): + if product_lines_name_qty_price_amount1: + product_lines_newline_name_qty_price_amount = ( + product_lines_name_qty_price_amount1) + if product_lines_name_qty_price_amount2: + product_lines_newline_name_qty_price_amount = ( + product_lines_name_qty_price_amount2) + # Fetching products and create new ones + products = [self.env['product.product'].search( + [('name', '=', line[0])], limit=1) or + self.env['product.product'].create( + {'name': line[0]}) + + for line in + product_lines_newline_name_qty_price_amount] + # Creating lists for prices and subtotals + price = [line[2] for line in + product_lines_newline_name_qty_price_amount] + subtotal = [line[3] for line in + product_lines_newline_name_qty_price_amount] + elif product_lines_name_qty_amount: + # Fetching products and create new ones + products = [ + self.env['product.product'].search([('name', '=', line[0])], + limit=1) or + self.env['product.product'].create({'name': line[0]}) + for line in product_lines_name_qty_amount] + # Calculating unit prices + price = [ + float(line[2]) / float(line[1]) if float(line[1]) != 0 else 0 + for line in product_lines_name_qty_amount] + # Creating a list for subtotals + subtotal = [line[2] for line in product_lines_name_qty_amount] + quantity = [float(line[1]) if line[1] else 0 for line in product_lines_name_qty_amount] + elif product_lines_qty_name_amount: + # Fetching products and create new ones + products = [ + self.env['product.product'].search([('name', '=', line[1])], + limit=1) or + self.env['product.product'].create({'name': line[1]}) + for line in product_lines_qty_name_amount] + # Calculating unit prices + price = [ + float(line[2]) / float(line[0]) if float(line[0]) != 0 else 0 + for line in product_lines_qty_name_amount] + # Creating a list for subtotals + subtotal = [line[2] for line in product_lines_qty_name_amount] + elif (product_lines_name_price_qty_amount_with_dollar or + product_lines_name_price_qty_amount): + if product_lines_name_price_qty_amount: + product_lines_name_price_qty_amount_with_dollar = ( + product_lines_name_price_qty_amount) + # Fetching products and create new ones + products = [ + self.env['product.product'].search([('name', '=', line[0])], + limit=1) or + self.env['product.product'].create({'name': line[0]}) + for line in product_lines_name_price_qty_amount_with_dollar] + # Extracting item prices and amounts + price = [line[1].replace('$', '') if '$' in line[1] else line[1] + for line in + product_lines_name_price_qty_amount_with_dollar] + subtotal = [line[3].replace('$', '') if '$' in line[3] else line[3] + for line in + product_lines_name_price_qty_amount_with_dollar] + elif product_lines_name_amount: + # Fetching products and create new ones + products = [ + self.env['product.product'].search([('name', '=', line[0])], + limit=1) or + self.env['product.product'].create({'name': line[0]}) + for line in product_lines_name_amount] + # Extracting item amounts and create a list for subtotals + subtotal = [line[1].replace('$', '') if '$' in line[1] else line[1] + for line in product_lines_name_amount] + elif product_lines_code_name: + name_list_one = [] + if product_line_name_with_extra_line: + for code, name in product_line_name_with_extra_line: + product_info = f"{code} {name}" + name_list_one.append(product_info) + names = [item.strip() for item in + product_lines_code_name[0].split('\n') if item.strip()] + if name_list_one and len(name_list_one) > len(names): + names = name_list_one + if product_lines_quantity_part: + order_lines = [line.strip() for line in + product_lines_quantity_part[0].split('\n') if + line.strip()] + elif product_lines_quantity_price_amount_pattern: + order_lines = [line.strip() for line in + product_lines_quantity_price_amount_pattern[ + 0].split('\n') if + line.strip()] + elif product_lines_quantity_price_amount_pattern2: + order_lines = [line.strip() for line in + product_lines_quantity_price_amount_pattern2[ + 0].split('\n') if + line.strip()] + else: + order_lines = [] + # Create the 'products' list + products = [ + self.env['product.product'].search([('name', '=', name)], + limit=1) or + self.env['product.product'].create({'name': name}) + for name in names] + # Creating the unit price list + price = [float(line.split()[1].replace(',', '')) if line else 0 for + line in order_lines] + # Calculating and Creating the 'subtotal' list + subtotal = [float(line.split()[1].replace(',', '')) * float( + line.split()[0]) if line else 0 for line in order_lines] + # Creating the quantity list + quantity = [float(line.split()[0]) if line else 0 for line in + order_lines] + elif product_lines_vendor_bill_pattern: + products = [ + self.env['product.product'].search([('name', '=', item[0])], + limit=1) or + self.env['product.product'].create({'name': item[0]}) + for item in product_lines_vendor_bill_pattern] + quantity = [float(item[1]) for item in + product_lines_vendor_bill_pattern] + price = [float(item[2]) for item in + product_lines_vendor_bill_pattern] + subtotal = [float(item[2]) * float(item[1]) for item in + product_lines_vendor_bill_pattern] + if product_lines_double_line_name: + for line in product_lines_double_line_name: + product_name = line[0] + ' ' + line[1] + product = self.env['product.product'].search( + [('name', '=', product_name)], limit=1) + if not product: + product = self.env['product.product'].create({ + 'name': product_name + }) + products.append(product) + if '$' in line[5]: + line[5] = line[5].replace('$', '') + subtotal.append(line[5]) + item_price = line[4].replace('$', '') if '$' in line[4] else \ + line[4] + price.append(item_price) + if bool(quantity): + # Looping lists to create product line values + move_line_vals = [ + (0, 0, { + 'product_id': product.id, + 'name': product.name, + 'price_unit': price_amount, + 'price_subtotal': total_amount, + 'quantity': qty, + 'tax_ids': [Command.set([])], + 'move_id': self.id, + }) + for product, price_amount, total_amount, qty in + zip(products, price, subtotal, quantity) + ] + elif bool(price): + # Looping three lists to create product line values + move_line_vals = [ + (0, 0, { + 'product_id': product.id, + 'name': product.name, + 'price_unit': price_amount, + 'price_subtotal': total_amount, + 'tax_ids': [Command.set([])], + 'move_id': self.id, + }) + for product, price_amount, total_amount in + zip(products, price, subtotal) + ] + + else: + move_line_vals = [ + (0, 0, { + 'product_id': product.id, + 'name': product.name, + 'quantity':qty, + 'price_subtotal': total_amount, + 'tax_ids': [Command.set([])], + 'move_id': self.id, + }) + + for product, total_amount,qty in zip(products, subtotal,quantity) + ] + return move_line_vals + + def create_record(self, text): + """ Function to create vendor bill """ + # Different patterns or regular expressions to identify the data + # from the text + newline_name_qty_price_amount = \ + r'\n([A-Za-z ]+) (\d+) (\d+\.\d{2}) (\d+\.\d{2})' + name_qty_amount = r'\n([A-Za-z ]+) (\d+) (\d+\.\d{2})' + qty_name_amount = r'\n(\d+) ([A-Za-z ]+) (\d+\.\d{2})' + name_qty_price_amount1 = r'\s*([A-Za-z() \d]+) (\d+) (\d+) (\d+)' + name_price_qty_amount_with_dollar = \ + r'\n(\$?\w+(?: \w+)*) (\$[\d.]+) (\d+) (\$[\d.]+)' + name_price_qty_amount = \ + r'\n(\$?\w+(?: \w+)*) (\[\d.]+) (\d+) (\[\d.]+)' + name_amount = r'\n(\$?\w+(?: \w+)*) (\d+\.\d{2})' + name_qty_price_amount2 = r"([\w\s]+)\s+(\d+)\s+(\d+)\s+\$(\d+)" + double_line_name = \ + r'([\w\s]+)\s([\w\s]+)\s*([\w\s]+)\s*(\d+)\s*(\$\d+' \ + r'\.\d{2})\s*(\d+\.\d{2})' + code_name = r'Description\n([\s\S]*?)(?=\n\n)' + quantity_price_pattern = r'Quantity Unit Price Taxes\n([\s\S]*?)(?=\n\n)' + vendor_bill_pattern = r'\[[A-Z0-9-]+\] (.+?) (\d+\.\d+) (\d+\.\d+) (\d+\.\d+%?) \$ (\d+\.\d+)' + quantity_price_amount_pattern = r'Quantity Unit Price Taxes Amount\n((?:\d+\.\d+\s+\d+\.\d+\s+\d+\.\d+% \$\s+\d+\.\d+\n)+)' + quantity_price_amount_pattern2 = r'Quantity Unit Price Taxes Amount([\s\S]*?)(?:Untaxed Amount|Tax|Total|$)' + name_with_extra_line = r'\[([A-Z0-9-]+)\] (.+)' + + # Pattern to match date and bill number from the text + date_pattern = r'\d{1,2}/\d{1,2}/\d{2,4}' + bill_no_pattern = r'Bill\sNo\.: (\d{4})' + # Pattern to match the year format of date + # (two digit or four digit format) + year_pattern = re.compile(r'\d{2}') + # Matching each pattern with the text and fetching the matching + # data from it + try: + product_lines_newline_name_qty_price_amount = re.findall( + newline_name_qty_price_amount, text) + product_lines_name_qty_amount = re.findall(name_qty_amount, text) + product_lines_qty_name_amount = re.findall(qty_name_amount, text) + product_lines_name_qty_price_amount1 = re.findall( + name_qty_price_amount1, text) + product_lines_name_price_qty_amount_with_dollar = re.findall( + name_price_qty_amount_with_dollar, + text) + product_lines_name_price_qty_amount = re.findall( + name_price_qty_amount, text) + product_lines_name_amount = re.findall(name_amount, text) + product_lines_name_qty_price_amount2 = re.findall( + name_qty_price_amount2, text) + product_lines_double_line_name = re.findall(double_line_name, text) + date_match = re.search(date_pattern, text) + bill_no_match = re.search(bill_no_pattern, text) + product_lines_code_name = re.findall(code_name, text) + product_lines_quantity_part = re.findall( + quantity_price_pattern, text) + product_lines_vendor_bill_pattern = re.findall( + vendor_bill_pattern, text) + product_lines_quantity_price_amount_pattern = re.findall( + quantity_price_amount_pattern, text) + product_lines_quantity_price_amount_pattern2 = re.findall( + quantity_price_amount_pattern2, text) + product_line_name_with_extra_line = re.findall( + name_with_extra_line, text) + except Exception: + raise ValidationError(_("Cannot find the pattern")) + date_object = '' + if date_match: + # Reading the date value if the date pattern match any data + date_value = date_match.group() + match = year_pattern.search(date_value) + if date_value == '%d/%m/%y' or date_value == '%d/%m/%Y': + date_object = fields.datetime.strptime( + date_value, '%d/%m/%y') if match and len( + date_value.split('/')[ + -1]) == 2 else fields.datetime.strptime( + date_value, '%d/%m/%Y') + elif date_value == '%m/%d/%y' or date_value == '%m/%d/%Y': + date_object = fields.datetime.strptime( + date_value, '%m/%d/%y') if match and len( + date_value.split('/')[ + -1]) == 2 else fields.datetime.strptime( + date_value, '%m/%d/%Y') + date = date_object.strftime( + '%Y-%m-%d') if date_object else fields.Date.today() + else: + date = fields.Date.today() + # Fetching the bill number if te pattern matches + bill_no = bill_no_match.group(1) if bill_no_match else '' + # Calling the function to get the product lines of the bill + move_line_vals = self.record_lines( + product_lines_newline_name_qty_price_amount, + product_lines_name_qty_amount, + product_lines_qty_name_amount, + product_lines_name_qty_price_amount1, + product_lines_name_price_qty_amount_with_dollar, + product_lines_name_price_qty_amount, + product_lines_name_amount, product_lines_name_qty_price_amount2, + product_lines_double_line_name, + product_lines_code_name, + product_lines_quantity_part, + product_lines_vendor_bill_pattern, + product_lines_quantity_price_amount_pattern, + product_lines_quantity_price_amount_pattern2, + product_line_name_with_extra_line) + # After getting all the data, creating a record in the + # vendor bill + bill_record = self.env['account.move'].create([{ + 'move_type': 'in_invoice', + 'ref': bill_no, + 'date': date, + 'invoice_date': date, + 'invoice_line_ids': move_line_vals, + }]) + return bill_record + + def action_add_document(self): + """ Function that reading the file in the format .jpg, .jpeg and .png + and converting into text using OCR python package """ + try: + file_attachment = self.env["ir.attachment"].search( + ['|', ('res_field', '!=', False), ('res_field', '=', False), + ('res_id', '=', self.id), + ('res_model', '=', 'digitize.bill')], + limit=1) + file_path = file_attachment._full_path(file_attachment.store_fname) + with open(file_path, mode='rb') as file: + binary_data = file.read() + img = Image.open(io.BytesIO(binary_data)) + # Resizing the image to improve the clarity + resized_img = img.resize((img.width * 2, img.height * 2), + resample=Image.BICUBIC) + except Exception: + raise ValidationError(_("Cannot identify data")) + # Converting the image into text using OCR python package + # pytesseract + try: + text = pytesseract.image_to_string(resized_img) + except Exception: + raise ValidationError(_("Data cannot read")) + # Calling the function to create vendor bill + bill_record = self.create_record(text) + # Opening the vendor bill using its id + return { + 'name': "Invoice", + 'type': 'ir.actions.act_window', + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'account.move', + 'res_id': bill_record.id, + 'view_id': self.env.ref('account.view_move_form').id, + 'target': 'current', + } diff --git a/bill_digitization/wizard/digitize_bill_views.xml b/bill_digitization/wizard/digitize_bill_views.xml new file mode 100644 index 000000000..2e513d72d --- /dev/null +++ b/bill_digitization/wizard/digitize_bill_views.xml @@ -0,0 +1,36 @@ + + + + + digitize.bill.view.form + digitize.bill + +
+ +

Upload images or pdf file format
+

+ + + + + + +
+
+
+
+
+
+ + + Digitize Bill + ir.actions.act_window + digitize.bill + form + + new + +