Browse Source

Jan 06 : [ADD] Initial Commit 'bill_digitization'

pull/254/merge
RisvanaCybro 1 year ago
parent
commit
06e394a0da
  1. 48
      bill_digitization/README.rst
  2. 23
      bill_digitization/__init__.py
  3. 58
      bill_digitization/__manifest__.py
  4. 5
      bill_digitization/doc/RELEASE_NOTES.md
  5. 23
      bill_digitization/models/__init__.py
  6. 36
      bill_digitization/models/ir_http.py
  7. 34
      bill_digitization/models/res_config_settings.py
  8. 2
      bill_digitization/security/ir.model.access.csv
  9. BIN
      bill_digitization/static/description/assets/icons/cogs.png
  10. BIN
      bill_digitization/static/description/assets/icons/consultation.png
  11. BIN
      bill_digitization/static/description/assets/icons/ecom-black.png
  12. BIN
      bill_digitization/static/description/assets/icons/education-black.png
  13. BIN
      bill_digitization/static/description/assets/icons/hotel-black.png
  14. BIN
      bill_digitization/static/description/assets/icons/license.png
  15. BIN
      bill_digitization/static/description/assets/icons/lifebuoy.png
  16. BIN
      bill_digitization/static/description/assets/icons/manufacturing-black.png
  17. BIN
      bill_digitization/static/description/assets/icons/pos-black.png
  18. BIN
      bill_digitization/static/description/assets/icons/puzzle.png
  19. BIN
      bill_digitization/static/description/assets/icons/restaurant-black.png
  20. BIN
      bill_digitization/static/description/assets/icons/service-black.png
  21. BIN
      bill_digitization/static/description/assets/icons/trading-black.png
  22. BIN
      bill_digitization/static/description/assets/icons/training.png
  23. BIN
      bill_digitization/static/description/assets/icons/update.png
  24. BIN
      bill_digitization/static/description/assets/icons/user.png
  25. BIN
      bill_digitization/static/description/assets/icons/wrench.png
  26. BIN
      bill_digitization/static/description/assets/misc/categories.png
  27. BIN
      bill_digitization/static/description/assets/misc/check-box.png
  28. BIN
      bill_digitization/static/description/assets/misc/compass.png
  29. BIN
      bill_digitization/static/description/assets/misc/config.png
  30. BIN
      bill_digitization/static/description/assets/misc/corporate.png
  31. BIN
      bill_digitization/static/description/assets/misc/customer-support.png
  32. BIN
      bill_digitization/static/description/assets/misc/features.png
  33. BIN
      bill_digitization/static/description/assets/misc/logo.png
  34. BIN
      bill_digitization/static/description/assets/misc/pictures.png
  35. BIN
      bill_digitization/static/description/assets/misc/pie-chart.png
  36. BIN
      bill_digitization/static/description/assets/misc/right-arrow.png
  37. BIN
      bill_digitization/static/description/assets/misc/star.png
  38. BIN
      bill_digitization/static/description/assets/misc/support.png
  39. BIN
      bill_digitization/static/description/assets/misc/whatsapp.png
  40. BIN
      bill_digitization/static/description/assets/modules/1.png
  41. BIN
      bill_digitization/static/description/assets/modules/2.png
  42. BIN
      bill_digitization/static/description/assets/modules/3.png
  43. BIN
      bill_digitization/static/description/assets/modules/4.png
  44. BIN
      bill_digitization/static/description/assets/modules/5.png
  45. BIN
      bill_digitization/static/description/assets/modules/6.png
  46. BIN
      bill_digitization/static/description/assets/screenshots/boolean.png
  47. BIN
      bill_digitization/static/description/assets/screenshots/button.png
  48. BIN
      bill_digitization/static/description/assets/screenshots/demo_bill.jpg
  49. BIN
      bill_digitization/static/description/assets/screenshots/demo_bill2.png
  50. BIN
      bill_digitization/static/description/assets/screenshots/hero.gif
  51. BIN
      bill_digitization/static/description/assets/screenshots/vendor_bill.png
  52. BIN
      bill_digitization/static/description/assets/screenshots/wizard.png
  53. BIN
      bill_digitization/static/description/banner.jpg
  54. BIN
      bill_digitization/static/description/icon.png
  55. 660
      bill_digitization/static/description/index.html
  56. 44
      bill_digitization/static/src/js/digitize_button.js
  57. 14
      bill_digitization/static/src/xml/digitize_button_templates.xml
  58. 14
      bill_digitization/views/account_move_views.xml
  59. 28
      bill_digitization/views/res_config_settings_views.xml
  60. 22
      bill_digitization/wizard/__init__.py
  61. 383
      bill_digitization/wizard/digitize_bill.py
  62. 41
      bill_digitization/wizard/digitize_bill_views.xml

