Browse Source

Feb 8 [ADD] : Initial Commit 'ocr_data_retrieval'

pull/267/merge
AjmalCybro 1 year ago
parent
commit
605bb70817
  1. 48
      ocr_data_retrieval/README.rst
  2. 22
      ocr_data_retrieval/__init__.py
  3. 51
      ocr_data_retrieval/__manifest__.py
  4. 6
      ocr_data_retrieval/doc/RELEASE_NOTES.md
  5. 22
      ocr_data_retrieval/models/__init__.py
  6. 507
      ocr_data_retrieval/models/ocr_data_template.py
  7. 2
      ocr_data_retrieval/security/ir.model.access.csv
  8. BIN
      ocr_data_retrieval/static/description/assets/icons/cogs.png
  9. BIN
      ocr_data_retrieval/static/description/assets/icons/consultation.png
  10. BIN
      ocr_data_retrieval/static/description/assets/icons/ecom-black.png
  11. BIN
      ocr_data_retrieval/static/description/assets/icons/education-black.png
  12. BIN
      ocr_data_retrieval/static/description/assets/icons/hotel-black.png
  13. BIN
      ocr_data_retrieval/static/description/assets/icons/license.png
  14. BIN
      ocr_data_retrieval/static/description/assets/icons/lifebuoy.png
  15. BIN
      ocr_data_retrieval/static/description/assets/icons/manufacturing-black.png
  16. BIN
      ocr_data_retrieval/static/description/assets/icons/pos-black.png
  17. BIN
      ocr_data_retrieval/static/description/assets/icons/puzzle.png
  18. BIN
      ocr_data_retrieval/static/description/assets/icons/restaurant-black.png
  19. BIN
      ocr_data_retrieval/static/description/assets/icons/service-black.png
  20. BIN
      ocr_data_retrieval/static/description/assets/icons/trading-black.png
  21. BIN
      ocr_data_retrieval/static/description/assets/icons/training.png
  22. BIN
      ocr_data_retrieval/static/description/assets/icons/update.png
  23. BIN
      ocr_data_retrieval/static/description/assets/icons/user.png
  24. BIN
      ocr_data_retrieval/static/description/assets/icons/wrench.png
  25. BIN
      ocr_data_retrieval/static/description/assets/misc/categories.png
  26. BIN
      ocr_data_retrieval/static/description/assets/misc/check-box.png
  27. BIN
      ocr_data_retrieval/static/description/assets/misc/compass.png
  28. BIN
      ocr_data_retrieval/static/description/assets/misc/config.png
  29. BIN
      ocr_data_retrieval/static/description/assets/misc/corporate.png
  30. BIN
      ocr_data_retrieval/static/description/assets/misc/customer-support.png
  31. BIN
      ocr_data_retrieval/static/description/assets/misc/features.png
  32. BIN
      ocr_data_retrieval/static/description/assets/misc/logo.png
  33. BIN
      ocr_data_retrieval/static/description/assets/misc/pictures.png
  34. BIN
      ocr_data_retrieval/static/description/assets/misc/pie-chart.png
  35. BIN
      ocr_data_retrieval/static/description/assets/misc/right-arrow.png
  36. BIN
      ocr_data_retrieval/static/description/assets/misc/star.png
  37. BIN
      ocr_data_retrieval/static/description/assets/misc/support.png
  38. BIN
      ocr_data_retrieval/static/description/assets/misc/whatsapp.png
  39. BIN
      ocr_data_retrieval/static/description/assets/modules/module01.png
  40. BIN
      ocr_data_retrieval/static/description/assets/modules/module02.png
  41. BIN
      ocr_data_retrieval/static/description/assets/modules/module03.png
  42. BIN
      ocr_data_retrieval/static/description/assets/modules/module04.png
  43. BIN
      ocr_data_retrieval/static/description/assets/modules/module05.png
  44. BIN
      ocr_data_retrieval/static/description/assets/modules/module06.png
  45. BIN
      ocr_data_retrieval/static/description/assets/screenshots/contact_mapping.png
  46. BIN
      ocr_data_retrieval/static/description/assets/screenshots/data_retrieval.png
  47. BIN
      ocr_data_retrieval/static/description/assets/screenshots/employee_mapping.png
  48. BIN
      ocr_data_retrieval/static/description/assets/screenshots/hero.gif
  49. BIN
      ocr_data_retrieval/static/description/assets/screenshots/ocr_menu.png
  50. BIN
      ocr_data_retrieval/static/description/assets/screenshots/purchase_order.pdf
  51. BIN
      ocr_data_retrieval/static/description/assets/screenshots/read_bill.png
  52. BIN
      ocr_data_retrieval/static/description/assets/screenshots/sale_mapping.png
  53. BIN
      ocr_data_retrieval/static/description/assets/screenshots/sale_order.pdf
  54. BIN
      ocr_data_retrieval/static/description/banner.jpg
  55. BIN
      ocr_data_retrieval/static/description/icon.png
  56. 704
      ocr_data_retrieval/static/description/index.html
  57. BIN
      ocr_data_retrieval/static/src/img/pdf.png
  58. 13
      ocr_data_retrieval/static/src/js/image_field.js
  59. 80
      ocr_data_retrieval/views/ocr_data_template_views.xml

