Skip to content

Commit

Permalink
🎨 Improve format and quality warnings
Browse files Browse the repository at this point in the history
Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>
  • Loading branch information
madmath03 committed Apr 19, 2020
1 parent 29f4658 commit 6bd6529
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 31 deletions.
36 changes: 18 additions & 18 deletions erpnext_ocr/config/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
from frappe import _

def get_data():
return [
{
"module_name": "OCR Read",
"_doctype": "OCR Read",
"color": "#00bcd4",
"icon": "fa fa-eye",
"type": "link",
"link": "List/OCR Read"
},
return [
{
"module_name": "OCR Read",
"_doctype": "OCR Read",
"color": "#00bcd4",
"icon": "fa fa-eye",
"type": "link",
"link": "List/OCR Read"
},

{
"module_name": "ERPNext OCR",
"color": "#00bcd4",
"icon": "octicon octicon-eye",
"type": "module",
"label": _("ERPNext OCR"),
"hidden": 1
}
]
{
"module_name": "ERPNext OCR",
"color": "#00bcd4",
"icon": "octicon octicon-eye",
"type": "module",
"label": _("ERPNext OCR"),
"hidden": 1
}
]
9 changes: 0 additions & 9 deletions erpnext_ocr/erpnext_ocr/doctype/ocr_import/constants.py

This file was deleted.

10 changes: 9 additions & 1 deletion erpnext_ocr/erpnext_ocr/doctype/ocr_import/test_ocr_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@
import unittest

import frappe
from erpnext_ocr.erpnext_ocr.doctype.ocr_import.constants import TEST_RESULT_FOR_SI, TEST_RESULT_FOR_ITEM

from erpnext_ocr.erpnext_ocr.doctype.ocr_import.ocr_import import generate_doctype

# test recodes will automatically be generated by frappe
test_data = frappe.get_test_records('OCR Import')

TEST_RESULT_FOR_SI = '''
\n\nD. Brawn Manufacture\n\nInvoice no. DVT-AX-345678\n\nPayment date: 03/12/2006\n\n \n\n
\n\n \n\n \n\nReference Designation ty Unit price “Total CHF Sales\nWork\nSERVICE D COMPLETE OVERHAUL 1 5500.00 500,00 220\nSERVICE D REFRESHING COMPLETE CASE 1 380,00 380.00 220\nAND RHODIUM BATH\nExterior parts:\nJO.297.085.FP FLAT GASKET. 1 3.00 3.00 220\nJO.197.075.FP FLAT GASKET 1 4.00 4.00 220\nJO.199.059.08 FLAT ROUND GASKET 1 6.00 600 220\nVi.261.036.8C W.G.FIXATION SCREWS 10 4.00 40.00 220\nAL465.085.BC WHITE GOLD "FOIL" 1 70.00 70.00 220\nPAIR OF HAND\nLENGTH: 10/13.50MM\nCALIBRE 2868\nSPECIAL DISCOUNT -3003.00 — -3003.00\nDiscount “500.00 “800.00\nTotal CHF 2100.00\nRETURN AFTER REPAIR\n\nNO COMMERCIAL VALUE\n'''

TEST_RESULT_FOR_ITEM = '''
Series STO-ITEM-.YYYY.-\n\nItem Code fdsa\n\nItem Name fdsa\n\nItem Group Consumable\nDefault Unit of Measure Nos\n\nfdsa\n\nShelf Life In Days\n\nEnd of Life 31-12-2099\nDefault Material Request Purchase\nType\n\nSr UOM\n\n1 Nos\n\nMax Sample Quantity\n\nVariant Based On\n\nSr Company\n\n1 fdsa\n\nIs Purchase Item\nMinimum Order Qty\n\nSafety Stock\nCountry of Origin Russian Federation\n\nIs Sales Item\n\nWeightage\n\nMaintain Stock\n\nInclude Item In Manufacturing\n\nOpening Stock\n\nValuation Rate\nStandard Selling Rate\n\nAllow over delivery or receipt\nupto this percent\n\n0 Weight Per Unit\n\nItem Attribute\n\nDefault Warehouse\n\nStores - F\n\nv Lead Time in days\n\n0 Last Purchase Rate\n\nv Max Discount (%)\nNo of Months\n\nNo of Months\n\nv\n\n0\nRUB 0,00\n\nRUB 123,00\n\n0\n\nConversion Factor\n\n‘l\n
'''


class TestOCRImport(unittest.TestCase):
def setUp(self):
Expand Down
5 changes: 3 additions & 2 deletions erpnext_ocr/erpnext_ocr/doctype/ocr_read/ocr_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ def read_image(self):
return read_ocr(self)

def read_image_bg(self, is_async=True, now=False):
return frappe.enqueue("erpnext_ocr.erpnext_ocr.doctype.ocr_read.ocr_read.read_ocr", queue="long",
timeout=1500, is_async=is_async, now=now, **{'obj': self})
return frappe.enqueue("erpnext_ocr.erpnext_ocr.doctype.ocr_read.ocr_read.read_ocr",
queue="long", timeout=1500, is_async=is_async,
now=now, **{'obj': self})


@frappe.whitelist()
Expand Down
9 changes: 8 additions & 1 deletion erpnext_ocr/install.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Monogramm and Contributors
# For license information, please see license.txt

from __future__ import unicode_literals

import frappe


def before_tests():
"""Frappe trigger before application tests."""
settings = frappe.get_doc("System Settings")
settings.time_zone = "Etc/GMT+3"
settings.language = "en"
settings.save()
selling_settings = frappe.get_doc("Selling Settings")
selling_settings.allow_multiple_items = 1
selling_settings.save()
selling_settings.save()

0 comments on commit 6bd6529

Please sign in to comment.