48
bill_digitization/README.rst

@ -0,0 +1,48 @@
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
Bill Digitization
=================
Reading scanned documents with extension .jpg, .jpeg and .png and creating
vendor bills in odoo.
Configuration
=============
- Install PIL, pytesseract
- Enable 'Digitize Bill' option from configuration settings
Company
-------
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__
License
-------
General Public License, Version 3 (LGPL v3).
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html)
Credits
-------
Developer: (V15) Sruthi Renjith, Contact: odoo@cybrosys.com
Contacts
--------
* Mail Contact : odoo@cybrosys.com
* Website : https://cybrosys.com
Bug Tracker
-----------
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported.
Maintainer
==========
.. image:: https://cybrosys.com/images/logo.png
:target: https://cybrosys.com
This module is maintained by Cybrosys Technologies.
For support and more information, please visit `Our Website <https://cybrosys.com/>`__
Further information
===================
HTML Description: `<static/description/index.html>`__

23
bill_digitization/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Sruthi Renjith (odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import models
from . import wizard

58
bill_digitization/__manifest__.py

@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Sruthi Renjith (odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
{
'name': 'Bill Digitization',
'version': '15.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'],
'data': ['security/ir.model.access.csv',
'views/res_config_settings_views.xml',
'views/account_move_views.xml',
'wizard/digitize_bill_views.xml'],
'assets': {
'web.assets_backend': [
'bill_digitization/static/src/js/digitize_button.js',
],
'web.assets_qweb': [
'bill_digitization/static/src/xml/digitize_button_templates.xml',
],
},
'external_dependencies': {
'python': ['PIL', 'pytesseract']
},
'images': ['static/description/banner.jpg'],
'license': 'LGPL-3',
'installable': True,
'auto_install': False,
'application': False,
}

5
bill_digitization/doc/RELEASE_NOTES.md

@ -0,0 +1,5 @@
## Module <bill_digitization>
#### 26.11.2023
#### Version 15.0.1.0.0
#### ADD
- Initial commit for Bill Digitization

23
bill_digitization/models/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Sruthi Renjith (odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from . import ir_http
from . import res_config_settings

36
bill_digitization/models/ir_http.py

@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Sruthi Renjith (odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import models
class IrHttp(models.AbstractModel):
""" Class to get the button state in a session """
_inherit = 'ir.http'
def session_info(self):
""" Inheriting the ir.http model and super the session_info function
to use the value in JS """
info = super(IrHttp, self).session_info()
info["button_state"] = True if self.env[
'ir.config_parameter'].get_param(
'bill_digitization.digitize_bill') == 'True' else False
return info

34
bill_digitization/models/res_config_settings.py

@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
#############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# Author: Sruthi Renjith (odoo@cybrosys.com)
#
# 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 <http://www.gnu.org/licenses/>.
#
#############################################################################
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
""" Class to add a boolean field in configuration settings to enable
digitization """
_inherit = "res.config.settings"
digitize_bill = fields.Boolean(config_parameter='bill_digitization.'
'digitize_bill',
string="Digitize Bill",
help="Enable the option to digitize bill")

2
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
1 id name model_id/id group_id/id perm_read perm_write perm_create perm_unlink
2 access_digitize_bill_user access.digitize.bill.user model_digitize_bill base.group_user 1 1 1 1

BIN
bill_digitization/static/description/assets/icons/cogs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
bill_digitization/static/description/assets/icons/consultation.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
bill_digitization/static/description/assets/icons/ecom-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

BIN
bill_digitization/static/description/assets/icons/education-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
bill_digitization/static/description/assets/icons/hotel-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

BIN
bill_digitization/static/description/assets/icons/license.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
bill_digitization/static/description/assets/icons/lifebuoy.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
bill_digitization/static/description/assets/icons/manufacturing-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

BIN
bill_digitization/static/description/assets/icons/pos-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

BIN
bill_digitization/static/description/assets/icons/puzzle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

BIN
bill_digitization/static/description/assets/icons/restaurant-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

BIN
bill_digitization/static/description/assets/icons/service-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

BIN
bill_digitization/static/description/assets/icons/trading-black.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

BIN
bill_digitization/static/description/assets/icons/training.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

BIN
bill_digitization/static/description/assets/icons/update.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
bill_digitization/static/description/assets/icons/user.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

BIN
bill_digitization/static/description/assets/icons/wrench.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
bill_digitization/static/description/assets/misc/categories.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
bill_digitization/static/description/assets/misc/check-box.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
bill_digitization/static/description/assets/misc/compass.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
bill_digitization/static/description/assets/misc/config.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
bill_digitization/static/description/assets/misc/corporate.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
bill_digitization/static/description/assets/misc/customer-support.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
bill_digitization/static/description/assets/misc/features.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

BIN
bill_digitization/static/description/assets/misc/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
bill_digitization/static/description/assets/misc/pictures.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
bill_digitization/static/description/assets/misc/pie-chart.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
bill_digitization/static/description/assets/misc/right-arrow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

BIN
bill_digitization/static/description/assets/misc/star.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
bill_digitization/static/description/assets/misc/support.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
bill_digitization/static/description/assets/misc/whatsapp.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
bill_digitization/static/description/assets/modules/1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
bill_digitization/static/description/assets/modules/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
bill_digitization/static/description/assets/modules/3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
bill_digitization/static/description/assets/modules/4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
bill_digitization/static/description/assets/modules/5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
bill_digitization/static/description/assets/modules/6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
bill_digitization/static/description/assets/screenshots/boolean.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

BIN
bill_digitization/static/description/assets/screenshots/button.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

BIN
bill_digitization/static/description/assets/screenshots/demo_bill.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
bill_digitization/static/description/assets/screenshots/demo_bill2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
bill_digitization/static/description/assets/screenshots/hero.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

BIN
bill_digitization/static/description/assets/screenshots/vendor_bill.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
bill_digitization/static/description/assets/screenshots/wizard.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

BIN
bill_digitization/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

BIN
bill_digitization/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

660
bill_digitization/static/description/index.html

@ -0,0 +1,660 @@
<div style="background-color: #714B67; min-height: 600px; width: 100%; padding: 15px; position: relative;">
<!-- TITLE BAR -->
<div class="d-flex align-items-center justify-content-between"
style="border-bottom: 1px solid #875A7B; padding: 15px; display: flex; justify-content: space-between; align-items: center;">
<img src="assets/misc/logo.png" width="162" height="60"
style="width:auto !important; height:60px !important"/>
<div>
<div style="color: #7C7BAD; font-size: 14px; font-family: 'Montserrat', sans-serif; font-weight: bold; background-color: white; display: inline-block; padding: 3px 10px; border-radius: 50px;"
class="mr-2">
<i class="fa fa-check mr-1"></i>Community
</div>
</div>
</div>
<!-- END OF TITLE BAR -->
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12">
<!-- APP HERO -->
<h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;">
Bill Digitization</h1>
<p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;">
Creating Vendor Bill from Scanned Document</p>
</div>
<!-- END OF APP HERO -->
<img src="assets/screenshots/hero.gif"
style="width: 75%; height: auto; position: absolute; margin-left: auto; margin-right: auto; top: 45%; left: 12%; right: auto;"/>
</div>
</div>
</div>
<!-- NAVIGATION SECTION -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px; margin-top: 300px;">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="assets/misc/compass.png"/>
</div>
<h2 class="mt-2"
style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">
Explore This
Module</h2>
</div>
<div class="row my-4" style="font-family: 'Montserrat', sans-serif;">
<div class="col-sm-12 col-md-6 my-3">
<a href="#overview">
<div class="d-flex justify-content-between align-items-center"
style="background-color: #f5f5f5; padding: 30px; width: 100%;">
<div>
<span style="color: #714B67; font-size: 24px; font-weight: 500; display: block;">Overview</span>
<span
style="color: #714B67; font-size: 16px; font-weight: 400; color:#282F33; display: block;">Learn
more about this
module</span>
</div>
<img src="assets/misc/right-arrow.png" width="36" height="36"/>
</div>
</a>
</div>
<div class="col-sm-12 col-md-6 my-3">
<a href="#config">
<div class="d-flex justify-content-between align-items-center"
style="background-color: #f5f5f5; padding: 30px; width: 100%;">
<div>
<span style="color: #714B67; font-size: 24px; font-weight: 500; display: block;">Configuration</span>
<span
style="color: #714B67; font-size: 16px; font-weight: 400; color:#282F33; display: block;">View
configuration of this
module</span>
</div>
<img src="assets/misc/right-arrow.png" width="36" height="36"/>
</div>
</a>
</div>
<div class="col-sm-12 col-md-6 my-3">
<a href="#features">
<div class="d-flex justify-content-between align-items-center"
style="background-color: #f5f5f5; padding: 30px; width: 100%;">
<div>
<span style="color: #714B67; font-size: 24px; font-weight: 500; display: block;">Features</span>
<span
style="color: #714B67; font-size: 16px; font-weight: 400; color:#282F33; display: block;">View
features of this
module</span>
</div>
<img src="assets/misc/right-arrow.png" width="36" height="36"/>
</div>
</a>
</div>
<div class="col-sm-12 col-md-6 my-3">
<a href="#screenshots">
<div class="d-flex justify-content-between align-items-center"
style="background-color: #f5f5f5; padding: 30px; width: 100%;">
<div>
<span style="color: #714B67; font-size: 24px; font-weight: 500; display: block;">Screenshots</span>
<span
style="color: #714B67; font-size: 16px; font-weight: 400; color:#282F33; display: block;">View
screenshots for this
module</span>
</div>
<img src="assets/misc/right-arrow.png" width="36" height="36"/>
</div>
</a>
</div>
</div>
<!-- END OF NAVIGATION SECTION -->
<!-- OVERVIEW SECTION -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;"
id="overview">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="assets/misc/pie-chart.png"/>
</div>
<h2 class="mt-2"
style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">
Overview
</h2>
</div>
<div class="row"
style="font-family: 'Montserrat', sans-serif; font-weight: 400; font-size: 14px; line-height: 200%;">
<div class="col-sm-12 py-4">
Bill Digitization allows user to create vendor bill from scanned
documents. User can read .jpg, .jpeg and .png scanned files.
</div>
</div>
<!-- END OF OVERVIEW SECTION -->
<!-- CONFIGURATION SECTION -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;" id="config">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="assets/misc/config.png"/>
</div>
<h2 class="mt-2"
style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">
Configuration
</h2>
</div>
<div class="row"
style="font-family: 'Montserrat', sans-serif; font-weight: 400; font-size: 14px; line-height: 200%;">
<div class="col-sm-12 py-4">
Need to install the following python packages
1. PIL (pip3 install PIL)
2. pytesseract (pip3 install pytesseract)
3. tesseract-ocr (sudo apt-get install tesseract-ocr)
</div>
</div>
<!-- END OF CONFIGURATION SECTION -->
<!-- FEATURES SECTION -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;"
id="features">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="assets/misc/features.png"/>
</div>
<h2 class="mt-2"
style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">
Features
</h2>
</div>
<div class="row"
style="font-family: 'Montserrat', sans-serif; font-weight: 400; font-size: 14px; line-height: 200%;">
<div class="col-sm-12 col-md-6">
<div class="d-flex align-items-start"
style="margin-top: 40px; margin-bottom: 40px">
<img src="assets/misc/check-box.png" class="mr-2"/>
<div>
<span
style="display: block; font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Boolean Field on Configuration Settings to Choose Digitization</span>
</div>
</div>
<div class="d-flex align-items-start"
style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2"/>
<div>
<span
style="display: block; font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">A Button on Vendor Bill Tree View to Read Documents</span>
</div>
</div>
<div class="d-flex align-items-start"
style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2"/>
<div>
<span
style="display: block; font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">A View that Shows the Vendor Bill with All the Fetched Data</span>
</div>
</div>
</div>
</div>
<!-- END OF FEATURES SECTION -->
<!-- SCREENSHOTS SECTION -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;"
id="screenshots">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="assets/misc/pictures.png"/>
</div>
<h2 class="mt-2"
style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">
Screenshots
</h2>
</div>
<div class="row">
<div class="col-sm-12">
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Option to Enable Digitization</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
This allows the user to choose digitization.</p>
<img src="assets/screenshots/boolean.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Digitization Button</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
Button to read scanned documents.</p>
<img src="assets/screenshots/button.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Digitization Wizard</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
A wizard that allows to read document.</p>
<img src="assets/screenshots/wizard.png" class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Vendor Bill</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
Vendor bill with scanned document data</p>
<img src="assets/screenshots/vendor_bill.png"
class="img-thumbnail">
</div>
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
(The example format for scanned document is added in the
module screenshots folder.)</h3>
</div>
</div>
</div>
<!-- END OF SCREENSHOTS SECTION -->
<!-- SUGGESTED PRODUCTS -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="assets/misc/categories.png"/>
</div>
<h2 class="mt-2"
style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">
Suggested
Products
</h2>
</div>
<div class="row">
<div class="col-sm-12">
<div id="demo1" class="row carousel slide" data-ride="carousel">
<!-- The slideshow -->
<div class="carousel-inner" style="padding: 30px;">
<div class="carousel-item" style="min-height: 198.656px;">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/invoice_multi_approval/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius: 0px;"
src="./assets/modules/1.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/account_interest_on_overdue_invoice/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius: 0px;"
src="./assets/modules/2.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/product_brand_invoicing/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius: 0px;"
src="./assets/modules/3.png">
</div>
</a>
</div>
</div>
<div class="carousel-item active"
style="min-height: 198.656px;">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/invoice_format_editor/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius: 0px;"
src="./assets/modules/4.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/base_account_budget/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius: 0px;"
src="./assets/modules/5.png">
</div>
</a>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/auto_daily_weekly_report/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius: 0px;"
src="./assets/modules/6.png">
</div>
</a>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="carousel-control-prev" href="#demo1" data-slide="prev"
style="width:35px; color:#000"> <span
class="carousel-control-prev-icon"><i
class="fa fa-chevron-left"
style="font-size:24px"></i></span>
</a> <a class="carousel-control-next" href="#demo1"
data-slide="next" style="width:35px; color:#000">
<span class="carousel-control-next-icon"><i
class="fa fa-chevron-right"
style="font-size:24px"></i></span>
</a>
</div>
</div>
</div>
<!-- END OF SUGGESTED PRODUCTS -->
<!-- OUR SERVICES -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="assets/misc/star.png"/>
</div>
<h2 class="mt-2"
style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">
Our Services
</h2>
</div>
<div class="container my-5">
<div class="row">
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #1dd1a1 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/cogs.png" class="img-responsive"
height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Customization</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ff6b6b !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/wrench.png" class="img-responsive"
height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6462CD !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/lifebuoy.png" class="img-responsive"
height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Support</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #ffa801 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/user.png" class="img-responsive"
height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Hire
Odoo
Developer</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #54a0ff !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/puzzle.png" class="img-responsive"
height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Integration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #6d7680 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/update.png" class="img-responsive"
height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Migration</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #786fa6 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/consultation.png" class="img-responsive"
height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Consultancy</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #f8a5c2 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/training.png" class="img-responsive"
height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Implementation</h6>
</div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #e6be26 !important; border-radius: 15px !important; height: 80px; width: 80px;">
<img src="assets/icons/license.png" class="img-responsive"
height="48px" width="48px">
</div>
<h6 class="text-center"
style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;">
Odoo
Licensing Consultancy</h6>
</div>
</div>
</div>
<!-- END OF OUR SERVICES -->
<!-- OUR INDUSTRIES -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="assets/misc/corporate.png"/>
</div>
<h2 class="mt-2"
style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">
Our
Industries
</h2>
</div>
<div class="container my-5">
<div class="row">
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="assets/icons/trading-black.png"
class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Trading
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Easily procure
and
sell your products</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="assets/icons/pos-black.png"
class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
POS
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Easy
configuration
and convivial experience</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="assets/icons/education-black.png"
class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Education
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
A platform for
educational management</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="assets/icons/manufacturing-black.png"
class="img-responsive mb-3" height="48px"
width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Manufacturing
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Plan, track and
schedule your operations</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/ecom-black.png"
class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
E-commerce &amp; Website
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Mobile
friendly,
awe-inspiring product pages</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/service-black.png"
class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Service Management
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Keep track of
services and invoice</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/restaurant-black.png"
class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Restaurant
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
Run your bar or
restaurant methodically</p>
</div>
</div>
<div class="col-lg-3">
<div class="my-4 d-flex flex-column justify-content-center"
style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;">
<img src="./assets/icons/hotel-black.png"
class="img-responsive mb-3" height="48px" width="48px">
<h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;">
Hotel Management
</h5>
<p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;">
An
all-inclusive
hotel management application</p>
</div>
</div>
</div>
</div>
<!-- END OF OUR INDUSTRIES -->
<!-- SUPPORT -->
<div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2"
style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">
<img src="assets/misc/customer-support.png"/>
</div>
<h2 class="mt-2"
style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">
Support
</h2>
</div>
<div class="container mt-5">
<div class="row">
<div class="col-sm-12 col-md-6">
<div style="background-color: #F6F8F9; padding: 30px; display: flex; align-items: center;">
<div class="mr-4"
style="background-color: #714B67; display: inline-block; height: 70px; width: 70px; display: flex; align-items: center; justify-content: center;">
<img src="assets/misc/support.png" height="48" width="48"
style="width: 42px; height: 42px;"/>
</div>
<div>
<h4>Need Help?</h4>
<p style="line-height: 100%;">Got questions or need help?
Get in touch.</p>
<a href="mailto:odoo@cybrosys.com">
<p style="font-weight: 400; font-size: 28px; line-height: 80%; color: #714B67;">
odoo@cybrosys.com</p>
</a>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6">
<div style="background-color: #F6F8F9; padding: 30px; display: flex; align-items: center;">
<div class="mr-4"
style="background-color: #2AC44D; display: inline-block; height: 70px; width: 70px; display: flex; align-items: center; justify-content: center;">
<img src="assets/misc/whatsapp.png" height="52" width="52"
style="width: 52px; height: 52px;"/>
</div>
<div>
<h4>WhatsApp</h4>
<p style="line-height: 100%;">Say hi to us on WhatsApp!</p>
<a href="https://api.whatsapp.com/send?phone=918606827707">
<p style="font-weight: 400; font-size: 28px; line-height: 80%; color: #714B67;">
+91 86068
27707</p>
</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12 my-5 d-flex justify-content-center align-items-center">
<img src="assets/misc/logo.png" width="144" height="31"
style="width:144px; height: 31px; margin-top: 40px;"/>
</div>
</div>
</div>
<!-- END OF SUPPORT -->

44
bill_digitization/static/src/js/digitize_button.js

@ -0,0 +1,44 @@
odoo.define('bill_digitization.tree_button', function (require) {
"use strict";
var ListController = require('web.ListController');
var ListView = require('web.ListView');
var viewRegistry = require('web.view_registry');
var rpc = require('web.rpc');
const session = require('web.session');
var TreeButton = ListController.extend({
/* Assigning a default value to the button_state */
state: {
button_state : false
},
/* Retrieves the current value of the button state from the session. */
get_button_value: function(){
return session.button_state
},
buttons_template: 'bill_digitization.buttons',
/* Click event to pop up a wizard */
events: _.extend({}, ListController.prototype.events, {
'click .open_wizard_action': '_OpenWizard',
}),
/* Function that calling upon clicking the button */
_OpenWizard: function () {
var self = this;
self.do_action({
type: 'ir.actions.act_window',
res_model: 'digitize.bill',
name :'Upload Bill',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
target: 'new',
res_id: false,
});
},
});
/* Adding the button into specific view */
var AccountMoveListView = ListView.extend({
config: _.extend({}, ListView.prototype.config, {
Controller: TreeButton,
}),
});
viewRegistry.add('button_in_tree', AccountMoveListView);
});

14
bill_digitization/static/src/xml/digitize_button_templates.xml

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Template to inherit and add button to the view -->
<templates>
<t t-extend="ListView.buttons" t-name="bill_digitization.buttons">
<t t-jquery="button.o_list_export_xlsx" t-operation="after">
<t t-if="widget.get_button_value()">
<button type="button"
class="btn btn-primary open_wizard_action">
Digitize Bill
</button>
</t>
</t>
</t>
</templates>

14
bill_digitization/views/account_move_views.xml

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Inheriting and adding a button in the view -->
<record id="view_in_invoice_bill_tree" model="ir.ui.view">
<field name="name">account.move.view.tree.inherit.bill.digitization</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_in_invoice_bill_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree" position="attributes">
<attribute name="js_class">button_in_tree</attribute>
</xpath>
</field>
</record>
</odoo>

28
bill_digitization/views/res_config_settings_views.xml

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- Adding a field in res_config_setting view -->
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.bill.digitization</field>
<field name="model">res.config.settings</field>
<field name="inherit_id"
ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='account_vendor_bills']"
position="inside">
<div class="col-xs-12 col-md-6 o_setting_box"
id="digitize_bill">
<div class="o_setting_left_pane">
<field name="digitize_bill"/>
</div>
<div class="o_setting_right_pane"
name="digitize_bill_right_pane">
<label for="digitize_bill"/>
<div class="text-muted">
Digitize bill from scanned documents with .jpg, .jpeg or .png extension using OCR and Artificial Intelligence
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

22
bill_digitization/wizard/__init__.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Sruthi Renjith (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 <http://www.gnu.org/licenses/>.
#
################################################################################
from . import digitize_bill

383
bill_digitization/wizard/digitize_bill.py

@ -0,0 +1,383 @@
# -*- coding: utf-8 -*-
################################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Sruthi Renjith (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 <http://www.gnu.org/licenses/>.
#
################################################################################
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):
""" Class to read bills and create vendor bill from it """
_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_amount,
product_lines_name_price_qty_amount_with_dollar,
product_lines_name_price_qty_amount,
product_lines_name_amount,
product_lines_name_qty_price_dollar_amount,
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_amount or \
product_lines_name_qty_price_dollar_amount:
if product_lines_name_qty_price_amount:
product_lines_newline_name_qty_price_amount = \
product_lines_name_qty_price_amount
if product_lines_name_qty_price_dollar_amount:
product_lines_newline_name_qty_price_amount = \
product_lines_name_qty_price_dollar_amount
# Creating products and appending them to the products list
products = [
self.env['product.product'].search([('name', '=', line[0])],
limit=1)[0]
if self.env['product.product'].search([('name', '=', line[0])],
limit=1)
else self.env['product.product'].create({'name': line[0]})
for line in product_lines_newline_name_qty_price_amount
]
# Extracting price and subtotal from each line and appending them
# to their respective lists
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:
# Creating the 'products' list and calculate unit price
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 the unit price and create the 'price' list
price = [
float(line[2]) / float(line[1]) if float(line[1]) != 0 else 0
for line in product_lines_name_qty_amount]
# Creating the 'subtotal' list
subtotal = [line[2] for line in product_lines_name_qty_amount]
elif product_lines_qty_name_amount:
# Create the 'products' list and calculate unit price
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 the unit price and create the 'price' list
price = [
float(line[2]) / float(line[0]) if float(line[0]) != 0 else 0
for line in product_lines_qty_name_amount]
# Creating the 'subtotal' list
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
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
price = [line[1].replace('$', '') if '$' in line[1] else line[1]
for line in
product_lines_name_price_qty_amount_with_dollar]
# Extracting subtotal amounts
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
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 subtotal amounts
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]
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:
# Fetching the product name, price and subtotal and appending
# into different lists for the patterns
# 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 = [
{
'product_id': product.id,
'name': 'Outside Bill',
'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 = [
{
'product_id': product.id,
'name': 'Outside Bill',
'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 = [
{
'product_id': product.id,
'name': 'Outside Bill',
'price_subtotal': total_amount,
'tax_ids': [Command.set([])],
'move_id': self.id,
}
for product, total_amount in zip(products, subtotal)
]
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_amount = 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_dollar_amount = 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)'
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|$)'
vendor_bill_pattern = r'\[[A-Z0-9-]+\] (.+?) (\d+\.\d+) (\d+\.\d+) (\d+\.\d+%?) \$ (\d+\.\d+)'
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_amount = re.findall(
name_qty_price_amount, 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_dollar_amount = re.findall(
name_qty_price_dollar_amount, text)
product_lines_double_line_name = re.findall(double_line_name, 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)
date_match = re.search(date_pattern, text)
bill_no_match = re.search(bill_no_pattern, 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_amount,
product_lines_name_price_qty_amount_with_dollar,
product_lines_name_price_qty_amount,
product_lines_name_amount,
product_lines_name_qty_price_dollar_amount,
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 f:
binary_data = f.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',
}

41
bill_digitization/wizard/digitize_bill_views.xml

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- Wizard view to upload files -->
<record id="digitize_bill_view_form" model="ir.ui.view">
<field name="name">digitize.bill.view.form</field>
<field name="model">digitize.bill</field>
<field name="arch" type="xml">
<form>
<sheet>
<p>
<center>
<i>Upload images or pdf file format</i>
</center>
</p>
<group>
<group>
<field name="bill" filename="file_name"/>
<field name="file_name" invisible="1"/>
</group>
</group>
<footer>
<button name="action_add_document" class="oe_highlight"
string="ADD" type="object"
help="Add a bill document"/>
<button special="cancel" class="oe_highlight"
string="CANCEL" help="Cancel the process"/>
</footer>
</sheet>
</form>
</field>
</record>
<!-- Record for wizard action -->
<record id="digitize_bill_action" model="ir.actions.act_window">
<field name="name">Digitize Bill</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">digitize.bill</field>
<field name="view_mode">form</field>
<field name="view_id" ref="digitize_bill_view_form"/>
<field name="target">new</field>
</record>
</odoo>
Loading…
Cancel
Save