48
ocr_data_retrieval/README.rst

@ -0,0 +1,48 @@
.. image:: https://img.shields.io/badge/licence-LGPL--3-green.svg
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
OCR Data Retrieval
==================
This module allows user to retrieve data from scanned documents and images.
Configuration
=============
- www.odoo.com/documentation/16.0/setup/install.html
- Install our custom addon
- Install pdf2image, PIL, pytesseract, spacy, en_core_web_sm
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: (V16) 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>`__

22
ocr_data_retrieval/__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 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

51
ocr_data_retrieval/__manifest__.py

@ -0,0 +1,51 @@
# -*- 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': 'OCR Data Retrieval',
'version': '16.0.1.0.0',
'category': 'Productivity',
'summary': 'Data retrieval from scanned documents',
'description': """Data retrieval from scanned documents with .jpg,
.jpeg, .png and .pdf files. Also mapping them to appropriate models""",
'author': "Cybrosys Techno Solutions",
'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions',
'website': "https://www.cybrosys.com",
'depends': ['base', 'hr_expense', 'bill_digitization', 'contacts',
'purchase'],
'assets': {
'web.assets_backend': [
'/ocr_data_retrieval/static/src/js/image_field.js',
],
},
'data': ['security/ir.model.access.csv',
'views/ocr_data_template_views.xml'],
'external_dependencies': {
'python': ['pdf2image', 'PIL', 'pytesseract', 'spacy',
'en_core_web_sm']
},
'images': ['static/description/banner.jpg'],
'license': 'LGPL-3',
'installable': True,
'auto_install': False,
'application': False,
}

6
ocr_data_retrieval/doc/RELEASE_NOTES.md

@ -0,0 +1,6 @@
## Module <ocr_data_retrieval>
#### 10.01.2024
#### Version 16.0.1.0.0
#### ADD
- Initial commit for OCR Data Retrieval

22
ocr_data_retrieval/models/__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 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 ocr_data_template

507
ocr_data_retrieval/models/ocr_data_template.py

@ -0,0 +1,507 @@
# -*- 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/>.
#
###############################################################################
import io
import os
import pytesseract
import re
import spacy
from pdf2image import convert_from_bytes
from PIL import Image, ImageOps
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class OCRDataTemplate(models.TransientModel):
""" Class to read document and extract the text from JPG, JPEG, PNG and
PDF files. """
_name = "ocr.data.template"
_description = "Data Retrieving Template"
_rec_name = "file_name"
image = fields.Binary(string="Document", required=True,
help="Upload .jpg, .jpeg, .png or .pdf files")
file_name = fields.Char(string="Document Name", help="Name of document")
image2 = fields.Image(string="Document",
help="Uploaded document", store=True)
flag = fields.Boolean(string="Flag", default=False,
help="Flag to check document read or not")
data = fields.Text(string="Data", readonly=True,
help="Content from the document")
model_name_id = fields.Many2one(
'ir.model', string="Model",
domain="[('model', 'in', ['res.partner', 'account.move', "
"'hr.employee', 'hr.expense', 'sale.order', "
"'purchase.order'])]",
help="Model to which the data want to map")
model_field_ids = fields.Many2many(
'ir.model.fields', string="Fields",
domain="[('model_id', '=', model_name_id)]",
help="Fields names to map data")
def data_segmentation(self, img):
"""
Function to do segmentation for the retrieved data after converting it
into image
"""
img = ImageOps.grayscale(img)
threshold_value = 176
img = img.point(lambda x: 255 if x > threshold_value else 0, '1')
img_rgb = ImageOps.invert(img.convert("RGB"))
segments = []
segment_bounds = img_rgb.getbbox()
while segment_bounds:
segment = img_rgb.crop(segment_bounds)
if segment.size[0] > 0 and segment.size[1] > 0:
segments.append(segment)
img_rgb = ImageOps.crop(img_rgb, segment_bounds)
segment_bounds = img_rgb.getbbox()
return segments
def action_get_data(self):
"""
Function to get the files in .jpg, .jpeg, .png and .pdf formats
"""
split_tup = os.path.splitext(self.file_name)
try:
# Getting the file path from ir.attachments
file_attachment = self.env["ir.attachment"].search(
['|', ('res_field', '!=', False), ('res_field', '=', False),
('res_id', '=', self.id),
('res_model', '=', 'ocr.data.template')],
limit=1)
file_path = file_attachment._full_path(file_attachment.store_fname)
segmented_data = []
# Reading files in the format .jpg, .jpeg and .png
if (split_tup[1] == '.jpg' or split_tup[1] == '.jpeg' or
split_tup[1] == '.png'):
with open(file_path, mode='rb') as f:
binary_data = f.read()
img = Image.open(io.BytesIO(binary_data))
# Calling the function to do segmentation
segmented_data = self.data_segmentation(img)
elif split_tup[1] == '.pdf':
# Reading files in the format .pdf
with open(file_path, mode='rb') as f:
pdf_data = f.read()
pages = convert_from_bytes(pdf_data)
# Making the contents in 2 or more pages into combined page
max_width = max(page.width for page in pages)
total_height = sum(page.height for page in pages)
resized_images = []
for page in pages:
resized_page = page.resize((2400, 1800))
resized_images.append(resized_page)
combined_image = Image.new('RGB', (max_width, total_height))
y_offset = 0
for resized_page in resized_images:
combined_image.paste(resized_page, (0, y_offset))
y_offset += resized_page.height
# Calling the segmentation function
segmented_data = self.data_segmentation(combined_image)
except Exception:
self.env['ocr.data.template'].search([], order="id desc",
limit=1).unlink()
raise ValidationError(_("Cannot identify data"))
# Converting the segmented image into text using pytesseract
text = ""
for segment in segmented_data:
try:
text += pytesseract.image_to_string(segment) + "\n"
break
except Exception:
raise ValidationError(_("Data cannot be read"))
# Assigning retrieved data into text field
self.data = text
self.flag = True
@api.onchange('model_name_id')
def onchange_model_name_id(self):
""" Function to update the Many2many field to empty """
self.write({'model_field_ids': [(6, 0, [])]})
def find_person_name(self):
"""
Function to find person name from the retrieved text using 'spacy'
"""
person = ''
nlp = spacy.load("en_core_web_sm")
doc = nlp(self.data)
for entity in doc.ents:
if entity.label_ == "PERSON":
person = entity.text
break
return person
def get_order_line(self, text):
"""
Function to find product lines from retrieved data using regex
"""
product_line_list = []
quantities = []
unit_prices = []
product_regex = r'\[?(.+?)\]?\s*(.+)\n(?:HSN/SAC Code):\s+(\d+)'
quantity_regex = r"Quantity Unit\n([\d.\s\S]+)"
unit_price_regex = r"Amount\n([\d.\s\S]+)"
# Matching the pattern with the data
quantity_match = re.search(quantity_regex, text)
price_match = re.search(unit_price_regex, text)
if quantity_match:
quantity_unit_text = quantity_match.group(1)
# If matched finding a particular pattern for quantities
# form that group
quantities = re.findall(r"\d+\.\d+", quantity_unit_text)
if price_match:
price_unit_text = price_match.group(1)
# If matched finding a particular pattern for unit price
# form that group
unit_prices = re.findall(r"\d+\.\d+", price_unit_text)
# Finding the data that matches the pattern for products
products = re.findall(product_regex, text)
number_of_product = len(products)
number_of_qty = len(quantities)
number_of_price = len(unit_prices)
# Getting the products and its corresponding quantity and price
if number_of_product == number_of_qty == number_of_price:
for i in range(number_of_product):
product_line_list.append(
{'product': products[i], 'quantity': quantities[i],
'price': unit_prices[i]})
elif number_of_product == number_of_qty:
for i in range(number_of_product):
product_line_list.append(
{'product': products[i], 'quantity': quantities[i]})
elif number_of_product == number_of_price:
for i in range(number_of_product):
product_line_list.append(
{'product': products[i], 'price': unit_prices[i]})
elif products:
for i in range(number_of_product):
product_line_list.append({'product': products[i]})
return product_line_list
def action_process_data(self):
"""
Function to process the data after fetching it.
The fetched data are mapping into some models.
"""
phone_number = ''
email_address = ''
person = ''
phone_pattern = r'\(\d{3}\) \d{3}-\d{4}|\d{3}-\d{3}-\d{4}|\+\d{1}-\d{3}-\d{3}-\d{4}|\d{11}|P \+\d{3} \d{6}'
email_pattern = r'[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}'
if self.model_name_id.name == 'Contact':
# Mapping the data into Contact module by fetching person name,
# phone number and email id from data
field_value = False
non_field_count = 0
for field in self.model_field_ids:
if field.name == 'name' or field.name == 'display_name':
person = self.find_person_name()
if not person:
raise ValidationError(_("Partner name cannot find"))
field_value = True
elif field.name == 'phone':
phone = re.findall(phone_pattern, self.data)
if phone:
phone_number = phone[0]
elif field.name == 'email':
email = re.findall(email_pattern, self.data)
if email:
email_address = email[0]
else:
non_field_count = 1
if not field_value and non_field_count == 1:
raise ValidationError(_("No data to map into the field"))
if person:
partner = self.env['res.partner'].search(
[('name', '=', person)], limit=1)
if not partner:
# Creating record in res.partner
partner_record = self.env['res.partner'].create({
'name': person,
'email': email_address,
'phone': phone_number
})
else:
raise ValidationError(_("Partner already exist"))
else:
raise ValidationError(_("Name field is not chosen to create"
" partner"))
if partner_record:
return {
'name': "Partner",
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'res.partner',
'res_id': partner_record.id,
'view_id': self.env.ref('base.view_partner_form').id,
'target': 'current',
}
elif self.model_name_id.name == 'Journal Entry':
# Mapping data into Journal Entry. Creating a record in vendor bill
vendor_bill_flag = False
for field in self.model_field_ids:
# Taking the file path from ir.attachment
if field.name == 'invoice_vendor_bill_id':
vendor_bill_flag = True
try:
file_attachment = self.env["ir.attachment"].search(
['|', ('res_field', '!=', False),
('res_field', '=', False),
('res_id', '=', self.id),
('res_model', '=', 'ocr.data.template')],
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(_("Can't create vendor bill"))
# Converting the image into text using OCR python package
# pytesseract
try:
text = pytesseract.image_to_string(resized_img)
except Exception:
raise ValidationError(_("Can't create vendor bill"))
bill = self.env['digitize.bill']
# Calling the function to create vendor bill
# from model digitize.bill
bill_record = bill.create_record(text)
return {
'name': "Bill",
'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',
}
if not vendor_bill_flag:
raise ValidationError(_("No data to map into the field"))
elif self.model_name_id.name == 'Employee':
# Mapping the data into Employee module by fetching person name,
# phone number and email
field_value = False
non_field_count = 0
for field in self.model_field_ids:
if field.name == 'name' or field.name == 'display_name' or \
field.name == 'emergency_contact':
person = self.find_person_name()
if not person:
raise ValidationError(_("Employee name cannot find"))
field_value = True
elif field.name == 'work_phone' or field.name == 'phone' or \
field.name == 'emergency_phone':
phone = re.findall(phone_pattern, self.data)
if phone:
phone_number = phone[0]
elif field.name == 'private_email' or \
field.name == 'work_email':
email = re.findall(email_pattern, self.data)
if email:
email_address = email[0]
else:
non_field_count = 1
if not field_value and non_field_count == 1:
raise ValidationError(_("No data to map into the field"))
if person:
partner = self.env['hr.employee'].search(
[('name', '=', person)], limit=1)
if not partner:
# Creating a record in hr.employee by mapping the
# data into employee name, work phone and work email
employee_record = self.env['hr.employee'].create({
'name': person,
'work_email': email_address,
'work_phone': phone_number
})
else:
raise ValidationError(_("Employee already exist"))
else:
raise ValidationError(
_("Name field is not chosen to create employee"))
if employee_record:
return {
'name': "Employee",
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'hr.employee',
'res_id': employee_record.id,
'view_id': self.env.ref('hr.view_employee_form').id,
'target': 'current',
}
elif self.model_name_id.name == 'Expense':
# Mapping the data into Expense module
expense_product = False
for field in self.model_field_ids:
if field.name == 'name' or field.name == 'product_id':
expense_product = True
product = self.env['product.product'].search(
[('name', '=', 'BILL EXPENSE')], limit=1)
if not product:
product = self.env['product.product'].create({
'name': 'BILL EXPENSE',
})
expense_record = self.env['hr.expense'].create({
'product_id': product.id,
})
return {
'name': "Expense",
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'hr.expense',
'res_id': expense_record.id,
'view_id': self.env.ref(
'hr_expense.hr_expense_view_form').id,
'target': 'current',
}
if not expense_product:
raise ValidationError(_("Can't create an expense without "
"description or category"))
elif self.model_name_id.name == 'Sales Order':
# Mapping the data from PDF with proper format into Sale Order
sale_order = ''
partner = False
field_value = False
non_field_value = 0
for field in self.model_field_ids:
if field.name == 'order_line':
field_value = True
person = self.find_person_name()
if person:
partner = self.env['hr.employee'].search(
[('name', '=', person)], limit=1)
if not partner:
partner = self.env['hr.employee'].create({
'name': person,
})
# Calling the function to get order lines
product_line = self.get_order_line(self.data)
sale_order = self.env['sale.order'].create({
'partner_id': partner.id,
})
if product_line:
for item in product_line:
if 'quantity' not in item.keys():
item.update({'quantity': 0})
if 'price' not in item.keys():
item.update({'price': 0})
product = self.env['product.product'].search(
[('name', '=', item['product'])], limit=1)
if not product:
product = self.env['product.product'].create({
'name': item['product']
})
item.update({'product': product.id})
self.env['sale.order.line'].create({
'order_id': sale_order.id,
'product_id': item['product'],
'product_uom_qty': item['quantity'],
'price_unit': item['price']
})
else:
non_field_value = 1
if sale_order:
return {
'name': "Sale order",
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'sale.order',
'res_id': sale_order.id,
'view_id': self.env.ref('sale.view_order_form').id,
'target': 'current',
}
if not field_value and non_field_value == 1:
raise ValidationError(_("No data to map into the field"))
elif self.model_name_id.name == 'Purchase Order':
# Mapping the data from PDF with proper format into Purchase Order
purchase_order = ''
field_value = False
non_field_value = 0
partner = False
for field in self.model_field_ids:
if field.name == 'order_line':
field_value = True
person = self.find_person_name()
if person:
partner = self.env['hr.employee'].search(
[('name', '=', person)], limit=1)
if not partner:
partner = self.env['hr.employee'].create({
'name': person,
})
# Calling the function to get order lines
product_line = self.get_order_line(self.data)
purchase_order = self.env['purchase.order'].create({
'partner_id': partner.id,
})
if product_line:
for item in product_line:
if 'quantity' not in item.keys():
item.update({'quantity': 0})
if 'price' not in item.keys():
item.update({'price': 0})
product = self.env['product.product'].search(
[('name', '=', item['product'])], limit=1)
if not product:
product = self.env['product.product'].create({
'name': item['product']
})
item.update({'product': product.id})
self.env['purchase.order.line'].create({
'order_id': purchase_order.id,
'product_id': item['product'],
'product_uom_qty': item['quantity'],
'price_unit': item['price']
})
else:
non_field_value = 1
if purchase_order:
return {
'name': "Purchase order",
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'purchase.order',
'res_id': purchase_order.id,
'view_id': self.env.ref(
'purchase.purchase_order_form').id,
'target': 'current',
}
if not field_value and non_field_value == 1:
raise ValidationError(_("No data to map into the field"))
@api.onchange('image')
def _onchange_image(self):
self.write({
'image2': self.image
})

2
ocr_data_retrieval/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_ocr_data_template_user,access.ocr.data.template.user,model_ocr_data_template,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_ocr_data_template_user access.ocr.data.template.user model_ocr_data_template base.group_user 1 1 1 1

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
ocr_data_retrieval/static/description/assets/modules/module01.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
ocr_data_retrieval/static/description/assets/modules/module02.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

BIN
ocr_data_retrieval/static/description/assets/modules/module03.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
ocr_data_retrieval/static/description/assets/modules/module04.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

BIN
ocr_data_retrieval/static/description/assets/modules/module05.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
ocr_data_retrieval/static/description/assets/modules/module06.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
ocr_data_retrieval/static/description/assets/screenshots/contact_mapping.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

BIN
ocr_data_retrieval/static/description/assets/screenshots/data_retrieval.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
ocr_data_retrieval/static/description/assets/screenshots/employee_mapping.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

BIN
ocr_data_retrieval/static/description/assets/screenshots/ocr_menu.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

BIN
ocr_data_retrieval/static/description/assets/screenshots/purchase_order.pdf

Binary file not shown.

BIN
ocr_data_retrieval/static/description/assets/screenshots/read_bill.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 KiB

BIN
ocr_data_retrieval/static/description/assets/screenshots/sale_mapping.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

BIN
ocr_data_retrieval/static/description/assets/screenshots/sale_order.pdf

Binary file not shown.

BIN
ocr_data_retrieval/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

BIN
ocr_data_retrieval/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

704
ocr_data_retrieval/static/description/index.html

@ -0,0 +1,704 @@
<div style="background-color: #714B67; min-height: 600px; width: 100%; padding: 15px; position: relative;">
<!-- TITLE BAR -->
<div
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 -->
<!-- APP HERO -->
<h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;">
OCR Data Retrieval</h1>
<p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;">
Retrieving the Contents from Images and PDF Files.</p>
<!-- 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>
<!-- 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">
OCR data retrieval module allows user to read data from images anf PDF
files.
The module make use of OCR (Optical Character Recognition) that enables
the extraction of text from scanned documents.
</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. pdf2image (pip install pdf2image).
2. PIL (pip3 install PIL).
3. pytesseract (pip3 install pytesseract).
4. spacy (pip3 install spacy).
5. en_core_web_sm (python3.8 -m spacy download en_core_web_sm).
</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;">Retrieving Data from Images with .jpg, .jpeg, .png Format.</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;">Retrieving Data from .pdf Format.</span>
</div>
</div>
<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;">Can Map Data into Contact Module.</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;">Can Map Data into Employee and Expense Module.</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;">Can Map Data into Vendor Bill Module.</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;">Can Map Data into Sales and Purchase Module.</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;">
OCR Data Retrieval Menu Option</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
Menu that direct to the data retrieval.</p>
<img src="assets/screenshots/ocr_menu.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;">
Data Retrieval Template</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
Form to read file and retrieve data.</p>
<img src="assets/screenshots/data_retrieval.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;">
OCR Data Retrieval from Bill</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
Reading content from scanned bill and mapping into Vendor
Bill.</p>
<img src="assets/screenshots/read_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;">
OCR Data Retrieval from Personal Cards</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
Reading content from personal documents and mapping into
Contact module.</p>
<img src="assets/screenshots/contact_mapping.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;">
OCR Data Mapping into Employee Module</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
Reading content from personal documents and mapping into
Employee module.</p>
<img src="assets/screenshots/employee_mapping.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;">
OCR Data Mapping into Sale Order</h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
Reading content from PDF file and mapping into Sale Order.</p>
<img src="assets/screenshots/sale_mapping.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 sale order PDF and purchase order PDF
is added in the module.)</h3>
</div>
</div>
</div>
<!-- END OF SCREENSHOTS SECTION -->
<!-- SUGGESTED PRODUCTS -->
<div class="row">
<div class="col-lg-12 d-flex flex-column justify-content-center"
style="text-align: center; padding: 2.5rem 1rem !important;">
<h2 style="color: #212529 !important;">Suggested Products</h2>
<hr
style="border: 3px solid #714B67 !important; background-color: #714B67 !important; width: 80px !important; margin-bottom: 2rem !important;"/>
<div id="demo1" class="row carousel slide" data-ride="carousel">
<!-- The slideshow -->
<div class="carousel-inner" style="padding: 30px;">
<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/16.0/direct_send_email_template/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius: 0px;"
src="./assets/modules/module01.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/16.0/sale_order_line_multi_warehouse/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius: 0px;"
src="./assets/modules/module02.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/16.0/pos_sync_orders/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius: 0px;"
src="./assets/modules/module03.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/16.0/fleet_complete_report/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius: 0px;"
src="./assets/modules/module04.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/16.0/gender_contact/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius: 0px;"
src="./assets/modules/module05.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/16.0/service_charges_pos/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius: 0px;"
src="./assets/modules/module06.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>
</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 -->

BIN
ocr_data_retrieval/static/src/img/pdf.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

13
ocr_data_retrieval/static/src/js/image_field.js

@ -0,0 +1,13 @@
/** @odoo-module */
import { patch } from "@web/core/utils/patch";
import { ImageField } from "@web/views/fields/image/image_field";
patch(ImageField.prototype, "ImagefieldPatch",{
getUrl(previewFieldName) {
if (!this.props.value){
return `/ocr_data_retrieval/static/src/img/pdf.png`
}
return this._super(...arguments)
}
})

80
ocr_data_retrieval/views/ocr_data_template_views.xml

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- Data retrieval tree view -->
<record id="ocr_data_template_view_tree" model="ir.ui.view">
<field name="name">ocr.data.template.view.tree</field>
<field name="model">ocr.data.template</field>
<field name="arch" type="xml">
<tree>
<field name="file_name"/>
</tree>
</field>
</record>
<!-- Data retrieval form view -->
<record id="ocr_data_template_view_form" model="ir.ui.view">
<field name="name">ocr.data.template.view.form</field>
<field name="model">ocr.data.template</field>
<field name="arch" type="xml">
<form>
<sheet>
<div style="width:100%;">
<div style="float:left; width:40%;">
<div style="height:50%;">
<group>
<field name="image"
filename="file_name"
style="max-width: 100%; max-height: 100%"
attrs="{'invisible':[('flag','!=', False)]}"/>
</group>
<field name="file_name" invisible="1"/>
<field name="image2" widget="image"
attrs="{'invisible':[('flag','!=', True)], 'readonly': [('flag', '==', True)]}"/>
</div>
<div style="height:50%;">
<button name="action_get_data"
type="object" class="btn btn-primary"
string="GET DATA"
attrs="{'invisible':[('flag','!=', False)]}"/>
</div>
</div>
<div style="float:right; width:60%; height:100%;">
<group>
<field name="flag" attrs="{'invisible':True}"/>
<field name="data"
attrs="{'invisible':[('flag','!=', True)]}"/>
</group>
</div>
</div>
<notebook attrs="{'invisible':[('flag','!=', True)]}">
<page string="Process Data">
<group>
<group>
<field name="model_name_id"/>
<field name="model_field_ids"
widget="many2many_tags"/>
</group>
<group>
<button name="action_process_data"
type="object"
class="btn btn-primary"
string="PROCESS DATA"/>
</group>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<!-- Data retrieval view action-->
<record id="ocr_data_template_action" model="ir.actions.act_window">
<field name="name">OCR Data Template</field>
<field name="res_model">ocr.data.template</field>
<field name="view_mode">tree,form</field>
</record>
<!-- Data retrieval menu -->
<menuitem id="ocr_data_template_menu" name="OCR data template"
parent="mail.mail_menu_technical"
action="ocr_data_template_action"
sequence="56"/>
</odoo>
Loading…
Cancel
Save