Merge branch 'develop' of https://github.com/frappe/erpnext into tds_validity
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index 566323a..6eaf9cc 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -16,3 +16,7 @@
# Whitespace fix throughout codebase
4551d7d6029b6f587f6c99d4f8df5519241c6a86
+b147b85e6ac19a9220cd1e2958a6ebd99373283a
+
+# sort and cleanup imports
+915b34391c2066dfc83e60a5813c5a877cebe7ac
diff --git a/.github/helper/.flake8_strict b/.github/helper/.flake8_strict
new file mode 100644
index 0000000..4c7f5f8
--- /dev/null
+++ b/.github/helper/.flake8_strict
@@ -0,0 +1,70 @@
+[flake8]
+ignore =
+ B007,
+ B950,
+ E101,
+ E111,
+ E114,
+ E116,
+ E117,
+ E121,
+ E122,
+ E123,
+ E124,
+ E125,
+ E126,
+ E127,
+ E128,
+ E131,
+ E201,
+ E202,
+ E203,
+ E211,
+ E221,
+ E222,
+ E223,
+ E224,
+ E225,
+ E226,
+ E228,
+ E231,
+ E241,
+ E242,
+ E251,
+ E261,
+ E262,
+ E265,
+ E266,
+ E271,
+ E272,
+ E273,
+ E274,
+ E301,
+ E302,
+ E303,
+ E305,
+ E306,
+ E402,
+ E501,
+ E502,
+ E701,
+ E702,
+ E703,
+ E741,
+ F403,
+ W191,
+ W291,
+ W292,
+ W293,
+ W391,
+ W503,
+ W504,
+ E711,
+ E129,
+ F841,
+ E713,
+ E712,
+
+
+max-line-length = 200
+exclude=.github/helper/semgrep_rules,test_*.py
diff --git a/.github/helper/semgrep_rules/frappe_correctness.py b/.github/helper/semgrep_rules/frappe_correctness.py
index 745e646..83d4acf 100644
--- a/.github/helper/semgrep_rules/frappe_correctness.py
+++ b/.github/helper/semgrep_rules/frappe_correctness.py
@@ -1,5 +1,5 @@
import frappe
-from frappe import _, flt
+from frappe import _
from frappe.model.document import Document
diff --git a/.github/helper/semgrep_rules/report.py b/.github/helper/semgrep_rules/report.py
new file mode 100644
index 0000000..ff27840
--- /dev/null
+++ b/.github/helper/semgrep_rules/report.py
@@ -0,0 +1,15 @@
+from frappe import _
+
+
+# ruleid: frappe-missing-translate-function-in-report-python
+{"label": "Field Label"}
+
+# ruleid: frappe-missing-translate-function-in-report-python
+dict(label="Field Label")
+
+
+# ok: frappe-missing-translate-function-in-report-python
+{"label": _("Field Label")}
+
+# ok: frappe-missing-translate-function-in-report-python
+dict(label=_("Field Label"))
diff --git a/.github/helper/semgrep_rules/report.yml b/.github/helper/semgrep_rules/report.yml
new file mode 100644
index 0000000..7f3dd01
--- /dev/null
+++ b/.github/helper/semgrep_rules/report.yml
@@ -0,0 +1,21 @@
+rules:
+- id: frappe-missing-translate-function-in-report-python
+ paths:
+ include:
+ - "**/report"
+ exclude:
+ - "**/regional"
+ pattern-either:
+ - patterns:
+ - pattern: |
+ {..., "label": "...", ...}
+ - pattern-not: |
+ {..., "label": _("..."), ...}
+ - patterns:
+ - pattern: dict(..., label="...", ...)
+ - pattern-not: dict(..., label=_("..."), ...)
+ message: |
+ All user facing text must be wrapped in translate function. Please refer to translation documentation. https://frappeframework.com/docs/user/en/guides/basics/translations
+ languages: [python]
+ severity: ERROR
+
diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml
new file mode 100644
index 0000000..16e490a
--- /dev/null
+++ b/.github/workflows/linters.yml
@@ -0,0 +1,27 @@
+name: Linters
+
+on:
+ pull_request: { }
+
+jobs:
+
+ linters:
+ name: linters
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - uses: returntocorp/semgrep-action@v1
+ env:
+ SEMGREP_TIMEOUT: 120
+ with:
+ config: >-
+ r/python.lang.correctness
+ .github/helper/semgrep_rules
+
+ - name: Set up Python 3.8
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.8
+
+ - name: Install and Run Pre-commit
+ uses: pre-commit/action@v2.0.3
diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml
index f65b000..92a1962 100644
--- a/.github/workflows/patch.yml
+++ b/.github/workflows/patch.yml
@@ -7,10 +7,13 @@
- '**.md'
workflow_dispatch:
+concurrency:
+ group: patch-develop-${{ github.event.number }}
+ cancel-in-progress: true
jobs:
test:
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-latest
timeout-minutes: 60
name: Patch Test
diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml
deleted file mode 100644
index e27b406..0000000
--- a/.github/workflows/semgrep.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-name: Semgrep
-
-on:
- pull_request: { }
-
-jobs:
- semgrep:
- name: Frappe Linter
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - uses: returntocorp/semgrep-action@v1
- env:
- SEMGREP_TIMEOUT: 120
- with:
- config: >-
- r/python.lang.correctness
- .github/helper/semgrep_rules
diff --git a/.github/workflows/server-tests.yml b/.github/workflows/server-tests.yml
index 0a73d74..71e9c2c 100644
--- a/.github/workflows/server-tests.yml
+++ b/.github/workflows/server-tests.yml
@@ -12,9 +12,13 @@
- '**.js'
- '**.md'
+concurrency:
+ group: server-develop-${{ github.event.number }}
+ cancel-in-progress: true
+
jobs:
test:
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
@@ -113,7 +117,7 @@
name: Coverage Wrap Up
needs: test
container: python:3-slim
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v2
diff --git a/.github/workflows/translation_linter.yml b/.github/workflows/translation_linter.yml
deleted file mode 100644
index 4becaeb..0000000
--- a/.github/workflows/translation_linter.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-name: Frappe Linter
-on:
- pull_request:
- branches:
- - develop
- - version-12-hotfix
- - version-11-hotfix
-jobs:
- check_translation:
- name: Translation Syntax Check
- runs-on: ubuntu-18.04
- steps:
- - uses: actions/checkout@v2
- - name: Setup python3
- uses: actions/setup-python@v1
- with:
- python-version: 3.6
- - name: Validating Translation Syntax
- run: |
- git fetch origin $GITHUB_BASE_REF:$GITHUB_BASE_REF -q
- files=$(git diff --name-only --diff-filter=d $GITHUB_BASE_REF)
- python $GITHUB_WORKSPACE/.github/helper/translation.py $files
diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml
index 0ece0d8..658892c 100644
--- a/.github/workflows/ui-tests.yml
+++ b/.github/workflows/ui-tests.yml
@@ -6,9 +6,13 @@
- '**.md'
workflow_dispatch:
+concurrency:
+ group: ui-develop-${{ github.event.number }}
+ cancel-in-progress: true
+
jobs:
test:
- runs-on: ubuntu-18.04
+ runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..2b3a471
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,35 @@
+exclude: 'node_modules|.git'
+default_stages: [commit]
+fail_fast: false
+
+
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.0.1
+ hooks:
+ - id: trailing-whitespace
+ files: "erpnext.*"
+ exclude: ".*json$|.*txt$|.*csv|.*md"
+ - id: check-yaml
+ - id: no-commit-to-branch
+ args: ['--branch', 'develop']
+ - id: check-merge-conflict
+ - id: check-ast
+
+ - repo: https://gitlab.com/pycqa/flake8
+ rev: 3.9.2
+ hooks:
+ - id: flake8
+ args: ['--config', '.github/helper/.flake8_strict']
+ exclude: ".*setup.py$"
+
+ - repo: https://github.com/timothycrosley/isort
+ rev: 5.9.1
+ hooks:
+ - id: isort
+ exclude: ".*setup.py$"
+
+ci:
+ autoupdate_schedule: weekly
+ skip: []
+ submodules: false
diff --git a/cypress/integration/test_organizational_chart_desktop.js b/cypress/integration/test_organizational_chart_desktop.js
index 820a23a..39b00d3 100644
--- a/cypress/integration/test_organizational_chart_desktop.js
+++ b/cypress/integration/test_organizational_chart_desktop.js
@@ -2,8 +2,11 @@
before(() => {
cy.login();
cy.visit('/app/website');
+ });
+
+ it('navigates to org chart', () => {
+ cy.visit('/app');
cy.awesomebar('Organizational Chart');
- cy.wait(500);
cy.url().should('include', '/organizational-chart');
cy.window().its('frappe.csrf_token').then(csrf_token => {
diff --git a/cypress/integration/test_organizational_chart_mobile.js b/cypress/integration/test_organizational_chart_mobile.js
index df90dbf..6e75151 100644
--- a/cypress/integration/test_organizational_chart_mobile.js
+++ b/cypress/integration/test_organizational_chart_mobile.js
@@ -1,9 +1,14 @@
context('Organizational Chart Mobile', () => {
before(() => {
cy.login();
- cy.viewport(375, 667);
cy.visit('/app/website');
+ });
+
+ it('navigates to org chart', () => {
+ cy.viewport(375, 667);
+ cy.visit('/app');
cy.awesomebar('Organizational Chart');
+ cy.url().should('include', '/organizational-chart');
cy.window().its('frappe.csrf_token').then(csrf_token => {
return cy.request({
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 17d6505..4521827 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
+
import inspect
+
import frappe
+
from erpnext.hooks import regional_overrides
-from frappe.utils import getdate
__version__ = '13.9.0'
diff --git a/erpnext/accounts/custom/address.py b/erpnext/accounts/custom/address.py
index 834227b..a6d08d8 100644
--- a/erpnext/accounts/custom/address.py
+++ b/erpnext/accounts/custom/address.py
@@ -1,7 +1,11 @@
import frappe
from frappe import _
-from frappe.contacts.doctype.address.address import Address
-from frappe.contacts.doctype.address.address import get_address_templates, get_address_display
+from frappe.contacts.doctype.address.address import (
+ Address,
+ get_address_display,
+ get_address_templates,
+)
+
class ERPNextAddress(Address):
def validate(self):
@@ -31,7 +35,7 @@
customers = frappe.db.get_all("Customer", filters=filters, as_list=True)
for customer_name in customers:
frappe.db.set_value("Customer", customer_name[0], "primary_address", address_display)
-
+
@frappe.whitelist()
def get_shipping_address(company, address = None):
filters = [
diff --git a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py
index 85f54f9..5eb8577 100644
--- a/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py
+++ b/erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py
@@ -2,14 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, json
+
+import frappe
from frappe import _
-from frappe.utils import add_to_date, date_diff, getdate, nowdate, get_last_day, formatdate, get_link_to_form
-from erpnext.accounts.report.general_ledger.general_ledger import execute
+from frappe.utils import add_to_date, formatdate, get_link_to_form, getdate, nowdate
from frappe.utils.dashboard import cache_source
from frappe.utils.dateutils import get_from_date_from_timespan, get_period_ending
from frappe.utils.nestedset import get_descendants_of
+
@frappe.whitelist()
@cache_source
def get(chart_name = None, chart = None, no_cache = None, filters = None, from_date = None,
diff --git a/erpnext/accounts/deferred_revenue.py b/erpnext/accounts/deferred_revenue.py
index 0c81d83..bcd0771 100644
--- a/erpnext/accounts/deferred_revenue.py
+++ b/erpnext/accounts/deferred_revenue.py
@@ -2,11 +2,26 @@
import frappe
from frappe import _
-from frappe.utils import date_diff, add_months, today, getdate, add_days, flt, get_last_day, get_first_day, cint, get_link_to_form, rounded
-from erpnext.accounts.utils import get_account_currency
from frappe.email import sendmail_to_system_managers
-from frappe.utils.background_jobs import enqueue
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
+from frappe.utils import (
+ add_days,
+ add_months,
+ cint,
+ date_diff,
+ flt,
+ get_first_day,
+ get_last_day,
+ get_link_to_form,
+ getdate,
+ rounded,
+ today,
+)
+
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+)
+from erpnext.accounts.utils import get_account_currency
+
def validate_service_stop_date(doc):
''' Validates service_stop_date for Purchase Invoice and Sales Invoice '''
@@ -359,7 +374,7 @@
try:
make_gl_entries(gl_entries, cancel=(doc.docstatus == 2), merge_entries=True)
frappe.db.commit()
- except:
+ except Exception:
frappe.db.rollback()
traceback = frappe.get_traceback()
frappe.log_error(message=traceback)
@@ -430,7 +445,7 @@
if submit:
journal_entry.submit()
- except:
+ except Exception:
frappe.db.rollback()
traceback = frappe.get_traceback()
frappe.log_error(message=traceback)
diff --git a/erpnext/accounts/doctype/account/account.py b/erpnext/accounts/doctype/account/account.py
index f763df0..f6198eb 100644
--- a/erpnext/accounts/doctype/account/account.py
+++ b/erpnext/accounts/doctype/account/account.py
@@ -2,11 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+from frappe import _, throw
from frappe.utils import cint, cstr
-from frappe import throw, _
from frappe.utils.nestedset import NestedSet, get_ancestors_of, get_descendants_of
+
class RootNotEditable(frappe.ValidationError): pass
class BalanceMismatchError(frappe.ValidationError): pass
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
index 927adc7..d6ccd16 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
@@ -2,12 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+import json
+import os
-import frappe, os, json
+import frappe
from frappe.utils import cstr
-from unidecode import unidecode
-from six import iteritems
from frappe.utils.nestedset import rebuild_tree
+from six import iteritems
+from unidecode import unidecode
+
def create_charts(company, chart_template=None, existing_company=None, custom_chart=None):
chart = custom_chart or get_chart(chart_template, existing_company)
@@ -91,11 +94,14 @@
return get_account_tree_from_existing_company(existing_company)
elif chart_template == "Standard":
- from erpnext.accounts.doctype.account.chart_of_accounts.verified import standard_chart_of_accounts
+ from erpnext.accounts.doctype.account.chart_of_accounts.verified import (
+ standard_chart_of_accounts,
+ )
return standard_chart_of_accounts.get()
elif chart_template == "Standard with Numbers":
- from erpnext.accounts.doctype.account.chart_of_accounts.verified \
- import standard_chart_of_accounts_with_account_number
+ from erpnext.accounts.doctype.account.chart_of_accounts.verified import (
+ standard_chart_of_accounts_with_account_number,
+ )
return standard_chart_of_accounts_with_account_number.get()
else:
folders = ("verified",)
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/import_from_openerp.py b/erpnext/accounts/doctype/account/chart_of_accounts/import_from_openerp.py
index eb3e7ff..7222357 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/import_from_openerp.py
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/import_from_openerp.py
@@ -6,12 +6,13 @@
"""
from __future__ import print_function, unicode_literals
-import os, json
import ast
+import json
+import os
from xml.etree import ElementTree as ET
-from frappe.utils.csvutils import read_csv_content
-import frappe
+import frappe
+from frappe.utils.csvutils import read_csv_content
from six import iteritems
path = "/Users/nabinhait/projects/odoo/addons"
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py
index 161e52a..f058afb 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
from frappe import _
+
def get():
return {
_("Application of Funds (Assets)"): {
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py
index acb11e5..9f33952 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
from frappe import _
+
def get():
return {
_("Application of Funds (Assets)"): {
diff --git a/erpnext/accounts/doctype/account/test_account.py b/erpnext/accounts/doctype/account/test_account.py
index 533eda3..0c3b33e 100644
--- a/erpnext/accounts/doctype/account/test_account.py
+++ b/erpnext/accounts/doctype/account/test_account.py
@@ -2,10 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import unittest
+
import frappe
-from erpnext.stock import get_warehouse_account, get_company_default_inventory_account
-from erpnext.accounts.doctype.account.account import update_account_number, merge_account
+
+from erpnext.accounts.doctype.account.account import merge_account, update_account_number
+from erpnext.stock import get_company_default_inventory_account, get_warehouse_account
+
class TestAccount(unittest.TestCase):
def test_rename_account(self):
diff --git a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py
index fac28c9..af8255f 100644
--- a/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py
+++ b/erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py
@@ -3,15 +3,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe import _
+
import json
-from frappe.model.document import Document
+
+import frappe
+from frappe import _, scrub
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
-from frappe import scrub
-from frappe.utils import cstr
-from frappe.utils.background_jobs import enqueue
from frappe.model import core_doctypes_list
+from frappe.model.document import Document
+from frappe.utils import cstr
+
class AccountingDimension(Document):
def before_insert(self):
@@ -47,9 +48,9 @@
def on_trash(self):
if frappe.flags.in_test:
- delete_accounting_dimension(doc=self, queue='long')
+ delete_accounting_dimension(doc=self)
else:
- frappe.enqueue(delete_accounting_dimension, doc=self)
+ frappe.enqueue(delete_accounting_dimension, doc=self, queue='long')
def set_fieldname_and_label(self):
if not self.label:
diff --git a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py
index 4f3ee76..3769fc1 100644
--- a/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py
+++ b/erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py
@@ -3,10 +3,12 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+
+import frappe
+
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
+from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
test_dependencies = ['Cost Center', 'Location', 'Warehouse', 'Department']
diff --git a/erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.py b/erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.py
index 17cf549..c116f16 100644
--- a/erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.py
+++ b/erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class AccountingDimensionDetail(Document):
pass
diff --git a/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py b/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py
index 6aef9ca..cb8c7d1 100644
--- a/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py
+++ b/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _, scrub
from frappe.model.document import Document
+
class AccountingDimensionFilter(Document):
def validate(self):
self.validate_applicable_accounts()
diff --git a/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py b/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py
index 7f6254f..9968f68 100644
--- a/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py
+++ b/erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py
@@ -3,10 +3,15 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
+
+from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import (
+ create_dimension,
+ disable_dimension,
+)
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
-from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import create_dimension, disable_dimension
from erpnext.exceptions import InvalidAccountDimensionError, MandatoryAccountDimensionError
test_dependencies = ['Location', 'Cost Center', 'Department']
diff --git a/erpnext/accounts/doctype/accounting_period/accounting_period.py b/erpnext/accounts/doctype/accounting_period/accounting_period.py
index 739d8f6..67d1a8a 100644
--- a/erpnext/accounts/doctype/accounting_period/accounting_period.py
+++ b/erpnext/accounts/doctype/accounting_period/accounting_period.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
+from frappe.model.document import Document
+
class OverlapError(frappe.ValidationError): pass
diff --git a/erpnext/accounts/doctype/accounting_period/test_accounting_period.py b/erpnext/accounts/doctype/accounting_period/test_accounting_period.py
index dc472c7..5885b58 100644
--- a/erpnext/accounts/doctype/accounting_period/test_accounting_period.py
+++ b/erpnext/accounts/doctype/accounting_period/test_accounting_period.py
@@ -3,12 +3,14 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import nowdate, add_months
-from erpnext.accounts.general_ledger import ClosedAccountingPeriod
+
+import frappe
+from frappe.utils import add_months, nowdate
+
from erpnext.accounts.doctype.accounting_period.accounting_period import OverlapError
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+from erpnext.accounts.general_ledger import ClosedAccountingPeriod
test_dependencies = ['Item']
diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
index 62c97f2..f544733 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
@@ -4,11 +4,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import cint
-from frappe.model.document import Document
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
+from frappe.model.document import Document
+from frappe.utils import cint
class AccountsSettings(Document):
diff --git a/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py
index 014cf45..c1c156f 100644
--- a/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py
+++ b/erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
import unittest
import frappe
diff --git a/erpnext/accounts/doctype/advance_taxes_and_charges/advance_taxes_and_charges.py b/erpnext/accounts/doctype/advance_taxes_and_charges/advance_taxes_and_charges.py
index 597d2cc..0c98f24 100644
--- a/erpnext/accounts/doctype/advance_taxes_and_charges/advance_taxes_and_charges.py
+++ b/erpnext/accounts/doctype/advance_taxes_and_charges/advance_taxes_and_charges.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class AdvanceTaxesandCharges(Document):
pass
diff --git a/erpnext/accounts/doctype/allowed_dimension/allowed_dimension.py b/erpnext/accounts/doctype/allowed_dimension/allowed_dimension.py
index c2afc1a..b5e7ad3 100644
--- a/erpnext/accounts/doctype/allowed_dimension/allowed_dimension.py
+++ b/erpnext/accounts/doctype/allowed_dimension/allowed_dimension.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class AllowedDimension(Document):
pass
diff --git a/erpnext/accounts/doctype/allowed_to_transact_with/allowed_to_transact_with.py b/erpnext/accounts/doctype/allowed_to_transact_with/allowed_to_transact_with.py
index a3e4bbc..3e84c30 100644
--- a/erpnext/accounts/doctype/allowed_to_transact_with/allowed_to_transact_with.py
+++ b/erpnext/accounts/doctype/allowed_to_transact_with/allowed_to_transact_with.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class AllowedToTransactWith(Document):
pass
diff --git a/erpnext/accounts/doctype/applicable_on_account/applicable_on_account.py b/erpnext/accounts/doctype/applicable_on_account/applicable_on_account.py
index 0fccaf3..91331fa 100644
--- a/erpnext/accounts/doctype/applicable_on_account/applicable_on_account.py
+++ b/erpnext/accounts/doctype/applicable_on_account/applicable_on_account.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ApplicableOnAccount(Document):
pass
diff --git a/erpnext/accounts/doctype/bank/bank.py b/erpnext/accounts/doctype/bank/bank.py
index 99fa21c..e1eb984 100644
--- a/erpnext/accounts/doctype/bank/bank.py
+++ b/erpnext/accounts/doctype/bank/bank.py
@@ -3,9 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
+from frappe.contacts.address_and_contact import (
+ delete_contact_and_address,
+ load_address_and_contact,
+)
from frappe.model.document import Document
-from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
+
class Bank(Document):
def onload(self):
diff --git a/erpnext/accounts/doctype/bank/test_bank.py b/erpnext/accounts/doctype/bank/test_bank.py
index d8741f2..62d14d6 100644
--- a/erpnext/accounts/doctype/bank/test_bank.py
+++ b/erpnext/accounts/doctype/bank/test_bank.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestBank(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/bank_account/bank_account.py b/erpnext/accounts/doctype/bank_account/bank_account.py
index 3e08c28..703f55d 100644
--- a/erpnext/accounts/doctype/bank_account/bank_account.py
+++ b/erpnext/accounts/doctype/bank_account/bank_account.py
@@ -3,10 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+from frappe.contacts.address_and_contact import (
+ delete_contact_and_address,
+ load_address_and_contact,
+)
from frappe.model.document import Document
-from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
+
class BankAccount(Document):
def onload(self):
diff --git a/erpnext/accounts/doctype/bank_account/test_bank_account.py b/erpnext/accounts/doctype/bank_account/test_bank_account.py
index ed34d17..dc970f3 100644
--- a/erpnext/accounts/doctype/bank_account/test_bank_account.py
+++ b/erpnext/accounts/doctype/bank_account/test_bank_account.py
@@ -3,11 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe import _
-from frappe import ValidationError
import unittest
+import frappe
+from frappe import ValidationError
+
# test_records = frappe.get_test_records('Bank Account')
class TestBankAccount(unittest.TestCase):
diff --git a/erpnext/accounts/doctype/bank_account_subtype/bank_account_subtype.py b/erpnext/accounts/doctype/bank_account_subtype/bank_account_subtype.py
index ab52c4a..84fa0c9 100644
--- a/erpnext/accounts/doctype/bank_account_subtype/bank_account_subtype.py
+++ b/erpnext/accounts/doctype/bank_account_subtype/bank_account_subtype.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class BankAccountSubtype(Document):
pass
diff --git a/erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py b/erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py
index ca3addc..d4eb88b 100644
--- a/erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py
+++ b/erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py
@@ -5,5 +5,6 @@
import unittest
+
class TestBankAccountSubtype(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/bank_account_type/bank_account_type.py b/erpnext/accounts/doctype/bank_account_type/bank_account_type.py
index b7dc0e0..bba43dc 100644
--- a/erpnext/accounts/doctype/bank_account_type/bank_account_type.py
+++ b/erpnext/accounts/doctype/bank_account_type/bank_account_type.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class BankAccountType(Document):
pass
diff --git a/erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py b/erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py
index f04725a..00fd433 100644
--- a/erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py
+++ b/erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestBankAccountType(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/bank_clearance/bank_clearance.py b/erpnext/accounts/doctype/bank_clearance/bank_clearance.py
index 79f5596..340b448 100644
--- a/erpnext/accounts/doctype/bank_clearance/bank_clearance.py
+++ b/erpnext/accounts/doctype/bank_clearance/bank_clearance.py
@@ -2,10 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import flt, getdate, nowdate, fmt_money
-from frappe import msgprint, _
+from frappe import _, msgprint
from frappe.model.document import Document
+from frappe.utils import flt, fmt_money, getdate, nowdate
form_grid_templates = {
"journal_entries": "templates/form_grid/bank_reconciliation_grid.html"
diff --git a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py
index 833abde..bdf3c7f 100644
--- a/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py
+++ b/erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestBankClearance(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/bank_clearance_detail/bank_clearance_detail.py b/erpnext/accounts/doctype/bank_clearance_detail/bank_clearance_detail.py
index 59299f8..1b23400 100644
--- a/erpnext/accounts/doctype/bank_clearance_detail/bank_clearance_detail.py
+++ b/erpnext/accounts/doctype/bank_clearance_detail/bank_clearance_detail.py
@@ -2,8 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class BankClearanceDetail(Document):
pass
diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
index a0aac6a..8043c5f 100644
--- a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
+++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
@@ -3,10 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json
-from frappe.model.document import Document
+
+import json
+
+import frappe
from frappe import _
from frappe.desk.search import sanitize_searchfield
+from frappe.model.document import Document
+
class BankGuarantee(Document):
def validate(self):
diff --git a/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py b/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py
index 816743a..5cd455f 100644
--- a/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py
+++ b/erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestBankGuarantee(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py
index 8a17233..ce64ee4 100644
--- a/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py
+++ b/erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py
@@ -3,17 +3,21 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import json
import frappe
-from frappe.model.document import Document
from frappe import _
+from frappe.model.document import Document
from frappe.utils import flt
from erpnext import get_company_currency
-from erpnext.accounts.utils import get_balance_on
-from erpnext.accounts.report.bank_reconciliation_statement.bank_reconciliation_statement import get_entries, get_amounts_not_reflected_in_system
from erpnext.accounts.doctype.bank_transaction.bank_transaction import get_paid_amount
+from erpnext.accounts.report.bank_reconciliation_statement.bank_reconciliation_statement import (
+ get_amounts_not_reflected_in_system,
+ get_entries,
+)
+from erpnext.accounts.utils import get_balance_on
class BankReconciliationTool(Document):
diff --git a/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py b/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py
index d96950a..55b83b6 100644
--- a/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py
+++ b/erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestBankReconciliationTool(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py b/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py
index ffc9d1c..25d1023 100644
--- a/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py
+++ b/erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py
@@ -3,22 +3,22 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import csv
import json
import re
+import frappe
import openpyxl
+from frappe import _
+from frappe.core.doctype.data_import.data_import import DataImport
+from frappe.core.doctype.data_import.importer import Importer, ImportFile
+from frappe.utils.background_jobs import enqueue
+from frappe.utils.xlsxutils import ILLEGAL_CHARACTERS_RE, handle_html
from openpyxl.styles import Font
from openpyxl.utils import get_column_letter
from six import string_types
-import frappe
-from frappe.core.doctype.data_import.importer import Importer, ImportFile
-from frappe.utils.background_jobs import enqueue
-from frappe.utils.xlsxutils import handle_html, ILLEGAL_CHARACTERS_RE
-from frappe import _
-
-from frappe.core.doctype.data_import.data_import import DataImport
class BankStatementImport(DataImport):
def __init__(self, *args, **kwargs):
diff --git a/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py b/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py
index cd58314..5b45fa2 100644
--- a/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py
+++ b/erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestBankStatementImport(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py
index 7ea71fc..c4cf37e 100644
--- a/erpnext/accounts/doctype/bank_transaction/bank_transaction.py
+++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction.py
@@ -3,11 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from erpnext.controllers.status_updater import StatusUpdater
from frappe.utils import flt
from six.moves import reduce
-from frappe import _
+
+from erpnext.controllers.status_updater import StatusUpdater
+
class BankTransaction(StatusUpdater):
def after_insert(self):
@@ -21,7 +23,7 @@
self.update_allocations()
self.clear_linked_payment_entries()
self.set_status(update=True)
-
+
def on_cancel(self):
self.clear_linked_payment_entries(for_cancel=True)
self.set_status(update=True)
@@ -45,7 +47,7 @@
frappe.db.set_value(self.doctype, self.name, "status", "Reconciled")
self.reload()
-
+
def clear_linked_payment_entries(self, for_cancel=False):
for payment_entry in self.payment_entries:
if payment_entry.payment_document in ["Payment Entry", "Journal Entry", "Purchase Invoice", "Expense Claim"]:
@@ -77,7 +79,7 @@
def get_reconciled_bank_transactions(payment_entry):
reconciled_bank_transactions = frappe.get_all(
- 'Bank Transaction Payments',
+ 'Bank Transaction Payments',
filters = {
'payment_entry': payment_entry.payment_entry
},
diff --git a/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py b/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py
index dc3b867..e8d032b 100644
--- a/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py
+++ b/erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
+
+import frappe
from frappe.utils import getdate
from frappe.utils.dateutils import parse_date
from six import iteritems
+
@frappe.whitelist()
def upload_bank_statement():
if getattr(frappe, "uploaded_file", None):
diff --git a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py
index 439d489..35d08bd 100644
--- a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py
+++ b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py
@@ -3,14 +3,19 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
-import unittest
import json
-from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
-from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
+import unittest
+
+import frappe
+
+from erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool import (
+ get_linked_payments,
+ reconcile_vouchers,
+)
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
-from erpnext.accounts.doctype.bank_reconciliation_tool.bank_reconciliation_tool import reconcile_vouchers, get_linked_payments
from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
+from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
+from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
test_dependencies = ["Item", "Cost Center"]
diff --git a/erpnext/accounts/doctype/bank_transaction_mapping/bank_transaction_mapping.py b/erpnext/accounts/doctype/bank_transaction_mapping/bank_transaction_mapping.py
index 95a5bc3..8b809fe 100644
--- a/erpnext/accounts/doctype/bank_transaction_mapping/bank_transaction_mapping.py
+++ b/erpnext/accounts/doctype/bank_transaction_mapping/bank_transaction_mapping.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class BankTransactionMapping(Document):
pass
diff --git a/erpnext/accounts/doctype/bank_transaction_payments/bank_transaction_payments.py b/erpnext/accounts/doctype/bank_transaction_payments/bank_transaction_payments.py
index d6d7c10..2546f27 100644
--- a/erpnext/accounts/doctype/bank_transaction_payments/bank_transaction_payments.py
+++ b/erpnext/accounts/doctype/bank_transaction_payments/bank_transaction_payments.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class BankTransactionPayments(Document):
pass
diff --git a/erpnext/accounts/doctype/budget/budget.py b/erpnext/accounts/doctype/budget/budget.py
index d93b6ff..9c20e82 100644
--- a/erpnext/accounts/doctype/budget/budget.py
+++ b/erpnext/accounts/doctype/budget/budget.py
@@ -1,15 +1,20 @@
- # -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt, getdate, add_months, get_last_day, fmt_money, nowdate
-from frappe.model.naming import make_autoname
-from erpnext.accounts.utils import get_fiscal_year
from frappe.model.document import Document
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
+from frappe.model.naming import make_autoname
+from frappe.utils import add_months, flt, fmt_money, get_last_day, getdate
+
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+)
+from erpnext.accounts.utils import get_fiscal_year
+
class BudgetError(frappe.ValidationError): pass
class DuplicateBudgetError(frappe.ValidationError): pass
diff --git a/erpnext/accounts/doctype/budget/test_budget.py b/erpnext/accounts/doctype/budget/test_budget.py
index 6c25f00..cc82209 100644
--- a/erpnext/accounts/doctype/budget/test_budget.py
+++ b/erpnext/accounts/doctype/budget/test_budget.py
@@ -3,13 +3,15 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import nowdate, now_datetime
+
+import frappe
+from frappe.utils import now_datetime, nowdate
+
+from erpnext.accounts.doctype.budget.budget import BudgetError, get_actual_expense
+from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
from erpnext.accounts.utils import get_fiscal_year
from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
-from erpnext.accounts.doctype.budget.budget import get_actual_expense, BudgetError
-from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
test_dependencies = ['Monthly Distribution']
diff --git a/erpnext/accounts/doctype/budget_account/budget_account.py b/erpnext/accounts/doctype/budget_account/budget_account.py
index 81b2709..454e47d 100644
--- a/erpnext/accounts/doctype/budget_account/budget_account.py
+++ b/erpnext/accounts/doctype/budget_account/budget_account.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class BudgetAccount(Document):
pass
diff --git a/erpnext/accounts/doctype/c_form/c_form.py b/erpnext/accounts/doctype/c_form/c_form.py
index cfe28f3..b1ab648 100644
--- a/erpnext/accounts/doctype/c_form/c_form.py
+++ b/erpnext/accounts/doctype/c_form/c_form.py
@@ -2,10 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import flt
from frappe import _
from frappe.model.document import Document
+from frappe.utils import flt
+
class CForm(Document):
def validate(self):
diff --git a/erpnext/accounts/doctype/c_form/test_c_form.py b/erpnext/accounts/doctype/c_form/test_c_form.py
index c4c95db..e5c5615 100644
--- a/erpnext/accounts/doctype/c_form/test_c_form.py
+++ b/erpnext/accounts/doctype/c_form/test_c_form.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('C-Form')
diff --git a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py
index 20e423a..1316227 100644
--- a/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py
+++ b/erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py
@@ -2,8 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class CFormInvoiceDetail(Document):
pass
diff --git a/erpnext/accounts/doctype/campaign_item/campaign_item.py b/erpnext/accounts/doctype/campaign_item/campaign_item.py
index 4f5fd7f..d78fdf5 100644
--- a/erpnext/accounts/doctype/campaign_item/campaign_item.py
+++ b/erpnext/accounts/doctype/campaign_item/campaign_item.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class CampaignItem(Document):
pass
diff --git a/erpnext/accounts/doctype/cash_flow_mapper/cash_flow_mapper.py b/erpnext/accounts/doctype/cash_flow_mapper/cash_flow_mapper.py
index 7251533..96920b3 100644
--- a/erpnext/accounts/doctype/cash_flow_mapper/cash_flow_mapper.py
+++ b/erpnext/accounts/doctype/cash_flow_mapper/cash_flow_mapper.py
@@ -3,6 +3,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
diff --git a/erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py b/erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py
index b1ad297..9ec466a 100644
--- a/erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py
+++ b/erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py
@@ -3,6 +3,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
diff --git a/erpnext/accounts/doctype/cash_flow_mapping/test_cash_flow_mapping.py b/erpnext/accounts/doctype/cash_flow_mapping/test_cash_flow_mapping.py
index 499c820..5e44c61 100644
--- a/erpnext/accounts/doctype/cash_flow_mapping/test_cash_flow_mapping.py
+++ b/erpnext/accounts/doctype/cash_flow_mapping/test_cash_flow_mapping.py
@@ -3,9 +3,10 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
class TestCashFlowMapping(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/accounts/doctype/cash_flow_mapping_accounts/cash_flow_mapping_accounts.py b/erpnext/accounts/doctype/cash_flow_mapping_accounts/cash_flow_mapping_accounts.py
index fc63b8f..5174035 100644
--- a/erpnext/accounts/doctype/cash_flow_mapping_accounts/cash_flow_mapping_accounts.py
+++ b/erpnext/accounts/doctype/cash_flow_mapping_accounts/cash_flow_mapping_accounts.py
@@ -3,6 +3,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
diff --git a/erpnext/accounts/doctype/cash_flow_mapping_template/cash_flow_mapping_template.py b/erpnext/accounts/doctype/cash_flow_mapping_template/cash_flow_mapping_template.py
index 6f77a39..fabf579 100644
--- a/erpnext/accounts/doctype/cash_flow_mapping_template/cash_flow_mapping_template.py
+++ b/erpnext/accounts/doctype/cash_flow_mapping_template/cash_flow_mapping_template.py
@@ -3,6 +3,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
diff --git a/erpnext/accounts/doctype/cash_flow_mapping_template_details/cash_flow_mapping_template_details.py b/erpnext/accounts/doctype/cash_flow_mapping_template_details/cash_flow_mapping_template_details.py
index e10b638..f0ff33f 100644
--- a/erpnext/accounts/doctype/cash_flow_mapping_template_details/cash_flow_mapping_template_details.py
+++ b/erpnext/accounts/doctype/cash_flow_mapping_template_details/cash_flow_mapping_template_details.py
@@ -3,6 +3,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
diff --git a/erpnext/accounts/doctype/cashier_closing/cashier_closing.py b/erpnext/accounts/doctype/cashier_closing/cashier_closing.py
index 081c6fa..cab7d40 100644
--- a/erpnext/accounts/doctype/cashier_closing/cashier_closing.py
+++ b/erpnext/accounts/doctype/cashier_closing/cashier_closing.py
@@ -3,10 +3,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+from frappe import _
from frappe.model.document import Document
-from frappe.utils import cint, flt, cstr
-from frappe import _, msgprint, throw
+from frappe.utils import flt
+
class CashierClosing(Document):
def validate(self):
diff --git a/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py b/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py
index 3c489a7..981093f 100644
--- a/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py
+++ b/erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestCashierClosing(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/cashier_closing_payments/cashier_closing_payments.py b/erpnext/accounts/doctype/cashier_closing_payments/cashier_closing_payments.py
index f737031..a2a8b94 100644
--- a/erpnext/accounts/doctype/cashier_closing_payments/cashier_closing_payments.py
+++ b/erpnext/accounts/doctype/cashier_closing_payments/cashier_closing_payments.py
@@ -3,8 +3,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class CashierClosingPayments(Document):
pass
diff --git a/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py b/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py
index 8456b49..61968cf 100644
--- a/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py
+++ b/erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py
@@ -3,14 +3,26 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+import csv
+import os
from functools import reduce
-import frappe, csv, os
+
+import frappe
from frappe import _
-from frappe.utils import cstr, cint
from frappe.model.document import Document
+from frappe.utils import cint, cstr
from frappe.utils.csvutils import UnicodeWriter
-from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import create_charts, build_tree_from_json
-from frappe.utils.xlsxutils import read_xlsx_file_from_attached_file, read_xls_file_from_attached_file
+from frappe.utils.xlsxutils import (
+ read_xls_file_from_attached_file,
+ read_xlsx_file_from_attached_file,
+)
+
+from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import (
+ build_tree_from_json,
+ create_charts,
+)
+
class ChartofAccountsImporter(Document):
def validate(self):
diff --git a/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py b/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py
index 6ab19b7..ca9cf69 100644
--- a/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py
+++ b/erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestChartofAccountsImporter(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
index d62ee9d..0f595ba 100644
--- a/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
+++ b/erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
+from frappe.model.document import Document
+
class ChequePrintTemplate(Document):
pass
diff --git a/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py b/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py
index fa9c5b5..8ce8794 100644
--- a/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py
+++ b/erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Cheque Print Template')
diff --git a/erpnext/accounts/doctype/closed_document/closed_document.py b/erpnext/accounts/doctype/closed_document/closed_document.py
index 048ceee..50469bc 100644
--- a/erpnext/accounts/doctype/closed_document/closed_document.py
+++ b/erpnext/accounts/doctype/closed_document/closed_document.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ClosedDocument(Document):
pass
diff --git a/erpnext/accounts/doctype/cost_center/cost_center.py b/erpnext/accounts/doctype/cost_center/cost_center.py
index 981fec3..166ebb8 100644
--- a/erpnext/accounts/doctype/cost_center/cost_center.py
+++ b/erpnext/accounts/doctype/cost_center/cost_center.py
@@ -2,10 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import cint, cstr
+from frappe.utils import cint
from frappe.utils.nestedset import NestedSet
+
from erpnext.accounts.utils import validate_field_number
diff --git a/erpnext/accounts/doctype/cost_center/test_cost_center.py b/erpnext/accounts/doctype/cost_center/test_cost_center.py
index 7779cce..142b925 100644
--- a/erpnext/accounts/doctype/cost_center/test_cost_center.py
+++ b/erpnext/accounts/doctype/cost_center/test_cost_center.py
@@ -1,7 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import unittest
+
import frappe
test_records = frappe.get_test_records('Cost Center')
diff --git a/erpnext/accounts/doctype/coupon_code/coupon_code.py b/erpnext/accounts/doctype/coupon_code/coupon_code.py
index 92a816d..bb2615b 100644
--- a/erpnext/accounts/doctype/coupon_code/coupon_code.py
+++ b/erpnext/accounts/doctype/coupon_code/coupon_code.py
@@ -3,10 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import (strip)
+from frappe.utils import strip
+
+
class CouponCode(Document):
def autoname(self):
self.coupon_name = strip(self.coupon_name)
diff --git a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py
index 06987a8..bf8c014 100644
--- a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py
+++ b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py
@@ -3,11 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
+
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
-from erpnext.stock.get_item_details import get_item_details
-from frappe.test_runner import make_test_objects
test_dependencies = ['Item']
diff --git a/erpnext/accounts/doctype/customer_group_item/customer_group_item.py b/erpnext/accounts/doctype/customer_group_item/customer_group_item.py
index df782ac..100bfd5 100644
--- a/erpnext/accounts/doctype/customer_group_item/customer_group_item.py
+++ b/erpnext/accounts/doctype/customer_group_item/customer_group_item.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class CustomerGroupItem(Document):
pass
diff --git a/erpnext/accounts/doctype/customer_item/customer_item.py b/erpnext/accounts/doctype/customer_item/customer_item.py
index a577145..da3533f 100644
--- a/erpnext/accounts/doctype/customer_item/customer_item.py
+++ b/erpnext/accounts/doctype/customer_item/customer_item.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class CustomerItem(Document):
pass
diff --git a/erpnext/accounts/doctype/discounted_invoice/discounted_invoice.py b/erpnext/accounts/doctype/discounted_invoice/discounted_invoice.py
index 93dfcc1..11faa77 100644
--- a/erpnext/accounts/doctype/discounted_invoice/discounted_invoice.py
+++ b/erpnext/accounts/doctype/discounted_invoice/discounted_invoice.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class DiscountedInvoice(Document):
pass
diff --git a/erpnext/accounts/doctype/distributed_cost_center/distributed_cost_center.py b/erpnext/accounts/doctype/distributed_cost_center/distributed_cost_center.py
index 48c589f..4367040 100644
--- a/erpnext/accounts/doctype/distributed_cost_center/distributed_cost_center.py
+++ b/erpnext/accounts/doctype/distributed_cost_center/distributed_cost_center.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class DistributedCostCenter(Document):
pass
diff --git a/erpnext/accounts/doctype/dunning/dunning.py b/erpnext/accounts/doctype/dunning/dunning.py
index 1ef512a..65ada53 100644
--- a/erpnext/accounts/doctype/dunning/dunning.py
+++ b/erpnext/accounts/doctype/dunning/dunning.py
@@ -3,13 +3,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
+
+import frappe
+from frappe.utils import cint, flt, getdate
from six import string_types
-from frappe.utils import getdate, get_datetime, rounded, flt, cint
-from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import days_in_year
+
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+)
from erpnext.accounts.general_ledger import make_gl_entries, make_reverse_gl_entries
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
from erpnext.controllers.accounts_controller import AccountsController
diff --git a/erpnext/accounts/doctype/dunning/dunning_dashboard.py b/erpnext/accounts/doctype/dunning/dunning_dashboard.py
index 33c6ab0..fa3330f 100644
--- a/erpnext/accounts/doctype/dunning/dunning_dashboard.py
+++ b/erpnext/accounts/doctype/dunning/dunning_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'dunning',
diff --git a/erpnext/accounts/doctype/dunning/test_dunning.py b/erpnext/accounts/doctype/dunning/test_dunning.py
index 67692ec..9e8b655 100644
--- a/erpnext/accounts/doctype/dunning/test_dunning.py
+++ b/erpnext/accounts/doctype/dunning/test_dunning.py
@@ -3,13 +3,19 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import add_days, today, nowdate
-from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import unlink_payment_on_cancel_of_invoice
-from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice_against_cost_center
+
+import frappe
+from frappe.utils import add_days, nowdate, today
+
from erpnext.accounts.doctype.dunning.dunning import calculate_interest_and_amount
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
+from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import (
+ unlink_payment_on_cancel_of_invoice,
+)
+from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import (
+ create_sales_invoice_against_cost_center,
+)
class TestDunning(unittest.TestCase):
diff --git a/erpnext/accounts/doctype/dunning_letter_text/dunning_letter_text.py b/erpnext/accounts/doctype/dunning_letter_text/dunning_letter_text.py
index 426497b..b14fdc1 100644
--- a/erpnext/accounts/doctype/dunning_letter_text/dunning_letter_text.py
+++ b/erpnext/accounts/doctype/dunning_letter_text/dunning_letter_text.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class DunningLetterText(Document):
pass
diff --git a/erpnext/accounts/doctype/dunning_type/dunning_type.py b/erpnext/accounts/doctype/dunning_type/dunning_type.py
index 8708748..64e7cf4 100644
--- a/erpnext/accounts/doctype/dunning_type/dunning_type.py
+++ b/erpnext/accounts/doctype/dunning_type/dunning_type.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class DunningType(Document):
pass
diff --git a/erpnext/accounts/doctype/dunning_type/test_dunning_type.py b/erpnext/accounts/doctype/dunning_type/test_dunning_type.py
index b2fb26f..ae08907 100644
--- a/erpnext/accounts/doctype/dunning_type/test_dunning_type.py
+++ b/erpnext/accounts/doctype/dunning_type/test_dunning_type.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestDunningType(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
index dbbcedc..9c173d0 100644
--- a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
+++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
@@ -3,13 +3,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
-from frappe.utils import flt
from frappe.model.document import Document
from frappe.model.meta import get_field_precision
-from erpnext.setup.utils import get_exchange_rate
+from frappe.utils import flt
+
+import erpnext
from erpnext.accounts.doctype.journal_entry.journal_entry import get_balance_on
+from erpnext.setup.utils import get_exchange_rate
+
class ExchangeRateRevaluation(Document):
def validate(self):
diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation_dashboard.py b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation_dashboard.py
index b5cfa04..7358f56 100644
--- a/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation_dashboard.py
+++ b/erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation_dashboard.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_data():
return {
'fieldname': 'reference_name',
diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py b/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py
index 3b037d1..e725ce4 100644
--- a/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py
+++ b/erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestExchangeRateRevaluation(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.py b/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.py
index 87d7b67..58375dd 100644
--- a/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.py
+++ b/erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ExchangeRateRevaluationAccount(Document):
pass
diff --git a/erpnext/accounts/doctype/finance_book/finance_book.py b/erpnext/accounts/doctype/finance_book/finance_book.py
index bc9fce2..527b8e6 100644
--- a/erpnext/accounts/doctype/finance_book/finance_book.py
+++ b/erpnext/accounts/doctype/finance_book/finance_book.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class FinanceBook(Document):
pass
diff --git a/erpnext/accounts/doctype/finance_book/test_finance_book.py b/erpnext/accounts/doctype/finance_book/test_finance_book.py
index 2ba2139..87a8ae2 100644
--- a/erpnext/accounts/doctype/finance_book/test_finance_book.py
+++ b/erpnext/accounts/doctype/finance_book/test_finance_book.py
@@ -2,11 +2,13 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
-from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
+import unittest
import frappe
-import unittest
+
+from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
+
class TestFinanceBook(unittest.TestCase):
def test_finance_book(self):
@@ -40,4 +42,4 @@
else:
finance_book = frappe.get_doc("Finance Book", "_Test Finance Book")
- return finance_book
\ No newline at end of file
+ return finance_book
diff --git a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
index 4255626..6854ac9 100644
--- a/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
+++ b/erpnext/accounts/doctype/fiscal_year/fiscal_year.py
@@ -2,12 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe import msgprint, _
-from frappe.utils import getdate, add_days, add_years, cstr
-from dateutil.relativedelta import relativedelta
+import frappe
+from dateutil.relativedelta import relativedelta
+from frappe import _, msgprint
from frappe.model.document import Document
+from frappe.utils import add_days, add_years, cstr, getdate
+
class FiscalYearIncorrectDate(frappe.ValidationError): pass
diff --git a/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py b/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py
index cec4f44..b0365af 100644
--- a/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py
+++ b/erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py
@@ -3,7 +3,9 @@
from __future__ import unicode_literals
-import frappe, unittest
+import unittest
+
+import frappe
from erpnext.accounts.doctype.fiscal_year.fiscal_year import FiscalYearIncorrectDate
diff --git a/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.py b/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.py
index 8dfc2fa..b9c57f6 100644
--- a/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.py
+++ b/erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class FiscalYearCompany(Document):
pass
diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py
index 0844995..1e983b1 100644
--- a/erpnext/accounts/doctype/gl_entry/gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py
@@ -2,20 +2,30 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
-from frappe.utils import flt, fmt_money, getdate, formatdate, cint
from frappe.model.document import Document
-from frappe.model.naming import set_name_from_naming_options
from frappe.model.meta import get_field_precision
-from erpnext.accounts.party import validate_party_gle_currency, validate_party_frozen_disabled
-from erpnext.accounts.utils import get_account_currency
-from erpnext.accounts.utils import get_fiscal_year
-from erpnext.exceptions import InvalidAccountCurrency, InvalidAccountDimensionError, MandatoryAccountDimensionError
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_checks_for_pl_and_bs_accounts
-from erpnext.accounts.doctype.accounting_dimension_filter.accounting_dimension_filter import get_dimension_filter_map
+from frappe.model.naming import set_name_from_naming_options
+from frappe.utils import flt, fmt_money
from six import iteritems
+import erpnext
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_checks_for_pl_and_bs_accounts,
+)
+from erpnext.accounts.doctype.accounting_dimension_filter.accounting_dimension_filter import (
+ get_dimension_filter_map,
+)
+from erpnext.accounts.party import validate_party_frozen_disabled, validate_party_gle_currency
+from erpnext.accounts.utils import get_account_currency, get_fiscal_year
+from erpnext.exceptions import (
+ InvalidAccountCurrency,
+ InvalidAccountDimensionError,
+ MandatoryAccountDimensionError,
+)
+
exclude_from_linked_with = True
class GLEntry(Document):
def autoname(self):
diff --git a/erpnext/accounts/doctype/gl_entry/test_gl_entry.py b/erpnext/accounts/doctype/gl_entry/test_gl_entry.py
index 4167ca7..1495952 100644
--- a/erpnext/accounts/doctype/gl_entry/test_gl_entry.py
+++ b/erpnext/accounts/doctype/gl_entry/test_gl_entry.py
@@ -2,10 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, unittest
+
+import unittest
+
+import frappe
from frappe.model.naming import parse_naming_series
-from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
+
from erpnext.accounts.doctype.gl_entry.gl_entry import rename_gle_sle_docs
+from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
+
class TestGLEntry(unittest.TestCase):
def test_round_off_entry(self):
diff --git a/erpnext/accounts/doctype/gst_account/gst_account.py b/erpnext/accounts/doctype/gst_account/gst_account.py
index d784849..9ca3f9a 100644
--- a/erpnext/accounts/doctype/gst_account/gst_account.py
+++ b/erpnext/accounts/doctype/gst_account/gst_account.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class GSTAccount(Document):
pass
diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py
index b73d8bf..8867f1c 100644
--- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py
+++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py
@@ -3,12 +3,20 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json, erpnext
+
+import json
+
+import frappe
from frappe import _
-from frappe.utils import flt, getdate, nowdate, add_days
-from erpnext.controllers.accounts_controller import AccountsController
+from frappe.utils import add_days, flt, getdate, nowdate
+
+import erpnext
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+)
from erpnext.accounts.general_ledger import make_gl_entries
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
+from erpnext.controllers.accounts_controller import AccountsController
+
class InvoiceDiscounting(AccountsController):
def validate(self):
diff --git a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py
index 6d35ca2..bab8e46 100644
--- a/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py
+++ b/erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'reference_name',
diff --git a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py
index 919dd0c..58aea92 100644
--- a/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py
+++ b/erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py
@@ -3,13 +3,17 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import nowdate, add_days, flt
import unittest
-from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
-from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries
+
+import frappe
+from frappe.utils import add_days, flt, nowdate
+
from erpnext.accounts.doctype.account.test_account import create_account
from erpnext.accounts.doctype.journal_entry.journal_entry import get_payment_entry_against_invoice
+from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries
+
+
class TestInvoiceDiscounting(unittest.TestCase):
def setUp(self):
self.ar_credit = create_account(account_name="_Test Accounts Receivable Credit", parent_account = "Accounts Receivable - _TC", company="_Test Company")
diff --git a/erpnext/accounts/doctype/item_tax_template/item_tax_template.py b/erpnext/accounts/doctype/item_tax_template/item_tax_template.py
index d9155cb..1e26afe 100644
--- a/erpnext/accounts/doctype/item_tax_template/item_tax_template.py
+++ b/erpnext/accounts/doctype/item_tax_template/item_tax_template.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
+from frappe.model.document import Document
+
class ItemTaxTemplate(Document):
def validate(self):
diff --git a/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py b/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py
index acf1e44..46bb300 100644
--- a/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py
+++ b/erpnext/accounts/doctype/item_tax_template/test_item_tax_template.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestItemTaxTemplate(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/item_tax_template_detail/item_tax_template_detail.py b/erpnext/accounts/doctype/item_tax_template_detail/item_tax_template_detail.py
index d51bed0..aa3b542 100644
--- a/erpnext/accounts/doctype/item_tax_template_detail/item_tax_template_detail.py
+++ b/erpnext/accounts/doctype/item_tax_template_detail/item_tax_template_detail.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ItemTaxTemplateDetail(Document):
pass
diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py
index 7264875..24368f0 100644
--- a/erpnext/accounts/doctype/journal_entry/journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py
@@ -2,19 +2,30 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext, json
-from frappe.utils import cstr, flt, fmt_money, formatdate, getdate, nowdate, cint, get_link_to_form
-from frappe import msgprint, _, scrub
-from erpnext.controllers.accounts_controller import AccountsController
-from erpnext.accounts.utils import get_balance_on, get_stock_accounts, get_stock_and_account_balance, \
- get_account_currency, check_if_stock_and_account_balance_synced
-from erpnext.accounts.party import get_party_account
-from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount
-from erpnext.accounts.doctype.invoice_discounting.invoice_discounting \
- import get_party_account_based_on_invoice_discounting
-from erpnext.accounts.deferred_revenue import get_deferred_booking_accounts
-from six import string_types, iteritems
+import json
+
+import frappe
+from frappe import _, msgprint, scrub
+from frappe.utils import cint, cstr, flt, fmt_money, formatdate, get_link_to_form, nowdate
+from six import iteritems, string_types
+
+import erpnext
+from erpnext.accounts.deferred_revenue import get_deferred_booking_accounts
+from erpnext.accounts.doctype.invoice_discounting.invoice_discounting import (
+ get_party_account_based_on_invoice_discounting,
+)
+from erpnext.accounts.party import get_party_account
+from erpnext.accounts.utils import (
+ check_if_stock_and_account_balance_synced,
+ get_account_currency,
+ get_balance_on,
+ get_stock_accounts,
+ get_stock_and_account_balance,
+)
+from erpnext.controllers.accounts_controller import AccountsController
+from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount
+
class StockAccountInvalidTransaction(frappe.ValidationError): pass
@@ -66,6 +77,7 @@
self.update_expense_claim()
self.update_inter_company_jv()
self.update_invoice_discounting()
+ self.update_status_for_full_and_final_statement()
check_if_stock_and_account_balance_synced(self.posting_date,
self.company, self.doctype, self.name)
@@ -83,6 +95,7 @@
self.unlink_inter_company_jv()
self.unlink_asset_adjustment_entry()
self.update_invoice_discounting()
+ self.update_status_for_full_and_final_statement()
def get_title(self):
return self.pay_to_recd_from or self.accounts[0].account
@@ -98,6 +111,15 @@
for voucher_no in list(set(order_list)):
frappe.get_doc(voucher_type, voucher_no).set_total_advance_paid()
+ def update_status_for_full_and_final_statement(self):
+ for entry in self.accounts:
+ if entry.reference_type == "Full and Final Statement":
+ if self.docstatus == 1:
+ frappe.db.set_value("Full and Final Statement", entry.reference_name, "status", "Paid")
+ elif self.docstatus == 2:
+ frappe.db.set_value("Full and Final Statement", entry.reference_name, "status", "Unpaid")
+
+
def validate_inter_company_accounts(self):
if self.voucher_type == "Inter Company Journal Entry" and self.inter_company_journal_entry_reference:
doc = frappe.get_doc("Journal Entry", self.inter_company_journal_entry_reference)
diff --git a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py
index 5835d46..d03a088 100644
--- a/erpnext/accounts/doctype/journal_entry/test_journal_entry.py
+++ b/erpnext/accounts/doctype/journal_entry/test_journal_entry.py
@@ -2,11 +2,16 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import unittest, frappe
+
+import unittest
+
+import frappe
from frappe.utils import flt, nowdate
+
from erpnext.accounts.doctype.account.test_account import get_inventory_account
-from erpnext.exceptions import InvalidAccountCurrency
from erpnext.accounts.doctype.journal_entry.journal_entry import StockAccountInvalidTransaction
+from erpnext.exceptions import InvalidAccountCurrency
+
class TestJournalEntry(unittest.TestCase):
def test_journal_entry_with_against_jv(self):
diff --git a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
index a89fefd..dff883a 100644
--- a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
+++ b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.json
@@ -202,7 +202,7 @@
"fieldname": "reference_type",
"fieldtype": "Select",
"label": "Reference Type",
- "options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim\nAsset\nLoan\nPayroll Entry\nEmployee Advance\nExchange Rate Revaluation\nInvoice Discounting\nFees"
+ "options": "\nSales Invoice\nPurchase Invoice\nJournal Entry\nSales Order\nPurchase Order\nExpense Claim\nAsset\nLoan\nPayroll Entry\nEmployee Advance\nExchange Rate Revaluation\nInvoice Discounting\nFees\nFull and Final Statement"
},
{
"fieldname": "reference_name",
@@ -280,7 +280,7 @@
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2020-06-26 14:06:54.833738",
+ "modified": "2021-08-30 21:27:32.200299",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Entry Account",
diff --git a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.py b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.py
index 2e77cf2..86d3df4 100644
--- a/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.py
+++ b/erpnext/accounts/doctype/journal_entry_account/journal_entry_account.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class JournalEntryAccount(Document):
pass
diff --git a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.py b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.py
index e0b9cbc..f0813f5 100644
--- a/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.py
+++ b/erpnext/accounts/doctype/journal_entry_template/journal_entry_template.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class JournalEntryTemplate(Document):
pass
diff --git a/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py b/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py
index 5f74a20..61fea94 100644
--- a/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py
+++ b/erpnext/accounts/doctype/journal_entry_template/test_journal_entry_template.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestJournalEntryTemplate(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/journal_entry_template_account/journal_entry_template_account.py b/erpnext/accounts/doctype/journal_entry_template_account/journal_entry_template_account.py
index 48e6abb..d0408ca 100644
--- a/erpnext/accounts/doctype/journal_entry_template_account/journal_entry_template_account.py
+++ b/erpnext/accounts/doctype/journal_entry_template_account/journal_entry_template_account.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class JournalEntryTemplateAccount(Document):
pass
diff --git a/erpnext/accounts/doctype/loyalty_point_entry/loyalty_point_entry.py b/erpnext/accounts/doctype/loyalty_point_entry/loyalty_point_entry.py
index 3579a1a..0813926 100644
--- a/erpnext/accounts/doctype/loyalty_point_entry/loyalty_point_entry.py
+++ b/erpnext/accounts/doctype/loyalty_point_entry/loyalty_point_entry.py
@@ -3,6 +3,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
from frappe.utils import today
diff --git a/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py b/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py
index b6e2d57..07856cf 100644
--- a/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py
+++ b/erpnext/accounts/doctype/loyalty_point_entry/test_loyalty_point_entry.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestLoyaltyPointEntry(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/loyalty_point_entry_redemption/loyalty_point_entry_redemption.py b/erpnext/accounts/doctype/loyalty_point_entry_redemption/loyalty_point_entry_redemption.py
index e4382b6..506e2ce 100644
--- a/erpnext/accounts/doctype/loyalty_point_entry_redemption/loyalty_point_entry_redemption.py
+++ b/erpnext/accounts/doctype/loyalty_point_entry_redemption/loyalty_point_entry_redemption.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class LoyaltyPointEntryRedemption(Document):
pass
diff --git a/erpnext/accounts/doctype/loyalty_program/loyalty_program.py b/erpnext/accounts/doctype/loyalty_program/loyalty_program.py
index cb753a3..89ed461 100644
--- a/erpnext/accounts/doctype/loyalty_program/loyalty_program.py
+++ b/erpnext/accounts/doctype/loyalty_program/loyalty_program.py
@@ -3,11 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import today, flt
+from frappe.utils import flt, today
+
class LoyaltyProgram(Document):
pass
diff --git a/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py b/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py
index 189004f..267bbbf 100644
--- a/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py
+++ b/erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py
@@ -1,7 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
-
def get_data():
return {
diff --git a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py
index 3199488..a039e32 100644
--- a/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py
+++ b/erpnext/accounts/doctype/loyalty_program/test_loyalty_program.py
@@ -3,12 +3,17 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import today, cint, flt, getdate
-from erpnext.accounts.doctype.loyalty_program.loyalty_program import get_loyalty_program_details_with_points
+
+import frappe
+from frappe.utils import cint, flt, getdate, today
+
+from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
+ get_loyalty_program_details_with_points,
+)
from erpnext.accounts.party import get_dashboard_info
+
class TestLoyaltyProgram(unittest.TestCase):
@classmethod
def setUpClass(self):
diff --git a/erpnext/accounts/doctype/loyalty_program_collection/loyalty_program_collection.py b/erpnext/accounts/doctype/loyalty_program_collection/loyalty_program_collection.py
index 42cc38c..4bbcf3a 100644
--- a/erpnext/accounts/doctype/loyalty_program_collection/loyalty_program_collection.py
+++ b/erpnext/accounts/doctype/loyalty_program_collection/loyalty_program_collection.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class LoyaltyProgramCollection(Document):
pass
diff --git a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py
index cea921e..dfe42df 100644
--- a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py
+++ b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py
@@ -2,10 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.model.document import Document
+import frappe
from frappe import _
+from frappe.model.document import Document
+
class ModeofPayment(Document):
def validate(self):
diff --git a/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py b/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py
index ad6cd47..299687b 100644
--- a/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py
+++ b/erpnext/accounts/doctype/mode_of_payment/test_mode_of_payment.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Mode of Payment')
diff --git a/erpnext/accounts/doctype/mode_of_payment_account/mode_of_payment_account.py b/erpnext/accounts/doctype/mode_of_payment_account/mode_of_payment_account.py
index 5cb195a..40b5f30 100644
--- a/erpnext/accounts/doctype/mode_of_payment_account/mode_of_payment_account.py
+++ b/erpnext/accounts/doctype/mode_of_payment_account/mode_of_payment_account.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ModeofPaymentAccount(Document):
pass
diff --git a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.py b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.py
index ad8623f..c0e00d6 100644
--- a/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.py
+++ b/erpnext/accounts/doctype/monthly_distribution/monthly_distribution.py
@@ -2,10 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import (flt, add_months)
from frappe.model.document import Document
+from frappe.utils import add_months, flt
+
class MonthlyDistribution(Document):
@frappe.whitelist()
diff --git a/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py b/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py
index efbf4eb..63faa15 100644
--- a/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py
+++ b/erpnext/accounts/doctype/monthly_distribution/test_monthly_distribution.py
@@ -2,9 +2,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
+
import unittest
+import frappe
+
test_records = frappe.get_test_records('Monthly Distribution')
class TestMonthlyDistribution(unittest.TestCase):
diff --git a/erpnext/accounts/doctype/monthly_distribution_percentage/monthly_distribution_percentage.py b/erpnext/accounts/doctype/monthly_distribution_percentage/monthly_distribution_percentage.py
index d9e8bf9..8ec30c7 100644
--- a/erpnext/accounts/doctype/monthly_distribution_percentage/monthly_distribution_percentage.py
+++ b/erpnext/accounts/doctype/monthly_distribution_percentage/monthly_distribution_percentage.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class MonthlyDistributionPercentage(Document):
pass
diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
index 9914b45..2b94bf4 100644
--- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
+++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
@@ -3,14 +3,19 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import traceback
from json import dumps
+
+import frappe
from frappe import _, scrub
-from frappe.utils import flt, nowdate
from frappe.model.document import Document
+from frappe.utils import flt, nowdate
from frappe.utils.background_jobs import enqueue
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
+
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+)
class OpeningInvoiceCreationTool(Document):
diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py
index 8d6de2d..ed3c6a9 100644
--- a/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py
+++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/test_opening_invoice_creation_tool.py
@@ -3,12 +3,15 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
from frappe.cache_manager import clear_doctype_cache
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
-from erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool import get_temporary_opening_account
+
+from erpnext.accounts.doctype.opening_invoice_creation_tool.opening_invoice_creation_tool import (
+ get_temporary_opening_account,
+)
test_dependencies = ["Customer", "Supplier"]
diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool_item/opening_invoice_creation_tool_item.py b/erpnext/accounts/doctype/opening_invoice_creation_tool_item/opening_invoice_creation_tool_item.py
index d47c3e9..4008022 100644
--- a/erpnext/accounts/doctype/opening_invoice_creation_tool_item/opening_invoice_creation_tool_item.py
+++ b/erpnext/accounts/doctype/opening_invoice_creation_tool_item/opening_invoice_creation_tool_item.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class OpeningInvoiceCreationToolItem(Document):
pass
diff --git a/erpnext/accounts/doctype/party_account/party_account.py b/erpnext/accounts/doctype/party_account/party_account.py
index 21cfb96..08d67c7 100644
--- a/erpnext/accounts/doctype/party_account/party_account.py
+++ b/erpnext/accounts/doctype/party_account/party_account.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PartyAccount(Document):
pass
diff --git a/erpnext/accounts/doctype/party_link/party_link.py b/erpnext/accounts/doctype/party_link/party_link.py
index 7d58506..daf667c 100644
--- a/erpnext/accounts/doctype/party_link/party_link.py
+++ b/erpnext/accounts/doctype/party_link/party_link.py
@@ -5,19 +5,20 @@
from frappe import _
from frappe.model.document import Document
+
class PartyLink(Document):
def validate(self):
if self.primary_role not in ['Customer', 'Supplier']:
frappe.throw(_("Allowed primary roles are 'Customer' and 'Supplier'. Please select one of these roles only."),
title=_("Invalid Primary Role"))
-
+
existing_party_link = frappe.get_all('Party Link', {
'primary_party': self.secondary_party
}, pluck="primary_role")
if existing_party_link:
frappe.throw(_('{} {} is already linked with another {}')
.format(self.secondary_role, self.secondary_party, existing_party_link[0]))
-
+
existing_party_link = frappe.get_all('Party Link', {
'secondary_party': self.primary_party
}, pluck="primary_role")
diff --git a/erpnext/accounts/doctype/party_link/test_party_link.py b/erpnext/accounts/doctype/party_link/test_party_link.py
index a3ea395..2ae3381 100644
--- a/erpnext/accounts/doctype/party_link/test_party_link.py
+++ b/erpnext/accounts/doctype/party_link/test_party_link.py
@@ -4,5 +4,6 @@
# import frappe
import unittest
+
class TestPartyLink(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index d96bc27..3be3925 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -872,7 +872,7 @@
&& frm.doc.base_total_allocated_amount < frm.doc.base_received_amount + total_deductions
&& frm.doc.total_allocated_amount < frm.doc.paid_amount + (total_deductions / frm.doc.source_exchange_rate)) {
unallocated_amount = (frm.doc.base_received_amount + total_deductions + frm.doc.base_total_taxes_and_charges
- + frm.doc.base_total_allocated_amount) / frm.doc.source_exchange_rate;
+ - frm.doc.base_total_allocated_amount) / frm.doc.source_exchange_rate;
} else if (frm.doc.payment_type == "Pay"
&& frm.doc.base_total_allocated_amount < frm.doc.base_paid_amount - total_deductions
&& frm.doc.total_allocated_amount < frm.doc.received_amount + (total_deductions / frm.doc.target_exchange_rate)) {
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index a5fcad4..a530321 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -3,22 +3,37 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext, json
-from frappe import _, scrub, ValidationError, throw
-from frappe.utils import flt, comma_or, nowdate, getdate, cint
-from erpnext.accounts.utils import get_outstanding_invoices, get_account_currency, get_balance_on
-from erpnext.accounts.party import get_party_account
-from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account
-from erpnext.setup.utils import get_exchange_rate
-from erpnext.accounts.general_ledger import make_gl_entries
-from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount
-from erpnext.accounts.doctype.bank_account.bank_account import get_party_bank_account, get_bank_account_details
-from erpnext.controllers.accounts_controller import AccountsController, get_supplier_block_status
-from erpnext.accounts.doctype.invoice_discounting.invoice_discounting import get_party_account_based_on_invoice_discounting
-from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import get_party_tax_withholding_details
-from six import string_types, iteritems
-from erpnext.controllers.accounts_controller import validate_taxes_and_charges
+import json
+
+import frappe
+from frappe import ValidationError, _, scrub, throw
+from frappe.utils import cint, comma_or, flt, getdate, nowdate
+from six import iteritems, string_types
+
+import erpnext
+from erpnext.accounts.doctype.bank_account.bank_account import (
+ get_bank_account_details,
+ get_party_bank_account,
+)
+from erpnext.accounts.doctype.invoice_discounting.invoice_discounting import (
+ get_party_account_based_on_invoice_discounting,
+)
+from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account
+from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import (
+ get_party_tax_withholding_details,
+)
+from erpnext.accounts.general_ledger import make_gl_entries
+from erpnext.accounts.party import get_party_account
+from erpnext.accounts.utils import get_account_currency, get_balance_on, get_outstanding_invoices
+from erpnext.controllers.accounts_controller import (
+ AccountsController,
+ get_supplier_block_status,
+ validate_taxes_and_charges,
+)
+from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount
+from erpnext.setup.utils import get_exchange_rate
+
class InvalidPaymentEntry(ValidationError):
pass
@@ -484,7 +499,7 @@
def validate_amounts(self):
self.validate_received_amount()
-
+
def validate_received_amount(self):
if self.paid_from_account_currency == self.paid_to_account_currency:
if self.paid_amount != self.received_amount:
@@ -1390,7 +1405,7 @@
})
def get_amounts_based_on_reference_doctype(reference_doctype, ref_doc, party_account_currency, company_currency, reference_name):
- total_amount, outstanding_amount, exchange_rate = None
+ total_amount = outstanding_amount = exchange_rate = None
if reference_doctype == "Fees":
total_amount = ref_doc.get("grand_total")
exchange_rate = 1
@@ -1410,7 +1425,7 @@
return total_amount, outstanding_amount, exchange_rate
def get_amounts_based_on_ref_doc(reference_doctype, ref_doc, party_account_currency, company_currency):
- total_amount, outstanding_amount, exchange_rate = None
+ total_amount = outstanding_amount = exchange_rate = None
if ref_doc.doctype == "Expense Claim":
total_amount = flt(ref_doc.total_sanctioned_amount) + flt(ref_doc.total_taxes_and_charges)
elif ref_doc.doctype == "Employee Advance":
@@ -1450,7 +1465,7 @@
return total_amount, exchange_rate
def get_bill_no_and_update_amounts(reference_doctype, ref_doc, total_amount, exchange_rate, party_account_currency, company_currency):
- outstanding_amount, bill_no = None
+ outstanding_amount = bill_no = None
if reference_doctype in ("Sales Invoice", "Purchase Invoice"):
outstanding_amount = ref_doc.get("outstanding_amount")
bill_no = ref_doc.get("bill_no")
diff --git a/erpnext/accounts/doctype/payment_entry/regional/india.js b/erpnext/accounts/doctype/payment_entry/regional/india.js
new file mode 100644
index 0000000..abb3445
--- /dev/null
+++ b/erpnext/accounts/doctype/payment_entry/regional/india.js
@@ -0,0 +1,29 @@
+frappe.ui.form.on("Payment Entry", {
+ company: function(frm) {
+ frappe.call({
+ 'method': 'frappe.contacts.doctype.address.address.get_default_address',
+ 'args': {
+ 'doctype': 'Company',
+ 'name': frm.doc.company
+ },
+ 'callback': function(r) {
+ frm.set_value('company_address', r.message);
+ }
+ });
+ },
+
+ party: function(frm) {
+ if (frm.doc.party_type == "Customer" && frm.doc.party) {
+ frappe.call({
+ 'method': 'frappe.contacts.doctype.address.address.get_default_address',
+ 'args': {
+ 'doctype': 'Customer',
+ 'name': frm.doc.party
+ },
+ 'callback': function(r) {
+ frm.set_value('customer_address', r.message);
+ }
+ });
+ }
+ }
+});
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
index dac927b..c90a3c5 100644
--- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py
@@ -3,14 +3,25 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from frappe.utils import flt, nowdate
-from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
-from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry, InvalidPaymentEntry
-from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice, create_sales_invoice_against_cost_center
-from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice, make_purchase_invoice_against_cost_center
+
+from erpnext.accounts.doctype.payment_entry.payment_entry import (
+ InvalidPaymentEntry,
+ get_payment_entry,
+)
+from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import (
+ make_purchase_invoice,
+ make_purchase_invoice_against_cost_center,
+)
+from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import (
+ create_sales_invoice,
+ create_sales_invoice_against_cost_center,
+)
from erpnext.hr.doctype.expense_claim.test_expense_claim import make_expense_claim
+from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
test_dependencies = ["Item"]
@@ -324,7 +335,10 @@
self.assertEqual(flt(pe.unallocated_amount, 2), 0.0)
def test_payment_entry_retrieves_last_exchange_rate(self):
- from erpnext.setup.doctype.currency_exchange.test_currency_exchange import test_records, save_new_records
+ from erpnext.setup.doctype.currency_exchange.test_currency_exchange import (
+ save_new_records,
+ test_records,
+ )
save_new_records(test_records)
diff --git a/erpnext/accounts/doctype/payment_entry_deduction/payment_entry_deduction.py b/erpnext/accounts/doctype/payment_entry_deduction/payment_entry_deduction.py
index d6686bb..9cfed7b 100644
--- a/erpnext/accounts/doctype/payment_entry_deduction/payment_entry_deduction.py
+++ b/erpnext/accounts/doctype/payment_entry_deduction/payment_entry_deduction.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PaymentEntryDeduction(Document):
pass
diff --git a/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.py b/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.py
index 51f8c06..a686f49 100644
--- a/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.py
+++ b/erpnext/accounts/doctype/payment_entry_reference/payment_entry_reference.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PaymentEntryReference(Document):
pass
diff --git a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.py b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.py
index 3529c16..1d8a8ac 100644
--- a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.py
+++ b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class PaymentGatewayAccount(Document):
def autoname(self):
self.name = self.payment_gateway + " - " + self.currency
diff --git a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py
index 0898229..2edc1a1 100644
--- a/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py
+++ b/erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py
@@ -1,7 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
-
def get_data():
return {
diff --git a/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py b/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py
index 84c3bc4..f76aa4a 100644
--- a/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py
+++ b/erpnext/accounts/doctype/payment_gateway_account/test_payment_gateway_account.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Payment Gateway Account')
diff --git a/erpnext/accounts/doctype/payment_order/payment_order.py b/erpnext/accounts/doctype/payment_order/payment_order.py
index 8d29ae7..e9b5ad9 100644
--- a/erpnext/accounts/doctype/payment_order/payment_order.py
+++ b/erpnext/accounts/doctype/payment_order/payment_order.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import nowdate
-from erpnext.accounts.party import get_party_account
from frappe.model.document import Document
+from frappe.utils import nowdate
+
+from erpnext.accounts.party import get_party_account
+
class PaymentOrder(Document):
def on_submit(self):
diff --git a/erpnext/accounts/doctype/payment_order/payment_order_dashboard.py b/erpnext/accounts/doctype/payment_order/payment_order_dashboard.py
index a4f3358..d9262be 100644
--- a/erpnext/accounts/doctype/payment_order/payment_order_dashboard.py
+++ b/erpnext/accounts/doctype/payment_order/payment_order_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/accounts/doctype/payment_order/test_payment_order.py b/erpnext/accounts/doctype/payment_order/test_payment_order.py
index 9ba57ae..6414473 100644
--- a/erpnext/accounts/doctype/payment_order/test_payment_order.py
+++ b/erpnext/accounts/doctype/payment_order/test_payment_order.py
@@ -3,13 +3,19 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from frappe.utils import getdate
+
from erpnext.accounts.doctype.bank_transaction.test_bank_transaction import create_bank_account
-from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry, make_payment_order
+from erpnext.accounts.doctype.payment_entry.payment_entry import (
+ get_payment_entry,
+ make_payment_order,
+)
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
+
class TestPaymentOrder(unittest.TestCase):
def setUp(self):
create_bank_account()
diff --git a/erpnext/accounts/doctype/payment_order_reference/payment_order_reference.py b/erpnext/accounts/doctype/payment_order_reference/payment_order_reference.py
index b3a9294..4bb98a3 100644
--- a/erpnext/accounts/doctype/payment_order_reference/payment_order_reference.py
+++ b/erpnext/accounts/doctype/payment_order_reference/payment_order_reference.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PaymentOrderReference(Document):
pass
diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js
index c71a62d..b1f3e6f 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.js
@@ -2,46 +2,10 @@
// For license information, please see license.txt
frappe.provide("erpnext.accounts");
-
-frappe.ui.form.on("Payment Reconciliation Payment", {
- invoice_number: function(frm, cdt, cdn) {
- var row = locals[cdt][cdn];
- if(row.invoice_number) {
- var parts = row.invoice_number.split(' | ');
- var invoice_type = parts[0];
- var invoice_number = parts[1];
-
- var invoice_amount = frm.doc.invoices.filter(function(d) {
- return d.invoice_type === invoice_type && d.invoice_number === invoice_number;
- })[0].outstanding_amount;
-
- frappe.model.set_value(cdt, cdn, "allocated_amount", Math.min(invoice_amount, row.amount));
-
- frm.call({
- doc: frm.doc,
- method: 'get_difference_amount',
- args: {
- child_row: row
- },
- callback: function(r, rt) {
- if(r.message) {
- frappe.model.set_value(cdt, cdn,
- "difference_amount", r.message);
- }
- }
- });
- }
- }
-});
-
erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationController extends frappe.ui.form.Controller {
onload() {
var me = this;
- this.frm.set_query("party", function() {
- check_mandatory(me.frm);
- });
-
this.frm.set_query("party_type", function() {
return {
"filters": {
@@ -88,15 +52,36 @@
refresh() {
this.frm.disable_save();
- this.toggle_primary_action();
+
+ if (this.frm.doc.receivable_payable_account) {
+ this.frm.add_custom_button(__('Get Unreconciled Entries'), () =>
+ this.frm.trigger("get_unreconciled_entries")
+ );
+ }
+ if (this.frm.doc.invoices.length && this.frm.doc.payments.length) {
+ this.frm.add_custom_button(__('Allocate'), () =>
+ this.frm.trigger("allocate")
+ );
+ }
+ if (this.frm.doc.allocation.length) {
+ this.frm.add_custom_button(__('Reconcile'), () =>
+ this.frm.trigger("reconcile")
+ );
+ }
}
- onload_post_render() {
- this.toggle_primary_action();
+ company() {
+ var me = this;
+ this.frm.set_value('receivable_payable_account', '');
+ me.frm.clear_table("allocation");
+ me.frm.clear_table("invoices");
+ me.frm.clear_table("payments");
+ me.frm.refresh_fields();
+ me.frm.trigger('party');
}
party() {
- var me = this
+ var me = this;
if (!me.frm.doc.receivable_payable_account && me.frm.doc.party_type && me.frm.doc.party) {
return frappe.call({
method: "erpnext.accounts.party.get_party_account",
@@ -109,6 +94,7 @@
if (!r.exc && r.message) {
me.frm.set_value("receivable_payable_account", r.message);
}
+ me.frm.refresh();
}
});
}
@@ -120,16 +106,41 @@
doc: me.frm.doc,
method: 'get_unreconciled_entries',
callback: function(r, rt) {
- me.set_invoice_options();
- me.toggle_primary_action();
+ if (!(me.frm.doc.payments.length || me.frm.doc.invoices.length)) {
+ frappe.throw({message: __("No invoice and payment records found for this party")});
+ }
+ me.frm.refresh();
}
});
}
+ allocate() {
+ var me = this;
+ let payments = me.frm.fields_dict.payments.grid.get_selected_children();
+ if (!(payments.length)) {
+ payments = me.frm.doc.payments;
+ }
+ let invoices = me.frm.fields_dict.invoices.grid.get_selected_children();
+ if (!(invoices.length)) {
+ invoices = me.frm.doc.invoices;
+ }
+ return me.frm.call({
+ doc: me.frm.doc,
+ method: 'allocate_entries',
+ args: {
+ payments: payments,
+ invoices: invoices
+ },
+ callback: function() {
+ me.frm.refresh();
+ }
+ });
+ }
+
reconcile() {
var me = this;
- var show_dialog = me.frm.doc.payments.filter(d => d.difference_amount && !d.difference_account);
+ var show_dialog = me.frm.doc.allocation.filter(d => d.difference_amount && !d.difference_account);
if (show_dialog && show_dialog.length) {
@@ -138,7 +149,7 @@
title: __("Select Difference Account"),
fields: [
{
- fieldname: "payments", fieldtype: "Table", label: __("Payments"),
+ fieldname: "allocation", fieldtype: "Table", label: __("Allocation"),
data: this.data, in_place_edit: true,
get_data: () => {
return this.data;
@@ -179,10 +190,10 @@
},
],
primary_action: function() {
- const args = dialog.get_values()["payments"];
+ const args = dialog.get_values()["allocation"];
args.forEach(d => {
- frappe.model.set_value("Payment Reconciliation Payment", d.docname,
+ frappe.model.set_value("Payment Reconciliation Allocation", d.docname,
"difference_account", d.difference_account);
});
@@ -192,9 +203,9 @@
primary_action_label: __('Reconcile Entries')
});
- this.frm.doc.payments.forEach(d => {
+ this.frm.doc.allocation.forEach(d => {
if (d.difference_amount && !d.difference_account) {
- dialog.fields_dict.payments.df.data.push({
+ dialog.fields_dict.allocation.df.data.push({
'docname': d.name,
'reference_name': d.reference_name,
'difference_amount': d.difference_amount,
@@ -203,8 +214,8 @@
}
});
- this.data = dialog.fields_dict.payments.df.data;
- dialog.fields_dict.payments.grid.refresh();
+ this.data = dialog.fields_dict.allocation.df.data;
+ dialog.fields_dict.allocation.grid.refresh();
dialog.show();
} else {
this.reconcile_payment_entries();
@@ -218,48 +229,12 @@
doc: me.frm.doc,
method: 'reconcile',
callback: function(r, rt) {
- me.set_invoice_options();
- me.toggle_primary_action();
+ me.frm.clear_table("allocation");
+ me.frm.refresh_fields();
+ me.frm.refresh();
}
});
}
-
- set_invoice_options() {
- var me = this;
- var invoices = [];
-
- $.each(me.frm.doc.invoices || [], function(i, row) {
- if (row.invoice_number && !in_list(invoices, row.invoice_number))
- invoices.push(row.invoice_type + " | " + row.invoice_number);
- });
-
- if (invoices) {
- this.frm.fields_dict.payments.grid.update_docfield_property(
- 'invoice_number', 'options', "\n" + invoices.join("\n")
- );
-
- $.each(me.frm.doc.payments || [], function(i, p) {
- if(!in_list(invoices, cstr(p.invoice_number))) p.invoice_number = null;
- });
- }
-
- refresh_field("payments");
- }
-
- toggle_primary_action() {
- if ((this.frm.doc.payments || []).length) {
- this.frm.fields_dict.reconcile.$input
- && this.frm.fields_dict.reconcile.$input.addClass("btn-primary");
- this.frm.fields_dict.get_unreconciled_entries.$input
- && this.frm.fields_dict.get_unreconciled_entries.$input.removeClass("btn-primary");
- } else {
- this.frm.fields_dict.reconcile.$input
- && this.frm.fields_dict.reconcile.$input.removeClass("btn-primary");
- this.frm.fields_dict.get_unreconciled_entries.$input
- && this.frm.fields_dict.get_unreconciled_entries.$input.addClass("btn-primary");
- }
- }
-
};
extend_cscript(cur_frm.cscript, new erpnext.accounts.PaymentReconciliationController({frm: cur_frm}));
diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json
index cfb24c3..9023b36 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.json
@@ -1,622 +1,206 @@
{
- "allow_copy": 1,
- "allow_events_in_timeline": 0,
- "allow_guest_to_view": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "beta": 0,
- "creation": "2014-07-09 12:04:51.681583",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "document_type": "",
- "editable_grid": 0,
- "engine": "InnoDB",
+ "actions": [],
+ "allow_copy": 1,
+ "creation": "2014-07-09 12:04:51.681583",
+ "doctype": "DocType",
+ "engine": "InnoDB",
+ "field_order": [
+ "company",
+ "party_type",
+ "column_break_4",
+ "party",
+ "receivable_payable_account",
+ "col_break1",
+ "from_invoice_date",
+ "to_invoice_date",
+ "minimum_invoice_amount",
+ "maximum_invoice_amount",
+ "invoice_limit",
+ "column_break_13",
+ "from_payment_date",
+ "to_payment_date",
+ "minimum_payment_amount",
+ "maximum_payment_amount",
+ "payment_limit",
+ "bank_cash_account",
+ "sec_break1",
+ "invoices",
+ "column_break_15",
+ "payments",
+ "sec_break2",
+ "allocation"
+ ],
"fields": [
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "company",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Company",
- "length": 0,
- "no_copy": 0,
- "options": "Company",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 1,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "company",
+ "fieldtype": "Link",
+ "label": "Company",
+ "options": "Company",
+ "reqd": 1
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "party_type",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Party Type",
- "length": 0,
- "no_copy": 0,
- "options": "DocType",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 1,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "party_type",
+ "fieldtype": "Link",
+ "label": "Party Type",
+ "options": "DocType",
+ "reqd": 1
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "depends_on": "",
- "fieldname": "party",
- "fieldtype": "Dynamic Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Party",
- "length": 0,
- "no_copy": 0,
- "options": "party_type",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 1,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "depends_on": "eval:doc.party_type",
+ "fieldname": "party",
+ "fieldtype": "Dynamic Link",
+ "label": "Party",
+ "options": "party_type",
+ "reqd": 1
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "receivable_payable_account",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Receivable / Payable Account",
- "length": 0,
- "no_copy": 0,
- "options": "Account",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 1,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "depends_on": "eval:doc.company && doc.party",
+ "fieldname": "receivable_payable_account",
+ "fieldtype": "Link",
+ "label": "Receivable / Payable Account",
+ "options": "Account",
+ "reqd": 1
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "bank_cash_account",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Bank / Cash Account",
- "length": 0,
- "no_copy": 0,
- "options": "Account",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "description": "This filter will be applied to Journal Entry.",
+ "fieldname": "bank_cash_account",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Bank / Cash Account",
+ "options": "Account"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "col_break1",
- "fieldtype": "Column Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "collapsible": 1,
+ "collapsible_depends_on": "eval: doc.invoices.length == 0",
+ "depends_on": "eval:doc.receivable_payable_account",
+ "fieldname": "col_break1",
+ "fieldtype": "Section Break",
+ "label": "Filters"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "from_date",
- "fieldtype": "Date",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "From Invoice Date",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "depends_on": "eval:(doc.payments).length || (doc.invoices).length",
+ "fieldname": "sec_break1",
+ "fieldtype": "Section Break",
+ "label": "Unreconciled Entries"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "to_date",
- "fieldtype": "Date",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "To Invoice Date",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "payments",
+ "fieldtype": "Table",
+ "label": "Payments",
+ "options": "Payment Reconciliation Payment"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "minimum_amount",
- "fieldtype": "Currency",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Minimum Invoice Amount",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "depends_on": "allocation",
+ "fieldname": "sec_break2",
+ "fieldtype": "Section Break",
+ "label": "Allocated Entries"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "maximum_amount",
- "fieldtype": "Currency",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Maximum Invoice Amount",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "invoices",
+ "fieldtype": "Table",
+ "label": "Invoices",
+ "options": "Payment Reconciliation Invoice"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "description": "System will fetch all the entries if limit value is zero.",
- "fieldname": "limit",
- "fieldtype": "Int",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Limit",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "column_break_15",
+ "fieldtype": "Column Break"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "get_unreconciled_entries",
- "fieldtype": "Button",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Get Unreconciled Entries",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "allocation",
+ "fieldtype": "Table",
+ "label": "Allocation",
+ "options": "Payment Reconciliation Allocation"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "sec_break1",
- "fieldtype": "Section Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Unreconciled Payment Details",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "column_break_4",
+ "fieldtype": "Column Break"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "payments",
- "fieldtype": "Table",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Payments",
- "length": 0,
- "no_copy": 0,
- "options": "Payment Reconciliation Payment",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "from_invoice_date",
+ "fieldtype": "Date",
+ "in_list_view": 1,
+ "label": "From Invoice Date"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "reconcile",
- "fieldtype": "Button",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Reconcile",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "to_invoice_date",
+ "fieldtype": "Date",
+ "in_list_view": 1,
+ "label": "To Invoice Date"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "sec_break2",
- "fieldtype": "Section Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Invoice/Journal Entry Details",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
- },
+ "fieldname": "minimum_invoice_amount",
+ "fieldtype": "Currency",
+ "label": "Minimum Invoice Amount"
+ },
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "invoices",
- "fieldtype": "Table",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Invoices",
- "length": 0,
- "no_copy": 0,
- "options": "Payment Reconciliation Invoice",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 1,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
+ "description": "System will fetch all the entries if limit value is zero.",
+ "fieldname": "invoice_limit",
+ "fieldtype": "Int",
+ "label": "Invoice Limit"
+ },
+ {
+ "fieldname": "column_break_13",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "from_payment_date",
+ "fieldtype": "Date",
+ "label": "From Payment Date"
+ },
+ {
+ "fieldname": "to_payment_date",
+ "fieldtype": "Date",
+ "label": "To Payment Date"
+ },
+ {
+ "fieldname": "minimum_payment_amount",
+ "fieldtype": "Currency",
+ "label": "Minimum Payment Amount"
+ },
+ {
+ "fieldname": "maximum_payment_amount",
+ "fieldtype": "Currency",
+ "label": "Maximum Payment Amount"
+ },
+ {
+ "fieldname": "payment_limit",
+ "fieldtype": "Int",
+ "label": "Payment Limit"
+ },
+ {
+ "fieldname": "maximum_invoice_amount",
+ "fieldtype": "Currency",
+ "label": "Maximum Invoice Amount"
}
- ],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 1,
- "icon": "icon-resize-horizontal",
- "idx": 0,
- "image_view": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 1,
- "istable": 0,
- "max_attachments": 0,
- "menu_index": 0,
- "modified": "2019-01-15 17:42:21.135214",
- "modified_by": "Administrator",
- "module": "Accounts",
- "name": "Payment Reconciliation",
- "name_case": "",
- "owner": "Administrator",
+ ],
+ "hide_toolbar": 1,
+ "icon": "icon-resize-horizontal",
+ "issingle": 1,
+ "links": [],
+ "modified": "2021-08-30 13:05:51.977861",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Payment Reconciliation",
+ "owner": "Administrator",
"permissions": [
{
- "amend": 0,
- "cancel": 0,
- "create": 1,
- "delete": 1,
- "email": 0,
- "export": 0,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
- "print": 0,
- "read": 1,
- "report": 0,
- "role": "Accounts Manager",
- "set_user_permissions": 0,
- "share": 1,
- "submit": 0,
+ "create": 1,
+ "delete": 1,
+ "read": 1,
+ "role": "Accounts Manager",
+ "share": 1,
"write": 1
- },
+ },
{
- "amend": 0,
- "cancel": 0,
- "create": 1,
- "delete": 1,
- "email": 0,
- "export": 0,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
- "print": 0,
- "read": 1,
- "report": 0,
- "role": "Accounts User",
- "set_user_permissions": 0,
- "share": 1,
- "submit": 0,
+ "create": 1,
+ "delete": 1,
+ "read": 1,
+ "role": "Accounts User",
+ "share": 1,
"write": 1
}
- ],
- "quick_entry": 0,
- "read_only": 0,
- "read_only_onload": 0,
- "show_name_in_global_search": 0,
- "sort_field": "modified",
- "sort_order": "DESC",
- "track_changes": 1,
- "track_seen": 0,
- "track_views": 0
+ ],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
index acfe1fe..9de79ae 100644
--- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
+++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py
@@ -2,14 +2,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe.utils import flt, today
-from frappe import msgprint, _
+
+import frappe
+from frappe import _, msgprint
from frappe.model.document import Document
-from erpnext.accounts.utils import (get_outstanding_invoices,
- update_reference_in_payment_entry, reconcile_against_document)
+from frappe.utils import flt, getdate, nowdate, today
+
+import erpnext
+from erpnext.accounts.utils import get_outstanding_invoices, reconcile_against_document
from erpnext.controllers.accounts_controller import get_advance_payment_entries
+
class PaymentReconciliation(Document):
@frappe.whitelist()
def get_unreconciled_entries(self):
@@ -27,24 +30,32 @@
else:
dr_or_cr_notes = []
- self.add_payment_entries(payment_entries + journal_entries + dr_or_cr_notes)
+ non_reconciled_payments = payment_entries + journal_entries + dr_or_cr_notes
+
+ if self.payment_limit:
+ non_reconciled_payments = non_reconciled_payments[:self.payment_limit]
+
+ non_reconciled_payments = sorted(non_reconciled_payments, key=lambda k: k['posting_date'] or getdate(nowdate()))
+
+ self.add_payment_entries(non_reconciled_payments)
def get_payment_entries(self):
order_doctype = "Sales Order" if self.party_type=="Customer" else "Purchase Order"
+ condition = self.get_conditions(get_payments=True)
payment_entries = get_advance_payment_entries(self.party_type, self.party,
- self.receivable_payable_account, order_doctype, against_all_orders=True, limit=self.limit)
+ self.receivable_payable_account, order_doctype, against_all_orders=True, limit=self.payment_limit,
+ condition=condition)
return payment_entries
def get_jv_entries(self):
+ condition = self.get_conditions()
dr_or_cr = ("credit_in_account_currency" if erpnext.get_party_account_type(self.party_type) == 'Receivable'
else "debit_in_account_currency")
bank_account_condition = "t2.against_account like %(bank_cash_account)s" \
if self.bank_cash_account else "1=1"
- limit_cond = "limit %s" % self.limit if self.limit else ""
-
journal_entries = frappe.db.sql("""
select
"Journal Entry" as reference_type, t1.name as reference_name,
@@ -56,7 +67,7 @@
where
t1.name = t2.parent and t1.docstatus = 1 and t2.docstatus = 1
and t2.party_type = %(party_type)s and t2.party = %(party)s
- and t2.account = %(account)s and {dr_or_cr} > 0
+ and t2.account = %(account)s and {dr_or_cr} > 0 {condition}
and (t2.reference_type is null or t2.reference_type = '' or
(t2.reference_type in ('Sales Order', 'Purchase Order')
and t2.reference_name is not null and t2.reference_name != ''))
@@ -65,11 +76,11 @@
THEN 1=1
ELSE {bank_account_condition}
END)
- order by t1.posting_date {limit_cond}
+ order by t1.posting_date
""".format(**{
"dr_or_cr": dr_or_cr,
"bank_account_condition": bank_account_condition,
- "limit_cond": limit_cond
+ "condition": condition
}), {
"party_type": self.party_type,
"party": self.party,
@@ -80,6 +91,7 @@
return list(journal_entries)
def get_dr_or_cr_notes(self):
+ condition = self.get_conditions(get_return_invoices=True)
dr_or_cr = ("credit_in_account_currency"
if erpnext.get_party_account_type(self.party_type) == 'Receivable' else "debit_in_account_currency")
@@ -90,7 +102,7 @@
if self.party_type == 'Customer' else "Purchase Invoice")
return frappe.db.sql(""" SELECT doc.name as reference_name, %(voucher_type)s as reference_type,
- (sum(gl.{dr_or_cr}) - sum(gl.{reconciled_dr_or_cr})) as amount,
+ (sum(gl.{dr_or_cr}) - sum(gl.{reconciled_dr_or_cr})) as amount, doc.posting_date,
account_currency as currency
FROM `tab{doc}` doc, `tabGL Entry` gl
WHERE
@@ -100,15 +112,17 @@
and gl.against_voucher_type = %(voucher_type)s
and doc.docstatus = 1 and gl.party = %(party)s
and gl.party_type = %(party_type)s and gl.account = %(account)s
- and gl.is_cancelled = 0
+ and gl.is_cancelled = 0 {condition}
GROUP BY doc.name
Having
amount > 0
+ ORDER BY doc.posting_date
""".format(
doc=voucher_type,
dr_or_cr=dr_or_cr,
reconciled_dr_or_cr=reconciled_dr_or_cr,
- party_type_field=frappe.scrub(self.party_type)),
+ party_type_field=frappe.scrub(self.party_type),
+ condition=condition or ""),
{
'party': self.party,
'party_type': self.party_type,
@@ -116,22 +130,23 @@
'account': self.receivable_payable_account
}, as_dict=1)
- def add_payment_entries(self, entries):
+ def add_payment_entries(self, non_reconciled_payments):
self.set('payments', [])
- for e in entries:
+
+ for payment in non_reconciled_payments:
row = self.append('payments', {})
- row.update(e)
+ row.update(payment)
def get_invoice_entries(self):
#Fetch JVs, Sales and Purchase Invoices for 'invoices' to reconcile against
- condition = self.check_condition()
+ condition = self.get_conditions(get_invoices=True)
non_reconciled_invoices = get_outstanding_invoices(self.party_type, self.party,
self.receivable_payable_account, condition=condition)
- if self.limit:
- non_reconciled_invoices = non_reconciled_invoices[:self.limit]
+ if self.invoice_limit:
+ non_reconciled_invoices = non_reconciled_invoices[:self.invoice_limit]
self.add_invoice_entries(non_reconciled_invoices)
@@ -139,41 +154,78 @@
#Populate 'invoices' with JVs and Invoices to reconcile against
self.set('invoices', [])
- for e in non_reconciled_invoices:
- ent = self.append('invoices', {})
- ent.invoice_type = e.get('voucher_type')
- ent.invoice_number = e.get('voucher_no')
- ent.invoice_date = e.get('posting_date')
- ent.amount = flt(e.get('invoice_amount'))
- ent.currency = e.get('currency')
- ent.outstanding_amount = e.get('outstanding_amount')
+ for entry in non_reconciled_invoices:
+ inv = self.append('invoices', {})
+ inv.invoice_type = entry.get('voucher_type')
+ inv.invoice_number = entry.get('voucher_no')
+ inv.invoice_date = entry.get('posting_date')
+ inv.amount = flt(entry.get('invoice_amount'))
+ inv.currency = entry.get('currency')
+ inv.outstanding_amount = flt(entry.get('outstanding_amount'))
@frappe.whitelist()
- def reconcile(self, args):
- for e in self.get('payments'):
- e.invoice_type = None
- if e.invoice_number and " | " in e.invoice_number:
- e.invoice_type, e.invoice_number = e.invoice_number.split(" | ")
+ def allocate_entries(self, args):
+ self.validate_entries()
+ entries = []
+ for pay in args.get('payments'):
+ pay.update({'unreconciled_amount': pay.get('amount')})
+ for inv in args.get('invoices'):
+ if pay.get('amount') >= inv.get('outstanding_amount'):
+ res = self.get_allocated_entry(pay, inv, inv['outstanding_amount'])
+ pay['amount'] = flt(pay.get('amount')) - flt(inv.get('outstanding_amount'))
+ inv['outstanding_amount'] = 0
+ else:
+ res = self.get_allocated_entry(pay, inv, pay['amount'])
+ inv['outstanding_amount'] = flt(inv.get('outstanding_amount')) - flt(pay.get('amount'))
+ pay['amount'] = 0
+ if pay.get('amount') == 0:
+ entries.append(res)
+ break
+ elif inv.get('outstanding_amount') == 0:
+ entries.append(res)
+ continue
+ else:
+ break
- self.get_invoice_entries()
- self.validate_invoice()
+ self.set('allocation', [])
+ for entry in entries:
+ if entry['allocated_amount'] != 0:
+ row = self.append('allocation', {})
+ row.update(entry)
+
+ def get_allocated_entry(self, pay, inv, allocated_amount):
+ return frappe._dict({
+ 'reference_type': pay.get('reference_type'),
+ 'reference_name': pay.get('reference_name'),
+ 'reference_row': pay.get('reference_row'),
+ 'invoice_type': inv.get('invoice_type'),
+ 'invoice_number': inv.get('invoice_number'),
+ 'unreconciled_amount': pay.get('unreconciled_amount'),
+ 'amount': pay.get('amount'),
+ 'allocated_amount': allocated_amount,
+ 'difference_amount': pay.get('difference_amount')
+ })
+
+ @frappe.whitelist()
+ def reconcile(self):
+ self.validate_allocation()
dr_or_cr = ("credit_in_account_currency"
if erpnext.get_party_account_type(self.party_type) == 'Receivable' else "debit_in_account_currency")
- lst = []
+ entry_list = []
dr_or_cr_notes = []
- for e in self.get('payments'):
+ for row in self.get('allocation'):
reconciled_entry = []
- if e.invoice_number and e.allocated_amount:
- if e.reference_type in ['Sales Invoice', 'Purchase Invoice']:
+ if row.invoice_number and row.allocated_amount:
+ if row.reference_type in ['Sales Invoice', 'Purchase Invoice']:
reconciled_entry = dr_or_cr_notes
else:
- reconciled_entry = lst
+ reconciled_entry = entry_list
- reconciled_entry.append(self.get_payment_details(e, dr_or_cr))
+ reconciled_entry.append(self.get_payment_details(row, dr_or_cr))
- if lst:
- reconcile_against_document(lst)
+ if entry_list:
+ reconcile_against_document(entry_list)
if dr_or_cr_notes:
reconcile_dr_cr_note(dr_or_cr_notes, self.company)
@@ -183,98 +235,104 @@
def get_payment_details(self, row, dr_or_cr):
return frappe._dict({
- 'voucher_type': row.reference_type,
- 'voucher_no' : row.reference_name,
- 'voucher_detail_no' : row.reference_row,
- 'against_voucher_type' : row.invoice_type,
- 'against_voucher' : row.invoice_number,
+ 'voucher_type': row.get('reference_type'),
+ 'voucher_no' : row.get('reference_name'),
+ 'voucher_detail_no' : row.get('reference_row'),
+ 'against_voucher_type' : row.get('invoice_type'),
+ 'against_voucher' : row.get('invoice_number'),
'account' : self.receivable_payable_account,
'party_type': self.party_type,
'party': self.party,
- 'is_advance' : row.is_advance,
+ 'is_advance' : row.get('is_advance'),
'dr_or_cr' : dr_or_cr,
- 'unadjusted_amount' : flt(row.amount),
- 'allocated_amount' : flt(row.allocated_amount),
- 'difference_amount': row.difference_amount,
- 'difference_account': row.difference_account
+ 'unreconciled_amount': flt(row.get('unreconciled_amount')),
+ 'unadjusted_amount' : flt(row.get('amount')),
+ 'allocated_amount' : flt(row.get('allocated_amount')),
+ 'difference_amount': flt(row.get('difference_amount')),
+ 'difference_account': row.get('difference_account')
})
- @frappe.whitelist()
- def get_difference_amount(self, child_row):
- if child_row.get("reference_type") != 'Payment Entry': return
-
- child_row = frappe._dict(child_row)
-
- if child_row.invoice_number and " | " in child_row.invoice_number:
- child_row.invoice_type, child_row.invoice_number = child_row.invoice_number.split(" | ")
-
- dr_or_cr = ("credit_in_account_currency"
- if erpnext.get_party_account_type(self.party_type) == 'Receivable' else "debit_in_account_currency")
-
- row = self.get_payment_details(child_row, dr_or_cr)
-
- doc = frappe.get_doc(row.voucher_type, row.voucher_no)
- update_reference_in_payment_entry(row, doc, do_not_save=True)
-
- return doc.difference_amount
-
def check_mandatory_to_fetch(self):
for fieldname in ["company", "party_type", "party", "receivable_payable_account"]:
if not self.get(fieldname):
frappe.throw(_("Please select {0} first").format(self.meta.get_label(fieldname)))
- def validate_invoice(self):
+ def validate_entries(self):
if not self.get("invoices"):
- frappe.throw(_("No records found in the Invoice table"))
+ frappe.throw(_("No records found in the Invoices table"))
if not self.get("payments"):
- frappe.throw(_("No records found in the Payment table"))
+ frappe.throw(_("No records found in the Payments table"))
+ def validate_allocation(self):
unreconciled_invoices = frappe._dict()
- for d in self.get("invoices"):
- unreconciled_invoices.setdefault(d.invoice_type, {}).setdefault(d.invoice_number, d.outstanding_amount)
+
+ for inv in self.get("invoices"):
+ unreconciled_invoices.setdefault(inv.invoice_type, {}).setdefault(inv.invoice_number, inv.outstanding_amount)
invoices_to_reconcile = []
- for p in self.get("payments"):
- if p.invoice_type and p.invoice_number and p.allocated_amount:
- invoices_to_reconcile.append(p.invoice_number)
+ for row in self.get("allocation"):
+ if row.invoice_type and row.invoice_number and row.allocated_amount:
+ invoices_to_reconcile.append(row.invoice_number)
- if p.invoice_number not in unreconciled_invoices.get(p.invoice_type, {}):
- frappe.throw(_("{0}: {1} not found in Invoice Details table")
- .format(p.invoice_type, p.invoice_number))
+ if flt(row.amount) - flt(row.allocated_amount) < 0:
+ frappe.throw(_("Row {0}: Allocated amount {1} must be less than or equal to remaining payment amount {2}")
+ .format(row.idx, row.allocated_amount, row.amount))
- if flt(p.allocated_amount) > flt(p.amount):
- frappe.throw(_("Row {0}: Allocated amount {1} must be less than or equals to Payment Entry amount {2}")
- .format(p.idx, p.allocated_amount, p.amount))
-
- invoice_outstanding = unreconciled_invoices.get(p.invoice_type, {}).get(p.invoice_number)
- if flt(p.allocated_amount) - invoice_outstanding > 0.009:
- frappe.throw(_("Row {0}: Allocated amount {1} must be less than or equals to invoice outstanding amount {2}")
- .format(p.idx, p.allocated_amount, invoice_outstanding))
+ invoice_outstanding = unreconciled_invoices.get(row.invoice_type, {}).get(row.invoice_number)
+ if flt(row.allocated_amount) - invoice_outstanding > 0.009:
+ frappe.throw(_("Row {0}: Allocated amount {1} must be less than or equal to invoice outstanding amount {2}")
+ .format(row.idx, row.allocated_amount, invoice_outstanding))
if not invoices_to_reconcile:
- frappe.throw(_("Please select Allocated Amount, Invoice Type and Invoice Number in atleast one row"))
+ frappe.throw(_("No records found in Allocation table"))
- def check_condition(self):
- cond = " and posting_date >= {0}".format(frappe.db.escape(self.from_date)) if self.from_date else ""
- cond += " and posting_date <= {0}".format(frappe.db.escape(self.to_date)) if self.to_date else ""
- dr_or_cr = ("debit_in_account_currency" if erpnext.get_party_account_type(self.party_type) == 'Receivable'
- else "credit_in_account_currency")
+ def get_conditions(self, get_invoices=False, get_payments=False, get_return_invoices=False):
+ condition = " and company = '{0}' ".format(self.company)
- if self.minimum_amount:
- cond += " and `{0}` >= {1}".format(dr_or_cr, flt(self.minimum_amount))
- if self.maximum_amount:
- cond += " and `{0}` <= {1}".format(dr_or_cr, flt(self.maximum_amount))
+ if get_invoices:
+ condition += " and posting_date >= {0}".format(frappe.db.escape(self.from_invoice_date)) if self.from_invoice_date else ""
+ condition += " and posting_date <= {0}".format(frappe.db.escape(self.to_invoice_date)) if self.to_invoice_date else ""
+ dr_or_cr = ("debit_in_account_currency" if erpnext.get_party_account_type(self.party_type) == 'Receivable'
+ else "credit_in_account_currency")
- return cond
+ if self.minimum_invoice_amount:
+ condition += " and `{0}` >= {1}".format(dr_or_cr, flt(self.minimum_invoice_amount))
+ if self.maximum_invoice_amount:
+ condition += " and `{0}` <= {1}".format(dr_or_cr, flt(self.maximum_invoice_amount))
+
+ elif get_return_invoices:
+ condition = " and doc.company = '{0}' ".format(self.company)
+ condition += " and doc.posting_date >= {0}".format(frappe.db.escape(self.from_payment_date)) if self.from_payment_date else ""
+ condition += " and doc.posting_date <= {0}".format(frappe.db.escape(self.to_payment_date)) if self.to_payment_date else ""
+ dr_or_cr = ("gl.debit_in_account_currency" if erpnext.get_party_account_type(self.party_type) == 'Receivable'
+ else "gl.credit_in_account_currency")
+
+ if self.minimum_invoice_amount:
+ condition += " and `{0}` >= {1}".format(dr_or_cr, flt(self.minimum_payment_amount))
+ if self.maximum_invoice_amount:
+ condition += " and `{0}` <= {1}".format(dr_or_cr, flt(self.maximum_payment_amount))
+
+ else:
+ condition += " and posting_date >= {0}".format(frappe.db.escape(self.from_payment_date)) if self.from_payment_date else ""
+ condition += " and posting_date <= {0}".format(frappe.db.escape(self.to_payment_date)) if self.to_payment_date else ""
+
+ if self.minimum_payment_amount:
+ condition += " and unallocated_amount >= {0}".format(flt(self.minimum_payment_amount)) if get_payments \
+ else " and total_debit >= {0}".format(flt(self.minimum_payment_amount))
+ if self.maximum_payment_amount:
+ condition += " and unallocated_amount <= {0}".format(flt(self.maximum_payment_amount)) if get_payments \
+ else " and total_debit <= {0}".format(flt(self.maximum_payment_amount))
+
+ return condition
def reconcile_dr_cr_note(dr_cr_notes, company):
- for d in dr_cr_notes:
+ for inv in dr_cr_notes:
voucher_type = ('Credit Note'
- if d.voucher_type == 'Sales Invoice' else 'Debit Note')
+ if inv.voucher_type == 'Sales Invoice' else 'Debit Note')
reconcile_dr_or_cr = ('debit_in_account_currency'
- if d.dr_or_cr == 'credit_in_account_currency' else 'credit_in_account_currency')
+ if inv.dr_or_cr == 'credit_in_account_currency' else 'credit_in_account_currency')
company_currency = erpnext.get_company_currency(company)
@@ -283,25 +341,25 @@
"voucher_type": voucher_type,
"posting_date": today(),
"company": company,
- "multi_currency": 1 if d.currency != company_currency else 0,
+ "multi_currency": 1 if inv.currency != company_currency else 0,
"accounts": [
{
- 'account': d.account,
- 'party': d.party,
- 'party_type': d.party_type,
- d.dr_or_cr: abs(d.allocated_amount),
- 'reference_type': d.against_voucher_type,
- 'reference_name': d.against_voucher,
+ 'account': inv.account,
+ 'party': inv.party,
+ 'party_type': inv.party_type,
+ inv.dr_or_cr: abs(inv.allocated_amount),
+ 'reference_type': inv.against_voucher_type,
+ 'reference_name': inv.against_voucher,
'cost_center': erpnext.get_default_cost_center(company)
},
{
- 'account': d.account,
- 'party': d.party,
- 'party_type': d.party_type,
- reconcile_dr_or_cr: (abs(d.allocated_amount)
- if abs(d.unadjusted_amount) > abs(d.allocated_amount) else abs(d.unadjusted_amount)),
- 'reference_type': d.voucher_type,
- 'reference_name': d.voucher_no,
+ 'account': inv.account,
+ 'party': inv.party,
+ 'party_type': inv.party_type,
+ reconcile_dr_or_cr: (abs(inv.allocated_amount)
+ if abs(inv.unadjusted_amount) > abs(inv.allocated_amount) else abs(inv.unadjusted_amount)),
+ 'reference_type': inv.voucher_type,
+ 'reference_name': inv.voucher_no,
'cost_center': erpnext.get_default_cost_center(company)
}
]
diff --git a/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py
new file mode 100644
index 0000000..2271f48
--- /dev/null
+++ b/erpnext/accounts/doctype/payment_reconciliation/test_payment_reconciliation.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+
+# import frappe
+import unittest
+
+
+class TestPaymentReconciliation(unittest.TestCase):
+ pass
diff --git a/erpnext/accounts/doctype/payment_reconciliation_allocation/__init__.py b/erpnext/accounts/doctype/payment_reconciliation_allocation/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/accounts/doctype/payment_reconciliation_allocation/__init__.py
diff --git a/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json b/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json
new file mode 100644
index 0000000..3653501
--- /dev/null
+++ b/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.json
@@ -0,0 +1,137 @@
+{
+ "actions": [],
+ "creation": "2021-08-16 17:04:40.185167",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "reference_type",
+ "reference_name",
+ "column_break_3",
+ "invoice_type",
+ "invoice_number",
+ "section_break_6",
+ "allocated_amount",
+ "unreconciled_amount",
+ "amount",
+ "column_break_8",
+ "is_advance",
+ "section_break_5",
+ "difference_amount",
+ "column_break_7",
+ "difference_account"
+ ],
+ "fields": [
+ {
+ "fieldname": "invoice_number",
+ "fieldtype": "Dynamic Link",
+ "in_list_view": 1,
+ "label": "Invoice Number",
+ "options": "invoice_type",
+ "read_only": 1,
+ "reqd": 1
+ },
+ {
+ "fieldname": "allocated_amount",
+ "fieldtype": "Currency",
+ "in_list_view": 1,
+ "label": "Allocated Amount",
+ "options": "Currency",
+ "reqd": 1
+ },
+ {
+ "fieldname": "column_break_3",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "section_break_5",
+ "fieldtype": "Section Break"
+ },
+ {
+ "fieldname": "difference_account",
+ "fieldtype": "Link",
+ "label": "Difference Account",
+ "options": "Account",
+ "read_only": 1
+ },
+ {
+ "fieldname": "column_break_7",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "difference_amount",
+ "fieldtype": "Currency",
+ "in_list_view": 1,
+ "label": "Difference Amount",
+ "options": "Currency",
+ "read_only": 1
+ },
+ {
+ "fieldname": "reference_name",
+ "fieldtype": "Dynamic Link",
+ "in_list_view": 1,
+ "label": "Reference Name",
+ "options": "reference_type",
+ "read_only": 1,
+ "reqd": 1
+ },
+ {
+ "fieldname": "is_advance",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "label": "Is Advance",
+ "read_only": 1
+ },
+ {
+ "fieldname": "reference_type",
+ "fieldtype": "Link",
+ "label": "Reference Type",
+ "options": "DocType",
+ "read_only": 1,
+ "reqd": 1
+ },
+ {
+ "fieldname": "invoice_type",
+ "fieldtype": "Link",
+ "label": "Invoice Type",
+ "options": "DocType",
+ "read_only": 1,
+ "reqd": 1
+ },
+ {
+ "fieldname": "section_break_6",
+ "fieldtype": "Section Break"
+ },
+ {
+ "fieldname": "column_break_8",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "unreconciled_amount",
+ "fieldtype": "Currency",
+ "hidden": 1,
+ "label": "Unreconciled Amount",
+ "options": "Currency",
+ "read_only": 1
+ },
+ {
+ "fieldname": "amount",
+ "fieldtype": "Currency",
+ "hidden": 1,
+ "label": "Amount",
+ "options": "Currency",
+ "read_only": 1
+ }
+ ],
+ "istable": 1,
+ "links": [],
+ "modified": "2021-08-30 10:58:42.665107",
+ "modified_by": "Administrator",
+ "module": "Accounts",
+ "name": "Payment Reconciliation Allocation",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.py b/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.py
new file mode 100644
index 0000000..9db8e62
--- /dev/null
+++ b/erpnext/accounts/doctype/payment_reconciliation_allocation/payment_reconciliation_allocation.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+
+class PaymentReconciliationAllocation(Document):
+ pass
diff --git a/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json b/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json
index 6a79a85..00c9e12 100644
--- a/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json
+++ b/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.json
@@ -44,7 +44,6 @@
{
"fieldname": "amount",
"fieldtype": "Currency",
- "in_list_view": 1,
"label": "Amount",
"options": "currency",
"read_only": 1
@@ -67,7 +66,7 @@
],
"istable": 1,
"links": [],
- "modified": "2020-07-19 18:12:27.964073",
+ "modified": "2021-08-24 22:42:40.923179",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation Invoice",
diff --git a/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.py b/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.py
index 800d800..5ac1855 100644
--- a/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.py
+++ b/erpnext/accounts/doctype/payment_reconciliation_invoice/payment_reconciliation_invoice.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PaymentReconciliationInvoice(Document):
pass
diff --git a/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json b/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json
index 925a6f1..add07e8 100644
--- a/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json
+++ b/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.json
@@ -11,11 +11,7 @@
"is_advance",
"reference_row",
"col_break1",
- "invoice_number",
"amount",
- "allocated_amount",
- "section_break_10",
- "difference_account",
"difference_amount",
"sec_break1",
"remark",
@@ -41,6 +37,7 @@
{
"fieldname": "posting_date",
"fieldtype": "Date",
+ "in_list_view": 1,
"label": "Posting Date",
"read_only": 1
},
@@ -64,14 +61,6 @@
},
{
"columns": 2,
- "fieldname": "invoice_number",
- "fieldtype": "Select",
- "in_list_view": 1,
- "label": "Invoice Number",
- "reqd": 1
- },
- {
- "columns": 2,
"fieldname": "amount",
"fieldtype": "Currency",
"in_list_view": 1,
@@ -80,56 +69,33 @@
"read_only": 1
},
{
- "columns": 2,
- "fieldname": "allocated_amount",
- "fieldtype": "Currency",
- "in_list_view": 1,
- "label": "Allocated amount",
- "options": "currency",
- "reqd": 1
- },
- {
"fieldname": "sec_break1",
"fieldtype": "Section Break"
},
{
"fieldname": "remark",
"fieldtype": "Small Text",
- "in_list_view": 1,
"label": "Remark",
"read_only": 1
},
{
- "columns": 2,
- "fieldname": "difference_account",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Difference Account",
- "options": "Account"
- },
- {
- "fieldname": "difference_amount",
- "fieldtype": "Currency",
- "label": "Difference Amount",
- "options": "currency",
- "print_hide": 1,
- "read_only": 1
- },
- {
- "fieldname": "section_break_10",
- "fieldtype": "Section Break"
- },
- {
"fieldname": "currency",
"fieldtype": "Link",
"hidden": 1,
"label": "Currency",
"options": "Currency"
+ },
+ {
+ "fieldname": "difference_amount",
+ "fieldtype": "Currency",
+ "label": "Difference Amount",
+ "options": "currency",
+ "read_only": 1
}
],
"istable": 1,
"links": [],
- "modified": "2020-07-19 18:12:41.682347",
+ "modified": "2021-08-30 10:51:48.140062",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Reconciliation Payment",
diff --git a/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.py b/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.py
index c76f785..78c84ff 100644
--- a/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.py
+++ b/erpnext/accounts/doctype/payment_reconciliation_payment/payment_reconciliation_payment.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PaymentReconciliationPayment(Document):
pass
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index f83cb37..2c96749 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -3,18 +3,25 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import json
+
import frappe
from frappe import _
+from frappe.integrations.utils import get_payment_gateway_controller
from frappe.model.document import Document
-from frappe.utils import flt, nowdate, get_url
+from frappe.utils import flt, get_url, nowdate
+from frappe.utils.background_jobs import enqueue
+
+from erpnext.accounts.doctype.payment_entry.payment_entry import (
+ get_company_defaults,
+ get_payment_entry,
+)
+from erpnext.accounts.doctype.subscription_plan.subscription_plan import get_plan_rate
from erpnext.accounts.party import get_party_account, get_party_bank_account
from erpnext.accounts.utils import get_account_currency
-from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry, get_company_defaults
-from frappe.integrations.utils import get_payment_gateway_controller
-from frappe.utils.background_jobs import enqueue
from erpnext.erpnext_integrations.stripe_integration import create_stripe_subscription
-from erpnext.accounts.doctype.subscription_plan.subscription_plan import get_plan_rate
+
class PaymentRequest(Document):
def validate(self):
@@ -542,3 +549,11 @@
}, target_doc, set_missing_values)
return doclist
+
+def validate_payment(doc, method=""):
+ if not frappe.db.has_column(doc.reference_doctype, 'status'):
+ return
+
+ status = frappe.db.get_value(doc.reference_doctype, doc.reference_docname, 'status')
+ if status == 'Paid':
+ frappe.throw(_("The Payment Request {0} is already paid, cannot process payment twice").format(doc.reference_docname))
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payment_request/test_payment_request.py b/erpnext/accounts/doctype/payment_request/test_payment_request.py
index ad6ff6f..c97c873 100644
--- a/erpnext/accounts/doctype/payment_request/test_payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/test_payment_request.py
@@ -3,11 +3,13 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
+
+import frappe
+
from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
from erpnext.setup.utils import get_exchange_rate
test_dependencies = ["Currency Exchange", "Journal Entry", "Contact", "Address"]
diff --git a/erpnext/accounts/doctype/payment_schedule/payment_schedule.py b/erpnext/accounts/doctype/payment_schedule/payment_schedule.py
index 4174017..33d5efa 100644
--- a/erpnext/accounts/doctype/payment_schedule/payment_schedule.py
+++ b/erpnext/accounts/doctype/payment_schedule/payment_schedule.py
@@ -3,6 +3,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
diff --git a/erpnext/accounts/doctype/payment_term/payment_term.py b/erpnext/accounts/doctype/payment_term/payment_term.py
index 5d4df05..a04c183 100644
--- a/erpnext/accounts/doctype/payment_term/payment_term.py
+++ b/erpnext/accounts/doctype/payment_term/payment_term.py
@@ -3,6 +3,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
diff --git a/erpnext/accounts/doctype/payment_term/test_payment_term.py b/erpnext/accounts/doctype/payment_term/test_payment_term.py
index d9baa59..bc0645f 100644
--- a/erpnext/accounts/doctype/payment_term/test_payment_term.py
+++ b/erpnext/accounts/doctype/payment_term/test_payment_term.py
@@ -2,6 +2,7 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
diff --git a/erpnext/accounts/doctype/payment_terms_template/payment_terms_template.py b/erpnext/accounts/doctype/payment_terms_template/payment_terms_template.py
index 39627eb..3568591 100644
--- a/erpnext/accounts/doctype/payment_terms_template/payment_terms_template.py
+++ b/erpnext/accounts/doctype/payment_terms_template/payment_terms_template.py
@@ -5,9 +5,9 @@
from __future__ import unicode_literals
import frappe
-from frappe.model.document import Document
-from frappe.utils import flt, cint
from frappe import _
+from frappe.model.document import Document
+from frappe.utils import flt
class PaymentTermsTemplate(Document):
diff --git a/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py b/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py
index 6daaf1e..2052a50 100644
--- a/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py
+++ b/erpnext/accounts/doctype/payment_terms_template/test_payment_terms_template.py
@@ -2,6 +2,7 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
import frappe
diff --git a/erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.py b/erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.py
index 54c0fda..c857a88 100644
--- a/erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.py
+++ b/erpnext/accounts/doctype/payment_terms_template_detail/payment_terms_template_detail.py
@@ -3,6 +3,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
diff --git a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
index 289278e..888bf9f 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/period_closing_voucher.py
@@ -2,13 +2,18 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import flt
from frappe import _
+from frappe.utils import flt
+
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+ get_dimensions,
+)
from erpnext.accounts.utils import get_account_currency
from erpnext.controllers.accounts_controller import AccountsController
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (get_accounting_dimensions,
- get_dimensions)
+
class PeriodClosingVoucher(AccountsController):
def validate(self):
@@ -54,7 +59,7 @@
if gl_entries:
from erpnext.accounts.general_ledger import make_gl_entries
make_gl_entries(gl_entries)
-
+
def get_gl_entries(self):
gl_entries = []
pl_accounts = self.get_pl_balances()
@@ -77,7 +82,7 @@
gl_entries += gle_for_net_pl_bal
return gl_entries
-
+
def get_pnl_gl_entry(self, pl_accounts):
company_cost_center = frappe.db.get_value("Company", self.company, "cost_center")
gl_entries = []
diff --git a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
index 2a636bb..2d417a4 100644
--- a/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
+++ b/erpnext/accounts/doctype/period_closing_voucher/test_period_closing_voucher.py
@@ -3,13 +3,17 @@
from __future__ import unicode_literals
+
import unittest
+
import frappe
-from frappe.utils import flt, today
-from erpnext.accounts.utils import get_fiscal_year, now
-from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
+from frappe.utils import today
+
from erpnext.accounts.doctype.finance_book.test_finance_book import create_finance_book
+from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+from erpnext.accounts.utils import get_fiscal_year, now
+
class TestPeriodClosingVoucher(unittest.TestCase):
def test_closing_entry(self):
diff --git a/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py b/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py
index 8252872..896ebdf 100644
--- a/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py
+++ b/erpnext/accounts/doctype/pos_closing_entry/pos_closing_entry.py
@@ -3,13 +3,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-import json
from frappe import _
-from frappe.utils import get_datetime, flt
+from frappe.utils import flt, get_datetime
+
+from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import (
+ consolidate_pos_invoices,
+ unconsolidate_pos_invoices,
+)
from erpnext.controllers.status_updater import StatusUpdater
-from erpnext.controllers.taxes_and_totals import get_itemised_tax_breakup_data
-from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import consolidate_pos_invoices, unconsolidate_pos_invoices
+
class POSClosingEntry(StatusUpdater):
def validate(self):
diff --git a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py
index 5b18ebb..44c87d6 100644
--- a/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py
+++ b/erpnext/accounts/doctype/pos_closing_entry/test_pos_closing_entry.py
@@ -2,14 +2,19 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
-import frappe
+
import unittest
-from frappe.utils import nowdate
-from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
+
+import frappe
+
+from erpnext.accounts.doctype.pos_closing_entry.pos_closing_entry import (
+ make_closing_entry_from_opening,
+)
from erpnext.accounts.doctype.pos_invoice.test_pos_invoice import create_pos_invoice
-from erpnext.accounts.doctype.pos_closing_entry.pos_closing_entry import make_closing_entry_from_opening
from erpnext.accounts.doctype.pos_opening_entry.test_pos_opening_entry import create_opening_entry
from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
+from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
+
class TestPOSClosingEntry(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/accounts/doctype/pos_closing_entry_detail/pos_closing_entry_detail.py b/erpnext/accounts/doctype/pos_closing_entry_detail/pos_closing_entry_detail.py
index 46b6c77..4293abd 100644
--- a/erpnext/accounts/doctype/pos_closing_entry_detail/pos_closing_entry_detail.py
+++ b/erpnext/accounts/doctype/pos_closing_entry_detail/pos_closing_entry_detail.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class POSClosingEntryDetail(Document):
pass
diff --git a/erpnext/accounts/doctype/pos_closing_entry_taxes/pos_closing_entry_taxes.py b/erpnext/accounts/doctype/pos_closing_entry_taxes/pos_closing_entry_taxes.py
index f72d9a6..74cf754 100644
--- a/erpnext/accounts/doctype/pos_closing_entry_taxes/pos_closing_entry_taxes.py
+++ b/erpnext/accounts/doctype/pos_closing_entry_taxes/pos_closing_entry_taxes.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class POSClosingEntryTaxes(Document):
pass
diff --git a/erpnext/accounts/doctype/pos_customer_group/pos_customer_group.py b/erpnext/accounts/doctype/pos_customer_group/pos_customer_group.py
index 85c1c9f..570eb9e 100644
--- a/erpnext/accounts/doctype/pos_customer_group/pos_customer_group.py
+++ b/erpnext/accounts/doctype/pos_customer_group/pos_customer_group.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class POSCustomerGroup(Document):
pass
diff --git a/erpnext/accounts/doctype/pos_field/pos_field.py b/erpnext/accounts/doctype/pos_field/pos_field.py
index b4720b3..00faebb 100644
--- a/erpnext/accounts/doctype/pos_field/pos_field.py
+++ b/erpnext/accounts/doctype/pos_field/pos_field.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class POSField(Document):
pass
diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.json b/erpnext/accounts/doctype/pos_invoice/pos_invoice.json
index 19c6c8f..bff8587 100644
--- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.json
+++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.json
@@ -622,6 +622,7 @@
"read_only": 1
},
{
+ "depends_on": "packed_items",
"fieldname": "packing_list",
"fieldtype": "Section Break",
"label": "Packing List",
@@ -629,6 +630,7 @@
"print_hide": 1
},
{
+ "depends_on": "packed_items",
"fieldname": "packed_items",
"fieldtype": "Table",
"label": "Packed Items",
@@ -1564,7 +1566,7 @@
"icon": "fa fa-file-text",
"is_submittable": 1,
"links": [],
- "modified": "2021-08-24 18:19:20.728433",
+ "modified": "2021-08-27 20:12:57.306772",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Invoice",
diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
index 034a217..d6e41e6 100644
--- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
+++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
@@ -3,19 +3,24 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.model.document import Document
-from erpnext.accounts.utils import get_account_currency
-from erpnext.accounts.party import get_party_account, get_due_date
-from frappe.utils import cint, flt, getdate, nowdate, get_link_to_form
-from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request
-from erpnext.accounts.doctype.loyalty_program.loyalty_program import validate_loyalty_points
-from erpnext.stock.doctype.serial_no.serial_no import get_pos_reserved_serial_nos, get_serial_nos
-from erpnext.accounts.doctype.sales_invoice.sales_invoice import SalesInvoice, get_bank_cash_account, update_multi_mode_option, get_mode_of_payment_info
-
+from frappe.utils import cint, flt, get_link_to_form, getdate, nowdate
from six import iteritems
+from erpnext.accounts.doctype.loyalty_program.loyalty_program import validate_loyalty_points
+from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request
+from erpnext.accounts.doctype.sales_invoice.sales_invoice import (
+ SalesInvoice,
+ get_bank_cash_account,
+ get_mode_of_payment_info,
+ update_multi_mode_option,
+)
+from erpnext.accounts.party import get_due_date, get_party_account
+from erpnext.stock.doctype.serial_no.serial_no import get_pos_reserved_serial_nos, get_serial_nos
+
+
class POSInvoice(SalesInvoice):
def __init__(self, *args, **kwargs):
super(POSInvoice, self).__init__(*args, **kwargs)
@@ -309,7 +314,7 @@
def set_pos_fields(self, for_validate=False):
"""Set retail related fields from POS Profiles"""
- from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile
+ from erpnext.stock.get_item_details import get_pos_profile, get_pos_profile_item_details
if not self.pos_profile:
pos_profile = get_pos_profile(self.company) or {}
if not pos_profile:
@@ -519,6 +524,7 @@
@frappe.whitelist()
def make_merge_log(invoices):
import json
+
from six import string_types
if isinstance(invoices, string_types):
diff --git a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
index d2527fb..e6e0dd2 100644
--- a/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
+++ b/erpnext/accounts/doctype/pos_invoice/test_pos_invoice.py
@@ -3,14 +3,18 @@
# See license.txt
from __future__ import unicode_literals
+import copy
+import unittest
+
import frappe
-import unittest, copy, time
-from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
+
from erpnext.accounts.doctype.pos_invoice.pos_invoice import make_sales_return
-from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
-from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
-from erpnext.stock.doctype.item.test_item import make_item
+from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+from erpnext.stock.doctype.item.test_item import make_item
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
+from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
+
class TestPOSInvoice(unittest.TestCase):
@classmethod
@@ -213,8 +217,8 @@
self.assertEqual(pos_return.get('payments')[1].amount, -500)
def test_pos_return_for_serialized_item(self):
- from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+ from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
se = make_serialized_item(company='_Test Company',
target_warehouse="Stores - _TC", cost_center='Main - _TC', expense_account='Cost of Goods Sold - _TC')
@@ -239,8 +243,8 @@
self.assertEqual(pos_return.get('items')[0].serial_no, serial_nos[0])
def test_partial_pos_returns(self):
- from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+ from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
se = make_serialized_item(company='_Test Company',
target_warehouse="Stores - _TC", cost_center='Main - _TC', expense_account='Cost of Goods Sold - _TC')
@@ -293,8 +297,8 @@
self.assertRaises(frappe.ValidationError, inv.insert)
def test_serialized_item_transaction(self):
- from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+ from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
se = make_serialized_item(company='_Test Company',
target_warehouse="Stores - _TC", cost_center='Main - _TC', expense_account='Cost of Goods Sold - _TC')
@@ -324,8 +328,8 @@
self.assertRaises(frappe.ValidationError, pos2.submit)
def test_delivered_serialized_item_transaction(self):
- from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+ from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
se = make_serialized_item(company='_Test Company',
target_warehouse="Stores - _TC", cost_center='Main - _TC', expense_account='Cost of Goods Sold - _TC')
@@ -353,8 +357,10 @@
self.assertRaises(frappe.ValidationError, pos2.submit)
def test_loyalty_points(self):
+ from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
+ get_loyalty_program_details_with_points,
+ )
from erpnext.accounts.doctype.loyalty_program.test_loyalty_program import create_records
- from erpnext.accounts.doctype.loyalty_program.loyalty_program import get_loyalty_program_details_with_points
create_records()
frappe.db.set_value("Customer", "Test Loyalty Customer", "loyalty_program", "Test Single Loyalty")
@@ -374,7 +380,10 @@
self.assertEqual(after_cancel_lp_details.loyalty_points, before_lp_details.loyalty_points)
def test_loyalty_points_redeemption(self):
- from erpnext.accounts.doctype.loyalty_program.loyalty_program import get_loyalty_program_details_with_points
+ from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
+ get_loyalty_program_details_with_points,
+ )
+
# add 10 loyalty points
create_pos_invoice(customer="Test Loyalty Customer", rate=10000)
@@ -392,8 +401,12 @@
self.assertEqual(after_redeem_lp_details.loyalty_points, 9)
def test_merging_into_sales_invoice_with_discount(self):
- from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import init_user_and_profile
- from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import consolidate_pos_invoices
+ from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import (
+ init_user_and_profile,
+ )
+ from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import (
+ consolidate_pos_invoices,
+ )
frappe.db.sql("delete from `tabPOS Invoice`")
test_user, pos_profile = init_user_and_profile()
@@ -416,8 +429,12 @@
self.assertEqual(rounded_total, 3470)
def test_merging_into_sales_invoice_with_discount_and_inclusive_tax(self):
- from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import init_user_and_profile
- from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import consolidate_pos_invoices
+ from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import (
+ init_user_and_profile,
+ )
+ from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import (
+ consolidate_pos_invoices,
+ )
frappe.db.sql("delete from `tabPOS Invoice`")
test_user, pos_profile = init_user_and_profile()
@@ -457,8 +474,12 @@
self.assertEqual(rounded_total, 840)
def test_merging_with_validate_selling_price(self):
- from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import init_user_and_profile
- from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import consolidate_pos_invoices
+ from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import (
+ init_user_and_profile,
+ )
+ from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import (
+ consolidate_pos_invoices,
+ )
if not frappe.db.get_single_value("Selling Settings", "validate_selling_price"):
frappe.db.set_value("Selling Settings", "Selling Settings", "validate_selling_price", 1)
diff --git a/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.py b/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.py
index 92ce61b..99e4719 100644
--- a/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.py
+++ b/erpnext/accounts/doctype/pos_invoice_item/pos_invoice_item.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class POSInvoiceItem(Document):
pass
diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
index e50d437..0be8ca7 100644
--- a/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
+++ b/erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
@@ -3,17 +3,19 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+import json
+
import frappe
+import six
from frappe import _
-from frappe.model import default_fields
+from frappe.core.page.background_jobs.background_jobs import get_info
from frappe.model.document import Document
+from frappe.model.mapper import map_child_doc, map_doc
from frappe.utils import flt, getdate, nowdate
from frappe.utils.background_jobs import enqueue
-from frappe.model.mapper import map_doc, map_child_doc
from frappe.utils.scheduler import is_scheduler_inactive
-from frappe.core.page.background_jobs.background_jobs import get_info
-import json
-import six
+
class POSInvoiceMergeLog(Document):
def validate(self):
diff --git a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py
index 1b96594..c531bb9 100644
--- a/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py
+++ b/erpnext/accounts/doctype/pos_invoice_merge_log/test_pos_invoice_merge_log.py
@@ -3,13 +3,18 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
-import unittest
import json
-from erpnext.accounts.doctype.pos_invoice.test_pos_invoice import create_pos_invoice
-from erpnext.accounts.doctype.pos_invoice.pos_invoice import make_sales_return
-from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import consolidate_pos_invoices
+import unittest
+
+import frappe
+
from erpnext.accounts.doctype.pos_closing_entry.test_pos_closing_entry import init_user_and_profile
+from erpnext.accounts.doctype.pos_invoice.pos_invoice import make_sales_return
+from erpnext.accounts.doctype.pos_invoice.test_pos_invoice import create_pos_invoice
+from erpnext.accounts.doctype.pos_invoice_merge_log.pos_invoice_merge_log import (
+ consolidate_pos_invoices,
+)
+
class TestPOSInvoiceMergeLog(unittest.TestCase):
def test_consolidated_invoice_creation(self):
diff --git a/erpnext/accounts/doctype/pos_invoice_reference/pos_invoice_reference.py b/erpnext/accounts/doctype/pos_invoice_reference/pos_invoice_reference.py
index 4c45265..9bce082 100644
--- a/erpnext/accounts/doctype/pos_invoice_reference/pos_invoice_reference.py
+++ b/erpnext/accounts/doctype/pos_invoice_reference/pos_invoice_reference.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class POSInvoiceReference(Document):
pass
diff --git a/erpnext/accounts/doctype/pos_item_group/pos_item_group.py b/erpnext/accounts/doctype/pos_item_group/pos_item_group.py
index ceaa57b..b5ff794 100644
--- a/erpnext/accounts/doctype/pos_item_group/pos_item_group.py
+++ b/erpnext/accounts/doctype/pos_item_group/pos_item_group.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class POSItemGroup(Document):
pass
diff --git a/erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.py b/erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.py
index 3318fef..979479f 100644
--- a/erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.py
+++ b/erpnext/accounts/doctype/pos_opening_entry/pos_opening_entry.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import cint, get_link_to_form
+
from erpnext.controllers.status_updater import StatusUpdater
+
class POSOpeningEntry(StatusUpdater):
def validate(self):
self.validate_pos_profile_and_cashier()
diff --git a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py
index c115be5..35a2b58 100644
--- a/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py
+++ b/erpnext/accounts/doctype/pos_opening_entry/test_pos_opening_entry.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestPOSOpeningEntry(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/pos_opening_entry_detail/pos_opening_entry_detail.py b/erpnext/accounts/doctype/pos_opening_entry_detail/pos_opening_entry_detail.py
index 5557062..be5d876 100644
--- a/erpnext/accounts/doctype/pos_opening_entry_detail/pos_opening_entry_detail.py
+++ b/erpnext/accounts/doctype/pos_opening_entry_detail/pos_opening_entry_detail.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class POSOpeningEntryDetail(Document):
pass
diff --git a/erpnext/accounts/doctype/pos_payment_method/pos_payment_method.py b/erpnext/accounts/doctype/pos_payment_method/pos_payment_method.py
index 8a46d84..851d8ef 100644
--- a/erpnext/accounts/doctype/pos_payment_method/pos_payment_method.py
+++ b/erpnext/accounts/doctype/pos_payment_method/pos_payment_method.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class POSPaymentMethod(Document):
pass
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py
index cf7ed26..b64e2ed 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.py
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py
@@ -2,11 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import msgprint, _
-from frappe.utils import cint, now, get_link_to_form
-from six import iteritems
+from frappe import _, msgprint
from frappe.model.document import Document
+from frappe.utils import get_link_to_form, now
+from six import iteritems
+
class POSProfile(Document):
def validate(self):
diff --git a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py
index 0033965..83ecfb4 100644
--- a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py
+++ b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py
@@ -3,10 +3,12 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.stock.get_item_details import get_pos_profile
+
+import frappe
+
from erpnext.accounts.doctype.pos_profile.pos_profile import get_child_nodes
+from erpnext.stock.get_item_details import get_pos_profile
test_dependencies = ['Item']
diff --git a/erpnext/accounts/doctype/pos_profile_user/pos_profile_user.py b/erpnext/accounts/doctype/pos_profile_user/pos_profile_user.py
index d77cdde..404c4ab 100644
--- a/erpnext/accounts/doctype/pos_profile_user/pos_profile_user.py
+++ b/erpnext/accounts/doctype/pos_profile_user/pos_profile_user.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class POSProfileUser(Document):
pass
diff --git a/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py b/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py
index 5c69ab1..dca3556 100644
--- a/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py
+++ b/erpnext/accounts/doctype/pos_profile_user/test_pos_profile_user.py
@@ -5,5 +5,6 @@
import unittest
+
class TestPOSProfileUser(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/pos_search_fields/pos_search_fields.py b/erpnext/accounts/doctype/pos_search_fields/pos_search_fields.py
index 720ea77..32f9f92 100644
--- a/erpnext/accounts/doctype/pos_search_fields/pos_search_fields.py
+++ b/erpnext/accounts/doctype/pos_search_fields/pos_search_fields.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class POSSearchFields(Document):
pass
diff --git a/erpnext/accounts/doctype/pos_settings/pos_settings.py b/erpnext/accounts/doctype/pos_settings/pos_settings.py
index d925dd9..5c5aaa0 100644
--- a/erpnext/accounts/doctype/pos_settings/pos_settings.py
+++ b/erpnext/accounts/doctype/pos_settings/pos_settings.py
@@ -3,9 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class POSSettings(Document):
def validate(self):
pass
diff --git a/erpnext/accounts/doctype/pos_settings/test_pos_settings.py b/erpnext/accounts/doctype/pos_settings/test_pos_settings.py
index a3df108..949fed7 100644
--- a/erpnext/accounts/doctype/pos_settings/test_pos_settings.py
+++ b/erpnext/accounts/doctype/pos_settings/test_pos_settings.py
@@ -5,5 +5,6 @@
import unittest
+
class TestPOSSettings(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index 4903c50..e5bf3b8 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -3,15 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-import json
+
import copy
+import json
import re
-from frappe import throw, _
-from frappe.utils import flt, cint, getdate
+import frappe
+from frappe import _, throw
from frappe.model.document import Document
-
+from frappe.utils import cint, flt, getdate
from six import string_types
apply_on_dict = {"Item Code": "items",
@@ -203,13 +203,13 @@
serialized_items = dict()
for item_code, val in query_items:
serialized_items.setdefault(item_code, val)
-
+
for item in item_list:
args_copy = copy.deepcopy(args)
args_copy.update(item)
data = get_pricing_rule_for_item(args_copy, item.get('price_list_rate'), doc=doc)
out.append(data)
-
+
if serialized_items.get(item.get('item_code')) and not item.get("serial_no") and set_serial_nos_based_on_fifo and not args.get('is_return'):
out[0].update(get_serial_no_for_item(args_copy))
@@ -228,8 +228,12 @@
return item_details
def get_pricing_rule_for_item(args, price_list_rate=0, doc=None, for_validate=False):
- from erpnext.accounts.doctype.pricing_rule.utils import (get_pricing_rules,
- get_applied_pricing_rules, get_pricing_rule_items, get_product_discount_rule)
+ from erpnext.accounts.doctype.pricing_rule.utils import (
+ get_applied_pricing_rules,
+ get_pricing_rule_items,
+ get_pricing_rules,
+ get_product_discount_rule,
+ )
if isinstance(doc, string_types):
doc = json.loads(doc)
@@ -315,9 +319,8 @@
if not (args.item_group and args.brand):
try:
args.item_group, args.brand = frappe.get_cached_value("Item", args.item_code, ["item_group", "brand"])
- except TypeError:
- # invalid item_code
- return item_details
+ except frappe.DoesNotExistError:
+ return
if not args.item_group:
frappe.throw(_("Item Group not mentioned in item master for item {0}").format(args.item_code))
@@ -390,8 +393,10 @@
if pricing_rule else args.get(field, 0))
def remove_pricing_rule_for_item(pricing_rules, item_details, item_code=None):
- from erpnext.accounts.doctype.pricing_rule.utils import (get_applied_pricing_rules,
- get_pricing_rule_items)
+ from erpnext.accounts.doctype.pricing_rule.utils import (
+ get_applied_pricing_rules,
+ get_pricing_rule_items,
+ )
for d in get_applied_pricing_rules(pricing_rules):
if not d or not frappe.db.exists("Pricing Rule", d): continue
pricing_rule = frappe.get_cached_doc('Pricing Rule', d)
diff --git a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
index 680370b..2e2d425 100644
--- a/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/test_pricing_rule.py
@@ -3,14 +3,18 @@
from __future__ import unicode_literals
+
import unittest
+
import frappe
-from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
-from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
-from erpnext.stock.get_item_details import get_item_details
from frappe import MandatoryError
-from erpnext.stock.doctype.item.test_item import make_item
+
+from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
from erpnext.healthcare.doctype.lab_test_template.lab_test_template import make_item_price
+from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
+from erpnext.stock.doctype.item.test_item import make_item
+from erpnext.stock.get_item_details import get_item_details
+
class TestPricingRule(unittest.TestCase):
def setUp(self):
@@ -21,9 +25,10 @@
delete_existing_pricing_rules()
def test_pricing_rule_for_discount(self):
- from erpnext.stock.get_item_details import get_item_details
from frappe import MandatoryError
+ from erpnext.stock.get_item_details import get_item_details
+
test_record = {
"doctype": "Pricing Rule",
"title": "_Test Pricing Rule",
@@ -103,9 +108,10 @@
self.assertEqual(details.get("discount_percentage"), 15)
def test_pricing_rule_for_margin(self):
- from erpnext.stock.get_item_details import get_item_details
from frappe import MandatoryError
+ from erpnext.stock.get_item_details import get_item_details
+
test_record = {
"doctype": "Pricing Rule",
"title": "_Test Pricing Rule",
@@ -196,9 +202,10 @@
self.assertEqual(details.get("discount_percentage"), 10)
def test_pricing_rule_for_variants(self):
- from erpnext.stock.get_item_details import get_item_details
from frappe import MandatoryError
+ from erpnext.stock.get_item_details import get_item_details
+
if not frappe.db.exists("Item", "Test Variant PRT"):
frappe.get_doc({
"doctype": "Item",
diff --git a/erpnext/accounts/doctype/pricing_rule/utils.py b/erpnext/accounts/doctype/pricing_rule/utils.py
index 5467cb0..12b486e 100644
--- a/erpnext/accounts/doctype/pricing_rule/utils.py
+++ b/erpnext/accounts/doctype/pricing_rule/utils.py
@@ -8,14 +8,14 @@
import copy
import json
-from six import string_types
-
import frappe
+from frappe import _, bold
+from frappe.utils import cint, flt, fmt_money, get_link_to_form, getdate, today
+
from erpnext.setup.doctype.item_group.item_group import get_child_item_groups
from erpnext.stock.doctype.warehouse.warehouse import get_child_warehouses
from erpnext.stock.get_item_details import get_conversion_factor
-from frappe import _, bold
-from frappe.utils import cint, flt, get_link_to_form, getdate, today, fmt_money
+
class MultiplePricingRuleConflict(frappe.ValidationError): pass
@@ -81,7 +81,7 @@
try:
if frappe.safe_eval(pricing_rule.condition, None, doc.as_dict()):
filtered_pricing_rules.append(pricing_rule)
- except:
+ except Exception:
pass
else:
filtered_pricing_rules.append(pricing_rule)
diff --git a/erpnext/accounts/doctype/pricing_rule_brand/pricing_rule_brand.py b/erpnext/accounts/doctype/pricing_rule_brand/pricing_rule_brand.py
index e2f70af..5e10b84 100644
--- a/erpnext/accounts/doctype/pricing_rule_brand/pricing_rule_brand.py
+++ b/erpnext/accounts/doctype/pricing_rule_brand/pricing_rule_brand.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PricingRuleBrand(Document):
pass
diff --git a/erpnext/accounts/doctype/pricing_rule_detail/pricing_rule_detail.py b/erpnext/accounts/doctype/pricing_rule_detail/pricing_rule_detail.py
index 3cb7da9..a90ecbb 100644
--- a/erpnext/accounts/doctype/pricing_rule_detail/pricing_rule_detail.py
+++ b/erpnext/accounts/doctype/pricing_rule_detail/pricing_rule_detail.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PricingRuleDetail(Document):
pass
diff --git a/erpnext/accounts/doctype/pricing_rule_item_code/pricing_rule_item_code.py b/erpnext/accounts/doctype/pricing_rule_item_code/pricing_rule_item_code.py
index 4468620..4746b39 100644
--- a/erpnext/accounts/doctype/pricing_rule_item_code/pricing_rule_item_code.py
+++ b/erpnext/accounts/doctype/pricing_rule_item_code/pricing_rule_item_code.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PricingRuleItemCode(Document):
pass
diff --git a/erpnext/accounts/doctype/pricing_rule_item_group/pricing_rule_item_group.py b/erpnext/accounts/doctype/pricing_rule_item_group/pricing_rule_item_group.py
index d3c3619..ff1ba75 100644
--- a/erpnext/accounts/doctype/pricing_rule_item_group/pricing_rule_item_group.py
+++ b/erpnext/accounts/doctype/pricing_rule_item_group/pricing_rule_item_group.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PricingRuleItemGroup(Document):
pass
diff --git a/erpnext/accounts/doctype/process_deferred_accounting/process_deferred_accounting.py b/erpnext/accounts/doctype/process_deferred_accounting/process_deferred_accounting.py
index 5e7583a..72b7b23 100644
--- a/erpnext/accounts/doctype/process_deferred_accounting/process_deferred_accounting.py
+++ b/erpnext/accounts/doctype/process_deferred_accounting/process_deferred_accounting.py
@@ -3,13 +3,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-import erpnext
from frappe import _
from frappe.model.document import Document
+
+from erpnext.accounts.deferred_revenue import (
+ build_conditions,
+ convert_deferred_expense_to_expense,
+ convert_deferred_revenue_to_income,
+)
from erpnext.accounts.general_ledger import make_reverse_gl_entries
-from erpnext.accounts.deferred_revenue import convert_deferred_expense_to_expense, \
- convert_deferred_revenue_to_income, build_conditions
+
class ProcessDeferredAccounting(Document):
def validate(self):
diff --git a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py
index 03c269a..69e2caa 100644
--- a/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py
+++ b/erpnext/accounts/doctype/process_deferred_accounting/test_process_deferred_accounting.py
@@ -3,11 +3,17 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
+
from erpnext.accounts.doctype.account.test_account import create_account
+from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import (
+ check_gl_entries,
+ create_sales_invoice,
+)
from erpnext.stock.doctype.item.test_item import create_item
-from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice, check_gl_entries
+
class TestProcessDeferredAccounting(unittest.TestCase):
def test_creation_of_ledger_entry_on_submit(self):
diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
index a12ea40..73f3038 100644
--- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
+++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py
@@ -3,22 +3,24 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+import copy
+
import frappe
from frappe import _
from frappe.model.document import Document
-from erpnext.accounts.report.general_ledger.general_ledger import execute as get_soa
-from erpnext.accounts.report.accounts_receivable_summary.accounts_receivable_summary import execute as get_ageing
+from frappe.utils import add_days, add_months, format_date, getdate, today
+from frappe.utils.jinja import validate_template
+from frappe.utils.pdf import get_pdf
+from frappe.www.printview import get_print_style
+
from erpnext import get_company_currency
from erpnext.accounts.party import get_party_account_currency
+from erpnext.accounts.report.accounts_receivable_summary.accounts_receivable_summary import (
+ execute as get_ageing,
+)
+from erpnext.accounts.report.general_ledger.general_ledger import execute as get_soa
-from frappe.utils.print_format import report_to_pdf
-from frappe.utils.pdf import get_pdf
-from frappe.utils import today, add_days, add_months, getdate, format_date
-from frappe.utils.jinja import validate_template
-
-import copy
-from datetime import timedelta
-from frappe.www.printview import get_print_style
class ProcessStatementOfAccounts(Document):
def validate(self):
@@ -158,7 +160,7 @@
if doc.cc_to != '':
try:
cc=[frappe.get_value('User', doc.cc_to, 'email')]
- except:
+ except Exception:
pass
return recipients, cc
diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py b/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py
index 30efbb3..7ddcd10 100644
--- a/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py
+++ b/erpnext/accounts/doctype/process_statement_of_accounts/test_process_statement_of_accounts.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestProcessStatementOfAccounts(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/process_statement_of_accounts_customer/process_statement_of_accounts_customer.py b/erpnext/accounts/doctype/process_statement_of_accounts_customer/process_statement_of_accounts_customer.py
index 1a76010..fe94009 100644
--- a/erpnext/accounts/doctype/process_statement_of_accounts_customer/process_statement_of_accounts_customer.py
+++ b/erpnext/accounts/doctype/process_statement_of_accounts_customer/process_statement_of_accounts_customer.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ProcessStatementOfAccountsCustomer(Document):
pass
diff --git a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.py b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.py
index 3d7a891..d09f7dc 100644
--- a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.py
+++ b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme.py
@@ -3,10 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import cstr
-from frappe.model.naming import make_autoname
from frappe.model.document import Document
pricing_rule_fields = ['apply_on', 'mixed_conditions', 'is_cumulative', 'other_item_code', 'other_item_group',
diff --git a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme_dashboard.py b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme_dashboard.py
index 54fedb7..6d07924 100644
--- a/erpnext/accounts/doctype/promotional_scheme/promotional_scheme_dashboard.py
+++ b/erpnext/accounts/doctype/promotional_scheme/promotional_scheme_dashboard.py
@@ -1,5 +1,6 @@
from frappe import _
+
def get_data():
return {
'fieldname': 'promotional_scheme',
diff --git a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
index 286f7cf..190b734 100644
--- a/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
+++ b/erpnext/accounts/doctype/promotional_scheme/test_promotional_scheme.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestPromotionalScheme(unittest.TestCase):
def test_promotional_scheme(self):
ps = make_promotional_scheme()
diff --git a/erpnext/accounts/doctype/promotional_scheme_price_discount/promotional_scheme_price_discount.py b/erpnext/accounts/doctype/promotional_scheme_price_discount/promotional_scheme_price_discount.py
index 380ae32..ab8efc3 100644
--- a/erpnext/accounts/doctype/promotional_scheme_price_discount/promotional_scheme_price_discount.py
+++ b/erpnext/accounts/doctype/promotional_scheme_price_discount/promotional_scheme_price_discount.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PromotionalSchemePriceDiscount(Document):
pass
diff --git a/erpnext/accounts/doctype/promotional_scheme_product_discount/promotional_scheme_product_discount.py b/erpnext/accounts/doctype/promotional_scheme_product_discount/promotional_scheme_product_discount.py
index 2931106..85019b4 100644
--- a/erpnext/accounts/doctype/promotional_scheme_product_discount/promotional_scheme_product_discount.py
+++ b/erpnext/accounts/doctype/promotional_scheme_product_discount/promotional_scheme_product_discount.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PromotionalSchemeProductDiscount(Document):
pass
diff --git a/erpnext/accounts/doctype/psoa_cost_center/psoa_cost_center.py b/erpnext/accounts/doctype/psoa_cost_center/psoa_cost_center.py
index 0aeef3e..cb5aaa9 100644
--- a/erpnext/accounts/doctype/psoa_cost_center/psoa_cost_center.py
+++ b/erpnext/accounts/doctype/psoa_cost_center/psoa_cost_center.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class PSOACostCenter(Document):
pass
diff --git a/erpnext/accounts/doctype/psoa_project/psoa_project.py b/erpnext/accounts/doctype/psoa_project/psoa_project.py
index f4a5dee..1cd9951 100644
--- a/erpnext/accounts/doctype/psoa_project/psoa_project.py
+++ b/erpnext/accounts/doctype/psoa_project/psoa_project.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class PSOAProject(Document):
pass
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index e2f02f3..62cd90e 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -3,29 +3,43 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe.utils import cint, cstr, formatdate, flt, getdate, nowdate, get_link_to_form
-from frappe import _, throw
-import frappe.defaults
-from erpnext.assets.doctype.asset_category.asset_category import get_asset_category_account
-from erpnext.controllers.buying_controller import BuyingController
-from erpnext.accounts.party import get_party_account, get_due_date
-from erpnext.accounts.utils import get_account_currency, get_fiscal_year
-from erpnext.stock.doctype.purchase_receipt.purchase_receipt import update_billed_amount_based_on_po
-from erpnext.stock import get_warehouse_account_map
-from erpnext.accounts.general_ledger import make_gl_entries, merge_similar_entries, make_reverse_gl_entries
-from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt
-from erpnext.buying.utils import check_on_hold_or_closed_status
-from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center
-from erpnext.assets.doctype.asset.asset import get_asset_account, is_cwip_accounting_enabled
+import frappe
+from frappe import _, throw
from frappe.model.mapper import get_mapped_doc
+from frappe.utils import cint, cstr, flt, formatdate, get_link_to_form, getdate, nowdate
from six import iteritems
-from erpnext.accounts.doctype.sales_invoice.sales_invoice import validate_inter_company_party, update_linked_doc,\
- unlink_inter_company_doc, check_if_return_invoice_linked_with_payment_entry
-from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import get_party_tax_withholding_details
+
+import erpnext
from erpnext.accounts.deferred_revenue import validate_service_stop_date
-from erpnext.stock.doctype.purchase_receipt.purchase_receipt import get_item_account_wise_additional_cost
+from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt
+from erpnext.accounts.doctype.sales_invoice.sales_invoice import (
+ check_if_return_invoice_linked_with_payment_entry,
+ unlink_inter_company_doc,
+ update_linked_doc,
+ validate_inter_company_party,
+)
+from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import (
+ get_party_tax_withholding_details,
+)
+from erpnext.accounts.general_ledger import (
+ get_round_off_account_and_cost_center,
+ make_gl_entries,
+ make_reverse_gl_entries,
+ merge_similar_entries,
+)
+from erpnext.accounts.party import get_due_date, get_party_account
+from erpnext.accounts.utils import get_account_currency, get_fiscal_year
+from erpnext.assets.doctype.asset.asset import get_asset_account, is_cwip_accounting_enabled
+from erpnext.assets.doctype.asset_category.asset_category import get_asset_category_account
+from erpnext.buying.utils import check_on_hold_or_closed_status
+from erpnext.controllers.buying_controller import BuyingController
+from erpnext.stock import get_warehouse_account_map
+from erpnext.stock.doctype.purchase_receipt.purchase_receipt import (
+ get_item_account_wise_additional_cost,
+ update_billed_amount_based_on_po,
+)
+
class WarehouseMissingError(frappe.ValidationError): pass
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py
index b6467a3..4cc319d 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'purchase_invoice',
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index 06f4fdb..51f58b7 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -3,20 +3,25 @@
from __future__ import unicode_literals
+
import unittest
-import frappe, erpnext
-import frappe.model
+
+import frappe
+from frappe.utils import add_days, cint, flt, getdate, nowdate, today
+
+import erpnext
+from erpnext.accounts.doctype.account.test_account import create_account, get_inventory_account
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
-from frappe.utils import cint, flt, today, nowdate, add_days, getdate
-import frappe.defaults
-from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt, get_taxes
+from erpnext.buying.doctype.supplier.test_supplier import create_supplier
from erpnext.controllers.accounts_controller import get_payment_terms
from erpnext.exceptions import InvalidCurrency
-from erpnext.stock.doctype.stock_entry.test_stock_entry import get_qty_after_transaction
from erpnext.projects.doctype.project.test_project import make_project
-from erpnext.accounts.doctype.account.test_account import get_inventory_account, create_account
from erpnext.stock.doctype.item.test_item import create_item
-from erpnext.buying.doctype.supplier.test_supplier import create_supplier
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import (
+ get_taxes,
+ make_purchase_receipt,
+)
+from erpnext.stock.doctype.stock_entry.test_stock_entry import get_qty_after_transaction
test_dependencies = ["Item", "Cost Center", "Payment Term", "Payment Terms Template"]
test_ignore = ["Serial No"]
@@ -231,7 +236,9 @@
self.assertEqual(expected_values[gle.account][2], gle.credit)
def test_purchase_invoice_with_exchange_rate_difference(self):
- from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice as create_purchase_invoice
+ from erpnext.stock.doctype.purchase_receipt.purchase_receipt import (
+ make_purchase_invoice as create_purchase_invoice,
+ )
pr = make_purchase_receipt(company="_Test Company with perpetual inventory", warehouse='Stores - TCP1',
currency = "USD", conversion_rate = 70)
@@ -401,8 +408,9 @@
self.assertEqual(tax.total, expected_values[i][2])
def test_purchase_invoice_with_advance(self):
- from erpnext.accounts.doctype.journal_entry.test_journal_entry \
- import test_records as jv_test_records
+ from erpnext.accounts.doctype.journal_entry.test_journal_entry import (
+ test_records as jv_test_records,
+ )
jv = frappe.copy_doc(jv_test_records[1])
jv.insert()
@@ -441,8 +449,9 @@
where reference_type='Purchase Invoice' and reference_name=%s""", pi.name))
def test_invoice_with_advance_and_multi_payment_terms(self):
- from erpnext.accounts.doctype.journal_entry.test_journal_entry \
- import test_records as jv_test_records
+ from erpnext.accounts.doctype.journal_entry.test_journal_entry import (
+ test_records as jv_test_records,
+ )
jv = frappe.copy_doc(jv_test_records[1])
jv.insert()
@@ -714,8 +723,9 @@
"warehouse"), pi.get("items")[0].rejected_warehouse)
def test_outstanding_amount_after_advance_jv_cancelation(self):
- from erpnext.accounts.doctype.journal_entry.test_journal_entry \
- import test_records as jv_test_records
+ from erpnext.accounts.doctype.journal_entry.test_journal_entry import (
+ test_records as jv_test_records,
+ )
jv = frappe.copy_doc(jv_test_records[1])
jv.accounts[0].is_advance = 'Yes'
@@ -794,8 +804,7 @@
self.assertEqual(flt(pi.outstanding_amount), flt(pi.rounded_total + pi.total_advance))
def test_purchase_invoice_with_shipping_rule(self):
- from erpnext.accounts.doctype.shipping_rule.test_shipping_rule \
- import create_shipping_rule
+ from erpnext.accounts.doctype.shipping_rule.test_shipping_rule import create_shipping_rule
shipping_rule = create_shipping_rule(shipping_rule_type = "Buying", shipping_rule_name = "Shipping Rule - Purchase Invoice Test")
@@ -1133,9 +1142,9 @@
frappe.db.set_value("Company", "_Test Company", "exchange_gain_loss_account", original_account)
def test_purchase_invoice_advance_taxes(self):
- from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
from erpnext.buying.doctype.purchase_order.purchase_order import get_mapped_purchase_invoice
+ from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
# create a new supplier to test
supplier = create_supplier(supplier_name = '_Test TDS Advance Supplier',
diff --git a/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.py b/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.py
index d157837..ec2ce65 100644
--- a/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.py
+++ b/erpnext/accounts/doctype/purchase_invoice_advance/purchase_invoice_advance.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class PurchaseInvoiceAdvance(Document):
pass
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
index a7618e2..d39a9fc 100644
--- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.json
@@ -8,6 +8,7 @@
"engine": "InnoDB",
"field_order": [
"item_code",
+ "product_bundle",
"col_break1",
"item_name",
"description_section",
@@ -857,12 +858,19 @@
"fieldtype": "Link",
"label": "Discount Account",
"options": "Account"
+ },
+ {
+ "fieldname": "product_bundle",
+ "fieldtype": "Link",
+ "label": "Product Bundle",
+ "options": "Product Bundle",
+ "read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2021-08-12 20:14:48.506639",
+ "modified": "2021-09-01 16:04:03.538643",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",
diff --git a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.py b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.py
index 50ec7d8..ad2a24c 100644
--- a/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.py
+++ b/erpnext/accounts/doctype/purchase_invoice_item/purchase_invoice_item.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class PurchaseInvoiceItem(Document):
pass
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.py b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.py
index 5854dde..34ac257 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.py
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class PurchaseTaxesandCharges(Document):
pass
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.py
index efcef46..53b549f 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.py
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template.py
@@ -3,10 +3,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
-from erpnext.accounts.doctype.sales_taxes_and_charges_template.sales_taxes_and_charges_template \
- import valdiate_taxes_and_charges_template
+
+from erpnext.accounts.doctype.sales_taxes_and_charges_template.sales_taxes_and_charges_template import (
+ valdiate_taxes_and_charges_template,
+)
+
class PurchaseTaxesandChargesTemplate(Document):
def validate(self):
diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py
index 97fbca3..c60c81b 100644
--- a/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py
+++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Purchase Taxes and Charges Template')
diff --git a/erpnext/accounts/doctype/salary_component_account/salary_component_account.py b/erpnext/accounts/doctype/salary_component_account/salary_component_account.py
index 983d015..d96ef62 100644
--- a/erpnext/accounts/doctype/salary_component_account/salary_component_account.py
+++ b/erpnext/accounts/doctype/salary_component_account/salary_component_account.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class SalaryComponentAccount(Document):
pass
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 2dd3d69..2cb9acf 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -578,6 +578,9 @@
frm.add_fetch('payment_term', 'invoice_portion', 'invoice_portion');
frm.add_fetch('payment_term', 'description', 'description');
+ frm.set_df_property('packed_items', 'cannot_add_rows', true);
+ frm.set_df_property('packed_items', 'cannot_delete_rows', true);
+
frm.set_query("account_for_change_amount", function() {
return {
filters: {
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index d8aa32e..b5620ae 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -247,7 +247,7 @@
"depends_on": "customer",
"fetch_from": "customer.customer_name",
"fieldname": "customer_name",
- "fieldtype": "Small Text",
+ "fieldtype": "Data",
"hide_days": 1,
"hide_seconds": 1,
"in_global_search": 1,
@@ -695,7 +695,6 @@
"hide_days": 1,
"hide_seconds": 1,
"label": "Scan Barcode",
- "length": 1,
"options": "Barcode"
},
{
@@ -727,6 +726,7 @@
"read_only": 1
},
{
+ "depends_on": "packed_items",
"fieldname": "packing_list",
"fieldtype": "Section Break",
"hide_days": 1,
@@ -736,6 +736,7 @@
"print_hide": 1
},
{
+ "depends_on": "packed_items",
"fieldname": "packed_items",
"fieldtype": "Table",
"hide_days": 1,
@@ -1060,7 +1061,6 @@
"hide_days": 1,
"hide_seconds": 1,
"label": "Apply Additional Discount On",
- "length": 15,
"options": "\nGrand Total\nNet Total",
"print_hide": 1
},
@@ -1147,7 +1147,7 @@
{
"description": "In Words will be visible once you save the Sales Invoice.",
"fieldname": "base_in_words",
- "fieldtype": "Small Text",
+ "fieldtype": "Data",
"hide_days": 1,
"hide_seconds": 1,
"label": "In Words (Company Currency)",
@@ -1207,7 +1207,7 @@
},
{
"fieldname": "in_words",
- "fieldtype": "Small Text",
+ "fieldtype": "Data",
"hide_days": 1,
"hide_seconds": 1,
"label": "In Words",
@@ -1560,7 +1560,6 @@
"hide_days": 1,
"hide_seconds": 1,
"label": "Print Language",
- "length": 6,
"print_hide": 1,
"read_only": 1
},
@@ -1648,7 +1647,6 @@
"hide_seconds": 1,
"in_standard_filter": 1,
"label": "Status",
- "length": 30,
"no_copy": 1,
"options": "\nDraft\nReturn\nCredit Note Issued\nSubmitted\nPaid\nUnpaid\nUnpaid and Discounted\nOverdue and Discounted\nOverdue\nCancelled\nInternal Transfer",
"print_hide": 1,
@@ -1708,7 +1706,6 @@
"hide_days": 1,
"hide_seconds": 1,
"label": "Is Opening Entry",
- "length": 4,
"oldfieldname": "is_opening",
"oldfieldtype": "Select",
"options": "No\nYes",
@@ -1720,7 +1717,6 @@
"hide_days": 1,
"hide_seconds": 1,
"label": "C-Form Applicable",
- "length": 4,
"no_copy": 1,
"options": "No\nYes",
"print_hide": 1
@@ -2021,7 +2017,7 @@
"link_fieldname": "consolidated_invoice"
}
],
- "modified": "2021-08-25 14:46:05.279588",
+ "modified": "2021-08-27 20:13:40.456462",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index fe3ed16..ec249c2 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -2,34 +2,51 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-import frappe.defaults
-from frappe.utils import cint, flt, getdate, add_days, add_months, cstr, nowdate, get_link_to_form, formatdate
+
+import frappe
from frappe import _, msgprint, throw
-from erpnext.accounts.party import get_party_account, get_due_date, get_party_details
-from frappe.model.mapper import get_mapped_doc
-from erpnext.controllers.selling_controller import SellingController
-from erpnext.accounts.utils import get_account_currency
-from erpnext.stock.doctype.delivery_note.delivery_note import update_billed_amount_based_on_so
-from erpnext.projects.doctype.timesheet.timesheet import get_projectwise_timesheet_data
-from erpnext.assets.doctype.asset.depreciation \
- import get_disposal_account_and_cost_center, get_gl_entries_on_asset_disposal, get_gl_entries_on_asset_regain, post_depreciation_entries
-from erpnext.stock.doctype.batch.batch import set_batch_nos
-from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos, get_delivery_note_serial_no
-from erpnext.setup.doctype.company.company import update_company_current_month_sales
-from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center
-from erpnext.accounts.doctype.loyalty_program.loyalty_program import \
- get_loyalty_program_details_with_points, get_loyalty_details, validate_loyalty_points
-from erpnext.accounts.deferred_revenue import validate_service_stop_date
-from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import get_party_tax_withholding_details
-from frappe.model.utils import get_fetch_values
from frappe.contacts.doctype.address.address import get_address_display
-from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import get_party_tax_withholding_details
-
-from erpnext.healthcare.utils import manage_invoice_submit_cancel
-
+from frappe.model.mapper import get_mapped_doc
+from frappe.model.utils import get_fetch_values
+from frappe.utils import (
+ add_days,
+ add_months,
+ cint,
+ cstr,
+ flt,
+ formatdate,
+ get_link_to_form,
+ getdate,
+ nowdate,
+)
from six import iteritems
+import erpnext
+from erpnext.accounts.deferred_revenue import validate_service_stop_date
+from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
+ get_loyalty_program_details_with_points,
+ validate_loyalty_points,
+)
+from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import (
+ get_party_tax_withholding_details,
+)
+from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center
+from erpnext.accounts.party import get_due_date, get_party_account, get_party_details
+from erpnext.accounts.utils import get_account_currency
+from erpnext.assets.doctype.asset.depreciation import (
+ get_disposal_account_and_cost_center,
+ get_gl_entries_on_asset_disposal,
+ get_gl_entries_on_asset_regain,
+ post_depreciation_entries,
+)
+from erpnext.controllers.selling_controller import SellingController
+from erpnext.healthcare.utils import manage_invoice_submit_cancel
+from erpnext.projects.doctype.timesheet.timesheet import get_projectwise_timesheet_data
+from erpnext.setup.doctype.company.company import update_company_current_month_sales
+from erpnext.stock.doctype.batch.batch import set_batch_nos
+from erpnext.stock.doctype.delivery_note.delivery_note import update_billed_amount_based_on_so
+from erpnext.stock.doctype.serial_no.serial_no import get_delivery_note_serial_no, get_serial_nos
+
form_grid_templates = {
"items": "templates/form_grid/item_grid.html"
}
@@ -481,7 +498,7 @@
if not self.account_for_change_amount:
self.account_for_change_amount = frappe.get_cached_value('Company', self.company, 'default_cash_account')
- from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile
+ from erpnext.stock.get_item_details import get_pos_profile, get_pos_profile_item_details
if not self.pos_profile:
pos_profile = get_pos_profile(self.company) or {}
if not pos_profile:
@@ -1375,8 +1392,10 @@
# redeem the loyalty points.
def apply_loyalty_points(self):
- from erpnext.accounts.doctype.loyalty_point_entry.loyalty_point_entry \
- import get_loyalty_point_entries, get_redemption_details
+ from erpnext.accounts.doctype.loyalty_point_entry.loyalty_point_entry import (
+ get_loyalty_point_entries,
+ get_redemption_details,
+ )
loyalty_point_entries = get_loyalty_point_entries(self.customer, self.loyalty_program, self.company, self.posting_date)
redemption_details = get_redemption_details(self.customer, self.loyalty_program, self.company)
@@ -2009,7 +2028,11 @@
@frappe.whitelist()
def create_dunning(source_name, target_doc=None):
from frappe.model.mapper import get_mapped_doc
- from erpnext.accounts.doctype.dunning.dunning import get_dunning_letter_text, calculate_interest_and_amount
+
+ from erpnext.accounts.doctype.dunning.dunning import (
+ calculate_interest_and_amount,
+ get_dunning_letter_text,
+ )
def set_missing_values(source, target):
target.sales_invoice = source_name
target.outstanding_amount = source.outstanding_amount
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py
index 3238ead..64b35b2 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'sales_invoice',
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index e06a3bb..da0c315 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -2,31 +2,39 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+import copy
+import unittest
-import unittest, copy, time
-from frappe.utils import nowdate, flt, getdate, cint, add_days, add_months
+import frappe
from frappe.model.dynamic_links import get_dynamic_link_map
-from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry, get_qty_after_transaction
-from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import unlink_payment_on_cancel_of_invoice
-from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import WarehouseMissingError
-from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
-from erpnext.assets.doctype.asset.test_asset import create_asset, create_asset_data
-from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries
-from erpnext.exceptions import InvalidAccountCurrency, InvalidCurrency
-from erpnext.stock.doctype.serial_no.serial_no import SerialNoWarehouseError
from frappe.model.naming import make_autoname
-from erpnext.accounts.doctype.account.test_account import get_inventory_account, create_account
-from erpnext.controllers.taxes_and_totals import get_itemised_tax_breakup_data
-from erpnext.stock.doctype.item.test_item import create_item
+from frappe.utils import add_days, flt, getdate, nowdate
from six import iteritems
+
+import erpnext
+from erpnext.accounts.doctype.account.test_account import create_account, get_inventory_account
+from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
+from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import WarehouseMissingError
+from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import (
+ unlink_payment_on_cancel_of_invoice,
+)
from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_inter_company_transaction
-from erpnext.regional.india.utils import get_ewb_data
-from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
-from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
-from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice
-from erpnext.stock.utils import get_incoming_rate
from erpnext.accounts.utils import PaymentEntryUnlinkError
+from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries
+from erpnext.assets.doctype.asset.test_asset import create_asset, create_asset_data
+from erpnext.controllers.taxes_and_totals import get_itemised_tax_breakup_data
+from erpnext.exceptions import InvalidAccountCurrency, InvalidCurrency
+from erpnext.regional.india.utils import get_ewb_data
+from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice
+from erpnext.stock.doctype.item.test_item import create_item
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
+from erpnext.stock.doctype.serial_no.serial_no import SerialNoWarehouseError
+from erpnext.stock.doctype.stock_entry.test_stock_entry import (
+ get_qty_after_transaction,
+ make_stock_entry,
+)
+from erpnext.stock.utils import get_incoming_rate
+
class TestSalesInvoice(unittest.TestCase):
def make(self):
@@ -677,8 +685,9 @@
def test_payment(self):
w = self.make()
- from erpnext.accounts.doctype.journal_entry.test_journal_entry \
- import test_records as jv_test_records
+ from erpnext.accounts.doctype.journal_entry.test_journal_entry import (
+ test_records as jv_test_records,
+ )
jv = frappe.get_doc(frappe.copy_doc(jv_test_records[0]))
jv.get("accounts")[0].reference_type = w.doctype
@@ -944,16 +953,18 @@
def _insert_purchase_receipt(self):
- from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import test_records \
- as pr_test_records
+ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import (
+ test_records as pr_test_records,
+ )
pr = frappe.copy_doc(pr_test_records[0])
pr.naming_series = "_T-Purchase Receipt-"
pr.insert()
pr.submit()
def _insert_delivery_note(self):
- from erpnext.stock.doctype.delivery_note.test_delivery_note import test_records \
- as dn_test_records
+ from erpnext.stock.doctype.delivery_note.test_delivery_note import (
+ test_records as dn_test_records,
+ )
dn = frappe.copy_doc(dn_test_records[0])
dn.naming_series = "_T-Delivery Note-"
dn.insert()
@@ -961,8 +972,9 @@
return dn
def test_sales_invoice_with_advance(self):
- from erpnext.accounts.doctype.journal_entry.test_journal_entry \
- import test_records as jv_test_records
+ from erpnext.accounts.doctype.journal_entry.test_journal_entry import (
+ test_records as jv_test_records,
+ )
jv = frappe.copy_doc(jv_test_records[0])
jv.insert()
@@ -994,8 +1006,8 @@
si.cancel()
def test_serialized(self):
- from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+ from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
se = make_serialized_item()
serial_nos = get_serial_nos(se.get("items")[0].serial_no)
@@ -1048,9 +1060,9 @@
check if the sales invoice item serial numbers and the delivery note items
serial numbers are same
"""
- from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+ from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
se = make_serialized_item()
serial_nos = get_serial_nos(se.get("items")[0].serial_no)
@@ -1290,8 +1302,9 @@
self.assertEqual(si.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
def test_outstanding_amount_after_advance_jv_cancelation(self):
- from erpnext.accounts.doctype.journal_entry.test_journal_entry \
- import test_records as jv_test_records
+ from erpnext.accounts.doctype.journal_entry.test_journal_entry import (
+ test_records as jv_test_records,
+ )
jv = frappe.copy_doc(jv_test_records[0])
jv.accounts[0].is_advance = 'Yes'
@@ -1577,8 +1590,7 @@
self.assertEqual(expected_values[gle.account][2], gle.credit)
def test_sales_invoice_with_shipping_rule(self):
- from erpnext.accounts.doctype.shipping_rule.test_shipping_rule \
- import create_shipping_rule
+ from erpnext.accounts.doctype.shipping_rule.test_shipping_rule import create_shipping_rule
shipping_rule = create_shipping_rule(shipping_rule_type = "Selling", shipping_rule_name = "Shipping Rule - Sales Invoice Test")
@@ -2129,7 +2141,9 @@
self.assertEqual(sales_invoice.items[0].item_tax_template, "_Test Account Excise Duty @ 10 - _TC")
def test_sales_invoice_with_discount_accounting_enabled(self):
- from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import enable_discount_accounting
+ from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import (
+ enable_discount_accounting,
+ )
enable_discount_accounting()
@@ -2147,7 +2161,9 @@
enable_discount_accounting(enable=0)
def test_additional_discount_for_sales_invoice_with_discount_accounting_enabled(self):
- from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import enable_discount_accounting
+ from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import (
+ enable_discount_accounting,
+ )
enable_discount_accounting()
additional_discount_account = create_account(account_name="Discount Account",
@@ -2201,7 +2217,9 @@
self.assertTrue(schedule.journal_entry)
def test_sales_invoice_against_supplier(self):
- from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import make_customer
+ from erpnext.accounts.doctype.opening_invoice_creation_tool.test_opening_invoice_creation_tool import (
+ make_customer,
+ )
from erpnext.buying.doctype.supplier.test_supplier import create_supplier
# create a customer
diff --git a/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.py b/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.py
index 28aeef4..ae69598 100644
--- a/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.py
+++ b/erpnext/accounts/doctype/sales_invoice_advance/sales_invoice_advance.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class SalesInvoiceAdvance(Document):
pass
diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py
index a73b03a..063c591 100644
--- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py
+++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class SalesInvoiceItem(Document):
pass
diff --git a/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.py b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.py
index cc0b7a6..a980ece 100644
--- a/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.py
+++ b/erpnext/accounts/doctype/sales_invoice_payment/sales_invoice_payment.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class SalesInvoicePayment(Document):
pass
diff --git a/erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.py b/erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.py
index afc05ab..e8d4b11 100644
--- a/erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.py
+++ b/erpnext/accounts/doctype/sales_invoice_timesheet/sales_invoice_timesheet.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class SalesInvoiceTimesheet(Document):
pass
diff --git a/erpnext/accounts/doctype/sales_partner_item/sales_partner_item.py b/erpnext/accounts/doctype/sales_partner_item/sales_partner_item.py
index 9796c7b..97489d1 100644
--- a/erpnext/accounts/doctype/sales_partner_item/sales_partner_item.py
+++ b/erpnext/accounts/doctype/sales_partner_item/sales_partner_item.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class SalesPartnerItem(Document):
pass
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.py b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.py
index b1de9d8..39872f3 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.py
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class SalesTaxesandCharges(Document):
pass
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.js b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.js
index 97a6fdd..066c4ea 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.js
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.js
@@ -4,4 +4,3 @@
cur_frm.cscript.tax_table = "Sales Taxes and Charges";
{% include "erpnext/public/js/controllers/accounts.js" %}
-
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
index 8f9eb65..0a0bb3e 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
@@ -2,11 +2,19 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt
from frappe.model.document import Document
-from erpnext.controllers.accounts_controller import validate_taxes_and_charges, validate_inclusive_tax, validate_cost_center, validate_account_head
+from frappe.utils import flt
+
+from erpnext.controllers.accounts_controller import (
+ validate_account_head,
+ validate_cost_center,
+ validate_inclusive_tax,
+ validate_taxes_and_charges,
+)
+
class SalesTaxesandChargesTemplate(Document):
def validate(self):
diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py b/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py
index 1c0c0c7..1cad412 100644
--- a/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py
+++ b/erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.py
@@ -3,9 +3,10 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
test_records = frappe.get_test_records('Sales Taxes and Charges Template')
class TestSalesTaxesandChargesTemplate(unittest.TestCase):
diff --git a/erpnext/accounts/doctype/share_balance/share_balance.py b/erpnext/accounts/doctype/share_balance/share_balance.py
index bd165cd..0353e99 100644
--- a/erpnext/accounts/doctype/share_balance/share_balance.py
+++ b/erpnext/accounts/doctype/share_balance/share_balance.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ShareBalance(Document):
pass
diff --git a/erpnext/accounts/doctype/share_transfer/share_transfer.py b/erpnext/accounts/doctype/share_transfer/share_transfer.py
index 3d4543f..5117ef8 100644
--- a/erpnext/accounts/doctype/share_transfer/share_transfer.py
+++ b/erpnext/accounts/doctype/share_transfer/share_transfer.py
@@ -3,13 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.model.document import Document
-from frappe.model.naming import make_autoname
from frappe.exceptions import ValidationError
+from frappe.model.document import Document
+from frappe.model.naming import make_autoname
from frappe.utils import nowdate
+
class ShareDontExists(ValidationError): pass
class ShareTransfer(Document):
diff --git a/erpnext/accounts/doctype/share_transfer/test_share_transfer.py b/erpnext/accounts/doctype/share_transfer/test_share_transfer.py
index 2ff9b02..b40e5fb 100644
--- a/erpnext/accounts/doctype/share_transfer/test_share_transfer.py
+++ b/erpnext/accounts/doctype/share_transfer/test_share_transfer.py
@@ -3,8 +3,10 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
+
from erpnext.accounts.doctype.share_transfer.share_transfer import ShareDontExists
test_dependencies = ["Share Type", "Shareholder"]
diff --git a/erpnext/accounts/doctype/share_type/share_type.py b/erpnext/accounts/doctype/share_type/share_type.py
index ab4b8bc..5b133aa 100644
--- a/erpnext/accounts/doctype/share_type/share_type.py
+++ b/erpnext/accounts/doctype/share_type/share_type.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ShareType(Document):
pass
diff --git a/erpnext/accounts/doctype/share_type/test_share_type.py b/erpnext/accounts/doctype/share_type/test_share_type.py
index 1c1f051..a6f8d61 100644
--- a/erpnext/accounts/doctype/share_type/test_share_type.py
+++ b/erpnext/accounts/doctype/share_type/test_share_type.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestShareType(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/shareholder/shareholder.py b/erpnext/accounts/doctype/shareholder/shareholder.py
index c507fcf..12c50c8 100644
--- a/erpnext/accounts/doctype/shareholder/shareholder.py
+++ b/erpnext/accounts/doctype/shareholder/shareholder.py
@@ -3,9 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
+from frappe.contacts.address_and_contact import (
+ delete_contact_and_address,
+ load_address_and_contact,
+)
from frappe.model.document import Document
-from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
+
class Shareholder(Document):
def onload(self):
diff --git a/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py b/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py
index 3b77fd5..0084f25 100644
--- a/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py
+++ b/erpnext/accounts/doctype/shareholder/shareholder_dashboard.py
@@ -1,7 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
-
def get_data():
return {
diff --git a/erpnext/accounts/doctype/shareholder/test_shareholder.py b/erpnext/accounts/doctype/shareholder/test_shareholder.py
index 9ce0093..6790fdd 100644
--- a/erpnext/accounts/doctype/shareholder/test_shareholder.py
+++ b/erpnext/accounts/doctype/shareholder/test_shareholder.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestShareholder(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/shipping_rule/shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/shipping_rule.py
index d32a348..2852101 100644
--- a/erpnext/accounts/doctype/shipping_rule/shipping_rule.py
+++ b/erpnext/accounts/doctype/shipping_rule/shipping_rule.py
@@ -4,10 +4,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _, msgprint, throw
-from frappe.utils import flt, fmt_money
from frappe.model.document import Document
+from frappe.utils import flt, fmt_money
+
+import erpnext
+
class OverlappingConditionError(frappe.ValidationError): pass
class FromGreaterThanToError(frappe.ValidationError): pass
diff --git a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py
index abc6ab8..bdd9be3 100644
--- a/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py
+++ b/erpnext/accounts/doctype/shipping_rule/test_shipping_rule.py
@@ -2,9 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.accounts.doctype.shipping_rule.shipping_rule import FromGreaterThanToError, ManyBlankToValuesError, OverlappingConditionError
+
+import frappe
+
+from erpnext.accounts.doctype.shipping_rule.shipping_rule import (
+ FromGreaterThanToError,
+ ManyBlankToValuesError,
+ OverlappingConditionError,
+)
test_records = frappe.get_test_records('Shipping Rule')
diff --git a/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.py b/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.py
index db6ef11..66cd269 100644
--- a/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.py
+++ b/erpnext/accounts/doctype/shipping_rule_condition/shipping_rule_condition.py
@@ -4,9 +4,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class ShippingRuleCondition(Document):
pass
diff --git a/erpnext/accounts/doctype/shipping_rule_country/shipping_rule_country.py b/erpnext/accounts/doctype/shipping_rule_country/shipping_rule_country.py
index b9646cf..9576acd 100644
--- a/erpnext/accounts/doctype/shipping_rule_country/shipping_rule_country.py
+++ b/erpnext/accounts/doctype/shipping_rule_country/shipping_rule_country.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ShippingRuleCountry(Document):
pass
diff --git a/erpnext/accounts/doctype/south_africa_vat_account/south_africa_vat_account.py b/erpnext/accounts/doctype/south_africa_vat_account/south_africa_vat_account.py
index 4bd8c65..d9a3bcc 100644
--- a/erpnext/accounts/doctype/south_africa_vat_account/south_africa_vat_account.py
+++ b/erpnext/accounts/doctype/south_africa_vat_account/south_africa_vat_account.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class SouthAfricaVATAccount(Document):
pass
diff --git a/erpnext/accounts/doctype/subscription/subscription.py b/erpnext/accounts/doctype/subscription/subscription.py
index 8bf7b78f..445eb3c 100644
--- a/erpnext/accounts/doctype/subscription/subscription.py
+++ b/erpnext/accounts/doctype/subscription/subscription.py
@@ -6,13 +6,27 @@
from __future__ import unicode_literals
import frappe
-import erpnext
from frappe import _
from frappe.model.document import Document
-from frappe.utils.data import nowdate, getdate, cstr, cint, add_days, date_diff, get_last_day, add_to_date, flt
-from erpnext.accounts.doctype.subscription_plan.subscription_plan import get_plan_rate
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
+from frappe.utils.data import (
+ add_days,
+ add_to_date,
+ cint,
+ cstr,
+ date_diff,
+ flt,
+ get_last_day,
+ getdate,
+ nowdate,
+)
+
+import erpnext
from erpnext import get_default_company
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+)
+from erpnext.accounts.doctype.subscription_plan.subscription_plan import get_plan_rate
+
class Subscription(Document):
def before_insert(self):
diff --git a/erpnext/accounts/doctype/subscription/test_subscription.py b/erpnext/accounts/doctype/subscription/test_subscription.py
index 4f2cf48..e2cf4d5 100644
--- a/erpnext/accounts/doctype/subscription/test_subscription.py
+++ b/erpnext/accounts/doctype/subscription/test_subscription.py
@@ -6,9 +6,18 @@
import unittest
import frappe
+from frappe.utils.data import (
+ add_days,
+ add_months,
+ add_to_date,
+ date_diff,
+ flt,
+ get_date_str,
+ nowdate,
+)
+
from erpnext.accounts.doctype.subscription.subscription import get_prorata_factor
-from frappe.utils.data import (nowdate, add_days, add_to_date, add_months, date_diff, flt, get_date_str,
- get_first_day, get_last_day)
+
def create_plan():
if not frappe.db.exists('Subscription Plan', '_Test Plan Name'):
diff --git a/erpnext/accounts/doctype/subscription_invoice/subscription_invoice.py b/erpnext/accounts/doctype/subscription_invoice/subscription_invoice.py
index 6f459b4..687c94c 100644
--- a/erpnext/accounts/doctype/subscription_invoice/subscription_invoice.py
+++ b/erpnext/accounts/doctype/subscription_invoice/subscription_invoice.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class SubscriptionInvoice(Document):
pass
diff --git a/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py b/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py
index e60a4ee..2cc3038 100644
--- a/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py
+++ b/erpnext/accounts/doctype/subscription_invoice/test_subscription_invoice.py
@@ -5,5 +5,6 @@
import unittest
+
class TestSubscriptionInvoice(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/subscription_plan/subscription_plan.py b/erpnext/accounts/doctype/subscription_plan/subscription_plan.py
index a341c2a..c7bb58c 100644
--- a/erpnext/accounts/doctype/subscription_plan/subscription_plan.py
+++ b/erpnext/accounts/doctype/subscription_plan/subscription_plan.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import get_first_day, get_last_day, date_diff, flt, getdate
from frappe.model.document import Document
+from frappe.utils import date_diff, flt, get_first_day, get_last_day, getdate
+
from erpnext.utilities.product import get_price
+
class SubscriptionPlan(Document):
def validate(self):
self.validate_interval_count()
diff --git a/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py b/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py
index 73afbf6..ba99763 100644
--- a/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py
+++ b/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py
@@ -5,5 +5,6 @@
import unittest
+
class TestSubscriptionPlan(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/subscription_plan_detail/subscription_plan_detail.py b/erpnext/accounts/doctype/subscription_plan_detail/subscription_plan_detail.py
index 1d9606f..a63a277 100644
--- a/erpnext/accounts/doctype/subscription_plan_detail/subscription_plan_detail.py
+++ b/erpnext/accounts/doctype/subscription_plan_detail/subscription_plan_detail.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class SubscriptionPlanDetail(Document):
pass
diff --git a/erpnext/accounts/doctype/subscription_settings/subscription_settings.py b/erpnext/accounts/doctype/subscription_settings/subscription_settings.py
index cc378e4..5473583 100644
--- a/erpnext/accounts/doctype/subscription_settings/subscription_settings.py
+++ b/erpnext/accounts/doctype/subscription_settings/subscription_settings.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class SubscriptionSettings(Document):
pass
diff --git a/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py b/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py
index 82c7e1d..5875ee0 100644
--- a/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py
+++ b/erpnext/accounts/doctype/subscription_settings/test_subscription_settings.py
@@ -5,5 +5,6 @@
import unittest
+
class TestSubscriptionSettings(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/supplier_group_item/supplier_group_item.py b/erpnext/accounts/doctype/supplier_group_item/supplier_group_item.py
index de0444e..61c16fe 100644
--- a/erpnext/accounts/doctype/supplier_group_item/supplier_group_item.py
+++ b/erpnext/accounts/doctype/supplier_group_item/supplier_group_item.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class SupplierGroupItem(Document):
pass
diff --git a/erpnext/accounts/doctype/supplier_item/supplier_item.py b/erpnext/accounts/doctype/supplier_item/supplier_item.py
index ad66e23..2105b1d 100644
--- a/erpnext/accounts/doctype/supplier_item/supplier_item.py
+++ b/erpnext/accounts/doctype/supplier_item/supplier_item.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class SupplierItem(Document):
pass
diff --git a/erpnext/accounts/doctype/tax_category/tax_category.py b/erpnext/accounts/doctype/tax_category/tax_category.py
index 2870e32..df31a5e 100644
--- a/erpnext/accounts/doctype/tax_category/tax_category.py
+++ b/erpnext/accounts/doctype/tax_category/tax_category.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class TaxCategory(Document):
pass
diff --git a/erpnext/accounts/doctype/tax_category/test_tax_category.py b/erpnext/accounts/doctype/tax_category/test_tax_category.py
index 548d008..9093105 100644
--- a/erpnext/accounts/doctype/tax_category/test_tax_category.py
+++ b/erpnext/accounts/doctype/tax_category/test_tax_category.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestTaxCategory(unittest.TestCase):
pass
diff --git a/erpnext/accounts/doctype/tax_rule/tax_rule.py b/erpnext/accounts/doctype/tax_rule/tax_rule.py
index 5814231..150498d 100644
--- a/erpnext/accounts/doctype/tax_rule/tax_rule.py
+++ b/erpnext/accounts/doctype/tax_rule/tax_rule.py
@@ -3,19 +3,21 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from past.builtins import cmp
-import frappe
-from frappe import _
-from frappe.model.document import Document
-from frappe.utils import cstr, cint
-from frappe.contacts.doctype.address.address import get_default_address
-from frappe.utils.nestedset import get_root_of
-from erpnext.setup.doctype.customer_group.customer_group import get_parent_customer_groups
import functools
+import frappe
+from frappe import _
+from frappe.contacts.doctype.address.address import get_default_address
+from frappe.model.document import Document
+from frappe.utils import cint, cstr
+from frappe.utils.nestedset import get_root_of
+from past.builtins import cmp
from six import iteritems
+from erpnext.setup.doctype.customer_group.customer_group import get_parent_customer_groups
+
+
class IncorrectCustomerGroup(frappe.ValidationError): pass
class IncorrectSupplierType(frappe.ValidationError): pass
class ConflictingTaxRule(frappe.ValidationError): pass
diff --git a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py
index cf72268..f937274 100644
--- a/erpnext/accounts/doctype/tax_rule/test_tax_rule.py
+++ b/erpnext/accounts/doctype/tax_rule/test_tax_rule.py
@@ -3,16 +3,19 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.accounts.doctype.tax_rule.tax_rule import IncorrectCustomerGroup, IncorrectSupplierType, ConflictingTaxRule, get_tax_template
-from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity
+
+import frappe
+
+from erpnext.accounts.doctype.tax_rule.tax_rule import ConflictingTaxRule, get_tax_template
from erpnext.crm.doctype.opportunity.opportunity import make_quotation
+from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity
test_records = frappe.get_test_records('Tax Rule')
from six import iteritems
+
class TestTaxRule(unittest.TestCase):
@classmethod
def setUpClass(cls):
diff --git a/erpnext/accounts/doctype/tax_withholding_account/tax_withholding_account.py b/erpnext/accounts/doctype/tax_withholding_account/tax_withholding_account.py
index 76e3fa3..fd19482 100644
--- a/erpnext/accounts/doctype/tax_withholding_account/tax_withholding_account.py
+++ b/erpnext/accounts/doctype/tax_withholding_account/tax_withholding_account.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class TaxWithholdingAccount(Document):
pass
diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
index 06b8df1..33b7e47 100644
--- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
+++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import flt, getdate, cint
+from frappe.utils import cint, getdate
+
from erpnext.accounts.utils import get_fiscal_year
+
class TaxWithholdingCategory(Document):
def validate(self):
self.validate_dates()
@@ -255,7 +258,7 @@
def get_tds_amount(ldc, parties, inv, tax_details, tax_deducted, vouchers):
tds_amount = 0
invoice_filters = {
- 'name': ('in', vouchers),
+ 'name': ('in', vouchers),
'docstatus': 1,
'apply_tds': 1
}
diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py
index d51ba65..152ee46 100644
--- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py
+++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py
@@ -1,7 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
-
def get_data():
return {
diff --git a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
index 138aaec..8a88d79 100644
--- a/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
+++ b/erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
@@ -3,11 +3,12 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from frappe.utils import today
+
from erpnext.accounts.utils import get_fiscal_year
-from erpnext.buying.doctype.supplier.test_supplier import create_supplier
test_dependencies = ["Supplier Group", "Customer Group"]
diff --git a/erpnext/accounts/doctype/tax_withholding_rate/tax_withholding_rate.py b/erpnext/accounts/doctype/tax_withholding_rate/tax_withholding_rate.py
index 6e32abe..6556277 100644
--- a/erpnext/accounts/doctype/tax_withholding_rate/tax_withholding_rate.py
+++ b/erpnext/accounts/doctype/tax_withholding_rate/tax_withholding_rate.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class TaxWithholdingRate(Document):
pass
diff --git a/erpnext/accounts/doctype/territory_item/territory_item.py b/erpnext/accounts/doctype/territory_item/territory_item.py
index d46edc9..bcc02be 100644
--- a/erpnext/accounts/doctype/territory_item/territory_item.py
+++ b/erpnext/accounts/doctype/territory_item/territory_item.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class TerritoryItem(Document):
pass
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index 3126138..4bf2b82 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -2,12 +2,18 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe.utils import flt, cstr, cint, comma_and, today, getdate, formatdate, now
+
+import frappe
from frappe import _
from frappe.model.meta import get_field_precision
+from frappe.utils import cint, cstr, flt, formatdate, getdate, now
+
+import erpnext
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+)
from erpnext.accounts.doctype.budget.budget import validate_expense_against_budget
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
+
class ClosedAccountingPeriod(frappe.ValidationError): pass
diff --git a/erpnext/accounts/notification/notification_for_new_fiscal_year/notification_for_new_fiscal_year.py b/erpnext/accounts/notification/notification_for_new_fiscal_year/notification_for_new_fiscal_year.py
index 1bc4d18..f57de91 100644
--- a/erpnext/accounts/notification/notification_for_new_fiscal_year/notification_for_new_fiscal_year.py
+++ b/erpnext/accounts/notification/notification_for_new_fiscal_year/notification_for_new_fiscal_year.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_context(context):
# do your magic here
pass
diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py
index de7dde9..7ea6cce 100644
--- a/erpnext/accounts/party.py
+++ b/erpnext/accounts/party.py
@@ -3,20 +3,37 @@
from __future__ import unicode_literals
-import frappe, erpnext
+import frappe
from frappe import _, msgprint, scrub
+from frappe.contacts.doctype.address.address import (
+ get_address_display,
+ get_company_address,
+ get_default_address,
+)
+from frappe.contacts.doctype.contact.contact import get_contact_details
from frappe.core.doctype.user_permission.user_permission import get_permitted_documents
from frappe.model.utils import get_fetch_values
-from frappe.utils import (add_days, getdate, formatdate, date_diff,
- add_years, get_timestamp, nowdate, flt, cstr, add_months, get_last_day, cint)
-from frappe.contacts.doctype.address.address import (get_address_display,
- get_default_address, get_company_address)
-from frappe.contacts.doctype.contact.contact import get_contact_details
-from erpnext.exceptions import PartyFrozen, PartyDisabled, InvalidAccountCurrency
-from erpnext.accounts.utils import get_fiscal_year
-from erpnext import get_company_currency
+from frappe.utils import (
+ add_days,
+ add_months,
+ add_years,
+ cint,
+ cstr,
+ date_diff,
+ flt,
+ formatdate,
+ get_last_day,
+ get_timestamp,
+ getdate,
+ nowdate,
+)
+from six import iteritems
-from six import iteritems, string_types
+import erpnext
+from erpnext import get_company_currency
+from erpnext.accounts.utils import get_fiscal_year
+from erpnext.exceptions import InvalidAccountCurrency, PartyDisabled, PartyFrozen
+
class DuplicatePartyAccountError(frappe.ValidationError): pass
@@ -386,7 +403,7 @@
@frappe.whitelist()
def set_taxes(party, party_type, posting_date, company, customer_group=None, supplier_group=None, tax_category=None,
billing_address=None, shipping_address=None, use_for_shopping_cart=None):
- from erpnext.accounts.doctype.tax_rule.tax_rule import get_tax_template, get_party_details
+ from erpnext.accounts.doctype.tax_rule.tax_rule import get_party_details, get_tax_template
args = {
party_type.lower(): party,
"company": company
@@ -648,7 +665,7 @@
if out:
try:
return out[0][0]
- except:
+ except Exception:
return None
else:
return None
diff --git a/erpnext/accounts/report/account_balance/account_balance.py b/erpnext/accounts/report/account_balance/account_balance.py
index be64c32..9ae61dd 100644
--- a/erpnext/accounts/report/account_balance/account_balance.py
+++ b/erpnext/accounts/report/account_balance/account_balance.py
@@ -2,10 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
from erpnext.accounts.utils import get_balance_on
+
def execute(filters=None):
filters = frappe._dict(filters or {})
columns = get_columns(filters)
diff --git a/erpnext/accounts/report/account_balance/test_account_balance.py b/erpnext/accounts/report/account_balance/test_account_balance.py
index f5c9449..94c73f5 100644
--- a/erpnext/accounts/report/account_balance/test_account_balance.py
+++ b/erpnext/accounts/report/account_balance/test_account_balance.py
@@ -1,10 +1,13 @@
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from frappe.utils import getdate
-from erpnext.accounts.report.account_balance.account_balance import execute
+
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+from erpnext.accounts.report.account_balance.account_balance import execute
+
class TestAccountBalance(unittest.TestCase):
def test_account_balance(self):
diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.py b/erpnext/accounts/report/accounts_payable/accounts_payable.py
index 246ead6..0de573e 100644
--- a/erpnext/accounts/report/accounts_payable/accounts_payable.py
+++ b/erpnext/accounts/report/accounts_payable/accounts_payable.py
@@ -2,9 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
+
def execute(filters=None):
args = {
"party_type": "Supplier",
diff --git a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.py b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.py
index c08582b..6034ec0 100644
--- a/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.py
+++ b/erpnext/accounts/report/accounts_payable_summary/accounts_payable_summary.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from erpnext.accounts.report.accounts_receivable_summary.accounts_receivable_summary \
- import AccountsReceivableSummary
+
+from erpnext.accounts.report.accounts_receivable_summary.accounts_receivable_summary import (
+ AccountsReceivableSummary,
+)
+
def execute(filters=None):
args = {
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
index cedfc0f..e91fdf2 100755
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
@@ -2,12 +2,18 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe import _, scrub
-from frappe.utils import getdate, nowdate, flt, cint, formatdate, cstr, now, time_diff_in_seconds
+
from collections import OrderedDict
+
+import frappe
+from frappe import _, scrub
+from frappe.utils import cint, cstr, flt, getdate, nowdate
+
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+ get_dimension_with_children,
+)
from erpnext.accounts.utils import get_currency_precision
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children
# This report gives a summary of all Outstanding Invoices considering the following
diff --git a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py
index cca6760..1d24561 100644
--- a/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py
@@ -1,11 +1,14 @@
from __future__ import unicode_literals
-import frappe
-import frappe.defaults
+
import unittest
-from frappe.utils import today, getdate, add_days
-from erpnext.accounts.report.accounts_receivable.accounts_receivable import execute
-from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+
+import frappe
+from frappe.utils import add_days, getdate, today
+
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
+from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+from erpnext.accounts.report.accounts_receivable.accounts_receivable import execute
+
class TestAccountsReceivable(unittest.TestCase):
def test_accounts_receivable(self):
diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
index 4bfb022..106f224 100644
--- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
+++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
@@ -2,12 +2,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _, scrub
-from frappe.utils import flt, cint
+from frappe.utils import cint
+from six import iteritems
+
from erpnext.accounts.party import get_partywise_advanced_payment_amount
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
-from six import iteritems
+
def execute(filters=None):
args = {
diff --git a/erpnext/accounts/report/asset_depreciation_ledger/asset_depreciation_ledger.py b/erpnext/accounts/report/asset_depreciation_ledger/asset_depreciation_ledger.py
index 2162a02..0fd4ca0 100644
--- a/erpnext/accounts/report/asset_depreciation_ledger/asset_depreciation_ledger.py
+++ b/erpnext/accounts/report/asset_depreciation_ledger/asset_depreciation_ledger.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe.utils import flt
+
+import frappe
from frappe import _
+from frappe.utils import flt
+
def execute(filters=None):
columns, data = get_columns(), get_data(filters)
diff --git a/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py b/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py
index 5001ad9..d34bc85 100644
--- a/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py
+++ b/erpnext/accounts/report/asset_depreciations_and_balances/asset_depreciations_and_balances.py
@@ -2,9 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import formatdate, flt, add_days
+from frappe.utils import add_days, flt, formatdate
def execute(filters=None):
diff --git a/erpnext/accounts/report/balance_sheet/balance_sheet.py b/erpnext/accounts/report/balance_sheet/balance_sheet.py
index 7838385..78ee7ca 100644
--- a/erpnext/accounts/report/balance_sheet/balance_sheet.py
+++ b/erpnext/accounts/report/balance_sheet/balance_sheet.py
@@ -2,11 +2,18 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt, cint
-from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data,
- get_filtered_list_for_consolidated_report)
+from frappe.utils import cint, flt
+
+from erpnext.accounts.report.financial_statements import (
+ get_columns,
+ get_data,
+ get_filtered_list_for_consolidated_report,
+ get_period_list,
+)
+
def execute(filters=None):
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
diff --git a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
index 95f724c..1a1fa96 100644
--- a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
+++ b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import nowdate, getdate
+from frappe.utils import getdate, nowdate
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
index 63317c5..b984306 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import flt, getdate, nowdate
from frappe import _
+from frappe.utils import flt, getdate, nowdate
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/accounts/report/billed_items_to_be_received/billed_items_to_be_received.py b/erpnext/accounts/report/billed_items_to_be_received/billed_items_to_be_received.py
index 2dcea22..6c4cd67 100644
--- a/erpnext/accounts/report/billed_items_to_be_received/billed_items_to_be_received.py
+++ b/erpnext/accounts/report/billed_items_to_be_received/billed_items_to_be_received.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
data = get_data(filters) or []
columns = get_columns()
diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
index 443126e..c204250 100644
--- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
+++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
@@ -2,12 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import datetime
-from six import iteritems
import frappe
from frappe import _
from frappe.utils import flt, formatdate
+from six import iteritems
from erpnext.controllers.trends import get_period_date_ranges, get_period_month_ranges
diff --git a/erpnext/accounts/report/cash_flow/cash_flow.py b/erpnext/accounts/report/cash_flow/cash_flow.py
index 3577457..d527188 100644
--- a/erpnext/accounts/report/cash_flow/cash_flow.py
+++ b/erpnext/accounts/report/cash_flow/cash_flow.py
@@ -2,14 +2,23 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import cint, cstr
-from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data, get_filtered_list_for_consolidated_report)
-from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import get_net_profit_loss
-from erpnext.accounts.utils import get_fiscal_year
from six import iteritems
+from erpnext.accounts.report.financial_statements import (
+ get_columns,
+ get_data,
+ get_filtered_list_for_consolidated_report,
+ get_period_list,
+)
+from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import (
+ get_net_profit_loss,
+)
+from erpnext.accounts.utils import get_fiscal_year
+
def execute(filters=None):
if cint(frappe.db.get_single_value('Accounts Settings', 'use_custom_cash_flow')):
diff --git a/erpnext/accounts/report/cash_flow/custom_cash_flow.py b/erpnext/accounts/report/cash_flow/custom_cash_flow.py
index c11c153..bbc020e 100644
--- a/erpnext/accounts/report/cash_flow/custom_cash_flow.py
+++ b/erpnext/accounts/report/cash_flow/custom_cash_flow.py
@@ -2,11 +2,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import add_to_date
-from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
-from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import get_net_profit_loss
+
+from erpnext.accounts.report.financial_statements import get_columns, get_data, get_period_list
+from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import (
+ get_net_profit_loss,
+)
def get_mapper_for(mappers, position):
diff --git a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
index fc42127..e419727 100644
--- a/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
+++ b/erpnext/accounts/report/consolidated_financial_statement/consolidated_financial_statement.py
@@ -2,17 +2,37 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
-from frappe.utils import flt, cint, getdate
-from erpnext.accounts.report.utils import get_currency, convert_to_presentation_currency
+from frappe.utils import cint, flt, getdate
+
+from erpnext.accounts.report.balance_sheet.balance_sheet import (
+ check_opening_balance,
+ get_chart_data,
+ get_provisional_profit_loss,
+)
+from erpnext.accounts.report.balance_sheet.balance_sheet import (
+ get_report_summary as get_bs_summary,
+)
+from erpnext.accounts.report.cash_flow.cash_flow import (
+ add_total_row_account,
+ get_account_type_based_gl_data,
+ get_cash_flow_accounts,
+)
+from erpnext.accounts.report.cash_flow.cash_flow import get_report_summary as get_cash_flow_summary
from erpnext.accounts.report.financial_statements import get_fiscal_year_data, sort_accounts
-from erpnext.accounts.report.balance_sheet.balance_sheet import (get_provisional_profit_loss,
- check_opening_balance, get_chart_data, get_report_summary as get_bs_summary)
-from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import (get_net_profit_loss,
- get_chart_data as get_pl_chart_data, get_report_summary as get_pl_summary)
-from erpnext.accounts.report.cash_flow.cash_flow import (get_cash_flow_accounts, get_account_type_based_gl_data,
- add_total_row_account, get_report_summary as get_cash_flow_summary)
+from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import (
+ get_chart_data as get_pl_chart_data,
+)
+from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import (
+ get_net_profit_loss,
+)
+from erpnext.accounts.report.profit_and_loss_statement.profit_and_loss_statement import (
+ get_report_summary as get_pl_summary,
+)
+from erpnext.accounts.report.utils import convert_to_presentation_currency
+
def execute(filters=None):
columns, data, message, chart = [], [], [], []
diff --git a/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py b/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py
index c79d740..603fbac 100644
--- a/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py
+++ b/erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py
@@ -2,12 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-import erpnext
from frappe import _, scrub
from frappe.utils import getdate, nowdate
from six import iteritems, itervalues
+
class PartyLedgerSummaryReport(object):
def __init__(self, filters=None):
self.filters = frappe._dict(filters or {})
diff --git a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py
index 9953d8f..f096094 100644
--- a/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py
+++ b/erpnext/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe import _
+
from erpnext.accounts.report.non_billed_report import get_ordered_to_be_billed_data
+
def execute(filters=None):
columns = get_column()
args = get_args()
diff --git a/erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.py b/erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.py
index de7ed49..4212137 100644
--- a/erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.py
+++ b/erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.py
@@ -2,14 +2,19 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe import _
-from frappe.utils import (flt, cstr)
-from erpnext.accounts.report.financial_statements import filter_accounts, filter_out_zero_value_rows
+import frappe
+from frappe import _
+from frappe.utils import cstr, flt
+from six import itervalues
+
+import erpnext
+from erpnext.accounts.report.financial_statements import (
+ filter_accounts,
+ filter_out_zero_value_rows,
+)
from erpnext.accounts.report.trial_balance.trial_balance import validate_filters
-from six import itervalues
def execute(filters=None):
validate_filters(filters)
diff --git a/erpnext/accounts/report/financial_statements.py b/erpnext/accounts/report/financial_statements.py
index 39ff804..2cb8a68 100644
--- a/erpnext/accounts/report/financial_statements.py
+++ b/erpnext/accounts/report/financial_statements.py
@@ -5,19 +5,23 @@
from __future__ import unicode_literals
-import re
-from past.builtins import cmp
import functools
import math
+import re
-import frappe, erpnext
-from erpnext.accounts.report.utils import get_currency, convert_to_presentation_currency
-from erpnext.accounts.utils import get_fiscal_year
+import frappe
from frappe import _
-from frappe.utils import (flt, getdate, get_first_day, add_months, add_days, formatdate, cstr, cint)
-
+from frappe.utils import add_days, add_months, cint, cstr, flt, formatdate, get_first_day, getdate
+from past.builtins import cmp
from six import itervalues
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children
+
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+ get_dimension_with_children,
+)
+from erpnext.accounts.report.utils import convert_to_presentation_currency, get_currency
+from erpnext.accounts.utils import get_fiscal_year
+
def get_period_list(from_fiscal_year, to_fiscal_year, period_start_date, period_end_date, filter_based_on, periodicity, accumulated_values=False,
company=None, reset_period_on_fy_change=True, ignore_fiscal_year=False):
@@ -339,7 +343,7 @@
"""Sort root types as Asset, Liability, Equity, Income, Expense"""
def compare_accounts(a, b):
- if re.split('\W+', a[key])[0].isdigit():
+ if re.split(r'\W+', a[key])[0].isdigit():
# if chart of accounts is numbered, then sort by number
return cmp(a[key], b[key])
elif is_root:
diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py
index 3723c8e..a044518 100644
--- a/erpnext/accounts/report/general_ledger/general_ledger.py
+++ b/erpnext/accounts/report/general_ledger/general_ledger.py
@@ -2,17 +2,24 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from erpnext import get_company_currency, get_default_company
-from erpnext.accounts.report.utils import get_currency, convert_to_presentation_currency
-from frappe.utils import getdate, cstr, flt, fmt_money
-from frappe import _, _dict
-from erpnext.accounts.utils import get_account_currency
-from erpnext.accounts.report.financial_statements import get_cost_centers_with_children
-from six import iteritems
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children
+
from collections import OrderedDict
+import frappe
+from frappe import _, _dict
+from frappe.utils import cstr, flt, getdate
+from six import iteritems
+
+from erpnext import get_company_currency, get_default_company
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+ get_dimension_with_children,
+)
+from erpnext.accounts.report.financial_statements import get_cost_centers_with_children
+from erpnext.accounts.report.utils import convert_to_presentation_currency, get_currency
+from erpnext.accounts.utils import get_account_currency
+
+
def execute(filters=None):
if not filters:
return [], []
diff --git a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py
index 8e33af7..49522d9 100644
--- a/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py
+++ b/erpnext/accounts/report/gross_and_net_profit_report/gross_and_net_profit_report.py
@@ -2,11 +2,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+import copy
+
import frappe
from frappe import _
from frappe.utils import flt
-from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
-import copy
+
+from erpnext.accounts.report.financial_statements import get_columns, get_data, get_period_list
+
def execute(filters=None):
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.period_start_date,
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.js b/erpnext/accounts/report/gross_profit/gross_profit.js
index ba17a94..856b97d 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.js
+++ b/erpnext/accounts/report/gross_profit/gross_profit.js
@@ -36,5 +36,20 @@
"options": "Invoice\nItem Code\nItem Group\nBrand\nWarehouse\nCustomer\nCustomer Group\nTerritory\nSales Person\nProject",
"default": "Invoice"
},
- ]
+ ],
+ "tree": true,
+ "name_field": "parent",
+ "parent_field": "parent_invoice",
+ "initial_depth": 3,
+ "formatter": function(value, row, column, data, default_formatter) {
+ value = default_formatter(value, row, column, data);
+
+ if (data && data.indent == 0.0) {
+ value = $(`<span>${value}</span>`);
+ var $value = $(value).css("font-weight", "bold");
+ value = $value.wrap("<p></p>").parent().html();
+ }
+
+ return value;
+ },
}
diff --git a/erpnext/accounts/report/gross_profit/gross_profit.py b/erpnext/accounts/report/gross_profit/gross_profit.py
index c949d9b..f08bca9 100644
--- a/erpnext/accounts/report/gross_profit/gross_profit.py
+++ b/erpnext/accounts/report/gross_profit/gross_profit.py
@@ -2,11 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _, scrub
-from erpnext.stock.utils import get_incoming_rate
+from frappe.utils import cint, flt
+
from erpnext.controllers.queries import get_match_cond
-from frappe.utils import flt, cint
+from erpnext.stock.utils import get_incoming_rate
def execute(filters=None):
@@ -41,6 +43,34 @@
columns = get_columns(group_wise_columns, filters)
+ if filters.group_by == 'Invoice':
+ get_data_when_grouped_by_invoice(columns, gross_profit_data, filters, group_wise_columns, data)
+
+ else:
+ get_data_when_not_grouped_by_invoice(gross_profit_data, filters, group_wise_columns, data)
+
+ return columns, data
+
+def get_data_when_grouped_by_invoice(columns, gross_profit_data, filters, group_wise_columns, data):
+ column_names = get_column_names()
+
+ # to display item as Item Code: Item Name
+ columns[0] = 'Sales Invoice:Link/Item:300'
+ # removing Item Code and Item Name columns
+ del columns[4:6]
+
+ for src in gross_profit_data.si_list:
+ row = frappe._dict()
+ row.indent = src.indent
+ row.parent_invoice = src.parent_invoice
+ row.currency = filters.currency
+
+ for col in group_wise_columns.get(scrub(filters.group_by)):
+ row[column_names[col]] = src.get(col)
+
+ data.append(row)
+
+def get_data_when_not_grouped_by_invoice(gross_profit_data, filters, group_wise_columns, data):
for idx, src in enumerate(gross_profit_data.grouped_data):
row = []
for col in group_wise_columns.get(scrub(filters.group_by)):
@@ -51,8 +81,6 @@
row[0] = frappe.bold("Total")
data.append(row)
- return columns, data
-
def get_columns(group_wise_columns, filters):
columns = []
column_map = frappe._dict({
@@ -93,12 +121,38 @@
return columns
+def get_column_names():
+ return frappe._dict({
+ 'parent': 'sales_invoice',
+ 'customer': 'customer',
+ 'customer_group': 'customer_group',
+ 'posting_date': 'posting_date',
+ 'item_code': 'item_code',
+ 'item_name': 'item_name',
+ 'item_group': 'item_group',
+ 'brand': 'brand',
+ 'description': 'description',
+ 'warehouse': 'warehouse',
+ 'qty': 'qty',
+ 'base_rate': 'avg._selling_rate',
+ 'buying_rate': 'valuation_rate',
+ 'base_amount': 'selling_amount',
+ 'buying_amount': 'buying_amount',
+ 'gross_profit': 'gross_profit',
+ 'gross_profit_percent': 'gross_profit_%',
+ 'project': 'project'
+ })
+
class GrossProfitGenerator(object):
def __init__(self, filters=None):
self.data = []
self.average_buying_rate = {}
self.filters = frappe._dict(filters)
self.load_invoice_items()
+
+ if filters.group_by == 'Invoice':
+ self.group_items_by_invoice()
+
self.load_stock_ledger_entries()
self.load_product_bundle()
self.load_non_stock_items()
@@ -112,7 +166,12 @@
self.currency_precision = cint(frappe.db.get_default("currency_precision")) or 3
self.float_precision = cint(frappe.db.get_default("float_precision")) or 2
- for row in self.si_list:
+ grouped_by_invoice = True if self.filters.get("group_by") == "Invoice" else False
+
+ if grouped_by_invoice:
+ buying_amount = 0
+
+ for row in reversed(self.si_list):
if self.skip_row(row, self.product_bundles):
continue
@@ -134,12 +193,20 @@
row.buying_amount = flt(self.get_buying_amount(row, row.item_code),
self.currency_precision)
+ if grouped_by_invoice:
+ if row.indent == 1.0:
+ buying_amount += row.buying_amount
+ elif row.indent == 0.0:
+ row.buying_amount = buying_amount
+ buying_amount = 0
+
# get buying rate
- if row.qty:
- row.buying_rate = flt(row.buying_amount / row.qty, self.float_precision)
- row.base_rate = flt(row.base_amount / row.qty, self.float_precision)
+ if flt(row.qty):
+ row.buying_rate = flt(row.buying_amount / flt(row.qty), self.float_precision)
+ row.base_rate = flt(row.base_amount / flt(row.qty), self.float_precision)
else:
- row.buying_rate, row.base_rate = 0.0, 0.0
+ if self.is_not_invoice_row(row):
+ row.buying_rate, row.base_rate = 0.0, 0.0
# calculate gross profit
row.gross_profit = flt(row.base_amount - row.buying_amount, self.currency_precision)
@@ -171,7 +238,7 @@
if i==0:
new_row = row
else:
- new_row.qty += row.qty
+ new_row.qty += flt(row.qty)
new_row.buying_amount += flt(row.buying_amount, self.currency_precision)
new_row.base_amount += flt(row.base_amount, self.currency_precision)
new_row = self.set_average_rate(new_row)
@@ -183,16 +250,19 @@
and row.item_code in self.returned_invoices[row.parent]:
returned_item_rows = self.returned_invoices[row.parent][row.item_code]
for returned_item_row in returned_item_rows:
- row.qty += returned_item_row.qty
+ row.qty += flt(returned_item_row.qty)
row.base_amount += flt(returned_item_row.base_amount, self.currency_precision)
- row.buying_amount = flt(row.qty * row.buying_rate, self.currency_precision)
- if row.qty or row.base_amount:
+ row.buying_amount = flt(flt(row.qty) * flt(row.buying_rate), self.currency_precision)
+ if (flt(row.qty) or row.base_amount) and self.is_not_invoice_row(row):
row = self.set_average_rate(row)
self.grouped_data.append(row)
self.add_to_totals(row)
self.set_average_gross_profit(self.totals)
self.grouped_data.append(self.totals)
+ def is_not_invoice_row(self, row):
+ return (self.filters.get("group_by") == "Invoice" and row.indent != 0.0) or self.filters.get("group_by") != "Invoice"
+
def set_average_rate(self, new_row):
self.set_average_gross_profit(new_row)
new_row.buying_rate = flt(new_row.buying_amount / new_row.qty, self.float_precision) if new_row.qty else 0
@@ -354,6 +424,109 @@
.format(conditions=conditions, sales_person_cols=sales_person_cols,
sales_team_table=sales_team_table, match_cond = get_match_cond('Sales Invoice')), self.filters, as_dict=1)
+ def group_items_by_invoice(self):
+ """
+ Turns list of Sales Invoice Items to a tree of Sales Invoices with their Items as children.
+ """
+
+ parents = []
+
+ for row in self.si_list:
+ if row.parent not in parents:
+ parents.append(row.parent)
+
+ parents_index = 0
+ for index, row in enumerate(self.si_list):
+ if parents_index < len(parents) and row.parent == parents[parents_index]:
+ invoice = self.get_invoice_row(row)
+ self.si_list.insert(index, invoice)
+ parents_index += 1
+
+ else:
+ # skipping the bundle items rows
+ if not row.indent:
+ row.indent = 1.0
+ row.parent_invoice = row.parent
+ row.parent = row.item_code
+
+ if frappe.db.exists('Product Bundle', row.item_code):
+ self.add_bundle_items(row, index)
+
+ def get_invoice_row(self, row):
+ return frappe._dict({
+ 'parent_invoice': "",
+ 'indent': 0.0,
+ 'parent': row.parent,
+ 'posting_date': row.posting_date,
+ 'posting_time': row.posting_time,
+ 'project': row.project,
+ 'update_stock': row.update_stock,
+ 'customer': row.customer,
+ 'customer_group': row.customer_group,
+ 'item_code': None,
+ 'item_name': None,
+ 'description': None,
+ 'warehouse': None,
+ 'item_group': None,
+ 'brand': None,
+ 'dn_detail': None,
+ 'delivery_note': None,
+ 'qty': None,
+ 'item_row': None,
+ 'is_return': row.is_return,
+ 'cost_center': row.cost_center,
+ 'base_net_amount': frappe.db.get_value('Sales Invoice', row.parent, 'base_net_total')
+ })
+
+ def add_bundle_items(self, product_bundle, index):
+ bundle_items = self.get_bundle_items(product_bundle)
+
+ for i, item in enumerate(bundle_items):
+ bundle_item = self.get_bundle_item_row(product_bundle, item)
+ self.si_list.insert((index+i+1), bundle_item)
+
+ def get_bundle_items(self, product_bundle):
+ return frappe.get_all(
+ 'Product Bundle Item',
+ filters = {
+ 'parent': product_bundle.item_code
+ },
+ fields = ['item_code', 'qty']
+ )
+
+ def get_bundle_item_row(self, product_bundle, item):
+ item_name, description, item_group, brand = self.get_bundle_item_details(item.item_code)
+
+ return frappe._dict({
+ 'parent_invoice': product_bundle.item_code,
+ 'indent': product_bundle.indent + 1,
+ 'parent': item.item_code,
+ 'posting_date': product_bundle.posting_date,
+ 'posting_time': product_bundle.posting_time,
+ 'project': product_bundle.project,
+ 'customer': product_bundle.customer,
+ 'customer_group': product_bundle.customer_group,
+ 'item_code': item.item_code,
+ 'item_name': item_name,
+ 'description': description,
+ 'warehouse': product_bundle.warehouse,
+ 'item_group': item_group,
+ 'brand': brand,
+ 'dn_detail': product_bundle.dn_detail,
+ 'delivery_note': product_bundle.delivery_note,
+ 'qty': (flt(product_bundle.qty) * flt(item.qty)),
+ 'item_row': None,
+ 'is_return': product_bundle.is_return,
+ 'cost_center': product_bundle.cost_center
+ })
+
+ def get_bundle_item_details(self, item_code):
+ return frappe.db.get_value(
+ 'Item',
+ item_code,
+ ['item_name', 'description', 'item_group', 'brand']
+ )
+
def load_stock_ledger_entries(self):
res = frappe.db.sql("""select item_code, voucher_type, voucher_no,
voucher_detail_no, stock_value, warehouse, actual_qty as qty
diff --git a/erpnext/accounts/report/inactive_sales_items/inactive_sales_items.py b/erpnext/accounts/report/inactive_sales_items/inactive_sales_items.py
index 7dea80c..8f82271 100644
--- a/erpnext/accounts/report/inactive_sales_items/inactive_sales_items.py
+++ b/erpnext/accounts/report/inactive_sales_items/inactive_sales_items.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import getdate, add_days, today, cint
from frappe import _
+from frappe.utils import cint
+
def execute(filters=None):
columns = get_columns()
diff --git a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
index 685419a..cd25c05 100644
--- a/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
+++ b/erpnext/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
@@ -2,14 +2,23 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
from frappe.utils import flt
-from erpnext.accounts.report.item_wise_sales_register.item_wise_sales_register import (get_tax_accounts,
- get_grand_total, add_total_row, get_display_value, get_group_by_and_display_fields, add_sub_total_row,
- get_group_by_conditions)
+
+import erpnext
+from erpnext.accounts.report.item_wise_sales_register.item_wise_sales_register import (
+ add_sub_total_row,
+ add_total_row,
+ get_grand_total,
+ get_group_by_and_display_fields,
+ get_group_by_conditions,
+ get_tax_accounts,
+)
from erpnext.selling.report.item_wise_sales_history.item_wise_sales_history import get_item_details
+
def execute(filters=None):
return _execute(filters)
diff --git a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
index c9c22c2..847a127 100644
--- a/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
+++ b/erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -2,13 +2,19 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
-from frappe.utils import flt, cstr
from frappe.model.meta import get_field_precision
+from frappe.utils import cstr, flt
from frappe.utils.xlsxutils import handle_html
+
from erpnext.accounts.report.sales_register.sales_register import get_mode_of_payments
-from erpnext.selling.report.item_wise_sales_history.item_wise_sales_history import get_item_details, get_customer_details
+from erpnext.selling.report.item_wise_sales_history.item_wise_sales_history import (
+ get_customer_details,
+ get_item_details,
+)
+
def execute(filters=None):
return _execute(filters)
diff --git a/erpnext/accounts/report/non_billed_report.py b/erpnext/accounts/report/non_billed_report.py
index 5173505..b61f87d 100644
--- a/erpnext/accounts/report/non_billed_report.py
+++ b/erpnext/accounts/report/non_billed_report.py
@@ -2,11 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import _
-from erpnext import get_default_currency
from frappe.model.meta import get_field_precision
+from erpnext import get_default_currency
+
+
def get_ordered_to_be_billed_data(args):
doctype, party = args.get('doctype'), args.get('party')
child_tab = doctype + " Item"
diff --git a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py
index 556f5ad..6c6af1c 100644
--- a/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py
+++ b/erpnext/accounts/report/payment_period_based_on_invoice_date/payment_period_based_on_invoice_date.py
@@ -2,10 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+from frappe.utils import flt, getdate
+
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
-from frappe.utils import getdate, flt
def execute(filters=None):
diff --git a/erpnext/accounts/report/pos_register/pos_register.py b/erpnext/accounts/report/pos_register/pos_register.py
index b7e112c..c9463ca 100644
--- a/erpnext/accounts/report/pos_register/pos_register.py
+++ b/erpnext/accounts/report/pos_register/pos_register.py
@@ -2,11 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import _, _dict
-from erpnext import get_company_currency, get_default_company
+from frappe import _
+
from erpnext.accounts.report.sales_register.sales_register import get_mode_of_payments
+
def execute(filters=None):
if not filters:
return [], []
diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
index 5d04824..ef799f6 100644
--- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
+++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py
@@ -2,11 +2,18 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt
-from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data,
- get_filtered_list_for_consolidated_report)
+
+from erpnext.accounts.report.financial_statements import (
+ get_columns,
+ get_data,
+ get_filtered_list_for_consolidated_report,
+ get_period_list,
+)
+
def execute(filters=None):
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
diff --git a/erpnext/accounts/report/profitability_analysis/profitability_analysis.py b/erpnext/accounts/report/profitability_analysis/profitability_analysis.py
index 48bd730..ad97808 100644
--- a/erpnext/accounts/report/profitability_analysis/profitability_analysis.py
+++ b/erpnext/accounts/report/profitability_analysis/profitability_analysis.py
@@ -2,10 +2,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt, getdate, formatdate, cstr
-from erpnext.accounts.report.financial_statements import filter_accounts, filter_out_zero_value_rows
+from frappe.utils import cstr, flt
+
+from erpnext.accounts.report.financial_statements import (
+ filter_accounts,
+ filter_out_zero_value_rows,
+)
from erpnext.accounts.report.trial_balance.trial_balance import validate_filters
value_fields = ("income", "expense", "gross_profit_loss")
diff --git a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py
index ba236b9..b26c733 100644
--- a/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py
+++ b/erpnext/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py
@@ -2,8 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from erpnext.controllers.trends import get_columns,get_data
+
+from erpnext.controllers.trends import get_columns, get_data
+
def execute(filters=None):
if not filters: filters ={}
diff --git a/erpnext/accounts/report/purchase_register/purchase_register.py b/erpnext/accounts/report/purchase_register/purchase_register.py
index 10edd41..5d4a03c 100644
--- a/erpnext/accounts/report/purchase_register/purchase_register.py
+++ b/erpnext/accounts/report/purchase_register/purchase_register.py
@@ -2,10 +2,16 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+from frappe import _, msgprint
from frappe.utils import flt
-from frappe import msgprint, _
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children
+
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+ get_dimension_with_children,
+)
+
def execute(filters=None):
return _execute(filters)
diff --git a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py
index a5eced5..adf6b29 100644
--- a/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py
+++ b/erpnext/accounts/report/received_items_to_be_billed/received_items_to_be_billed.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe import _
+
from erpnext.accounts.report.non_billed_report import get_ordered_to_be_billed_data
+
def execute(filters=None):
columns = get_column()
args = get_args()
diff --git a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.py b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.py
index ee3992f..0ec54c9 100644
--- a/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.py
+++ b/erpnext/accounts/report/sales_invoice_trends/sales_invoice_trends.py
@@ -2,8 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from erpnext.controllers.trends import get_columns,get_data
+
+from erpnext.controllers.trends import get_columns, get_data
+
def execute(filters=None):
if not filters: filters ={}
diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
index ff77468..9ad7007 100644
--- a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
+++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
@@ -1,6 +1,7 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import cstr
diff --git a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py
index e4a3d35..9fd7bc3 100644
--- a/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py
+++ b/erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py
@@ -2,11 +2,17 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import unittest
+
import frappe
-from erpnext.accounts.report.sales_payment_summary.sales_payment_summary import get_mode_of_payments, get_mode_of_payment_details
from frappe.utils import today
+
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
+from erpnext.accounts.report.sales_payment_summary.sales_payment_summary import (
+ get_mode_of_payment_details,
+ get_mode_of_payments,
+)
test_dependencies = ["Sales Invoice"]
diff --git a/erpnext/accounts/report/sales_register/sales_register.py b/erpnext/accounts/report/sales_register/sales_register.py
index f38bd78..57b69aa 100644
--- a/erpnext/accounts/report/sales_register/sales_register.py
+++ b/erpnext/accounts/report/sales_register/sales_register.py
@@ -2,11 +2,17 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import flt
-from frappe import msgprint, _
+from frappe import _, msgprint
from frappe.model.meta import get_field_precision
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children
+from frappe.utils import flt
+
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+ get_dimension_with_children,
+)
+
def execute(filters=None):
return _execute(filters)
diff --git a/erpnext/accounts/report/share_balance/share_balance.py b/erpnext/accounts/report/share_balance/share_balance.py
index 9f22f81..03efc9e 100644
--- a/erpnext/accounts/report/share_balance/share_balance.py
+++ b/erpnext/accounts/report/share_balance/share_balance.py
@@ -2,8 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import msgprint, _
+from frappe import _
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/accounts/report/share_ledger/share_ledger.py b/erpnext/accounts/report/share_ledger/share_ledger.py
index 3ed3c91..9be6622 100644
--- a/erpnext/accounts/report/share_ledger/share_ledger.py
+++ b/erpnext/accounts/report/share_ledger/share_ledger.py
@@ -3,9 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import cstr, cint, getdate
-from frappe import msgprint, _
+from frappe import _
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/accounts/report/supplier_ledger_summary/supplier_ledger_summary.py b/erpnext/accounts/report/supplier_ledger_summary/supplier_ledger_summary.py
index fbd25b1..00316ba 100644
--- a/erpnext/accounts/report/supplier_ledger_summary/supplier_ledger_summary.py
+++ b/erpnext/accounts/report/supplier_ledger_summary/supplier_ledger_summary.py
@@ -2,8 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from erpnext.accounts.report.customer_ledger_summary.customer_ledger_summary import PartyLedgerSummaryReport
+
+from erpnext.accounts.report.customer_ledger_summary.customer_ledger_summary import (
+ PartyLedgerSummaryReport,
+)
+
def execute(filters=None):
args = {
diff --git a/erpnext/accounts/report/tax_detail/tax_detail.py b/erpnext/accounts/report/tax_detail/tax_detail.py
index 18436de..f03498d 100644
--- a/erpnext/accounts/report/tax_detail/tax_detail.py
+++ b/erpnext/accounts/report/tax_detail/tax_detail.py
@@ -3,8 +3,10 @@
# Contributed by Case Solved and sponsored by Nulight Studios
from __future__ import unicode_literals
-import frappe
+
import json
+
+import frappe
from frappe import _
# NOTE: Payroll is implemented using Journal Entries which are included as GL Entries
diff --git a/erpnext/accounts/report/tax_detail/test_tax_detail.py b/erpnext/accounts/report/tax_detail/test_tax_detail.py
index 743ddba..e74b905 100644
--- a/erpnext/accounts/report/tax_detail/test_tax_detail.py
+++ b/erpnext/accounts/report/tax_detail/test_tax_detail.py
@@ -1,16 +1,26 @@
from __future__ import unicode_literals
-import frappe
-import unittest
import datetime
import json
import os
-from frappe.utils import getdate, add_to_date, get_first_day, get_last_day, get_year_start, get_year_ending
+import unittest
+
+import frappe
+from frappe.utils import (
+ add_to_date,
+ get_first_day,
+ get_last_day,
+ get_year_ending,
+ get_year_start,
+ getdate,
+)
+
from .tax_detail import filter_match, save_custom_report
+
class TestTaxDetail(unittest.TestCase):
def load_testdocs(self):
- from erpnext.accounts.utils import get_fiscal_year, FiscalYearError
+ from erpnext.accounts.utils import FiscalYearError, get_fiscal_year
datapath, _ = os.path.splitext(os.path.realpath(__file__))
with open(datapath + '.json', 'r') as fp:
docs = json.load(fp)
diff --git a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py
index 6b9df41..c4a8c7a 100644
--- a/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py
+++ b/erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py
@@ -1,10 +1,15 @@
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt
+
+from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import (
+ get_advance_vouchers,
+ get_debit_note_amount,
+)
from erpnext.accounts.utils import get_fiscal_year
-from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category \
- import get_advance_vouchers, get_debit_note_amount
+
def execute(filters=None):
validate_filters(filters)
diff --git a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py
index ceefa31..9e1382b 100644
--- a/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py
+++ b/erpnext/accounts/report/tds_payable_monthly/tds_payable_monthly.py
@@ -2,9 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import getdate
+
def execute(filters=None):
filters["invoices"] = frappe.cache().hget("invoices", frappe.session.user)
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py
index 1fc0faa..d65bcc4 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.py
+++ b/erpnext/accounts/report/trial_balance/trial_balance.py
@@ -2,12 +2,21 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
-from frappe.utils import flt, getdate, formatdate, cstr
-from erpnext.accounts.report.financial_statements \
- import filter_accounts, set_gl_entries_by_account, filter_out_zero_value_rows
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children
+from frappe.utils import cstr, flt, formatdate, getdate
+
+import erpnext
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+ get_dimension_with_children,
+)
+from erpnext.accounts.report.financial_statements import (
+ filter_accounts,
+ filter_out_zero_value_rows,
+ set_gl_entries_by_account,
+)
value_fields = ("opening_debit", "opening_credit", "debit", "credit", "closing_debit", "closing_credit")
diff --git a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
index f034e74..8e24544 100644
--- a/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
+++ b/erpnext/accounts/report/trial_balance_for_party/trial_balance_for_party.py
@@ -2,11 +2,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt, cint
+from frappe.utils import cint, flt
+
from erpnext.accounts.report.trial_balance.trial_balance import validate_filters
+
def execute(filters=None):
validate_filters(filters)
diff --git a/erpnext/accounts/report/unpaid_expense_claim/unpaid_expense_claim.py b/erpnext/accounts/report/unpaid_expense_claim/unpaid_expense_claim.py
index 1250d67..71fe4a2 100644
--- a/erpnext/accounts/report/unpaid_expense_claim/unpaid_expense_claim.py
+++ b/erpnext/accounts/report/unpaid_expense_claim/unpaid_expense_claim.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
columns, data = [], []
columns = get_columns()
diff --git a/erpnext/accounts/report/utils.py b/erpnext/accounts/report/utils.py
index ba461ed..57ff9b0 100644
--- a/erpnext/accounts/report/utils.py
+++ b/erpnext/accounts/report/utils.py
@@ -1,9 +1,11 @@
from __future__ import unicode_literals
+
import frappe
+from frappe.utils import flt, formatdate, get_datetime_str
+
from erpnext import get_company_currency, get_default_company
-from erpnext.setup.utils import get_exchange_rate
from erpnext.accounts.doctype.fiscal_year.fiscal_year import get_from_and_to_date
-from frappe.utils import cint, get_datetime_str, formatdate, flt
+from erpnext.setup.utils import get_exchange_rate
__exchange_rates = {}
diff --git a/erpnext/accounts/test/test_utils.py b/erpnext/accounts/test/test_utils.py
index 628c8ce..d7b60da 100644
--- a/erpnext/accounts/test/test_utils.py
+++ b/erpnext/accounts/test/test_utils.py
@@ -1,8 +1,11 @@
from __future__ import unicode_literals
+
import unittest
-from erpnext.accounts.party import get_party_shipping_address
+
from frappe.test_runner import make_test_objects
+from erpnext.accounts.party import get_party_shipping_address
+
class TestUtils(unittest.TestCase):
@classmethod
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 5ed4a19..4692869 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -4,18 +4,19 @@
from __future__ import unicode_literals
-import frappe, erpnext
+import frappe
import frappe.defaults
-from frappe.utils import nowdate, cstr, flt, cint, now, getdate
-from frappe import throw, _
-from frappe.utils import formatdate, get_number_format_info
-from six import iteritems
-# imported to enable erpnext.accounts.utils.get_account_currency
-from erpnext.accounts.doctype.account.account import get_account_currency
+from frappe import _, throw
from frappe.model.meta import get_field_precision
+from frappe.utils import cint, cstr, flt, formatdate, get_number_format_info, getdate, now, nowdate
-from erpnext.stock.utils import get_stock_value_on
+import erpnext
+
+# imported to enable erpnext.accounts.utils.get_account_currency
+from erpnext.accounts.doctype.account.account import get_account_currency # noqa
from erpnext.stock import get_warehouse_account_map
+from erpnext.stock.utils import get_stock_value_on
+
class StockValueAndAccountBalanceOutOfSync(frappe.ValidationError): pass
class FiscalYearError(frappe.ValidationError): pass
@@ -341,31 +342,42 @@
def reconcile_against_document(args):
"""
- Cancel JV, Update aginst document, split if required and resubmit jv
+ Cancel PE or JV, Update against document, split if required and resubmit
"""
- for d in args:
+ # To optimize making GL Entry for PE or JV with multiple references
+ reconciled_entries = {}
+ for row in args:
+ if not reconciled_entries.get((row.voucher_type, row.voucher_no)):
+ reconciled_entries[(row.voucher_type, row.voucher_no)] = []
- check_if_advance_entry_modified(d)
- validate_allocated_amount(d)
+ reconciled_entries[(row.voucher_type, row.voucher_no)].append(row)
+
+ for key, entries in reconciled_entries.items():
+ voucher_type = key[0]
+ voucher_no = key[1]
# cancel advance entry
- doc = frappe.get_doc(d.voucher_type, d.voucher_no)
-
+ doc = frappe.get_doc(voucher_type, voucher_no)
frappe.flags.ignore_party_validation = True
doc.make_gl_entries(cancel=1, adv_adj=1)
- # update ref in advance entry
- if d.voucher_type == "Journal Entry":
- update_reference_in_journal_entry(d, doc)
- else:
- update_reference_in_payment_entry(d, doc)
+ for entry in entries:
+ check_if_advance_entry_modified(entry)
+ validate_allocated_amount(entry)
+ # update ref in advance entry
+ if voucher_type == "Journal Entry":
+ update_reference_in_journal_entry(entry, doc, do_not_save=True)
+ else:
+ update_reference_in_payment_entry(entry, doc, do_not_save=True)
+
+ doc.save(ignore_permissions=True)
# re-submit advance entry
- doc = frappe.get_doc(d.voucher_type, d.voucher_no)
+ doc = frappe.get_doc(entry.voucher_type, entry.voucher_no)
doc.make_gl_entries(cancel = 0, adv_adj =1)
frappe.flags.ignore_party_validation = False
- if d.voucher_type in ('Payment Entry', 'Journal Entry'):
+ if entry.voucher_type in ('Payment Entry', 'Journal Entry'):
doc.update_expense_claim()
def check_if_advance_entry_modified(args):
@@ -374,6 +386,9 @@
check if amount is same
check if jv is submitted
"""
+ if not args.get('unreconciled_amount'):
+ args.update({'unreconciled_amount': args.get('unadjusted_amount')})
+
ret = None
if args.voucher_type == "Journal Entry":
ret = frappe.db.sql("""
@@ -395,14 +410,14 @@
and t1.name = %(voucher_no)s and t2.name = %(voucher_detail_no)s
and t1.party_type = %(party_type)s and t1.party = %(party)s and t1.{0} = %(account)s
and t2.reference_doctype in ("", "Sales Order", "Purchase Order")
- and t2.allocated_amount = %(unadjusted_amount)s
+ and t2.allocated_amount = %(unreconciled_amount)s
""".format(party_account_field), args)
else:
ret = frappe.db.sql("""select name from `tabPayment Entry`
where
name = %(voucher_no)s and docstatus = 1
and party_type = %(party_type)s and party = %(party)s and {0} = %(account)s
- and unallocated_amount = %(unadjusted_amount)s
+ and unallocated_amount = %(unreconciled_amount)s
""".format(party_account_field), args)
if not ret:
@@ -415,58 +430,44 @@
elif flt(args.get("allocated_amount"), precision) > flt(args.get("unadjusted_amount"), precision):
throw(_("Allocated amount cannot be greater than unadjusted amount"))
-def update_reference_in_journal_entry(d, jv_obj):
+def update_reference_in_journal_entry(d, journal_entry, do_not_save=False):
"""
Updates against document, if partial amount splits into rows
"""
- jv_detail = jv_obj.get("accounts", {"name": d["voucher_detail_no"]})[0]
- jv_detail.set(d["dr_or_cr"], d["allocated_amount"])
- jv_detail.set('debit' if d['dr_or_cr']=='debit_in_account_currency' else 'credit',
- d["allocated_amount"]*flt(jv_detail.exchange_rate))
+ jv_detail = journal_entry.get("accounts", {"name": d["voucher_detail_no"]})[0]
- original_reference_type = jv_detail.reference_type
- original_reference_name = jv_detail.reference_name
-
- jv_detail.set("reference_type", d["against_voucher_type"])
- jv_detail.set("reference_name", d["against_voucher"])
-
- if d['allocated_amount'] < d['unadjusted_amount']:
- jvd = frappe.db.sql("""
- select cost_center, balance, against_account, is_advance,
- account_type, exchange_rate, account_currency
- from `tabJournal Entry Account` where name = %s
- """, d['voucher_detail_no'], as_dict=True)
-
+ if flt(d['unadjusted_amount']) - flt(d['allocated_amount']) != 0:
+ # adjust the unreconciled balance
amount_in_account_currency = flt(d['unadjusted_amount']) - flt(d['allocated_amount'])
- amount_in_company_currency = amount_in_account_currency * flt(jvd[0]['exchange_rate'])
+ amount_in_company_currency = amount_in_account_currency * flt(jv_detail.exchange_rate)
+ jv_detail.set(d['dr_or_cr'], amount_in_account_currency)
+ jv_detail.set('debit' if d['dr_or_cr'] == 'debit_in_account_currency' else 'credit', amount_in_company_currency)
+ else:
+ journal_entry.remove(jv_detail)
- # new entry with balance amount
- ch = jv_obj.append("accounts")
- ch.account = d['account']
- ch.account_type = jvd[0]['account_type']
- ch.account_currency = jvd[0]['account_currency']
- ch.exchange_rate = jvd[0]['exchange_rate']
- ch.party_type = d["party_type"]
- ch.party = d["party"]
- ch.cost_center = cstr(jvd[0]["cost_center"])
- ch.balance = flt(jvd[0]["balance"])
+ # new row with references
+ new_row = journal_entry.append("accounts")
+ new_row.update(jv_detail.as_dict().copy())
- ch.set(d['dr_or_cr'], amount_in_account_currency)
- ch.set('debit' if d['dr_or_cr']=='debit_in_account_currency' else 'credit', amount_in_company_currency)
+ new_row.set(d["dr_or_cr"], d["allocated_amount"])
+ new_row.set('debit' if d['dr_or_cr'] == 'debit_in_account_currency' else 'credit',
+ d["allocated_amount"] * flt(jv_detail.exchange_rate))
- ch.set('credit_in_account_currency' if d['dr_or_cr']== 'debit_in_account_currency'
- else 'debit_in_account_currency', 0)
- ch.set('credit' if d['dr_or_cr']== 'debit_in_account_currency' else 'debit', 0)
+ new_row.set('credit_in_account_currency' if d['dr_or_cr'] == 'debit_in_account_currency'
+ else 'debit_in_account_currency', 0)
+ new_row.set('credit' if d['dr_or_cr'] == 'debit_in_account_currency' else 'debit', 0)
- ch.against_account = cstr(jvd[0]["against_account"])
- ch.reference_type = original_reference_type
- ch.reference_name = original_reference_name
- ch.is_advance = cstr(jvd[0]["is_advance"])
- ch.docstatus = 1
+ new_row.set("reference_type", d["against_voucher_type"])
+ new_row.set("reference_name", d["against_voucher"])
+
+ new_row.against_account = cstr(jv_detail.against_account)
+ new_row.is_advance = cstr(jv_detail.is_advance)
+ new_row.docstatus = 1
# will work as update after submit
- jv_obj.flags.ignore_validate_update_after_submit = True
- jv_obj.save(ignore_permissions=True)
+ journal_entry.flags.ignore_validate_update_after_submit = True
+ if not do_not_save:
+ journal_entry.save(ignore_permissions=True)
def update_reference_in_payment_entry(d, payment_entry, do_not_save=False):
reference_details = {
@@ -576,7 +577,7 @@
@frappe.whitelist()
def get_company_default(company, fieldname, ignore_validation=False):
- value = frappe.get_cached_value('Company', company, fieldname)
+ value = frappe.get_cached_value('Company', company, fieldname)
if not ignore_validation and not value:
throw(_("Please set default {0} in Company {1}")
@@ -886,7 +887,9 @@
@frappe.whitelist()
def get_coa(doctype, parent, is_root, chart=None):
- from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import build_tree_from_json
+ from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import (
+ build_tree_from_json,
+ )
# add chart to flags to retrieve when called from expand all function
chart = chart if chart else frappe.flags.chart
diff --git a/erpnext/agriculture/doctype/agriculture_analysis_criteria/agriculture_analysis_criteria.py b/erpnext/agriculture/doctype/agriculture_analysis_criteria/agriculture_analysis_criteria.py
index 3bd3d7d..b0441c2 100644
--- a/erpnext/agriculture/doctype/agriculture_analysis_criteria/agriculture_analysis_criteria.py
+++ b/erpnext/agriculture/doctype/agriculture_analysis_criteria/agriculture_analysis_criteria.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class AgricultureAnalysisCriteria(Document):
pass
diff --git a/erpnext/agriculture/doctype/agriculture_analysis_criteria/test_agriculture_analysis_criteria.py b/erpnext/agriculture/doctype/agriculture_analysis_criteria/test_agriculture_analysis_criteria.py
index d79970b..4213e45 100644
--- a/erpnext/agriculture/doctype/agriculture_analysis_criteria/test_agriculture_analysis_criteria.py
+++ b/erpnext/agriculture/doctype/agriculture_analysis_criteria/test_agriculture_analysis_criteria.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestAgricultureAnalysisCriteria(unittest.TestCase):
pass
diff --git a/erpnext/agriculture/doctype/agriculture_task/agriculture_task.py b/erpnext/agriculture/doctype/agriculture_task/agriculture_task.py
index ce39368..642f491 100644
--- a/erpnext/agriculture/doctype/agriculture_task/agriculture_task.py
+++ b/erpnext/agriculture/doctype/agriculture_task/agriculture_task.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class AgricultureTask(Document):
pass
diff --git a/erpnext/agriculture/doctype/agriculture_task/test_agriculture_task.py b/erpnext/agriculture/doctype/agriculture_task/test_agriculture_task.py
index e828151..2b3c338 100644
--- a/erpnext/agriculture/doctype/agriculture_task/test_agriculture_task.py
+++ b/erpnext/agriculture/doctype/agriculture_task/test_agriculture_task.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestAgricultureTask(unittest.TestCase):
pass
diff --git a/erpnext/agriculture/doctype/crop/crop_dashboard.py b/erpnext/agriculture/doctype/crop/crop_dashboard.py
index 8f37735..02b937a 100644
--- a/erpnext/agriculture/doctype/crop/crop_dashboard.py
+++ b/erpnext/agriculture/doctype/crop/crop_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'transactions': [
diff --git a/erpnext/agriculture/doctype/crop/test_crop.py b/erpnext/agriculture/doctype/crop/test_crop.py
index b307983..1968a04 100644
--- a/erpnext/agriculture/doctype/crop/test_crop.py
+++ b/erpnext/agriculture/doctype/crop/test_crop.py
@@ -3,9 +3,10 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
test_dependencies = ["Fertilizer"]
class TestCrop(unittest.TestCase):
diff --git a/erpnext/agriculture/doctype/detected_disease/detected_disease.py b/erpnext/agriculture/doctype/detected_disease/detected_disease.py
index 8c90b83..b73fc32f 100644
--- a/erpnext/agriculture/doctype/detected_disease/detected_disease.py
+++ b/erpnext/agriculture/doctype/detected_disease/detected_disease.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class DetectedDisease(Document):
pass
diff --git a/erpnext/agriculture/doctype/disease/disease.py b/erpnext/agriculture/doctype/disease/disease.py
index affa570..e474efe 100644
--- a/erpnext/agriculture/doctype/disease/disease.py
+++ b/erpnext/agriculture/doctype/disease/disease.py
@@ -3,10 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe import _
+
class Disease(Document):
def validate(self):
diff --git a/erpnext/agriculture/doctype/disease/test_disease.py b/erpnext/agriculture/doctype/disease/test_disease.py
index 8086177..1959d1f 100644
--- a/erpnext/agriculture/doctype/disease/test_disease.py
+++ b/erpnext/agriculture/doctype/disease/test_disease.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestDisease(unittest.TestCase):
def test_treatment_period(self):
disease = frappe.get_doc('Disease', 'Aphids')
diff --git a/erpnext/agriculture/doctype/fertilizer/fertilizer.py b/erpnext/agriculture/doctype/fertilizer/fertilizer.py
index c475f00..75c2542 100644
--- a/erpnext/agriculture/doctype/fertilizer/fertilizer.py
+++ b/erpnext/agriculture/doctype/fertilizer/fertilizer.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class Fertilizer(Document):
@frappe.whitelist()
def load_contents(self):
diff --git a/erpnext/agriculture/doctype/fertilizer/test_fertilizer.py b/erpnext/agriculture/doctype/fertilizer/test_fertilizer.py
index 4c71d33..c11c61a 100644
--- a/erpnext/agriculture/doctype/fertilizer/test_fertilizer.py
+++ b/erpnext/agriculture/doctype/fertilizer/test_fertilizer.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestFertilizer(unittest.TestCase):
def test_fertilizer_creation(self):
self.assertEqual(frappe.db.exists('Fertilizer', 'Urea'), 'Urea')
diff --git a/erpnext/agriculture/doctype/fertilizer_content/fertilizer_content.py b/erpnext/agriculture/doctype/fertilizer_content/fertilizer_content.py
index d385242..a050b71 100644
--- a/erpnext/agriculture/doctype/fertilizer_content/fertilizer_content.py
+++ b/erpnext/agriculture/doctype/fertilizer_content/fertilizer_content.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class FertilizerContent(Document):
pass
diff --git a/erpnext/agriculture/doctype/linked_location/linked_location.py b/erpnext/agriculture/doctype/linked_location/linked_location.py
index 3e49d3e..e622e84 100644
--- a/erpnext/agriculture/doctype/linked_location/linked_location.py
+++ b/erpnext/agriculture/doctype/linked_location/linked_location.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class LinkedLocation(Document):
pass
diff --git a/erpnext/agriculture/doctype/linked_plant_analysis/linked_plant_analysis.py b/erpnext/agriculture/doctype/linked_plant_analysis/linked_plant_analysis.py
index daea54b..608bf8c 100644
--- a/erpnext/agriculture/doctype/linked_plant_analysis/linked_plant_analysis.py
+++ b/erpnext/agriculture/doctype/linked_plant_analysis/linked_plant_analysis.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class LinkedPlantAnalysis(Document):
pass
diff --git a/erpnext/agriculture/doctype/linked_soil_analysis/linked_soil_analysis.py b/erpnext/agriculture/doctype/linked_soil_analysis/linked_soil_analysis.py
index c4e9245..02eb133 100644
--- a/erpnext/agriculture/doctype/linked_soil_analysis/linked_soil_analysis.py
+++ b/erpnext/agriculture/doctype/linked_soil_analysis/linked_soil_analysis.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class LinkedSoilAnalysis(Document):
pass
diff --git a/erpnext/agriculture/doctype/linked_soil_texture/linked_soil_texture.py b/erpnext/agriculture/doctype/linked_soil_texture/linked_soil_texture.py
index 1b75892..f580e16 100644
--- a/erpnext/agriculture/doctype/linked_soil_texture/linked_soil_texture.py
+++ b/erpnext/agriculture/doctype/linked_soil_texture/linked_soil_texture.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class LinkedSoilTexture(Document):
pass
diff --git a/erpnext/agriculture/doctype/plant_analysis/plant_analysis.py b/erpnext/agriculture/doctype/plant_analysis/plant_analysis.py
index b65f93d..6238250 100644
--- a/erpnext/agriculture/doctype/plant_analysis/plant_analysis.py
+++ b/erpnext/agriculture/doctype/plant_analysis/plant_analysis.py
@@ -3,10 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.naming import make_autoname
from frappe.model.document import Document
+
class PlantAnalysis(Document):
@frappe.whitelist()
def load_contents(self):
diff --git a/erpnext/agriculture/doctype/plant_analysis/test_plant_analysis.py b/erpnext/agriculture/doctype/plant_analysis/test_plant_analysis.py
index cbd2fd7..6b6e843 100644
--- a/erpnext/agriculture/doctype/plant_analysis/test_plant_analysis.py
+++ b/erpnext/agriculture/doctype/plant_analysis/test_plant_analysis.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestPlantAnalysis(unittest.TestCase):
pass
diff --git a/erpnext/agriculture/doctype/plant_analysis_criteria/plant_analysis_criteria.py b/erpnext/agriculture/doctype/plant_analysis_criteria/plant_analysis_criteria.py
index c173184..9f71987 100644
--- a/erpnext/agriculture/doctype/plant_analysis_criteria/plant_analysis_criteria.py
+++ b/erpnext/agriculture/doctype/plant_analysis_criteria/plant_analysis_criteria.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PlantAnalysisCriteria(Document):
pass
diff --git a/erpnext/agriculture/doctype/soil_analysis/soil_analysis.py b/erpnext/agriculture/doctype/soil_analysis/soil_analysis.py
index 234d0d4..e0c8177 100644
--- a/erpnext/agriculture/doctype/soil_analysis/soil_analysis.py
+++ b/erpnext/agriculture/doctype/soil_analysis/soil_analysis.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class SoilAnalysis(Document):
@frappe.whitelist()
def load_contents(self):
diff --git a/erpnext/agriculture/doctype/soil_analysis/test_soil_analysis.py b/erpnext/agriculture/doctype/soil_analysis/test_soil_analysis.py
index b89d756..24fe074 100644
--- a/erpnext/agriculture/doctype/soil_analysis/test_soil_analysis.py
+++ b/erpnext/agriculture/doctype/soil_analysis/test_soil_analysis.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestSoilAnalysis(unittest.TestCase):
pass
diff --git a/erpnext/agriculture/doctype/soil_analysis_criteria/soil_analysis_criteria.py b/erpnext/agriculture/doctype/soil_analysis_criteria/soil_analysis_criteria.py
index b073c20..09b917c 100644
--- a/erpnext/agriculture/doctype/soil_analysis_criteria/soil_analysis_criteria.py
+++ b/erpnext/agriculture/doctype/soil_analysis_criteria/soil_analysis_criteria.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class SoilAnalysisCriteria(Document):
pass
diff --git a/erpnext/agriculture/doctype/soil_texture/soil_texture.py b/erpnext/agriculture/doctype/soil_texture/soil_texture.py
index 209b2c8..636af77 100644
--- a/erpnext/agriculture/doctype/soil_texture/soil_texture.py
+++ b/erpnext/agriculture/doctype/soil_texture/soil_texture.py
@@ -3,11 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import flt, cint
-from frappe import _
+from frappe.utils import cint, flt
+
class SoilTexture(Document):
soil_edit_order = [2, 1, 0]
diff --git a/erpnext/agriculture/doctype/soil_texture/test_soil_texture.py b/erpnext/agriculture/doctype/soil_texture/test_soil_texture.py
index 16d105c..c701eb8 100644
--- a/erpnext/agriculture/doctype/soil_texture/test_soil_texture.py
+++ b/erpnext/agriculture/doctype/soil_texture/test_soil_texture.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestSoilTexture(unittest.TestCase):
def test_texture_selection(self):
soil_tex = frappe.get_all('Soil Texture', fields=['name'], filters={'collection_datetime': '2017-11-08'})
diff --git a/erpnext/agriculture/doctype/soil_texture_criteria/soil_texture_criteria.py b/erpnext/agriculture/doctype/soil_texture_criteria/soil_texture_criteria.py
index a7525ae..9980e8b 100644
--- a/erpnext/agriculture/doctype/soil_texture_criteria/soil_texture_criteria.py
+++ b/erpnext/agriculture/doctype/soil_texture_criteria/soil_texture_criteria.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class SoilTextureCriteria(Document):
pass
diff --git a/erpnext/agriculture/doctype/water_analysis/test_water_analysis.py b/erpnext/agriculture/doctype/water_analysis/test_water_analysis.py
index b6467b7..5cddeeb 100644
--- a/erpnext/agriculture/doctype/water_analysis/test_water_analysis.py
+++ b/erpnext/agriculture/doctype/water_analysis/test_water_analysis.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestWaterAnalysis(unittest.TestCase):
pass
diff --git a/erpnext/agriculture/doctype/water_analysis/water_analysis.py b/erpnext/agriculture/doctype/water_analysis/water_analysis.py
index cb2691d..228ae34 100644
--- a/erpnext/agriculture/doctype/water_analysis/water_analysis.py
+++ b/erpnext/agriculture/doctype/water_analysis/water_analysis.py
@@ -3,10 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe import _
+
class WaterAnalysis(Document):
@frappe.whitelist()
diff --git a/erpnext/agriculture/doctype/water_analysis_criteria/water_analysis_criteria.py b/erpnext/agriculture/doctype/water_analysis_criteria/water_analysis_criteria.py
index 6833f90..8771733 100644
--- a/erpnext/agriculture/doctype/water_analysis_criteria/water_analysis_criteria.py
+++ b/erpnext/agriculture/doctype/water_analysis_criteria/water_analysis_criteria.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class WaterAnalysisCriteria(Document):
pass
diff --git a/erpnext/agriculture/doctype/weather/test_weather.py b/erpnext/agriculture/doctype/weather/test_weather.py
index b4ab3ae..1b4bab9 100644
--- a/erpnext/agriculture/doctype/weather/test_weather.py
+++ b/erpnext/agriculture/doctype/weather/test_weather.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestWeather(unittest.TestCase):
pass
diff --git a/erpnext/agriculture/doctype/weather/weather.py b/erpnext/agriculture/doctype/weather/weather.py
index 235e684..b41964d 100644
--- a/erpnext/agriculture/doctype/weather/weather.py
+++ b/erpnext/agriculture/doctype/weather/weather.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class Weather(Document):
@frappe.whitelist()
def load_contents(self):
diff --git a/erpnext/agriculture/doctype/weather_parameter/weather_parameter.py b/erpnext/agriculture/doctype/weather_parameter/weather_parameter.py
index 89db74c..42fcbcb 100644
--- a/erpnext/agriculture/doctype/weather_parameter/weather_parameter.py
+++ b/erpnext/agriculture/doctype/weather_parameter/weather_parameter.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class WeatherParameter(Document):
pass
diff --git a/erpnext/assets/dashboard_fixtures.py b/erpnext/assets/dashboard_fixtures.py
index 2c70179..39f0f1a 100644
--- a/erpnext/assets/dashboard_fixtures.py
+++ b/erpnext/assets/dashboard_fixtures.py
@@ -1,13 +1,16 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-import frappe
import json
-from frappe.utils import nowdate, add_months, get_date_str
+
+import frappe
from frappe import _
+from frappe.utils import get_date_str, nowdate
+
from erpnext.accounts.dashboard_fixtures import _get_fiscal_year
from erpnext.buying.dashboard_fixtures import get_company_for_dashboards
+
def get_data():
fiscal_year = _get_fiscal_year(nowdate())
diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py
index 7afb43b..8ff4f97 100644
--- a/erpnext/assets/doctype/asset/asset.py
+++ b/erpnext/assets/doctype/asset/asset.py
@@ -3,18 +3,37 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext, math, json
+
+import json
+import math
+
+import frappe
from frappe import _
+from frappe.utils import (
+ add_days,
+ add_months,
+ cint,
+ date_diff,
+ flt,
+ get_datetime,
+ get_last_day,
+ getdate,
+ month_diff,
+ nowdate,
+ today,
+)
from six import string_types
-from frappe.utils import flt, add_months, cint, nowdate, getdate, today, date_diff, month_diff, add_days, get_last_day, get_datetime
-from frappe.model.document import Document
+
+import erpnext
+from erpnext.accounts.general_ledger import make_reverse_gl_entries
+from erpnext.assets.doctype.asset.depreciation import (
+ get_depreciation_accounts,
+ get_disposal_account_and_cost_center,
+)
from erpnext.assets.doctype.asset_category.asset_category import get_asset_category_account
-from erpnext.assets.doctype.asset.depreciation \
- import get_disposal_account_and_cost_center, get_depreciation_accounts
-from erpnext.accounts.general_ledger import make_gl_entries, make_reverse_gl_entries
-from erpnext.accounts.utils import get_account_currency
from erpnext.controllers.accounts_controller import AccountsController
+
class Asset(AccountsController):
def validate(self):
self.validate_asset_values()
@@ -546,7 +565,7 @@
cwip_account = None
try:
cwip_account = get_asset_account("capital_work_in_progress_account", self.name, self.asset_category, self.company)
- except:
+ except Exception:
# if no cwip account found in category or company and "cwip is enabled" then raise else silently pass
if cwip_enabled:
raise
@@ -783,6 +802,7 @@
@frappe.whitelist()
def make_asset_movement(assets, purpose=None):
import json
+
from six import string_types
if isinstance(assets, string_types):
diff --git a/erpnext/assets/doctype/asset/asset_dashboard.py b/erpnext/assets/doctype/asset/asset_dashboard.py
index 62bb4be..cd04e1d 100644
--- a/erpnext/assets/doctype/asset/asset_dashboard.py
+++ b/erpnext/assets/doctype/asset/asset_dashboard.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_data():
return {
'non_standard_fieldnames': {
diff --git a/erpnext/assets/doctype/asset/depreciation.py b/erpnext/assets/doctype/asset/depreciation.py
index 9a61b79..6097910 100644
--- a/erpnext/assets/doctype/asset/depreciation.py
+++ b/erpnext/assets/doctype/asset/depreciation.py
@@ -3,10 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt, today, getdate, cint
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_checks_for_pl_and_bs_accounts
+from frappe.utils import cint, flt, getdate, today
+
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_checks_for_pl_and_bs_accounts,
+)
+
def post_depreciation_entries(date=None):
# Return if automatic booking of asset depreciation is disabled
diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py
index 605ce2e..4cc9be5 100644
--- a/erpnext/assets/doctype/asset/test_asset.py
+++ b/erpnext/assets/doctype/asset/test_asset.py
@@ -3,14 +3,23 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import cstr, nowdate, getdate, flt, get_last_day, add_days, add_months
-from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries, scrap_asset, restore_asset
-from erpnext.assets.doctype.asset.asset import make_sales_invoice
-from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
+
+import frappe
+from frappe.utils import add_days, add_months, cstr, flt, get_last_day, getdate, nowdate
+
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
-from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice as make_invoice
+from erpnext.assets.doctype.asset.asset import make_sales_invoice
+from erpnext.assets.doctype.asset.depreciation import (
+ post_depreciation_entries,
+ restore_asset,
+ scrap_asset,
+)
+from erpnext.stock.doctype.purchase_receipt.purchase_receipt import (
+ make_purchase_invoice as make_invoice,
+)
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
+
class TestAsset(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/assets/doctype/asset_category/asset_category.py b/erpnext/assets/doctype/asset_category/asset_category.py
index 39032d6..1e56c01 100644
--- a/erpnext/assets/doctype/asset_category/asset_category.py
+++ b/erpnext/assets/doctype/asset_category/asset_category.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import cint, get_link_to_form
from frappe.model.document import Document
+from frappe.utils import cint, get_link_to_form
+
class AssetCategory(Document):
def validate(self):
diff --git a/erpnext/assets/doctype/asset_category/test_asset_category.py b/erpnext/assets/doctype/asset_category/test_asset_category.py
index 9f7ada6..53ec4ed 100644
--- a/erpnext/assets/doctype/asset_category/test_asset_category.py
+++ b/erpnext/assets/doctype/asset_category/test_asset_category.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestAssetCategory(unittest.TestCase):
def test_mandatory_fields(self):
asset_category = frappe.new_doc("Asset Category")
diff --git a/erpnext/assets/doctype/asset_category_account/asset_category_account.py b/erpnext/assets/doctype/asset_category_account/asset_category_account.py
index 67925f4..66280ac 100644
--- a/erpnext/assets/doctype/asset_category_account/asset_category_account.py
+++ b/erpnext/assets/doctype/asset_category_account/asset_category_account.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class AssetCategoryAccount(Document):
pass
diff --git a/erpnext/assets/doctype/asset_finance_book/asset_finance_book.py b/erpnext/assets/doctype/asset_finance_book/asset_finance_book.py
index bdc2acf..c4f0953 100644
--- a/erpnext/assets/doctype/asset_finance_book/asset_finance_book.py
+++ b/erpnext/assets/doctype/asset_finance_book/asset_finance_book.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class AssetFinanceBook(Document):
pass
diff --git a/erpnext/assets/doctype/asset_maintenance/asset_maintenance.py b/erpnext/assets/doctype/asset_maintenance/asset_maintenance.py
index e14f1d8..ec55fa4 100644
--- a/erpnext/assets/doctype/asset_maintenance/asset_maintenance.py
+++ b/erpnext/assets/doctype/asset_maintenance/asset_maintenance.py
@@ -3,12 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
+from frappe import _, throw
from frappe.desk.form import assign_to
-from frappe import throw, _
+from frappe.model.document import Document
from frappe.utils import add_days, add_months, add_years, getdate, nowdate
+
class AssetMaintenance(Document):
def validate(self):
for task in self.get('asset_maintenance_tasks'):
diff --git a/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py b/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py
index 7610152..0f91508 100644
--- a/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py
+++ b/erpnext/assets/doctype/asset_maintenance/test_asset_maintenance.py
@@ -3,11 +3,14 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import nowdate, get_last_day, add_days
-from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
+
+import frappe
+from frappe.utils import add_days, get_last_day, nowdate
+
from erpnext.assets.doctype.asset_maintenance.asset_maintenance import calculate_next_due_date
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
+
class TestAssetMaintenance(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.py b/erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.py
index 34facd8..1f23936 100644
--- a/erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.py
+++ b/erpnext/assets/doctype/asset_maintenance_log/asset_maintenance_log.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
-from frappe.utils import nowdate, getdate
+from frappe.model.document import Document
+from frappe.utils import getdate, nowdate
+
from erpnext.assets.doctype.asset_maintenance.asset_maintenance import calculate_next_due_date
+
class AssetMaintenanceLog(Document):
def validate(self):
if getdate(self.due_date) < getdate(nowdate()) and self.maintenance_status not in ["Completed", "Cancelled"]:
diff --git a/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py b/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py
index a1ec879..7ad69e9 100644
--- a/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py
+++ b/erpnext/assets/doctype/asset_maintenance_log/test_asset_maintenance_log.py
@@ -5,5 +5,6 @@
import unittest
+
class TestAssetMaintenanceLog(unittest.TestCase):
pass
diff --git a/erpnext/assets/doctype/asset_maintenance_task/asset_maintenance_task.py b/erpnext/assets/doctype/asset_maintenance_task/asset_maintenance_task.py
index 2a5666d..2280f55 100644
--- a/erpnext/assets/doctype/asset_maintenance_task/asset_maintenance_task.py
+++ b/erpnext/assets/doctype/asset_maintenance_task/asset_maintenance_task.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class AssetMaintenanceTask(Document):
pass
diff --git a/erpnext/assets/doctype/asset_maintenance_team/asset_maintenance_team.py b/erpnext/assets/doctype/asset_maintenance_team/asset_maintenance_team.py
index f741a8f..46e9029 100644
--- a/erpnext/assets/doctype/asset_maintenance_team/asset_maintenance_team.py
+++ b/erpnext/assets/doctype/asset_maintenance_team/asset_maintenance_team.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class AssetMaintenanceTeam(Document):
pass
diff --git a/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py b/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py
index a0c0b14..8d757b7 100644
--- a/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py
+++ b/erpnext/assets/doctype/asset_maintenance_team/test_asset_maintenance_team.py
@@ -5,5 +5,6 @@
import unittest
+
class TestAssetMaintenanceTeam(unittest.TestCase):
pass
diff --git a/erpnext/assets/doctype/asset_movement/asset_movement.py b/erpnext/assets/doctype/asset_movement/asset_movement.py
index 1771e27..901bdb5 100644
--- a/erpnext/assets/doctype/asset_movement/asset_movement.py
+++ b/erpnext/assets/doctype/asset_movement/asset_movement.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
class AssetMovement(Document):
def validate(self):
self.validate_asset()
diff --git a/erpnext/assets/doctype/asset_movement/test_asset_movement.py b/erpnext/assets/doctype/asset_movement/test_asset_movement.py
index 2b2d2b4..058bbd1 100644
--- a/erpnext/assets/doctype/asset_movement/test_asset_movement.py
+++ b/erpnext/assets/doctype/asset_movement/test_asset_movement.py
@@ -3,16 +3,16 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-import erpnext
-from erpnext.stock.doctype.item.test_item import make_item
-from frappe.utils import now, nowdate, get_last_day, add_days
+
+import frappe
+from frappe.utils import now
+
from erpnext.assets.doctype.asset.test_asset import create_asset_data
-from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
from erpnext.hr.doctype.employee.test_employee import make_employee
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
+
class TestAssetMovement(unittest.TestCase):
def setUp(self):
frappe.db.set_value("Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC")
diff --git a/erpnext/assets/doctype/asset_movement_item/asset_movement_item.py b/erpnext/assets/doctype/asset_movement_item/asset_movement_item.py
index 4c6aaab..24da371 100644
--- a/erpnext/assets/doctype/asset_movement_item/asset_movement_item.py
+++ b/erpnext/assets/doctype/asset_movement_item/asset_movement_item.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class AssetMovementItem(Document):
pass
diff --git a/erpnext/assets/doctype/asset_repair/asset_repair.py b/erpnext/assets/doctype/asset_repair/asset_repair.py
index 746f582..99a7d9b 100644
--- a/erpnext/assets/doctype/asset_repair/asset_repair.py
+++ b/erpnext/assets/doctype/asset_repair/asset_repair.py
@@ -3,13 +3,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import time_diff_in_hours, getdate, add_months, flt, cint
+from frappe.utils import add_months, cint, flt, getdate, time_diff_in_hours
+
from erpnext.accounts.general_ledger import make_gl_entries
from erpnext.assets.doctype.asset.asset import get_asset_account
from erpnext.controllers.accounts_controller import AccountsController
+
class AssetRepair(AccountsController):
def validate(self):
self.asset_doc = frappe.get_doc('Asset', self.asset)
diff --git a/erpnext/assets/doctype/asset_repair/test_asset_repair.py b/erpnext/assets/doctype/asset_repair/test_asset_repair.py
index 5e727d0..9945a32 100644
--- a/erpnext/assets/doctype/asset_repair/test_asset_repair.py
+++ b/erpnext/assets/doctype/asset_repair/test_asset_repair.py
@@ -2,10 +2,18 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import nowdate, flt
+
import unittest
-from erpnext.assets.doctype.asset.test_asset import create_asset_data, create_asset, set_depreciation_settings_in_company
+
+import frappe
+from frappe.utils import flt, nowdate
+
+from erpnext.assets.doctype.asset.test_asset import (
+ create_asset,
+ create_asset_data,
+ set_depreciation_settings_in_company,
+)
+
class TestAssetRepair(unittest.TestCase):
def setUp(self):
@@ -110,8 +118,8 @@
return asset.finance_books[0].total_number_of_depreciations
def create_asset_repair(**args):
- from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
+ from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
args = frappe._dict(args)
diff --git a/erpnext/assets/doctype/asset_repair_consumed_item/asset_repair_consumed_item.py b/erpnext/assets/doctype/asset_repair_consumed_item/asset_repair_consumed_item.py
index fa22a57..2a8d64e 100644
--- a/erpnext/assets/doctype/asset_repair_consumed_item/asset_repair_consumed_item.py
+++ b/erpnext/assets/doctype/asset_repair_consumed_item/asset_repair_consumed_item.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class AssetRepairConsumedItem(Document):
pass
diff --git a/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py b/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py
index 2f6b5ee..2c11018 100644
--- a/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py
+++ b/erpnext/assets/doctype/asset_value_adjustment/asset_value_adjustment.py
@@ -3,12 +3,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt, getdate, cint, date_diff, formatdate
-from erpnext.assets.doctype.asset.depreciation import get_depreciation_accounts
from frappe.model.document import Document
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_checks_for_pl_and_bs_accounts
+from frappe.utils import cint, date_diff, flt, formatdate, getdate
+
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_checks_for_pl_and_bs_accounts,
+)
+from erpnext.assets.doctype.asset.depreciation import get_depreciation_accounts
+
class AssetValueAdjustment(Document):
def validate(self):
diff --git a/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py b/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py
index a9dc979..52728d6 100644
--- a/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py
+++ b/erpnext/assets/doctype/asset_value_adjustment/test_asset_value_adjustment.py
@@ -3,12 +3,17 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import nowdate, get_last_day, add_days
+
+import frappe
+from frappe.utils import add_days, get_last_day, nowdate
+
from erpnext.assets.doctype.asset.test_asset import create_asset_data
+from erpnext.assets.doctype.asset_value_adjustment.asset_value_adjustment import (
+ get_current_asset_value,
+)
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
-from erpnext.assets.doctype.asset_value_adjustment.asset_value_adjustment import get_current_asset_value
+
class TestAssetValueAdjustment(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/assets/doctype/depreciation_schedule/depreciation_schedule.py b/erpnext/assets/doctype/depreciation_schedule/depreciation_schedule.py
index 54fba3f..3199b7d 100644
--- a/erpnext/assets/doctype/depreciation_schedule/depreciation_schedule.py
+++ b/erpnext/assets/doctype/depreciation_schedule/depreciation_schedule.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class DepreciationSchedule(Document):
pass
diff --git a/erpnext/assets/doctype/linked_location/linked_location.py b/erpnext/assets/doctype/linked_location/linked_location.py
index 3e49d3e..e622e84 100644
--- a/erpnext/assets/doctype/linked_location/linked_location.py
+++ b/erpnext/assets/doctype/linked_location/linked_location.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class LinkedLocation(Document):
pass
diff --git a/erpnext/assets/doctype/location/location.py b/erpnext/assets/doctype/location/location.py
index 317894c..1430306 100644
--- a/erpnext/assets/doctype/location/location.py
+++ b/erpnext/assets/doctype/location/location.py
@@ -8,8 +8,6 @@
import math
import frappe
-from frappe import _
-from frappe.model.document import Document
from frappe.utils import flt
from frappe.utils.nestedset import NestedSet, update_nsm
diff --git a/erpnext/assets/doctype/maintenance_team_member/maintenance_team_member.py b/erpnext/assets/doctype/maintenance_team_member/maintenance_team_member.py
index 3d9e555..8fc5c9c 100644
--- a/erpnext/assets/doctype/maintenance_team_member/maintenance_team_member.py
+++ b/erpnext/assets/doctype/maintenance_team_member/maintenance_team_member.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class MaintenanceTeamMember(Document):
pass
diff --git a/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py b/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py
index c805e56..f8958c6 100644
--- a/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py
+++ b/erpnext/assets/doctype/maintenance_team_member/test_maintenance_team_member.py
@@ -5,5 +5,6 @@
import unittest
+
class TestMaintenanceTeamMember(unittest.TestCase):
pass
diff --git a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py
index 7d07397..e370b9d 100644
--- a/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py
+++ b/erpnext/assets/report/fixed_asset_register/fixed_asset_register.py
@@ -2,10 +2,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import cstr, today, flt, add_years, formatdate, getdate
-from erpnext.accounts.report.financial_statements import get_period_list, get_fiscal_year_data, validate_fiscal_year
+from frappe.utils import cstr, flt, formatdate, getdate
+
+from erpnext.accounts.report.financial_statements import (
+ get_fiscal_year_data,
+ get_period_list,
+ validate_fiscal_year,
+)
+
def execute(filters=None):
filters = frappe._dict(filters or {})
diff --git a/erpnext/buying/doctype/buying_settings/buying_settings.py b/erpnext/buying/doctype/buying_settings/buying_settings.py
index a634a09..9e72c18 100644
--- a/erpnext/buying/doctype/buying_settings/buying_settings.py
+++ b/erpnext/buying/doctype/buying_settings/buying_settings.py
@@ -4,10 +4,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+import frappe
from frappe.model.document import Document
+
class BuyingSettings(Document):
def validate(self):
for key in ["supplier_group", "supp_master_name", "maintain_same_rate", "buying_price_list"]:
diff --git a/erpnext/buying/doctype/buying_settings/test_buying_settings.py b/erpnext/buying/doctype/buying_settings/test_buying_settings.py
index bf6eec6..4998aeb 100644
--- a/erpnext/buying/doctype/buying_settings/test_buying_settings.py
+++ b/erpnext/buying/doctype/buying_settings/test_buying_settings.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestBuyingSettings(unittest.TestCase):
pass
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index a55a0b7..ef54538 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -144,9 +144,7 @@
{
"fieldname": "supplier_section",
"fieldtype": "Section Break",
- "options": "fa fa-user",
- "show_days": 1,
- "show_seconds": 1
+ "options": "fa fa-user"
},
{
"allow_on_submit": 1,
@@ -156,9 +154,7 @@
"hidden": 1,
"label": "Title",
"no_copy": 1,
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "naming_series",
@@ -170,9 +166,7 @@
"options": "PUR-ORD-.YYYY.-",
"print_hide": 1,
"reqd": 1,
- "set_only_once": 1,
- "show_days": 1,
- "show_seconds": 1
+ "set_only_once": 1
},
{
"bold": 1,
@@ -186,18 +180,14 @@
"options": "Supplier",
"print_hide": 1,
"reqd": 1,
- "search_index": 1,
- "show_days": 1,
- "show_seconds": 1
+ "search_index": 1
},
{
"depends_on": "eval:doc.supplier && doc.docstatus===0 && (!(doc.items && doc.items.length) || (doc.items.length==1 && !doc.items[0].item_code))",
"description": "Fetch items based on Default Supplier.",
"fieldname": "get_items_from_open_material_requests",
"fieldtype": "Button",
- "label": "Get Items from Open Material Requests",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Get Items from Open Material Requests"
},
{
"bold": 1,
@@ -206,9 +196,7 @@
"fieldtype": "Data",
"in_global_search": 1,
"label": "Supplier Name",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "company",
@@ -220,17 +208,13 @@
"options": "Company",
"print_hide": 1,
"remember_last_selected_value": 1,
- "reqd": 1,
- "show_days": 1,
- "show_seconds": 1
+ "reqd": 1
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"print_width": "50%",
- "show_days": 1,
- "show_seconds": 1,
"width": "50%"
},
{
@@ -242,35 +226,27 @@
"oldfieldname": "transaction_date",
"oldfieldtype": "Date",
"reqd": 1,
- "search_index": 1,
- "show_days": 1,
- "show_seconds": 1
+ "search_index": 1
},
{
"allow_on_submit": 1,
"fieldname": "schedule_date",
"fieldtype": "Date",
- "label": "Required By",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Required By"
},
{
"allow_on_submit": 1,
"depends_on": "eval:doc.docstatus===1",
"fieldname": "order_confirmation_no",
"fieldtype": "Data",
- "label": "Order Confirmation No",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Order Confirmation No"
},
{
"allow_on_submit": 1,
"depends_on": "eval:doc.order_confirmation_no",
"fieldname": "order_confirmation_date",
"fieldtype": "Date",
- "label": "Order Confirmation Date",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Order Confirmation Date"
},
{
"fieldname": "amended_from",
@@ -282,25 +258,19 @@
"oldfieldtype": "Data",
"options": "Purchase Order",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "drop_ship",
"fieldtype": "Section Break",
- "label": "Drop Ship",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Drop Ship"
},
{
"fieldname": "customer",
"fieldtype": "Link",
"label": "Customer",
"options": "Customer",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"bold": 1,
@@ -308,41 +278,31 @@
"fieldtype": "Data",
"label": "Customer Name",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "column_break_19",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "customer_contact_person",
"fieldtype": "Link",
"label": "Customer Contact",
- "options": "Contact",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Contact"
},
{
"fieldname": "customer_contact_display",
"fieldtype": "Small Text",
"hidden": 1,
"label": "Customer Contact",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "customer_contact_mobile",
"fieldtype": "Small Text",
"hidden": 1,
"label": "Customer Mobile No",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "customer_contact_email",
@@ -350,35 +310,27 @@
"hidden": 1,
"label": "Customer Contact Email",
"options": "Email",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"collapsible": 1,
"fieldname": "section_addresses",
"fieldtype": "Section Break",
- "label": "Address and Contact",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Address and Contact"
},
{
"fieldname": "supplier_address",
"fieldtype": "Link",
"label": "Supplier Address",
"options": "Address",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "contact_person",
"fieldtype": "Link",
"label": "Supplier Contact",
"options": "Contact",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "address_display",
@@ -405,42 +357,32 @@
"label": "Contact Email",
"options": "Email",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "col_break_address",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "shipping_address",
"fieldtype": "Link",
"label": "Company Shipping Address",
"options": "Address",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "shipping_address_display",
"fieldtype": "Small Text",
"label": "Shipping Address Details",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"collapsible": 1,
"fieldname": "currency_and_price_list",
"fieldtype": "Section Break",
"label": "Currency and Price List",
- "options": "fa fa-tag",
- "show_days": 1,
- "show_seconds": 1
+ "options": "fa fa-tag"
},
{
"fieldname": "currency",
@@ -450,9 +392,7 @@
"oldfieldtype": "Select",
"options": "Currency",
"print_hide": 1,
- "reqd": 1,
- "show_days": 1,
- "show_seconds": 1
+ "reqd": 1
},
{
"fieldname": "conversion_rate",
@@ -462,24 +402,18 @@
"oldfieldtype": "Currency",
"precision": "9",
"print_hide": 1,
- "reqd": 1,
- "show_days": 1,
- "show_seconds": 1
+ "reqd": 1
},
{
"fieldname": "cb_price_list",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "buying_price_list",
"fieldtype": "Link",
"label": "Price List",
"options": "Price List",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "price_list_currency",
@@ -487,18 +421,14 @@
"label": "Price List Currency",
"options": "Currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "plc_conversion_rate",
"fieldtype": "Float",
"label": "Price List Exchange Rate",
"precision": "9",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"default": "0",
@@ -507,9 +437,7 @@
"label": "Ignore Pricing Rule",
"no_copy": 1,
"permlevel": 1,
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "sec_warehouse",
@@ -522,15 +450,11 @@
"fieldtype": "Link",
"label": "Set Target Warehouse",
"options": "Warehouse",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "col_break_warehouse",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"default": "No",
@@ -539,35 +463,27 @@
"in_standard_filter": 1,
"label": "Supply Raw Materials",
"options": "No\nYes",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"depends_on": "eval:doc.is_subcontracted==\"Yes\"",
"fieldname": "supplier_warehouse",
"fieldtype": "Link",
"label": "Supplier Warehouse",
- "options": "Warehouse",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Warehouse"
},
{
"fieldname": "items_section",
"fieldtype": "Section Break",
"hide_border": 1,
"oldfieldtype": "Section Break",
- "options": "fa fa-shopping-cart",
- "show_days": 1,
- "show_seconds": 1
+ "options": "fa fa-shopping-cart"
},
{
"fieldname": "scan_barcode",
"fieldtype": "Data",
"label": "Scan Barcode",
- "options": "Barcode",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Barcode"
},
{
"allow_bulk_edit": 1,
@@ -577,34 +493,26 @@
"oldfieldname": "po_details",
"oldfieldtype": "Table",
"options": "Purchase Order Item",
- "reqd": 1,
- "show_days": 1,
- "show_seconds": 1
+ "reqd": 1
},
{
"collapsible": 1,
"fieldname": "section_break_48",
"fieldtype": "Section Break",
- "label": "Pricing Rules",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Pricing Rules"
},
{
"fieldname": "pricing_rules",
"fieldtype": "Table",
"label": "Purchase Order Pricing Rule",
"options": "Pricing Rule Detail",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"collapsible_depends_on": "supplied_items",
"fieldname": "raw_material_details",
"fieldtype": "Section Break",
- "label": "Raw Materials Supplied",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Raw Materials Supplied"
},
{
"fieldname": "supplied_items",
@@ -615,23 +523,17 @@
"oldfieldtype": "Table",
"options": "Purchase Order Item Supplied",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "sb_last_purchase",
- "fieldtype": "Section Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Section Break"
},
{
"fieldname": "total_qty",
"fieldtype": "Float",
"label": "Total Quantity",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "base_total",
@@ -639,9 +541,7 @@
"label": "Total (Company Currency)",
"options": "Company:company:default_currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "base_net_total",
@@ -652,24 +552,18 @@
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "column_break_26",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "total",
"fieldtype": "Currency",
"label": "Total",
"options": "currency",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "net_total",
@@ -679,26 +573,20 @@
"oldfieldtype": "Currency",
"options": "currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "total_net_weight",
"fieldtype": "Float",
"label": "Total Net Weight",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "taxes_section",
"fieldtype": "Section Break",
"oldfieldtype": "Section Break",
- "options": "fa fa-money",
- "show_days": 1,
- "show_seconds": 1
+ "options": "fa fa-money"
},
{
"fieldname": "taxes_and_charges",
@@ -707,24 +595,18 @@
"oldfieldname": "purchase_other_charges",
"oldfieldtype": "Link",
"options": "Purchase Taxes and Charges Template",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "column_break_50",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "shipping_rule",
"fieldtype": "Link",
"label": "Shipping Rule",
"options": "Shipping Rule",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "section_break_52",
@@ -737,17 +619,13 @@
"label": "Purchase Taxes and Charges",
"oldfieldname": "purchase_tax_details",
"oldfieldtype": "Table",
- "options": "Purchase Taxes and Charges",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Purchase Taxes and Charges"
},
{
"collapsible": 1,
"fieldname": "sec_tax_breakup",
"fieldtype": "Section Break",
- "label": "Tax Breakup",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Tax Breakup"
},
{
"fieldname": "other_charges_calculation",
@@ -756,18 +634,14 @@
"no_copy": 1,
"oldfieldtype": "HTML",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "totals",
"fieldtype": "Section Break",
"label": "Taxes and Charges",
"oldfieldtype": "Section Break",
- "options": "fa fa-money",
- "show_days": 1,
- "show_seconds": 1
+ "options": "fa fa-money"
},
{
"depends_on": "base_taxes_and_charges_added",
@@ -778,9 +652,7 @@
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"depends_on": "base_taxes_and_charges_deducted",
@@ -791,9 +663,7 @@
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"depends_on": "base_total_taxes_and_charges",
@@ -805,15 +675,11 @@
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "column_break_39",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"depends_on": "taxes_and_charges_added",
@@ -824,9 +690,7 @@
"oldfieldtype": "Currency",
"options": "currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"depends_on": "taxes_and_charges_deducted",
@@ -837,9 +701,7 @@
"oldfieldtype": "Currency",
"options": "currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"depends_on": "total_taxes_and_charges",
@@ -848,18 +710,14 @@
"label": "Total Taxes and Charges",
"options": "currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"collapsible": 1,
"collapsible_depends_on": "apply_discount_on",
"fieldname": "discount_section",
"fieldtype": "Section Break",
- "label": "Additional Discount",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Additional Discount"
},
{
"default": "Grand Total",
@@ -867,9 +725,7 @@
"fieldtype": "Select",
"label": "Apply Additional Discount On",
"options": "\nGrand Total\nNet Total",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "base_discount_amount",
@@ -877,32 +733,24 @@
"label": "Additional Discount Amount (Company Currency)",
"options": "Company:company:default_currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "column_break_45",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "additional_discount_percentage",
"fieldtype": "Float",
"label": "Additional Discount Percentage",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "discount_amount",
"fieldtype": "Currency",
"label": "Additional Discount Amount",
"options": "currency",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "totals_section",
@@ -918,9 +766,7 @@
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"depends_on": "eval:!doc.disable_rounded_total",
@@ -930,9 +776,7 @@
"no_copy": 1,
"options": "Company:company:default_currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"description": "In Words will be visible once you save the Purchase Order.",
@@ -943,9 +787,7 @@
"oldfieldname": "in_words",
"oldfieldtype": "Data",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "base_rounded_total",
@@ -955,16 +797,12 @@
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "column_break4",
"fieldtype": "Column Break",
- "oldfieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "oldfieldtype": "Column Break"
},
{
"fieldname": "grand_total",
@@ -974,9 +812,7 @@
"oldfieldname": "grand_total_import",
"oldfieldtype": "Currency",
"options": "currency",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"depends_on": "eval:!doc.disable_rounded_total",
@@ -986,26 +822,20 @@
"no_copy": 1,
"options": "currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "rounded_total",
"fieldtype": "Currency",
"label": "Rounded Total",
"options": "currency",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"default": "0",
"fieldname": "disable_rounded_total",
"fieldtype": "Check",
- "label": "Disable Rounded Total",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Disable Rounded Total"
},
{
"fieldname": "in_words",
@@ -1015,9 +845,7 @@
"oldfieldname": "in_words_import",
"oldfieldtype": "Data",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "advance_paid",
@@ -1026,25 +854,19 @@
"no_copy": 1,
"options": "party_account_currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"collapsible": 1,
"fieldname": "payment_schedule_section",
"fieldtype": "Section Break",
- "label": "Payment Terms",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Payment Terms"
},
{
"fieldname": "payment_terms_template",
"fieldtype": "Link",
"label": "Payment Terms Template",
- "options": "Payment Terms Template",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Payment Terms Template"
},
{
"fieldname": "payment_schedule",
@@ -1052,9 +874,7 @@
"label": "Payment Schedule",
"no_copy": 1,
"options": "Payment Schedule",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"collapsible": 1,
@@ -1063,9 +883,7 @@
"fieldtype": "Section Break",
"label": "Terms and Conditions",
"oldfieldtype": "Section Break",
- "options": "fa fa-legal",
- "show_days": 1,
- "show_seconds": 1
+ "options": "fa fa-legal"
},
{
"fieldname": "tc_name",
@@ -1074,27 +892,21 @@
"oldfieldname": "tc_name",
"oldfieldtype": "Link",
"options": "Terms and Conditions",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "terms",
"fieldtype": "Text Editor",
"label": "Terms and Conditions",
"oldfieldname": "terms",
- "oldfieldtype": "Text Editor",
- "show_days": 1,
- "show_seconds": 1
+ "oldfieldtype": "Text Editor"
},
{
"collapsible": 1,
"fieldname": "more_info",
"fieldtype": "Section Break",
"label": "More Information",
- "oldfieldtype": "Section Break",
- "show_days": 1,
- "show_seconds": 1
+ "oldfieldtype": "Section Break"
},
{
"default": "Draft",
@@ -1109,9 +921,7 @@
"print_hide": 1,
"read_only": 1,
"reqd": 1,
- "search_index": 1,
- "show_days": 1,
- "show_seconds": 1
+ "search_index": 1
},
{
"fieldname": "ref_sq",
@@ -1122,9 +932,7 @@
"oldfieldtype": "Data",
"options": "Supplier Quotation",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "party_account_currency",
@@ -1134,24 +942,18 @@
"no_copy": 1,
"options": "Currency",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "inter_company_order_reference",
"fieldtype": "Link",
"label": "Inter Company Order Reference",
"options": "Sales Order",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "column_break_74",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"depends_on": "eval:!doc.__islocal",
@@ -1161,9 +963,7 @@
"label": "% Received",
"no_copy": 1,
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"depends_on": "eval:!doc.__islocal",
@@ -1173,9 +973,7 @@
"label": "% Billed",
"no_copy": 1,
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"collapsible": 1,
@@ -1185,8 +983,6 @@
"oldfieldtype": "Column Break",
"print_hide": 1,
"print_width": "50%",
- "show_days": 1,
- "show_seconds": 1,
"width": "50%"
},
{
@@ -1197,9 +993,7 @@
"oldfieldname": "letter_head",
"oldfieldtype": "Select",
"options": "Letter Head",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"allow_on_submit": 1,
@@ -1211,15 +1005,11 @@
"oldfieldtype": "Link",
"options": "Print Heading",
"print_hide": 1,
- "report_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "report_hide": 1
},
{
"fieldname": "column_break_86",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"allow_on_submit": 1,
@@ -1227,25 +1017,19 @@
"fieldname": "group_same_items",
"fieldtype": "Check",
"label": "Group same items",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "language",
"fieldtype": "Data",
"label": "Print Language",
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"collapsible": 1,
"fieldname": "subscription_section",
"fieldtype": "Section Break",
- "label": "Subscription Section",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Subscription Section"
},
{
"allow_on_submit": 1,
@@ -1253,9 +1037,7 @@
"fieldtype": "Date",
"label": "From Date",
"no_copy": 1,
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"allow_on_submit": 1,
@@ -1263,15 +1045,11 @@
"fieldtype": "Date",
"label": "To Date",
"no_copy": 1,
- "print_hide": 1,
- "show_days": 1,
- "show_seconds": 1
+ "print_hide": 1
},
{
"fieldname": "column_break_97",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "auto_repeat",
@@ -1280,35 +1058,27 @@
"no_copy": 1,
"options": "Auto Repeat",
"print_hide": 1,
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"allow_on_submit": 1,
"depends_on": "eval: doc.auto_repeat",
"fieldname": "update_auto_repeat_reference",
"fieldtype": "Button",
- "label": "Update Auto Repeat Reference",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Update Auto Repeat Reference"
},
{
"fieldname": "tax_category",
"fieldtype": "Link",
"label": "Tax Category",
- "options": "Tax Category",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Tax Category"
},
{
"depends_on": "supplied_items",
"fieldname": "set_reserve_warehouse",
"fieldtype": "Link",
"label": "Set Reserve Warehouse",
- "options": "Warehouse",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Warehouse"
},
{
"collapsible": 1,
@@ -1318,9 +1088,7 @@
},
{
"fieldname": "column_break_75",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "billing_address",
@@ -1361,25 +1129,21 @@
"default": "0",
"fieldname": "apply_tds",
"fieldtype": "Check",
- "label": "Apply Tax Withholding Amount",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Apply Tax Withholding Amount"
},
{
"depends_on": "eval: doc.apply_tds",
"fieldname": "tax_withholding_category",
"fieldtype": "Link",
"label": "Tax Withholding Category",
- "options": "Tax Withholding Category",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Tax Withholding Category"
}
],
"icon": "fa fa-file-text",
"idx": 105,
"is_submittable": 1,
"links": [],
- "modified": "2021-08-17 20:16:12.737743",
+ "modified": "2021-08-30 20:03:14.008804",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index ca3bd90..ac86337 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -2,23 +2,30 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
import json
-from frappe.utils import cstr, flt, cint
-from frappe import msgprint, _
-from frappe.model.mapper import get_mapped_doc
-from erpnext.controllers.buying_controller import BuyingController
-from erpnext.stock.doctype.item.item import get_last_purchase_details
-from erpnext.stock.stock_balance import update_bin_qty, get_ordered_qty
+
+import frappe
+from frappe import _, msgprint
from frappe.desk.notifications import clear_doctype_notifications
-from erpnext.buying.utils import validate_for_items, check_on_hold_or_closed_status
-from erpnext.stock.utils import get_bin
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import cint, cstr, flt
+
+from erpnext.accounts.doctype.sales_invoice.sales_invoice import (
+ unlink_inter_company_doc,
+ update_linked_doc,
+ validate_inter_company_party,
+)
+from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import (
+ get_party_tax_withholding_details,
+)
from erpnext.accounts.party import get_party_account_currency
-from erpnext.stock.doctype.item.item import get_item_defaults
+from erpnext.buying.utils import check_on_hold_or_closed_status, validate_for_items
+from erpnext.controllers.buying_controller import BuyingController
from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults
-from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import get_party_tax_withholding_details
-from erpnext.accounts.doctype.sales_invoice.sales_invoice import (validate_inter_company_party,
- update_linked_doc, unlink_inter_company_doc)
+from erpnext.stock.doctype.item.item import get_item_defaults, get_last_purchase_details
+from erpnext.stock.stock_balance import get_ordered_qty, update_bin_qty
+from erpnext.stock.utils import get_bin
form_grid_templates = {
"items": "templates/form_grid/item_grid.html"
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py b/erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py
index ab514da..af1dceb 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'purchase_order',
diff --git a/erpnext/buying/doctype/purchase_order/test_purchase_order.py b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
index fa174ba..1453b8e 100644
--- a/erpnext/buying/doctype/purchase_order/test_purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/test_purchase_order.py
@@ -2,24 +2,31 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import unittest
-import frappe
-import json
-import frappe.defaults
-from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
-from frappe.utils import flt, add_days, nowdate, getdate
-from erpnext.stock.doctype.item.test_item import make_item
-from erpnext.buying.doctype.purchase_order.purchase_order \
- import (make_purchase_receipt, make_purchase_invoice as make_pi_from_po, make_rm_stock_entry as make_subcontract_transfer_entry)
-from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice as make_pi_from_pr
-from erpnext.stock.doctype.material_request.test_material_request import make_material_request
-from erpnext.stock.doctype.material_request.material_request import make_purchase_order
-from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
-from erpnext.controllers.accounts_controller import update_child_qty_rate
-from erpnext.controllers.status_updater import OverAllowanceError
-from erpnext.manufacturing.doctype.blanket_order.test_blanket_order import make_blanket_order
-from erpnext.stock.doctype.batch.test_batch import make_new_batch
+import json
+import unittest
+
+import frappe
+from frappe.utils import add_days, flt, getdate, nowdate
+
+from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
+from erpnext.buying.doctype.purchase_order.purchase_order import (
+ make_purchase_invoice as make_pi_from_po,
+)
+from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt
+from erpnext.buying.doctype.purchase_order.purchase_order import (
+ make_rm_stock_entry as make_subcontract_transfer_entry,
+)
+from erpnext.controllers.accounts_controller import update_child_qty_rate
+from erpnext.manufacturing.doctype.blanket_order.test_blanket_order import make_blanket_order
+from erpnext.stock.doctype.item.test_item import make_item
+from erpnext.stock.doctype.material_request.material_request import make_purchase_order
+from erpnext.stock.doctype.material_request.test_material_request import make_material_request
+from erpnext.stock.doctype.purchase_receipt.purchase_receipt import (
+ make_purchase_invoice as make_pi_from_pr,
+)
+from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
+
class TestPurchaseOrder(unittest.TestCase):
def test_make_purchase_receipt(self):
@@ -415,10 +422,12 @@
self.assertEqual(po.get("items")[0].received_qty, 9)
# Make return purchase receipt, purchase invoice and check quantity
- from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt \
- import make_purchase_receipt as make_purchase_receipt_return
- from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice \
- import make_purchase_invoice as make_purchase_invoice_return
+ from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import (
+ make_purchase_invoice as make_purchase_invoice_return,
+ )
+ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import (
+ make_purchase_receipt as make_purchase_receipt_return,
+ )
pr1 = make_purchase_receipt_return(is_return=1, return_against=pr.name, qty=-3, do_not_submit=True)
pr1.items[0].purchase_order = po.name
@@ -484,7 +493,9 @@
def test_make_purchase_invoice_with_terms(self):
- from erpnext.selling.doctype.sales_order.test_sales_order import automatically_fetch_payment_terms, compare_payment_schedules
+ from erpnext.selling.doctype.sales_order.test_sales_order import (
+ automatically_fetch_payment_terms,
+ )
automatically_fetch_payment_terms()
po = create_purchase_order(do_not_save=True)
@@ -977,9 +988,14 @@
self.assertEqual(po_doc.items[0].blanket_order, None)
def test_payment_terms_are_fetched_when_creating_purchase_invoice(self):
- from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_terms_template
+ from erpnext.accounts.doctype.payment_entry.test_payment_entry import (
+ create_payment_terms_template,
+ )
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
- from erpnext.selling.doctype.sales_order.test_sales_order import automatically_fetch_payment_terms, compare_payment_schedules
+ from erpnext.selling.doctype.sales_order.test_sales_order import (
+ automatically_fetch_payment_terms,
+ compare_payment_schedules,
+ )
automatically_fetch_payment_terms()
diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
index 132dd17..87cd575 100644
--- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
@@ -10,6 +10,7 @@
"item_code",
"supplier_part_no",
"item_name",
+ "product_bundle",
"column_break_4",
"schedule_date",
"expected_delivery_date",
@@ -488,7 +489,6 @@
"no_copy": 1,
"options": "Sales Order",
"print_hide": 1,
- "read_only": 1,
"search_index": 1
},
{
@@ -830,13 +830,20 @@
"label": "Production Plan Sub Assembly Item",
"no_copy": 1,
"read_only": 1
+ },
+ {
+ "fieldname": "product_bundle",
+ "fieldtype": "Link",
+ "label": "Product Bundle",
+ "options": "Product Bundle",
+ "read_only": 1
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2021-06-28 19:22:22.715365",
+ "modified": "2021-08-30 20:06:26.712097",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item",
diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py
index b6e28b6..a391a3d 100644
--- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.py
@@ -2,10 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+import frappe
from frappe.model.document import Document
+
class PurchaseOrderItem(Document):
pass
diff --git a/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.py b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.py
index c85ca2f..909faec 100644
--- a/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.py
+++ b/erpnext/buying/doctype/purchase_order_item_supplied/purchase_order_item_supplied.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class PurchaseOrderItemSupplied(Document):
pass
diff --git a/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.py b/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.py
index 00c93ed..caec4e8 100644
--- a/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.py
+++ b/erpnext/buying/doctype/purchase_receipt_item_supplied/purchase_receipt_item_supplied.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class PurchaseReceiptItemSupplied(Document):
pass
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
index 8ed6c9e..af1a9a9 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
@@ -3,21 +3,24 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json
-from frappe import _
-from frappe.model.mapper import get_mapped_doc
-from frappe.utils import get_url, cint
-from frappe.utils.user import get_user_fullname
-from frappe.utils.print_format import download_pdf
-from frappe.desk.form.load import get_attachments
-from frappe.core.doctype.communication.email import make
-from erpnext.accounts.party import get_party_account_currency, get_party_details
-from erpnext.stock.doctype.material_request.material_request import set_missing_values
-from erpnext.controllers.buying_controller import BuyingController
-from erpnext.buying.utils import validate_for_items
+import json
+
+import frappe
+from frappe import _
+from frappe.core.doctype.communication.email import make
+from frappe.desk.form.load import get_attachments
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import get_url
+from frappe.utils.print_format import download_pdf
+from frappe.utils.user import get_user_fullname
from six import string_types
+from erpnext.accounts.party import get_party_account_currency, get_party_details
+from erpnext.buying.utils import validate_for_items
+from erpnext.controllers.buying_controller import BuyingController
+from erpnext.stock.doctype.material_request.material_request import set_missing_values
+
STANDARD_USERS = ("Guest", "Administrator")
class RequestforQuotation(BuyingController):
diff --git a/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py b/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py
index 751336d..0708cab 100644
--- a/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py
+++ b/erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py
index 36f87b0..33fde8e 100644
--- a/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py
+++ b/erpnext/buying/doctype/request_for_quotation/test_request_for_quotation.py
@@ -7,12 +7,16 @@
import frappe
from frappe.utils import nowdate
+
+from erpnext.buying.doctype.request_for_quotation.request_for_quotation import (
+ create_supplier_quotation,
+ make_supplier_quotation_from_rfq,
+)
+from erpnext.crm.doctype.opportunity.opportunity import make_request_for_quotation as make_rfq
+from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity
from erpnext.stock.doctype.item.test_item import make_item
from erpnext.templates.pages.rfq import check_supplier_has_docname_access
-from erpnext.buying.doctype.request_for_quotation.request_for_quotation import make_supplier_quotation_from_rfq
-from erpnext.buying.doctype.request_for_quotation.request_for_quotation import create_supplier_quotation
-from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity
-from erpnext.crm.doctype.opportunity.opportunity import make_request_for_quotation as make_rfq
+
class TestRequestforQuotation(unittest.TestCase):
def test_quote_status(self):
diff --git a/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.py b/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.py
index cc897af..35f3305 100644
--- a/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.py
+++ b/erpnext/buying/doctype/request_for_quotation_item/request_for_quotation_item.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class RequestforQuotationItem(Document):
pass
diff --git a/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.py b/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.py
index 4b0bbbe..47c0deb 100644
--- a/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.py
+++ b/erpnext/buying/doctype/request_for_quotation_supplier/request_for_quotation_supplier.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class RequestforQuotationSupplier(Document):
pass
diff --git a/erpnext/buying/doctype/supplier/supplier.js b/erpnext/buying/doctype/supplier/supplier.js
index 1766c2c..7ee9196 100644
--- a/erpnext/buying/doctype/supplier/supplier.js
+++ b/erpnext/buying/doctype/supplier/supplier.js
@@ -24,7 +24,26 @@
}
}
});
+
+ frm.set_query("supplier_primary_contact", function(doc) {
+ return {
+ query: "erpnext.buying.doctype.supplier.supplier.get_supplier_primary_contact",
+ filters: {
+ "supplier": doc.name
+ }
+ };
+ });
+
+ frm.set_query("supplier_primary_address", function(doc) {
+ return {
+ filters: {
+ "link_doctype": "Supplier",
+ "link_name": doc.name
+ }
+ };
+ });
},
+
refresh: function (frm) {
frappe.dynamic_link = { doc: frm.doc, fieldname: 'name', doctype: 'Supplier' }
@@ -78,6 +97,30 @@
});
},
+ supplier_primary_address: function(frm) {
+ if (frm.doc.supplier_primary_address) {
+ frappe.call({
+ method: 'frappe.contacts.doctype.address.address.get_address_display',
+ args: {
+ "address_dict": frm.doc.supplier_primary_address
+ },
+ callback: function(r) {
+ frm.set_value("primary_address", r.message);
+ }
+ });
+ }
+ if (!frm.doc.supplier_primary_address) {
+ frm.set_value("primary_address", "");
+ }
+ },
+
+ supplier_primary_contact: function(frm) {
+ if (!frm.doc.supplier_primary_contact) {
+ frm.set_value("mobile_no", "");
+ frm.set_value("email_id", "");
+ }
+ },
+
is_internal_supplier: function(frm) {
if (frm.doc.is_internal_supplier == 1) {
frm.toggle_reqd("represents_company", true);
diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json
index 38b8dfd..c7a5db5 100644
--- a/erpnext/buying/doctype/supplier/supplier.json
+++ b/erpnext/buying/doctype/supplier/supplier.json
@@ -49,6 +49,13 @@
"address_html",
"column_break1",
"contact_html",
+ "primary_address_and_contact_detail_section",
+ "supplier_primary_contact",
+ "mobile_no",
+ "email_id",
+ "column_break_44",
+ "supplier_primary_address",
+ "primary_address",
"default_payable_accounts",
"accounts",
"default_tax_withholding_config",
@@ -378,6 +385,47 @@
"fieldname": "allow_purchase_invoice_creation_without_purchase_receipt",
"fieldtype": "Check",
"label": "Allow Purchase Invoice Creation Without Purchase Receipt"
+ },
+ {
+ "fieldname": "primary_address_and_contact_detail_section",
+ "fieldtype": "Section Break",
+ "label": "Primary Address and Contact Detail"
+ },
+ {
+ "description": "Reselect, if the chosen contact is edited after save",
+ "fieldname": "supplier_primary_contact",
+ "fieldtype": "Link",
+ "label": "Supplier Primary Contact",
+ "options": "Contact"
+ },
+ {
+ "fetch_from": "supplier_primary_contact.mobile_no",
+ "fieldname": "mobile_no",
+ "fieldtype": "Read Only",
+ "label": "Mobile No"
+ },
+ {
+ "fetch_from": "supplier_primary_contact.email_id",
+ "fieldname": "email_id",
+ "fieldtype": "Read Only",
+ "label": "Email Id"
+ },
+ {
+ "fieldname": "column_break_44",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "primary_address",
+ "fieldtype": "Text",
+ "label": "Primary Address",
+ "read_only": 1
+ },
+ {
+ "description": "Reselect, if the chosen address is edited after save",
+ "fieldname": "supplier_primary_address",
+ "fieldtype": "Link",
+ "label": "Supplier Primary Address",
+ "options": "Address"
}
],
"icon": "fa fa-user",
@@ -390,7 +438,7 @@
"link_fieldname": "supplier"
}
],
- "modified": "2021-05-18 15:10:11.087191",
+ "modified": "2021-08-27 18:02:44.314077",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier",
diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py
index fd16b23..2a9f784 100644
--- a/erpnext/buying/doctype/supplier/supplier.py
+++ b/erpnext/buying/doctype/supplier/supplier.py
@@ -2,13 +2,18 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
import frappe.defaults
-from frappe import msgprint, _
+from frappe import _, msgprint
+from frappe.contacts.address_and_contact import (
+ delete_contact_and_address,
+ load_address_and_contact,
+)
from frappe.model.naming import set_name_by_naming_series
-from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
+
+from erpnext.accounts.party import get_dashboard_info, validate_party_accounts
from erpnext.utilities.transaction_base import TransactionBase
-from erpnext.accounts.party import validate_party_accounts, get_dashboard_info, get_timeline_data # keep this
class Supplier(TransactionBase):
@@ -42,7 +47,12 @@
if not self.naming_series:
self.naming_series = ''
+ self.create_primary_contact()
+ self.create_primary_address()
+
def validate(self):
+ self.flags.is_new_doc = self.is_new()
+
# validation for Naming Series mandatory field...
if frappe.defaults.get_global_default('supp_master_name') == 'Naming Series':
if not self.naming_series:
@@ -76,7 +86,40 @@
frappe.throw(_("Internal Supplier for company {0} already exists").format(
frappe.bold(self.represents_company)))
+ def create_primary_contact(self):
+ from erpnext.selling.doctype.customer.customer import make_contact
+
+ if not self.supplier_primary_contact:
+ if self.mobile_no or self.email_id:
+ contact = make_contact(self)
+ self.db_set('supplier_primary_contact', contact.name)
+ self.db_set('mobile_no', self.mobile_no)
+ self.db_set('email_id', self.email_id)
+
+ def create_primary_address(self):
+ from frappe.contacts.doctype.address.address import get_address_display
+
+ from erpnext.selling.doctype.customer.customer import make_address
+
+ if self.flags.is_new_doc and self.get('address_line1'):
+ address = make_address(self)
+ address_display = get_address_display(address.name)
+
+ self.db_set("supplier_primary_address", address.name)
+ self.db_set("primary_address", address_display)
+
def on_trash(self):
+ if self.supplier_primary_contact:
+ frappe.db.sql("""
+ UPDATE `tabSupplier`
+ SET
+ supplier_primary_contact=null,
+ supplier_primary_address=null,
+ mobile_no=null,
+ email_id=null,
+ primary_address=null
+ WHERE name=%(name)s""", {"name": self.name})
+
delete_contact_and_address('Supplier', self.name)
def after_rename(self, olddn, newdn, merge=False):
@@ -104,3 +147,21 @@
doc.name, args.get('supplier_email_' + str(i)))
except frappe.NameError:
pass
+
+@frappe.whitelist()
+@frappe.validate_and_sanitize_search_inputs
+def get_supplier_primary_contact(doctype, txt, searchfield, start, page_len, filters):
+ supplier = filters.get("supplier")
+ return frappe.db.sql("""
+ SELECT
+ `tabContact`.name from `tabContact`,
+ `tabDynamic Link`
+ WHERE
+ `tabContact`.name = `tabDynamic Link`.parent
+ and `tabDynamic Link`.link_name = %(supplier)s
+ and `tabDynamic Link`.link_doctype = 'Supplier'
+ and `tabContact`.name like %(txt)s
+ """, {
+ 'supplier': supplier,
+ 'txt': '%%%s%%' % txt
+ })
diff --git a/erpnext/buying/doctype/supplier/test_supplier.py b/erpnext/buying/doctype/supplier/test_supplier.py
index 8980466..8a4eefa 100644
--- a/erpnext/buying/doctype/supplier/test_supplier.py
+++ b/erpnext/buying/doctype/supplier/test_supplier.py
@@ -2,11 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+import unittest
-import frappe, unittest
+import frappe
+from frappe.test_runner import make_test_records
+
from erpnext.accounts.party import get_due_date
from erpnext.exceptions import PartyDisabled
-from frappe.test_runner import make_test_records
test_dependencies = ['Payment Term', 'Payment Terms Template']
test_records = frappe.get_test_records('Supplier')
diff --git a/erpnext/buying/doctype/supplier_item_group/supplier_item_group.py b/erpnext/buying/doctype/supplier_item_group/supplier_item_group.py
index 4473dde..6d71f7d 100644
--- a/erpnext/buying/doctype/supplier_item_group/supplier_item_group.py
+++ b/erpnext/buying/doctype/supplier_item_group/supplier_item_group.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
class SupplierItemGroup(Document):
def validate(self):
exists = frappe.db.exists({
diff --git a/erpnext/buying/doctype/supplier_item_group/test_supplier_item_group.py b/erpnext/buying/doctype/supplier_item_group/test_supplier_item_group.py
index c75044d..55ba85e 100644
--- a/erpnext/buying/doctype/supplier_item_group/test_supplier_item_group.py
+++ b/erpnext/buying/doctype/supplier_item_group/test_supplier_item_group.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestSupplierItemGroup(unittest.TestCase):
pass
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
index 25e4e2a..af462fc 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation.py
@@ -2,13 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt, nowdate, add_days, getdate
from frappe.model.mapper import get_mapped_doc
+from frappe.utils import flt, getdate, nowdate
-from erpnext.controllers.buying_controller import BuyingController
from erpnext.buying.utils import validate_for_items
+from erpnext.controllers.buying_controller import BuyingController
form_grid_templates = {
"items": "templates/form_grid/item_grid.html"
diff --git a/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py b/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py
index 6b40305..014b102 100644
--- a/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py
+++ b/erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'supplier_quotation',
diff --git a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py
index 6f34ca6..2db8e22 100644
--- a/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py
+++ b/erpnext/buying/doctype/supplier_quotation/test_supplier_quotation.py
@@ -3,9 +3,11 @@
from __future__ import unicode_literals
+
import unittest
+
import frappe
-import frappe.defaults
+
class TestPurchaseOrder(unittest.TestCase):
def test_make_purchase_order(self):
diff --git a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.py b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.py
index 64dda87..03adab5 100644
--- a/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.py
+++ b/erpnext/buying/doctype/supplier_quotation_item/supplier_quotation_item.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class SupplierQuotationItem(Document):
pass
diff --git a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py
index e956afd..f944fe4 100644
--- a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py
+++ b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard.py
@@ -3,13 +3,19 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe import throw, _
-from frappe.model.document import Document
+
import time
from datetime import timedelta
-from frappe.utils import nowdate, get_last_day, getdate, add_days, add_years
-from erpnext.buying.doctype.supplier_scorecard_period.supplier_scorecard_period import make_supplier_scorecard
+
+import frappe
+from frappe import _, throw
+from frappe.model.document import Document
+from frappe.utils import add_days, add_years, get_last_day, getdate, nowdate
+
+from erpnext.buying.doctype.supplier_scorecard_period.supplier_scorecard_period import (
+ make_supplier_scorecard,
+)
+
class SupplierScorecard(Document):
diff --git a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_dashboard.py b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_dashboard.py
index 8e5cce5..7186e01 100644
--- a/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_dashboard.py
+++ b/erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'heatmap': True,
diff --git a/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py b/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py
index a5f05ea..ef7fae3 100644
--- a/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py
+++ b/erpnext/buying/doctype/supplier_scorecard/test_supplier_scorecard.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestSupplierScorecard(unittest.TestCase):
def test_create_scorecard(self):
diff --git a/erpnext/buying/doctype/supplier_scorecard_criteria/supplier_scorecard_criteria.py b/erpnext/buying/doctype/supplier_scorecard_criteria/supplier_scorecard_criteria.py
index 33a0dc7..c456377 100644
--- a/erpnext/buying/doctype/supplier_scorecard_criteria/supplier_scorecard_criteria.py
+++ b/erpnext/buying/doctype/supplier_scorecard_criteria/supplier_scorecard_criteria.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+import re
+
import frappe
from frappe import _
-import re
from frappe.model.document import Document
+
class InvalidFormulaVariable(frappe.ValidationError): pass
class SupplierScorecardCriteria(Document):
diff --git a/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py b/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py
index 3babfc8..9fca9a9 100644
--- a/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py
+++ b/erpnext/buying/doctype/supplier_scorecard_criteria/test_supplier_scorecard_criteria.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestSupplierScorecardCriteria(unittest.TestCase):
def test_variables_exist(self):
delete_test_scorecards()
diff --git a/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.py b/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.py
index cc345e9..b03d216 100644
--- a/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.py
+++ b/erpnext/buying/doctype/supplier_scorecard_period/supplier_scorecard_period.py
@@ -3,12 +3,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import throw, _
+from frappe import _, throw
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
+
import erpnext.buying.doctype.supplier_scorecard_variable.supplier_scorecard_variable as variable_functions
-from erpnext.buying.doctype.supplier_scorecard_criteria.supplier_scorecard_criteria import get_variables
+from erpnext.buying.doctype.supplier_scorecard_criteria.supplier_scorecard_criteria import (
+ get_variables,
+)
+
class SupplierScorecardPeriod(Document):
diff --git a/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py b/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py
index 8baa318..de8bc0a 100644
--- a/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py
+++ b/erpnext/buying/doctype/supplier_scorecard_period/test_supplier_scorecard_period.py
@@ -5,5 +5,6 @@
import unittest
+
class TestSupplierScorecardPeriod(unittest.TestCase):
pass
diff --git a/erpnext/buying/doctype/supplier_scorecard_scoring_criteria/supplier_scorecard_scoring_criteria.py b/erpnext/buying/doctype/supplier_scorecard_scoring_criteria/supplier_scorecard_scoring_criteria.py
index b64abed..79d5082 100644
--- a/erpnext/buying/doctype/supplier_scorecard_scoring_criteria/supplier_scorecard_scoring_criteria.py
+++ b/erpnext/buying/doctype/supplier_scorecard_scoring_criteria/supplier_scorecard_scoring_criteria.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class SupplierScorecardScoringCriteria(Document):
pass
diff --git a/erpnext/buying/doctype/supplier_scorecard_scoring_standing/supplier_scorecard_scoring_standing.py b/erpnext/buying/doctype/supplier_scorecard_scoring_standing/supplier_scorecard_scoring_standing.py
index e8ad79f..5063b20 100644
--- a/erpnext/buying/doctype/supplier_scorecard_scoring_standing/supplier_scorecard_scoring_standing.py
+++ b/erpnext/buying/doctype/supplier_scorecard_scoring_standing/supplier_scorecard_scoring_standing.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class SupplierScorecardScoringStanding(Document):
pass
diff --git a/erpnext/buying/doctype/supplier_scorecard_scoring_variable/supplier_scorecard_scoring_variable.py b/erpnext/buying/doctype/supplier_scorecard_scoring_variable/supplier_scorecard_scoring_variable.py
index 58a8a99..476cb35 100644
--- a/erpnext/buying/doctype/supplier_scorecard_scoring_variable/supplier_scorecard_scoring_variable.py
+++ b/erpnext/buying/doctype/supplier_scorecard_scoring_variable/supplier_scorecard_scoring_variable.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class SupplierScorecardScoringVariable(Document):
pass
diff --git a/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.py b/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.py
index 678855a..4fc45e8 100644
--- a/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.py
+++ b/erpnext/buying/doctype/supplier_scorecard_standing/supplier_scorecard_standing.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class SupplierScorecardStanding(Document):
pass
diff --git a/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py b/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py
index 4d96651..5ac5927 100644
--- a/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py
+++ b/erpnext/buying/doctype/supplier_scorecard_standing/test_supplier_scorecard_standing.py
@@ -5,5 +5,6 @@
import unittest
+
class TestSupplierScorecardStanding(unittest.TestCase):
pass
diff --git a/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py b/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py
index 89a6459..30b2a18 100644
--- a/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py
+++ b/erpnext/buying/doctype/supplier_scorecard_variable/supplier_scorecard_variable.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import sys
+
+import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import getdate
+
class VariablePathNotFound(frappe.ValidationError): pass
class SupplierScorecardVariable(Document):
@@ -18,7 +21,9 @@
def validate_path_exists(self):
if '.' in self.path:
try:
- from erpnext.buying.doctype.supplier_scorecard_period.supplier_scorecard_period import import_string_path
+ from erpnext.buying.doctype.supplier_scorecard_period.supplier_scorecard_period import (
+ import_string_path,
+ )
import_string_path(self.path)
except AttributeError:
frappe.throw(_("Could not find path for " + self.path), VariablePathNotFound)
diff --git a/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py b/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py
index 14b8710..990413c 100644
--- a/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py
+++ b/erpnext/buying/doctype/supplier_scorecard_variable/test_supplier_scorecard_variable.py
@@ -3,10 +3,13 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.buying.doctype.supplier_scorecard_variable.supplier_scorecard_variable import VariablePathNotFound
+import frappe
+
+from erpnext.buying.doctype.supplier_scorecard_variable.supplier_scorecard_variable import (
+ VariablePathNotFound,
+)
class TestSupplierScorecardVariable(unittest.TestCase):
diff --git a/erpnext/buying/report/procurement_tracker/procurement_tracker.py b/erpnext/buying/report/procurement_tracker/procurement_tracker.py
index 99bcbe6..cb99234 100644
--- a/erpnext/buying/report/procurement_tracker/procurement_tracker.py
+++ b/erpnext/buying/report/procurement_tracker/procurement_tracker.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt
+
def execute(filters=None):
columns = get_columns(filters)
data = get_data(filters)
diff --git a/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py b/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py
index c36083f..a5b0947 100644
--- a/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py
+++ b/erpnext/buying/report/procurement_tracker/test_procurement_tracker.py
@@ -2,15 +2,19 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import unittest
from datetime import datetime
+
import frappe
-from erpnext.buying.report.procurement_tracker.procurement_tracker import execute
-from erpnext.stock.doctype.material_request.test_material_request import make_material_request
-from erpnext.stock.doctype.material_request.material_request import make_purchase_order
+
from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt
+from erpnext.buying.report.procurement_tracker.procurement_tracker import execute
+from erpnext.stock.doctype.material_request.material_request import make_purchase_order
+from erpnext.stock.doctype.material_request.test_material_request import make_material_request
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
+
class TestProcurementTracker(unittest.TestCase):
def test_result_for_procurement_tracker(self):
filters = {
diff --git a/erpnext/buying/report/purchase_analytics/purchase_analytics.py b/erpnext/buying/report/purchase_analytics/purchase_analytics.py
index 0f94947..bef66da 100644
--- a/erpnext/buying/report/purchase_analytics/purchase_analytics.py
+++ b/erpnext/buying/report/purchase_analytics/purchase_analytics.py
@@ -2,7 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from erpnext.selling.report.sales_analytics.sales_analytics import Analytics
+
def execute(filters=None):
return Analytics(filters).run()
diff --git a/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py b/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py
index bda1727..5d59456 100644
--- a/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py
+++ b/erpnext/buying/report/purchase_order_analysis/purchase_order_analysis.py
@@ -2,10 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import copy
+
+import frappe
from frappe import _
-from frappe.utils import flt, date_diff, getdate
+from frappe.utils import date_diff, flt, getdate
+
def execute(filters=None):
if not filters:
diff --git a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.py b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.py
index 095a443..9781480 100644
--- a/erpnext/buying/report/purchase_order_trends/purchase_order_trends.py
+++ b/erpnext/buying/report/purchase_order_trends/purchase_order_trends.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe import _
-from erpnext.controllers.trends import get_columns,get_data
+
+from erpnext.controllers.trends import get_columns, get_data
+
def execute(filters=None):
if not filters: filters ={}
diff --git a/erpnext/buying/report/requested_items_to_order_and_receive/requested_items_to_order_and_receive.py b/erpnext/buying/report/requested_items_to_order_and_receive/requested_items_to_order_and_receive.py
index faf67c9..42cc6eb 100644
--- a/erpnext/buying/report/requested_items_to_order_and_receive/requested_items_to_order_and_receive.py
+++ b/erpnext/buying/report/requested_items_to_order_and_receive/requested_items_to_order_and_receive.py
@@ -2,10 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import copy
+
+import frappe
from frappe import _
-from frappe.utils import flt, date_diff, getdate
+from frappe.utils import date_diff, flt, getdate
+
def execute(filters=None):
if not filters:
diff --git a/erpnext/buying/report/subcontract_order_summary/subcontract_order_summary.py b/erpnext/buying/report/subcontract_order_summary/subcontract_order_summary.py
index 9a45972..202d364 100644
--- a/erpnext/buying/report/subcontract_order_summary/subcontract_order_summary.py
+++ b/erpnext/buying/report/subcontract_order_summary/subcontract_order_summary.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
columns, data = [], []
columns = get_columns()
diff --git a/erpnext/buying/report/subcontracted_item_to_be_received/subcontracted_item_to_be_received.py b/erpnext/buying/report/subcontracted_item_to_be_received/subcontracted_item_to_be_received.py
index 2da53d7..9299cca 100644
--- a/erpnext/buying/report/subcontracted_item_to_be_received/subcontracted_item_to_be_received.py
+++ b/erpnext/buying/report/subcontracted_item_to_be_received/subcontracted_item_to_be_received.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
if filters.from_date >= filters.to_date:
frappe.msgprint(_("To Date must be greater than From Date"))
diff --git a/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py b/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py
index cb304a1..7aeae45 100644
--- a/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py
+++ b/erpnext/buying/report/subcontracted_item_to_be_received/test_subcontracted_item_to_be_received.py
@@ -3,12 +3,18 @@
# Compiled at: 2019-05-06 09:51:46
# Decompiled by https://python-decompiler.com
from __future__ import unicode_literals
-from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
+
+import unittest
+
+import frappe
+
from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt
+from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
+from erpnext.buying.report.subcontracted_item_to_be_received.subcontracted_item_to_be_received import (
+ execute,
+)
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
-from erpnext.buying.report.subcontracted_item_to_be_received.subcontracted_item_to_be_received import execute
-import frappe, unittest
-from pprint import pprint
+
class TestSubcontractedItemToBeReceived(unittest.TestCase):
diff --git a/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py b/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py
index 96cacb6..a8fad96 100644
--- a/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py
+++ b/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/subcontracted_raw_materials_to_be_transferred.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
if filters.from_date >= filters.to_date:
frappe.msgprint(_("To Date must be greater than From Date"))
diff --git a/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/test_subcontracted_raw_materials_to_be_transferred.py b/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/test_subcontracted_raw_materials_to_be_transferred.py
index 2448e17..dcdc5e3 100644
--- a/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/test_subcontracted_raw_materials_to_be_transferred.py
+++ b/erpnext/buying/report/subcontracted_raw_materials_to_be_transferred/test_subcontracted_raw_materials_to_be_transferred.py
@@ -3,11 +3,19 @@
# Compiled at: 2019-05-06 10:24:35
# Decompiled by https://python-decompiler.com
from __future__ import unicode_literals
-from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
+
+import json
+import unittest
+
+import frappe
+
from erpnext.buying.doctype.purchase_order.purchase_order import make_rm_stock_entry
+from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
+from erpnext.buying.report.subcontracted_raw_materials_to_be_transferred.subcontracted_raw_materials_to_be_transferred import (
+ execute,
+)
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
-from erpnext.buying.report.subcontracted_raw_materials_to_be_transferred.subcontracted_raw_materials_to_be_transferred import execute
-import json, frappe, unittest
+
class TestSubcontractedItemToBeTransferred(unittest.TestCase):
diff --git a/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.py b/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.py
index a5a3105..62b83ed 100644
--- a/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.py
+++ b/erpnext/buying/report/supplier_quotation_comparison/supplier_quotation_comparison.py
@@ -2,12 +2,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import flt, cint
-from frappe import _
+
from collections import defaultdict
+
+import frappe
+from frappe import _
+from frappe.utils import cint, flt
+
from erpnext.setup.utils import get_exchange_rate
+
def execute(filters=None):
if not filters:
return [], []
diff --git a/erpnext/buying/utils.py b/erpnext/buying/utils.py
index 1792863..81d995c 100644
--- a/erpnext/buying/utils.py
+++ b/erpnext/buying/utils.py
@@ -2,13 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import flt, cstr, cint
-from frappe import _
+
import json
-from erpnext.stock.doctype.item.item import get_last_purchase_details
-from erpnext.stock.doctype.item.item import validate_end_of_life
+import frappe
+from frappe import _
+from frappe.utils import cint, cstr, flt
+
+from erpnext.stock.doctype.item.item import get_last_purchase_details, validate_end_of_life
+
def update_last_purchase_rate(doc, is_submit):
"""updates last_purchase_rate in item table for each item"""
diff --git a/erpnext/commands/__init__.py b/erpnext/commands/__init__.py
index 2276c73..f3bf11a 100644
--- a/erpnext/commands/__init__.py
+++ b/erpnext/commands/__init__.py
@@ -1,10 +1,12 @@
# Copyright (c) 2015, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
-from __future__ import unicode_literals, absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
+
import click
import frappe
-from frappe.commands import pass_context, get_site
+from frappe.commands import get_site, pass_context
+
def call_command(cmd, context):
return click.Context(cmd, obj=context).forward(cmd)
diff --git a/erpnext/communication/doctype/communication_medium/communication_medium.py b/erpnext/communication/doctype/communication_medium/communication_medium.py
index f233da0..b15c3be 100644
--- a/erpnext/communication/doctype/communication_medium/communication_medium.py
+++ b/erpnext/communication/doctype/communication_medium/communication_medium.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class CommunicationMedium(Document):
pass
diff --git a/erpnext/communication/doctype/communication_medium_timeslot/communication_medium_timeslot.py b/erpnext/communication/doctype/communication_medium_timeslot/communication_medium_timeslot.py
index d68d2d6..5189b09 100644
--- a/erpnext/communication/doctype/communication_medium_timeslot/communication_medium_timeslot.py
+++ b/erpnext/communication/doctype/communication_medium_timeslot/communication_medium_timeslot.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class CommunicationMediumTimeslot(Document):
pass
diff --git a/erpnext/config/education.py b/erpnext/config/education.py
index 1c8ab10..ecd771f 100644
--- a/erpnext/config/education.py
+++ b/erpnext/config/education.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return [
{
diff --git a/erpnext/config/projects.py b/erpnext/config/projects.py
index ab4db96..d4d4a72 100644
--- a/erpnext/config/projects.py
+++ b/erpnext/config/projects.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return [
{
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index f4af893..b90db05 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -2,27 +2,60 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
import json
+
+import frappe
from frappe import _, throw
-from frappe.utils import (today, flt, cint, fmt_money, formatdate,
- getdate, add_days, add_months, get_last_day, nowdate, get_link_to_form)
-from frappe.model.workflow import get_workflow_name, is_transition_condition_satisfied, WorkflowPermissionError
-from erpnext.stock.get_item_details import get_conversion_factor, get_item_details
-from erpnext.setup.utils import get_exchange_rate
-from erpnext.accounts.utils import get_fiscal_years, validate_fiscal_year, get_account_currency
-from erpnext.utilities.transaction_base import TransactionBase
-from erpnext.buying.utils import update_last_purchase_rate
-from erpnext.controllers.sales_and_purchase_return import validate_return
-from erpnext.accounts.party import get_party_account_currency, validate_party_frozen_disabled, get_party_account
-from erpnext.accounts.doctype.pricing_rule.utils import (apply_pricing_rule_on_transaction,
- apply_pricing_rule_for_free_items, get_applied_pricing_rules)
-from erpnext.exceptions import InvalidCurrency
+from frappe.model.workflow import get_workflow_name, is_transition_condition_satisfied
+from frappe.utils import (
+ add_days,
+ add_months,
+ cint,
+ flt,
+ fmt_money,
+ formatdate,
+ get_last_day,
+ get_link_to_form,
+ getdate,
+ nowdate,
+ today,
+)
from six import text_type
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
-from erpnext.stock.get_item_details import get_item_warehouse, _get_item_tax_template, get_item_tax_map
+
+import erpnext
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+)
+from erpnext.accounts.doctype.pricing_rule.utils import (
+ apply_pricing_rule_for_free_items,
+ apply_pricing_rule_on_transaction,
+ get_applied_pricing_rules,
+)
+from erpnext.accounts.party import (
+ get_party_account,
+ get_party_account_currency,
+ validate_party_frozen_disabled,
+)
+from erpnext.accounts.utils import get_account_currency, get_fiscal_years, validate_fiscal_year
+from erpnext.buying.utils import update_last_purchase_rate
+from erpnext.controllers.print_settings import (
+ set_print_templates_for_item_table,
+ set_print_templates_for_taxes,
+)
+from erpnext.controllers.sales_and_purchase_return import validate_return
+from erpnext.exceptions import InvalidCurrency
+from erpnext.setup.utils import get_exchange_rate
from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
-from erpnext.controllers.print_settings import set_print_templates_for_item_table, set_print_templates_for_taxes
+from erpnext.stock.get_item_details import (
+ _get_item_tax_template,
+ get_conversion_factor,
+ get_item_details,
+ get_item_tax_map,
+ get_item_warehouse,
+)
+from erpnext.utilities.transaction_base import TransactionBase
+
class AccountMissingError(frappe.ValidationError): pass
@@ -1206,7 +1239,7 @@
d.base_payment_amount = flt(base_grand_total * flt(d.invoice_portion / 100), d.precision('base_payment_amount'))
d.outstanding = d.payment_amount
elif not d.invoice_portion:
- d.base_payment_amount = flt(base_grand_total * self.get("conversion_rate"), d.precision('base_payment_amount'))
+ d.base_payment_amount = flt(d.payment_amount * self.get("conversion_rate"), d.precision('base_payment_amount'))
def get_order_details(self):
@@ -1587,7 +1620,7 @@
def get_advance_payment_entries(party_type, party, party_account, order_doctype,
- order_list=None, include_unallocated=True, against_all_orders=False, limit=None):
+ order_list=None, include_unallocated=True, against_all_orders=False, limit=None, condition=None):
party_account_field = "paid_from" if party_type == "Customer" else "paid_to"
currency_field = "paid_from_account_currency" if party_type == "Customer" else "paid_to_account_currency"
payment_type = "Receive" if party_type == "Customer" else "Pay"
@@ -1622,14 +1655,14 @@
if include_unallocated:
unallocated_payment_entries = frappe.db.sql("""
- select "Payment Entry" as reference_type, name as reference_name,
- remarks, unallocated_amount as amount, {2} as exchange_rate
+ select "Payment Entry" as reference_type, name as reference_name, posting_date,
+ remarks, unallocated_amount as amount, {2} as exchange_rate, {3} as currency
from `tabPayment Entry`
where
{0} = %s and party_type = %s and party = %s and payment_type = %s
- and docstatus = 1 and unallocated_amount > 0
+ and docstatus = 1 and unallocated_amount > 0 {condition}
order by posting_date {1}
- """.format(party_account_field, limit_cond, exchange_rate_field),
+ """.format(party_account_field, limit_cond, exchange_rate_field, currency_field, condition=condition or ""),
(party_account, party_type, party, payment_type), as_dict=1)
return list(payment_entries_against_order) + list(unallocated_payment_entries)
@@ -1811,7 +1844,12 @@
def update_bin_on_delete(row, doctype):
"""Update bin for deleted item (row)."""
- from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty, get_ordered_qty, get_indented_qty
+ from erpnext.stock.stock_balance import (
+ get_indented_qty,
+ get_ordered_qty,
+ get_reserved_qty,
+ update_bin_qty,
+ )
qty_dict = {}
if doctype == "Sales Order":
diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py
index 974ade3..e0b3ad8 100644
--- a/erpnext/controllers/buying_controller.py
+++ b/erpnext/controllers/buying_controller.py
@@ -2,24 +2,21 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _, msgprint
-from frappe.utils import flt,cint, cstr, getdate
-from six import iteritems
-from collections import OrderedDict
-from erpnext.accounts.party import get_party_details
-from erpnext.stock.get_item_details import get_conversion_factor
-from erpnext.buying.utils import validate_for_items, update_last_purchase_rate
-from erpnext.stock.stock_ledger import get_valuation_rate
-from erpnext.stock.doctype.serial_no.serial_no import get_auto_serial_nos, auto_make_serial_nos, get_serial_nos
from frappe.contacts.doctype.address.address import get_address_display
+from frappe.utils import cint, cstr, flt, getdate
from erpnext.accounts.doctype.budget.budget import validate_expense_against_budget
+from erpnext.accounts.party import get_party_details
+from erpnext.buying.utils import update_last_purchase_rate, validate_for_items
from erpnext.controllers.sales_and_purchase_return import get_rate_for_return
-from erpnext.stock.utils import get_incoming_rate
-
from erpnext.controllers.stock_controller import StockController
from erpnext.controllers.subcontracting import Subcontracting
+from erpnext.stock.get_item_details import get_conversion_factor
+from erpnext.stock.utils import get_incoming_rate
+
class BuyingController(StockController, Subcontracting):
diff --git a/erpnext/controllers/employee_boarding_controller.py b/erpnext/controllers/employee_boarding_controller.py
index f43c804..b8dc92e 100644
--- a/erpnext/controllers/employee_boarding_controller.py
+++ b/erpnext/controllers/employee_boarding_controller.py
@@ -5,9 +5,11 @@
from frappe import _
from frappe.desk.form import assign_to
from frappe.model.document import Document
-from frappe.utils import flt, unique, add_days
-from erpnext.hr.doctype.holiday_list.holiday_list import is_holiday
+from frappe.utils import add_days, flt, unique
+
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
+from erpnext.hr.doctype.holiday_list.holiday_list import is_holiday
+
class EmployeeBoardingController(Document):
'''
diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py
index 8c361a2..1b56ae9 100644
--- a/erpnext/controllers/item_variant.py
+++ b/erpnext/controllers/item_variant.py
@@ -2,13 +2,16 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
+import copy
+import json
+
import frappe
from frappe import _
from frappe.utils import cstr, flt
-import json, copy
-
from six import string_types
+
class ItemVariantExistsError(frappe.ValidationError): pass
class InvalidItemAttributeValueError(frappe.ValidationError): pass
class ItemTemplateCannotHaveStock(frappe.ValidationError): pass
diff --git a/erpnext/controllers/print_settings.py b/erpnext/controllers/print_settings.py
index e08c400..f6e061b 100644
--- a/erpnext/controllers/print_settings.py
+++ b/erpnext/controllers/print_settings.py
@@ -2,8 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import cint
+
def set_print_templates_for_item_table(doc, settings):
doc.print_templates = {
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index 4b4c8be..aafaf5b 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -2,14 +2,17 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-import erpnext
+
import json
-from frappe.desk.reportview import get_match_cond, get_filters_cond
-from frappe.utils import nowdate, getdate
from collections import defaultdict
+
+import frappe
+from frappe.desk.reportview import get_filters_cond, get_match_cond
+from frappe.utils import nowdate, unique
+
+import erpnext
from erpnext.stock.get_item_details import _get_item_tax_template
-from frappe.utils import unique
+
# searches for active employees
@frappe.whitelist()
@@ -517,7 +520,9 @@
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_filtered_dimensions(doctype, txt, searchfield, start, page_len, filters):
- from erpnext.accounts.doctype.accounting_dimension_filter.accounting_dimension_filter import get_dimension_filter_map
+ from erpnext.accounts.doctype.accounting_dimension_filter.accounting_dimension_filter import (
+ get_dimension_filter_map,
+ )
dimension_filters = get_dimension_filter_map()
dimension_filters = dimension_filters.get((filters.get('dimension'),filters.get('account')))
query_filters = []
@@ -692,7 +697,9 @@
company = frappe.db.escape(filters.get('company')), txt = frappe.db.escape('%{0}%'.format(txt)))
if filters and filters.get('inpatient_record'):
- from erpnext.healthcare.doctype.inpatient_medication_entry.inpatient_medication_entry import get_current_healthcare_service_unit
+ from erpnext.healthcare.doctype.inpatient_medication_entry.inpatient_medication_entry import (
+ get_current_healthcare_service_unit,
+ )
service_unit = get_current_healthcare_service_unit(filters.get('inpatient_record'))
# if the patient is admitted, then appointments should be allowed against the admission service unit,
diff --git a/erpnext/controllers/sales_and_purchase_return.py b/erpnext/controllers/sales_and_purchase_return.py
index 01486fc..5f2fbeb 100644
--- a/erpnext/controllers/sales_and_purchase_return.py
+++ b/erpnext/controllers/sales_and_purchase_return.py
@@ -2,11 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
from frappe.model.meta import get_field_precision
+from frappe.utils import flt, format_datetime, get_datetime
+
+import erpnext
from erpnext.stock.utils import get_incoming_rate
-from frappe.utils import flt, get_datetime, format_datetime
+
class StockOverReturnError(frappe.ValidationError): pass
@@ -63,7 +67,7 @@
if doc.doctype in ("Delivery Note", "Sales Invoice"):
for d in frappe.db.sql("""select item_code, qty, serial_no, batch_no from `tabPacked Item`
- where parent = %s""".format(doc.doctype), doc.return_against, as_dict=1):
+ where parent = %s""", doc.return_against, as_dict=1):
valid_items = get_ref_item_dict(valid_items, d)
already_returned_items = get_already_returned_items(doc)
@@ -235,6 +239,7 @@
def make_return_doc(doctype, source_name, target_doc=None):
from frappe.model.mapper import get_mapped_doc
+
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
company = frappe.db.get_value("Delivery Note", source_name, "company")
default_warehouse_for_sales_return = frappe.db.get_value("Company", company, "default_warehouse_for_sales_return")
diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py
index 844c40c..0158a11 100644
--- a/erpnext/controllers/selling_controller.py
+++ b/erpnext/controllers/selling_controller.py
@@ -2,18 +2,19 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import cint, flt, cstr, get_link_to_form, nowtime
-from frappe import _, bold, throw
-from erpnext.stock.get_item_details import get_bin_details
-from erpnext.stock.utils import get_incoming_rate
-from erpnext.stock.get_item_details import get_conversion_factor
-from erpnext.stock.doctype.item.item import set_item_default
-from frappe.contacts.doctype.address.address import get_address_display
-from erpnext.controllers.accounts_controller import get_taxes_and_charges
-from erpnext.controllers.stock_controller import StockController
+import frappe
+from frappe import _, bold, throw
+from frappe.contacts.doctype.address.address import get_address_display
+from frappe.utils import cint, cstr, flt, get_link_to_form, nowtime
+
+from erpnext.controllers.accounts_controller import get_taxes_and_charges
from erpnext.controllers.sales_and_purchase_return import get_rate_for_return
+from erpnext.controllers.stock_controller import StockController
+from erpnext.stock.doctype.item.item import set_item_default
+from erpnext.stock.get_item_details import get_bin_details, get_conversion_factor
+from erpnext.stock.utils import get_incoming_rate
+
class SellingController(StockController):
def get_feed(self):
diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py
index 7b24e50..8738204 100644
--- a/erpnext/controllers/status_updater.py
+++ b/erpnext/controllers/status_updater.py
@@ -2,10 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import flt, comma_or, nowdate, getdate, now
from frappe import _
from frappe.model.document import Document
+from frappe.utils import comma_or, flt, getdate, now, nowdate
+
class OverAllowanceError(frappe.ValidationError): pass
diff --git a/erpnext/controllers/stock_controller.py b/erpnext/controllers/stock_controller.py
index 17707ec..78a6e52 100644
--- a/erpnext/controllers/stock_controller.py
+++ b/erpnext/controllers/stock_controller.py
@@ -5,12 +5,15 @@
from collections import defaultdict
import frappe
-import frappe.defaults
from frappe import _
from frappe.utils import cint, cstr, flt, get_link_to_form, getdate
import erpnext
-from erpnext.accounts.general_ledger import make_gl_entries, make_reverse_gl_entries, process_gl_map
+from erpnext.accounts.general_ledger import (
+ make_gl_entries,
+ make_reverse_gl_entries,
+ process_gl_map,
+)
from erpnext.accounts.utils import get_fiscal_year
from erpnext.controllers.accounts_controller import AccountsController
from erpnext.stock import get_warehouse_account_map
diff --git a/erpnext/controllers/subcontracting.py b/erpnext/controllers/subcontracting.py
index 969829f..3addb91 100644
--- a/erpnext/controllers/subcontracting.py
+++ b/erpnext/controllers/subcontracting.py
@@ -1,10 +1,13 @@
-import frappe
import copy
-from frappe import _
-from frappe.utils import flt, cint, get_link_to_form
from collections import defaultdict
+
+import frappe
+from frappe import _
+from frappe.utils import cint, flt, get_link_to_form
+
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+
class Subcontracting():
def set_materials_for_subcontracted_items(self, raw_material_table):
if self.doctype == 'Purchase Invoice' and not self.update_stock:
diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py
index 7c6d355..70cc8a5 100644
--- a/erpnext/controllers/taxes_and_totals.py
+++ b/erpnext/controllers/taxes_and_totals.py
@@ -2,15 +2,23 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import json
-import frappe, erpnext
+
+import frappe
from frappe import _, scrub
from frappe.utils import cint, flt, round_based_on_smallest_currency_fraction
-from erpnext.controllers.accounts_controller import validate_conversion_rate, \
- validate_taxes_and_charges, validate_inclusive_tax
-from erpnext.stock.get_item_details import _get_item_tax_template
-from erpnext.accounts.doctype.pricing_rule.utils import get_applied_pricing_rules
+
+import erpnext
from erpnext.accounts.doctype.journal_entry.journal_entry import get_exchange_rate
+from erpnext.accounts.doctype.pricing_rule.utils import get_applied_pricing_rules
+from erpnext.controllers.accounts_controller import (
+ validate_conversion_rate,
+ validate_inclusive_tax,
+ validate_taxes_and_charges,
+)
+from erpnext.stock.get_item_details import _get_item_tax_template
+
class calculate_taxes_and_totals(object):
def __init__(self, doc):
@@ -686,7 +694,7 @@
'mode_of_payment': default_mode_of_payment.mode_of_payment,
'amount': total_amount_to_pay,
'default': 1
- })
+ })
def get_itemised_tax_breakup_html(doc):
if not doc.taxes:
diff --git a/erpnext/controllers/tests/test_item_variant.py b/erpnext/controllers/tests/test_item_variant.py
index 813f0a0..b3633e6 100644
--- a/erpnext/controllers/tests/test_item_variant.py
+++ b/erpnext/controllers/tests/test_item_variant.py
@@ -1,15 +1,18 @@
from __future__ import unicode_literals
-import frappe
import json
import unittest
-from erpnext.stock.doctype.item.test_item import set_item_variant_settings
-from erpnext.controllers.item_variant import copy_attributes_to_variant, make_variant_item_code
-from erpnext.stock.doctype.quality_inspection.test_quality_inspection import create_quality_inspection_parameter
-
+import frappe
from six import string_types
+from erpnext.controllers.item_variant import copy_attributes_to_variant, make_variant_item_code
+from erpnext.stock.doctype.item.test_item import set_item_variant_settings
+from erpnext.stock.doctype.quality_inspection.test_quality_inspection import (
+ create_quality_inspection_parameter,
+)
+
+
class TestItemVariant(unittest.TestCase):
def test_tables_in_template_copied_to_variant(self):
fields = [{'field_name': 'quality_inspection_template'}]
diff --git a/erpnext/controllers/tests/test_mapper.py b/erpnext/controllers/tests/test_mapper.py
index 7a4b2d3..2d1ae43 100644
--- a/erpnext/controllers/tests/test_mapper.py
+++ b/erpnext/controllers/tests/test_mapper.py
@@ -1,12 +1,14 @@
from __future__ import unicode_literals
-import unittest
-import frappe
-import random, json
+import json
+import unittest
+
+import frappe
import frappe.utils
-from frappe.utils import nowdate, add_months
from frappe.model import mapper
from frappe.test_runner import make_test_records
+from frappe.utils import add_months, nowdate
+
class TestMapper(unittest.TestCase):
def test_map_docs(self):
diff --git a/erpnext/controllers/tests/test_qty_based_taxes.py b/erpnext/controllers/tests/test_qty_based_taxes.py
index aaeac5d..41673d1 100644
--- a/erpnext/controllers/tests/test_qty_based_taxes.py
+++ b/erpnext/controllers/tests/test_qty_based_taxes.py
@@ -1,8 +1,11 @@
-from __future__ import unicode_literals, print_function
+from __future__ import print_function, unicode_literals
+
import unittest
-import frappe
from uuid import uuid4 as _uuid4
+import frappe
+
+
def uuid4():
return str(_uuid4())
diff --git a/erpnext/controllers/trends.py b/erpnext/controllers/trends.py
index 9b4b0eb..05d900d 100644
--- a/erpnext/controllers/trends.py
+++ b/erpnext/controllers/trends.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import getdate
from frappe import _
+from frappe.utils import getdate
+
def get_columns(filters, trans):
validate_filters(filters)
diff --git a/erpnext/controllers/website_list_for_contact.py b/erpnext/controllers/website_list_for_contact.py
index 7c072e4..ff2ed45 100644
--- a/erpnext/controllers/website_list_for_contact.py
+++ b/erpnext/controllers/website_list_for_contact.py
@@ -2,12 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import json
+
import frappe
from frappe import _
from frappe.utils import flt, has_common
from frappe.utils.user import is_website_user
+
def get_list_context(context=None):
return {
"global_number_format": frappe.db.get_default("number_format") or "#,###.##",
diff --git a/erpnext/crm/doctype/appointment/appointment.py b/erpnext/crm/doctype/appointment/appointment.py
index f7c6b6c..f205534 100644
--- a/erpnext/crm/doctype/appointment/appointment.py
+++ b/erpnext/crm/doctype/appointment/appointment.py
@@ -4,15 +4,13 @@
from __future__ import unicode_literals
-import urllib
from collections import Counter
-from datetime import timedelta
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import get_url, getdate
-from frappe.utils.verified_command import verify_request, get_signed_params
+from frappe.utils.verified_command import get_signed_params
class Appointment(Document):
diff --git a/erpnext/crm/doctype/appointment/test_appointment.py b/erpnext/crm/doctype/appointment/test_appointment.py
index c7563e9..59138a9 100644
--- a/erpnext/crm/doctype/appointment/test_appointment.py
+++ b/erpnext/crm/doctype/appointment/test_appointment.py
@@ -3,9 +3,10 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
-import unittest
import datetime
+import unittest
+
+import frappe
def create_test_lead():
diff --git a/erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.py b/erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.py
index 27f14b1..7e1da67 100644
--- a/erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.py
+++ b/erpnext/crm/doctype/appointment_booking_settings/appointment_booking_settings.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+import datetime
+
import frappe
from frappe import _
-import datetime
from frappe.model.document import Document
@@ -28,10 +30,10 @@
to_time = datetime.datetime.strptime(
self.min_date+record.to_time, self.format_string)
timedelta = to_time-from_time
- self.validate_from_and_to_time(from_time, to_time)
+ self.validate_from_and_to_time(from_time, to_time, record)
self.duration_is_divisible(from_time, to_time)
- def validate_from_and_to_time(self, from_time, to_time):
+ def validate_from_and_to_time(self, from_time, to_time, record):
if from_time > to_time:
err_msg = _('<b>From Time</b> cannot be later than <b>To Time</b> for {0}').format(record.day_of_week)
frappe.throw(_(err_msg))
diff --git a/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py b/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py
index 3dc3c39..5c5432c 100644
--- a/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py
+++ b/erpnext/crm/doctype/appointment_booking_settings/test_appointment_booking_settings.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestAppointmentBookingSettings(unittest.TestCase):
pass
diff --git a/erpnext/crm/doctype/appointment_booking_slots/appointment_booking_slots.py b/erpnext/crm/doctype/appointment_booking_slots/appointment_booking_slots.py
index 3cadbc9..4741c8a 100644
--- a/erpnext/crm/doctype/appointment_booking_slots/appointment_booking_slots.py
+++ b/erpnext/crm/doctype/appointment_booking_slots/appointment_booking_slots.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class AppointmentBookingSlots(Document):
pass
diff --git a/erpnext/crm/doctype/availability_of_slots/availability_of_slots.py b/erpnext/crm/doctype/availability_of_slots/availability_of_slots.py
index 8258471..e33d87b 100644
--- a/erpnext/crm/doctype/availability_of_slots/availability_of_slots.py
+++ b/erpnext/crm/doctype/availability_of_slots/availability_of_slots.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class AvailabilityOfSlots(Document):
pass
diff --git a/erpnext/crm/doctype/campaign/campaign.py b/erpnext/crm/doctype/campaign/campaign.py
index e32799f..8b62800 100644
--- a/erpnext/crm/doctype/campaign/campaign.py
+++ b/erpnext/crm/doctype/campaign/campaign.py
@@ -5,6 +5,7 @@
from frappe.model.document import Document
from frappe.model.naming import set_name_by_naming_series
+
class Campaign(Document):
def autoname(self):
if frappe.defaults.get_global_default('campaign_naming_by') != 'Naming Series':
diff --git a/erpnext/crm/doctype/campaign/test_campaign.py b/erpnext/crm/doctype/campaign/test_campaign.py
index 7124b8c..2e25eb6 100644
--- a/erpnext/crm/doctype/campaign/test_campaign.py
+++ b/erpnext/crm/doctype/campaign/test_campaign.py
@@ -4,5 +4,6 @@
# import frappe
import unittest
+
class TestCampaign(unittest.TestCase):
pass
diff --git a/erpnext/crm/doctype/campaign_email_schedule/campaign_email_schedule.py b/erpnext/crm/doctype/campaign_email_schedule/campaign_email_schedule.py
index 8445b8a..f053e6e 100644
--- a/erpnext/crm/doctype/campaign_email_schedule/campaign_email_schedule.py
+++ b/erpnext/crm/doctype/campaign_email_schedule/campaign_email_schedule.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class CampaignEmailSchedule(Document):
pass
diff --git a/erpnext/crm/doctype/contract/contract.py b/erpnext/crm/doctype/contract/contract.py
index c39397b..9654613 100644
--- a/erpnext/crm/doctype/contract/contract.py
+++ b/erpnext/crm/doctype/contract/contract.py
@@ -7,7 +7,7 @@
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import getdate, now_datetime, nowdate
+from frappe.utils import getdate, nowdate
class Contract(Document):
diff --git a/erpnext/crm/doctype/contract/test_contract.py b/erpnext/crm/doctype/contract/test_contract.py
index d5f4e71..8771636 100644
--- a/erpnext/crm/doctype/contract/test_contract.py
+++ b/erpnext/crm/doctype/contract/test_contract.py
@@ -8,6 +8,7 @@
import frappe
from frappe.utils import add_days, nowdate
+
class TestContract(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/crm/doctype/contract_fulfilment_checklist/contract_fulfilment_checklist.py b/erpnext/crm/doctype/contract_fulfilment_checklist/contract_fulfilment_checklist.py
index 6039035..ae56f93 100644
--- a/erpnext/crm/doctype/contract_fulfilment_checklist/contract_fulfilment_checklist.py
+++ b/erpnext/crm/doctype/contract_fulfilment_checklist/contract_fulfilment_checklist.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ContractFulfilmentChecklist(Document):
pass
diff --git a/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py b/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py
index c78796b..82e7ad3 100644
--- a/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py
+++ b/erpnext/crm/doctype/contract_fulfilment_checklist/test_contract_fulfilment_checklist.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestContractFulfilmentChecklist(unittest.TestCase):
pass
diff --git a/erpnext/crm/doctype/contract_template/contract_template.py b/erpnext/crm/doctype/contract_template/contract_template.py
index 9281220..fc1845c 100644
--- a/erpnext/crm/doctype/contract_template/contract_template.py
+++ b/erpnext/crm/doctype/contract_template/contract_template.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+import json
+
import frappe
from frappe.model.document import Document
from frappe.utils.jinja import validate_template
from six import string_types
-import json
+
class ContractTemplate(Document):
def validate(self):
diff --git a/erpnext/crm/doctype/contract_template/test_contract_template.py b/erpnext/crm/doctype/contract_template/test_contract_template.py
index b2b0db6..5065505 100644
--- a/erpnext/crm/doctype/contract_template/test_contract_template.py
+++ b/erpnext/crm/doctype/contract_template/test_contract_template.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestContractTemplate(unittest.TestCase):
pass
diff --git a/erpnext/crm/doctype/contract_template_fulfilment_terms/contract_template_fulfilment_terms.py b/erpnext/crm/doctype/contract_template_fulfilment_terms/contract_template_fulfilment_terms.py
index 767b190..28f844d 100644
--- a/erpnext/crm/doctype/contract_template_fulfilment_terms/contract_template_fulfilment_terms.py
+++ b/erpnext/crm/doctype/contract_template_fulfilment_terms/contract_template_fulfilment_terms.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ContractTemplateFulfilmentTerms(Document):
pass
diff --git a/erpnext/crm/doctype/email_campaign/email_campaign.py b/erpnext/crm/doctype/email_campaign/email_campaign.py
index 71c93e8..4b74f25 100644
--- a/erpnext/crm/doctype/email_campaign/email_campaign.py
+++ b/erpnext/crm/doctype/email_campaign/email_campaign.py
@@ -3,11 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import getdate, add_days, today, nowdate, cstr
-from frappe.model.document import Document
from frappe.core.doctype.communication.email import make
+from frappe.model.document import Document
+from frappe.utils import add_days, getdate, today
+
class EmailCampaign(Document):
def validate(self):
diff --git a/erpnext/crm/doctype/email_campaign/test_email_campaign.py b/erpnext/crm/doctype/email_campaign/test_email_campaign.py
index f5eab48..f68b8c6 100644
--- a/erpnext/crm/doctype/email_campaign/test_email_campaign.py
+++ b/erpnext/crm/doctype/email_campaign/test_email_campaign.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestEmailCampaign(unittest.TestCase):
pass
diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py
index aa6c07b..5cf110f 100644
--- a/erpnext/crm/doctype/lead/lead.py
+++ b/erpnext/crm/doctype/lead/lead.py
@@ -4,13 +4,23 @@
from __future__ import unicode_literals
import frappe
-from erpnext.accounts.party import set_taxes
-from erpnext.controllers.selling_controller import SellingController
from frappe import _
from frappe.contacts.address_and_contact import load_address_and_contact
from frappe.email.inbox import link_communication_to_document
from frappe.model.mapper import get_mapped_doc
-from frappe.utils import cint, comma_and, cstr, getdate, has_gravatar, nowdate, validate_email_address
+from frappe.utils import (
+ cint,
+ comma_and,
+ cstr,
+ getdate,
+ has_gravatar,
+ nowdate,
+ validate_email_address,
+)
+
+from erpnext.accounts.party import set_taxes
+from erpnext.controllers.selling_controller import SellingController
+
class Lead(SellingController):
def get_feed(self):
@@ -174,6 +184,7 @@
"salutation": self.salutation,
"gender": self.gender,
"designation": self.designation,
+ "company_name": self.company_name,
})
if self.email_id:
@@ -371,4 +382,3 @@
prospect.save(ignore_permissions=True)
frappe.msgprint(_('Lead {0} has been added to prospect {1}.').format(frappe.bold(lead), frappe.bold(prospect.name)),
title=_('Lead Added'), indicator='green')
-
\ No newline at end of file
diff --git a/erpnext/crm/doctype/lead/lead_dashboard.py b/erpnext/crm/doctype/lead/lead_dashboard.py
index 50e88a5..5edf2b6 100644
--- a/erpnext/crm/doctype/lead/lead_dashboard.py
+++ b/erpnext/crm/doctype/lead/lead_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/crm/doctype/lead/test_lead.py b/erpnext/crm/doctype/lead/test_lead.py
index d7bc461..833c43e 100644
--- a/erpnext/crm/doctype/lead/test_lead.py
+++ b/erpnext/crm/doctype/lead/test_lead.py
@@ -3,9 +3,10 @@
from __future__ import unicode_literals
+import unittest
+
import frappe
from frappe.utils import random_string
-import unittest
test_records = frappe.get_test_records('Lead')
diff --git a/erpnext/crm/doctype/lead_source/lead_source.py b/erpnext/crm/doctype/lead_source/lead_source.py
index 5c64fb8..8de1c43 100644
--- a/erpnext/crm/doctype/lead_source/lead_source.py
+++ b/erpnext/crm/doctype/lead_source/lead_source.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class LeadSource(Document):
pass
diff --git a/erpnext/crm/doctype/lead_source/test_lead_source.py b/erpnext/crm/doctype/lead_source/test_lead_source.py
index b5bc649..ecf6117 100644
--- a/erpnext/crm/doctype/lead_source/test_lead_source.py
+++ b/erpnext/crm/doctype/lead_source/test_lead_source.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestLeadSource(unittest.TestCase):
pass
diff --git a/erpnext/crm/doctype/linkedin_settings/linkedin_settings.py b/erpnext/crm/doctype/linkedin_settings/linkedin_settings.py
index 9b88d78..03c9d9c 100644
--- a/erpnext/crm/doctype/linkedin_settings/linkedin_settings.py
+++ b/erpnext/crm/doctype/linkedin_settings/linkedin_settings.py
@@ -3,14 +3,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
import requests
from frappe import _
-from frappe.utils import get_url_to_form
from frappe.model.document import Document
+from frappe.utils import get_url_to_form
from frappe.utils.file_manager import get_file_path
from six.moves.urllib.parse import urlencode
+
class LinkedInSettings(Document):
@frappe.whitelist()
def get_authorization_url(self):
@@ -146,7 +148,7 @@
except Exception as e:
self.api_error(response)
-
+
return response
def get_headers(self):
@@ -168,7 +170,7 @@
raise
except Exception:
self.api_error(response)
-
+
def get_post(self, post_id):
url = "https://api.linkedin.com/v2/organizationalEntityShareStatistics?q=organizationalEntity&organizationalEntity=urn:li:organization:{0}&shares[0]=urn:li:share:{1}".format(self.company_id, post_id)
@@ -176,7 +178,7 @@
response = requests.get(url=url, headers=self.get_headers())
if response.status_code !=200:
raise
-
+
except Exception:
self.api_error(response)
diff --git a/erpnext/crm/doctype/linkedin_settings/test_linkedin_settings.py b/erpnext/crm/doctype/linkedin_settings/test_linkedin_settings.py
index 9c3ef3f..1d86f0c 100644
--- a/erpnext/crm/doctype/linkedin_settings/test_linkedin_settings.py
+++ b/erpnext/crm/doctype/linkedin_settings/test_linkedin_settings.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestLinkedInSettings(unittest.TestCase):
pass
diff --git a/erpnext/crm/doctype/lost_reason_detail/lost_reason_detail.py b/erpnext/crm/doctype/lost_reason_detail/lost_reason_detail.py
index 3baa011..88abd42 100644
--- a/erpnext/crm/doctype/lost_reason_detail/lost_reason_detail.py
+++ b/erpnext/crm/doctype/lost_reason_detail/lost_reason_detail.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class LostReasonDetail(Document):
pass
diff --git a/erpnext/crm/doctype/market_segment/market_segment.py b/erpnext/crm/doctype/market_segment/market_segment.py
index 830ea69..92adf56 100644
--- a/erpnext/crm/doctype/market_segment/market_segment.py
+++ b/erpnext/crm/doctype/market_segment/market_segment.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class MarketSegment(Document):
pass
diff --git a/erpnext/crm/doctype/market_segment/test_market_segment.py b/erpnext/crm/doctype/market_segment/test_market_segment.py
index 2f9ed34..b95cc4c 100644
--- a/erpnext/crm/doctype/market_segment/test_market_segment.py
+++ b/erpnext/crm/doctype/market_segment/test_market_segment.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestMarketSegment(unittest.TestCase):
pass
diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py
index a74a94a..0b3f508 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.py
+++ b/erpnext/crm/doctype/opportunity/opportunity.py
@@ -2,14 +2,19 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, json
-from frappe.utils import cstr, cint, get_fullname
-from frappe import msgprint, _
+
+import json
+
+import frappe
+from frappe import _
+from frappe.email.inbox import link_communication_to_document
from frappe.model.mapper import get_mapped_doc
+from frappe.utils import cint, cstr, get_fullname
+
+from erpnext.accounts.party import get_party_account_currency
from erpnext.setup.utils import get_exchange_rate
from erpnext.utilities.transaction_base import TransactionBase
-from erpnext.accounts.party import get_party_account_currency
-from frappe.email.inbox import link_communication_to_document
+
class Opportunity(TransactionBase):
def after_insert(self):
diff --git a/erpnext/crm/doctype/opportunity/opportunity_dashboard.py b/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
index b8c53f0..693a86c 100644
--- a/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
+++ b/erpnext/crm/doctype/opportunity/opportunity_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/crm/doctype/opportunity/test_opportunity.py b/erpnext/crm/doctype/opportunity/test_opportunity.py
index 52aa0b0..347bf63 100644
--- a/erpnext/crm/doctype/opportunity/test_opportunity.py
+++ b/erpnext/crm/doctype/opportunity/test_opportunity.py
@@ -2,11 +2,13 @@
# See license.txt
from __future__ import unicode_literals
+import unittest
+
import frappe
-from frappe.utils import today, random_string
+from frappe.utils import random_string, today
+
from erpnext.crm.doctype.lead.lead import make_customer
from erpnext.crm.doctype.opportunity.opportunity import make_quotation
-import unittest
test_records = frappe.get_test_records('Opportunity')
diff --git a/erpnext/crm/doctype/opportunity_item/opportunity_item.py b/erpnext/crm/doctype/opportunity_item/opportunity_item.py
index 7a5ed63..225cfe9 100644
--- a/erpnext/crm/doctype/opportunity_item/opportunity_item.py
+++ b/erpnext/crm/doctype/opportunity_item/opportunity_item.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class OpportunityItem(Document):
pass
diff --git a/erpnext/crm/doctype/opportunity_lost_reason/opportunity_lost_reason.py b/erpnext/crm/doctype/opportunity_lost_reason/opportunity_lost_reason.py
index 48b63b0..b25f02a 100644
--- a/erpnext/crm/doctype/opportunity_lost_reason/opportunity_lost_reason.py
+++ b/erpnext/crm/doctype/opportunity_lost_reason/opportunity_lost_reason.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class OpportunityLostReason(Document):
pass
diff --git a/erpnext/crm/doctype/opportunity_lost_reason_detail/opportunity_lost_reason_detail.py b/erpnext/crm/doctype/opportunity_lost_reason_detail/opportunity_lost_reason_detail.py
index 8723f1d..4bb5c54 100644
--- a/erpnext/crm/doctype/opportunity_lost_reason_detail/opportunity_lost_reason_detail.py
+++ b/erpnext/crm/doctype/opportunity_lost_reason_detail/opportunity_lost_reason_detail.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class OpportunityLostReasonDetail(Document):
pass
diff --git a/erpnext/crm/doctype/opportunity_type/opportunity_type.py b/erpnext/crm/doctype/opportunity_type/opportunity_type.py
index 48abac3..5b64e980 100644
--- a/erpnext/crm/doctype/opportunity_type/opportunity_type.py
+++ b/erpnext/crm/doctype/opportunity_type/opportunity_type.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class OpportunityType(Document):
pass
diff --git a/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py b/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py
index 6410bbc..f86a70e 100644
--- a/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py
+++ b/erpnext/crm/doctype/opportunity_type/test_opportunity_type.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestOpportunityType(unittest.TestCase):
pass
diff --git a/erpnext/crm/doctype/prospect/prospect.py b/erpnext/crm/doctype/prospect/prospect.py
index 5f5815d..367aa3d 100644
--- a/erpnext/crm/doctype/prospect/prospect.py
+++ b/erpnext/crm/doctype/prospect/prospect.py
@@ -2,9 +2,10 @@
# For license information, please see license.txt
import frappe
+from frappe.contacts.address_and_contact import load_address_and_contact
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
-from frappe.contacts.address_and_contact import load_address_and_contact
+
class Prospect(Document):
def onload(self):
@@ -15,7 +16,7 @@
def on_update(self):
self.link_with_lead_contact_and_address()
-
+
def on_trash(self):
self.unlink_dynamic_links()
diff --git a/erpnext/crm/doctype/prospect/test_prospect.py b/erpnext/crm/doctype/prospect/test_prospect.py
index 0fffad1..fa44e20 100644
--- a/erpnext/crm/doctype/prospect/test_prospect.py
+++ b/erpnext/crm/doctype/prospect/test_prospect.py
@@ -1,11 +1,13 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-import frappe
import unittest
+
+import frappe
from frappe.utils import random_string
-from erpnext.crm.doctype.lead.test_lead import make_lead
+
from erpnext.crm.doctype.lead.lead import add_lead_to_prospect
+from erpnext.crm.doctype.lead.test_lead import make_lead
class TestProspect(unittest.TestCase):
diff --git a/erpnext/crm/doctype/prospect_lead/prospect_lead.py b/erpnext/crm/doctype/prospect_lead/prospect_lead.py
index 2be5a5f..40edbe0 100644
--- a/erpnext/crm/doctype/prospect_lead/prospect_lead.py
+++ b/erpnext/crm/doctype/prospect_lead/prospect_lead.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class ProspectLead(Document):
pass
diff --git a/erpnext/crm/doctype/sales_stage/sales_stage.py b/erpnext/crm/doctype/sales_stage/sales_stage.py
index a80f4cc..e9e176f 100644
--- a/erpnext/crm/doctype/sales_stage/sales_stage.py
+++ b/erpnext/crm/doctype/sales_stage/sales_stage.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class SalesStage(Document):
pass
diff --git a/erpnext/crm/doctype/sales_stage/test_sales_stage.py b/erpnext/crm/doctype/sales_stage/test_sales_stage.py
index 80b6513..83d1f26 100644
--- a/erpnext/crm/doctype/sales_stage/test_sales_stage.py
+++ b/erpnext/crm/doctype/sales_stage/test_sales_stage.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestSalesStage(unittest.TestCase):
pass
diff --git a/erpnext/crm/doctype/social_media_post/social_media_post.js b/erpnext/crm/doctype/social_media_post/social_media_post.js
index a8f5dee..6874caa 100644
--- a/erpnext/crm/doctype/social_media_post/social_media_post.js
+++ b/erpnext/crm/doctype/social_media_post/social_media_post.js
@@ -80,10 +80,10 @@
refresh: function(frm) {
frm.trigger('text');
-
+
if (frm.doc.docstatus === 1) {
if (!['Posted', 'Deleted'].includes(frm.doc.post_status)) {
- frm.trigger('add_post_btn');
+ frm.trigger('add_post_btn');
}
if (frm.doc.post_status !='Deleted') {
frm.add_custom_button(('Delete Post'), function() {
diff --git a/erpnext/crm/doctype/social_media_post/social_media_post.py b/erpnext/crm/doctype/social_media_post/social_media_post.py
index 95320bf..14d4521 100644
--- a/erpnext/crm/doctype/social_media_post/social_media_post.py
+++ b/erpnext/crm/doctype/social_media_post/social_media_post.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.model.document import Document
-from frappe import _
+
import datetime
+import frappe
+from frappe import _
+from frappe.model.document import Document
+
+
class SocialMediaPost(Document):
def validate(self):
if (not self.twitter and not self.linkedin):
@@ -26,7 +29,7 @@
if self.scheduled_time:
self.post_status = "Scheduled"
super(SocialMediaPost, self).submit()
-
+
def on_cancel(self):
self.db_set('post_status', 'Cancelled')
@@ -35,11 +38,11 @@
if self.twitter and self.twitter_post_id:
twitter = frappe.get_doc("Twitter Settings")
twitter.delete_tweet(self.twitter_post_id)
-
+
if self.linkedin and self.linkedin_post_id:
linkedin = frappe.get_doc("LinkedIn Settings")
linkedin.delete_post(self.linkedin_post_id)
-
+
self.db_set('post_status', 'Deleted')
@frappe.whitelist()
@@ -51,7 +54,7 @@
if self.twitter and self.twitter_post_id:
twitter = frappe.get_doc("Twitter Settings")
response['twitter'] = twitter.get_tweet(self.twitter_post_id)
-
+
return response
@frappe.whitelist()
@@ -67,7 +70,7 @@
self.db_set("linkedin_post_id", linkedin_post.headers['X-RestLi-Id'])
self.db_set("post_status", "Posted")
- except:
+ except Exception:
self.db_set("post_status", "Error")
title = _("Error while POSTING {0}").format(self.name)
frappe.log_error(message=frappe.get_traceback(), title=title)
diff --git a/erpnext/crm/doctype/social_media_post/test_social_media_post.py b/erpnext/crm/doctype/social_media_post/test_social_media_post.py
index ec81ee5..c2d0418 100644
--- a/erpnext/crm/doctype/social_media_post/test_social_media_post.py
+++ b/erpnext/crm/doctype/social_media_post/test_social_media_post.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestSocialMediaPost(unittest.TestCase):
pass
diff --git a/erpnext/crm/doctype/twitter_settings/test_twitter_settings.py b/erpnext/crm/doctype/twitter_settings/test_twitter_settings.py
index 3f999c1..ff3163c 100644
--- a/erpnext/crm/doctype/twitter_settings/test_twitter_settings.py
+++ b/erpnext/crm/doctype/twitter_settings/test_twitter_settings.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestTwitterSettings(unittest.TestCase):
pass
diff --git a/erpnext/crm/doctype/twitter_settings/twitter_settings.py b/erpnext/crm/doctype/twitter_settings/twitter_settings.py
index 4775656..0205cca 100644
--- a/erpnext/crm/doctype/twitter_settings/twitter_settings.py
+++ b/erpnext/crm/doctype/twitter_settings/twitter_settings.py
@@ -3,13 +3,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, os, tweepy, json
+
+import json
+
+import frappe
+import tweepy
from frappe import _
from frappe.model.document import Document
+from frappe.utils import get_url_to_form
from frappe.utils.file_manager import get_file_path
-from frappe.utils import get_url_to_form, get_link_to_form
from tweepy.error import TweepError
+
class TwitterSettings(Document):
@frappe.whitelist()
def get_authorize_url(self):
@@ -53,10 +58,10 @@
frappe.throw(_('Invalid Consumer Key or Consumer Secret Key'))
def get_api(self):
- # authentication of consumer key and secret
- auth = tweepy.OAuthHandler(self.consumer_key, self.get_password(fieldname="consumer_secret"))
- # authentication of access token and secret
- auth.set_access_token(self.access_token, self.access_token_secret)
+ # authentication of consumer key and secret
+ auth = tweepy.OAuthHandler(self.consumer_key, self.get_password(fieldname="consumer_secret"))
+ # authentication of access token and secret
+ auth.set_access_token(self.access_token, self.access_token_secret)
return tweepy.API(auth)
@@ -90,20 +95,20 @@
def delete_tweet(self, tweet_id):
api = self.get_api()
- try:
+ try:
api.destroy_status(tweet_id)
except TweepError as e:
self.api_error(e)
def get_tweet(self, tweet_id):
api = self.get_api()
- try:
+ try:
response = api.get_status(tweet_id, trim_user=True, include_entities=True)
except TweepError as e:
self.api_error(e)
-
+
return response._json
-
+
def api_error(self, e):
content = json.loads(e.response.content)
content = content["errors"][0]
diff --git a/erpnext/crm/doctype/utils.py b/erpnext/crm/doctype/utils.py
index f244daf..0da0e0e 100644
--- a/erpnext/crm/doctype/utils.py
+++ b/erpnext/crm/doctype/utils.py
@@ -1,6 +1,6 @@
+
import frappe
-from frappe import _
-import json
+
@frappe.whitelist()
def get_last_interaction(contact=None, lead=None):
diff --git a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py
index 238884b..87f516b 100644
--- a/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py
+++ b/erpnext/crm/report/campaign_efficiency/campaign_efficiency.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt
+
def execute(filters=None):
columns, data = [], []
columns=get_columns("Campaign Name")
diff --git a/erpnext/crm/report/first_response_time_for_opportunity/first_response_time_for_opportunity.py b/erpnext/crm/report/first_response_time_for_opportunity/first_response_time_for_opportunity.py
index 2ffbc3e..df57893 100644
--- a/erpnext/crm/report/first_response_time_for_opportunity/first_response_time_for_opportunity.py
+++ b/erpnext/crm/report/first_response_time_for_opportunity/first_response_time_for_opportunity.py
@@ -2,8 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute(filters=None):
columns = [
{
diff --git a/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py b/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py
index e66bc1e..71efdb9 100644
--- a/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py
+++ b/erpnext/crm/report/lead_conversion_time/lead_conversion_time.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _, msgprint
from frappe.utils import date_diff, flt
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/crm/report/lead_details/lead_details.py b/erpnext/crm/report/lead_details/lead_details.py
index 072a476..11e8276 100644
--- a/erpnext/crm/report/lead_details/lead_details.py
+++ b/erpnext/crm/report/lead_details/lead_details.py
@@ -2,8 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe import _
+
import frappe
+from frappe import _
+
def execute(filters=None):
columns, data = get_columns(), get_data(filters)
diff --git a/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.py b/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.py
index 8fe16a2..5406eba 100644
--- a/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.py
+++ b/erpnext/crm/report/lead_owner_efficiency/lead_owner_efficiency.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe import _
+
from erpnext.crm.report.campaign_efficiency.campaign_efficiency import get_lead_data
+
def execute(filters=None):
columns, data = [], []
columns=get_columns()
diff --git a/erpnext/crm/report/lost_opportunity/lost_opportunity.py b/erpnext/crm/report/lost_opportunity/lost_opportunity.py
index 858dcc4..b308ceb 100644
--- a/erpnext/crm/report/lost_opportunity/lost_opportunity.py
+++ b/erpnext/crm/report/lost_opportunity/lost_opportunity.py
@@ -2,8 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe import _
+
import frappe
+from frappe import _
+
def execute(filters=None):
columns, data = get_columns(), get_data(filters)
diff --git a/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py b/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py
index 425b7a8..4a16f3d 100644
--- a/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py
+++ b/erpnext/crm/report/prospects_engaged_but_not_converted/prospects_engaged_but_not_converted.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import add_days, now
+
def execute(filters=None):
columns, data = [], []
set_defaut_value_for_filters(filters)
diff --git a/erpnext/demo/demo.py b/erpnext/demo/demo.py
index e89b689..5be2420 100644
--- a/erpnext/demo/demo.py
+++ b/erpnext/demo/demo.py
@@ -1,11 +1,16 @@
from __future__ import unicode_literals
-import frappe, sys
-import erpnext
+import sys
+
+import frappe
import frappe.utils
-from erpnext.demo.user import hr, sales, purchase, manufacturing, stock, accounts, projects, fixed_asset
+
+import erpnext
+from erpnext.demo.setup import education, healthcare, manufacture, retail, setup_data
+from erpnext.demo.user import accounts
from erpnext.demo.user import education as edu
-from erpnext.demo.setup import education, manufacture, setup_data, healthcare, retail
+from erpnext.demo.user import fixed_asset, hr, manufacturing, projects, purchase, sales, stock
+
"""
Make a demo
@@ -88,7 +93,7 @@
elif domain=='Education':
edu.work()
- except:
+ except Exception:
frappe.db.set_global('demo_last_date', current_date)
raise
finally:
diff --git a/erpnext/demo/setup/education.py b/erpnext/demo/setup/education.py
index cf9451d..304bc3d 100644
--- a/erpnext/demo/setup/education.py
+++ b/erpnext/demo/setup/education.py
@@ -2,11 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, json
-from frappe.utils.make_random import get_random
-from datetime import datetime
-from erpnext.demo.setup.setup_data import import_json
+import json
import random
+from datetime import datetime
+
+import frappe
+from frappe.utils.make_random import get_random
+
+from erpnext.demo.setup.setup_data import import_json
+
def setup_data():
frappe.flags.mute_emails = True
diff --git a/erpnext/demo/setup/healthcare.py b/erpnext/demo/setup/healthcare.py
index aa389e5..5d5707f 100644
--- a/erpnext/demo/setup/healthcare.py
+++ b/erpnext/demo/setup/healthcare.py
@@ -2,13 +2,17 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, json
-from frappe.utils.make_random import get_random
import datetime
-from erpnext.demo.setup.setup_data import import_json
+import json
+
+import frappe
from frappe.utils import getdate
+from frappe.utils.make_random import get_random
+
+from erpnext.demo.setup.setup_data import import_json
from erpnext.healthcare.doctype.lab_test.lab_test import create_test_from_template
+
def setup_data():
frappe.flags.mute_emails = True
make_masters()
diff --git a/erpnext/demo/setup/manufacture.py b/erpnext/demo/setup/manufacture.py
index 7d6b501..5db3519 100644
--- a/erpnext/demo/setup/manufacture.py
+++ b/erpnext/demo/setup/manufacture.py
@@ -1,13 +1,16 @@
from __future__ import unicode_literals
-import random, json
-import frappe
-from frappe.utils import nowdate, add_days
-from erpnext.demo.setup.setup_data import import_json
-from erpnext.demo.domains import data
+import json
+import random
+import frappe
+from frappe.utils import add_days, nowdate
from six import iteritems
+from erpnext.demo.domains import data
+from erpnext.demo.setup.setup_data import import_json
+
+
def setup_data():
import_json("Location")
import_json("Asset Category")
diff --git a/erpnext/demo/setup/retail.py b/erpnext/demo/setup/retail.py
index 82d1c15..d94d2d6 100644
--- a/erpnext/demo/setup/retail.py
+++ b/erpnext/demo/setup/retail.py
@@ -1,12 +1,12 @@
from __future__ import unicode_literals
-import random, json
+import json
+
import frappe
-from frappe.utils import nowdate, add_days
-from erpnext.demo.setup.setup_data import import_json
+from six import iteritems
+
from erpnext.demo.domains import data
-from six import iteritems
def setup_data():
setup_item()
diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py
index 05ee28a..42f83a3 100644
--- a/erpnext/demo/setup/setup_data.py
+++ b/erpnext/demo/setup/setup_data.py
@@ -1,13 +1,18 @@
from __future__ import print_function, unicode_literals
-import random, json
-import frappe, erpnext
-from frappe.utils.nestedset import get_root_of
-from frappe.utils import flt, now_datetime, cstr, random_string
-from frappe.utils.make_random import add_random_children, get_random
-from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
-from erpnext.demo.domains import data
+import json
+import random
+
+import frappe
from frappe import _
+from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+from frappe.utils import cstr, flt, now_datetime, random_string
+from frappe.utils.make_random import add_random_children, get_random
+from frappe.utils.nestedset import get_root_of
+
+import erpnext
+from erpnext.demo.domains import data
+
def setup(domain):
frappe.flags.in_demo = 1
diff --git a/erpnext/demo/user/accounts.py b/erpnext/demo/user/accounts.py
index 7fab772..2a24824 100644
--- a/erpnext/demo/user/accounts.py
+++ b/erpnext/demo/user/accounts.py
@@ -4,19 +4,25 @@
from __future__ import unicode_literals
-import erpnext
-import frappe
import random
-from frappe.utils import random_string
+
+import frappe
from frappe.desk import query_report
+from frappe.utils import random_string
+from frappe.utils.make_random import get_random
+
+import erpnext
from erpnext.accounts.doctype.journal_entry.journal_entry import get_payment_entry_against_invoice
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
-from frappe.utils.make_random import get_random
-from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request, make_payment_entry
+from erpnext.accounts.doctype.payment_request.payment_request import (
+ make_payment_entry,
+ make_payment_request,
+)
from erpnext.demo.user.sales import make_sales_order
from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
+
def work():
frappe.set_user(frappe.db.get_global('demo_accounts_user'))
diff --git a/erpnext/demo/user/education.py b/erpnext/demo/user/education.py
index 883a6d8..adc0463 100644
--- a/erpnext/demo/user/education.py
+++ b/erpnext/demo/user/education.py
@@ -4,13 +4,21 @@
from __future__ import unicode_literals
-import frappe
import random
+from datetime import timedelta
+
+import frappe
from frappe.utils import cstr
from frappe.utils.make_random import get_random
-from datetime import timedelta
-from erpnext.education.api import get_student_group_students, make_attendance_records, enroll_student, \
- get_fee_schedule, collect_fees, get_course
+
+from erpnext.education.api import (
+ collect_fees,
+ enroll_student,
+ get_course,
+ get_fee_schedule,
+ get_student_group_students,
+ make_attendance_records,
+)
def work():
diff --git a/erpnext/demo/user/fixed_asset.py b/erpnext/demo/user/fixed_asset.py
index dc094e1..ec0e4c8 100644
--- a/erpnext/demo/user/fixed_asset.py
+++ b/erpnext/demo/user/fixed_asset.py
@@ -6,6 +6,7 @@
import frappe
from frappe.utils.make_random import get_random
+
from erpnext.assets.doctype.asset.asset import make_sales_invoice
from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries, scrap_asset
diff --git a/erpnext/demo/user/hr.py b/erpnext/demo/user/hr.py
index 0211bc8..17d5829 100644
--- a/erpnext/demo/user/hr.py
+++ b/erpnext/demo/user/hr.py
@@ -1,15 +1,23 @@
from __future__ import unicode_literals
-import frappe, erpnext
-import random
+
import datetime
-from frappe.utils import random_string, add_days, get_last_day, getdate
+import random
+
+import frappe
+from frappe.utils import add_days, get_last_day, getdate, random_string
+from frappe.utils.make_random import get_random
+
+import erpnext
+from erpnext.hr.doctype.expense_claim.expense_claim import make_bank_entry
+from erpnext.hr.doctype.expense_claim.test_expense_claim import get_payable_account
+from erpnext.hr.doctype.leave_application.leave_application import (
+ AttendanceAlreadyMarkedError,
+ OverlapError,
+ get_leave_balance_on,
+)
from erpnext.projects.doctype.timesheet.test_timesheet import make_timesheet
from erpnext.projects.doctype.timesheet.timesheet import make_salary_slip, make_sales_invoice
-from frappe.utils.make_random import get_random
-from erpnext.hr.doctype.expense_claim.test_expense_claim import get_payable_account
-from erpnext.hr.doctype.expense_claim.expense_claim import make_bank_entry
-from erpnext.hr.doctype.leave_application.leave_application import (get_leave_balance_on,
- OverlapError, AttendanceAlreadyMarkedError)
+
def work():
frappe.set_user(frappe.db.get_global('demo_hr_user'))
diff --git a/erpnext/demo/user/manufacturing.py b/erpnext/demo/user/manufacturing.py
index bece079..6e01f0f 100644
--- a/erpnext/demo/user/manufacturing.py
+++ b/erpnext/demo/user/manufacturing.py
@@ -3,21 +3,23 @@
from __future__ import unicode_literals
-import frappe, random, erpnext
+import random
from datetime import timedelta
-from frappe.utils.make_random import how_many
+
+import frappe
from frappe.desk import query_report
-from erpnext.manufacturing.doctype.workstation.workstation import WorkstationHolidayError
+from frappe.utils.make_random import how_many
+
+import erpnext
from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record
+
def work():
if random.random() < 0.3: return
frappe.set_user(frappe.db.get_global('demo_manufacturing_user'))
if not frappe.get_all('Sales Order'): return
- from erpnext.projects.doctype.timesheet.timesheet import OverlapError
-
ppt = frappe.new_doc("Production Plan")
ppt.company = erpnext.get_default_company()
# ppt.use_multi_level_bom = 1 #refactored
@@ -68,9 +70,12 @@
def make_stock_entry_from_pro(pro_id, purpose):
from erpnext.manufacturing.doctype.work_order.work_order import make_stock_entry
+ from erpnext.stock.doctype.stock_entry.stock_entry import (
+ DuplicateEntryForWorkOrderError,
+ IncorrectValuationRateError,
+ OperationsNotCompleteError,
+ )
from erpnext.stock.stock_ledger import NegativeStockError
- from erpnext.stock.doctype.stock_entry.stock_entry import IncorrectValuationRateError, \
- DuplicateEntryForWorkOrderError, OperationsNotCompleteError
try:
st = frappe.get_doc(make_stock_entry(pro_id, purpose))
diff --git a/erpnext/demo/user/projects.py b/erpnext/demo/user/projects.py
index 044e296..b6b99de 100644
--- a/erpnext/demo/user/projects.py
+++ b/erpnext/demo/user/projects.py
@@ -3,11 +3,14 @@
from __future__ import unicode_literals
-import frappe, erpnext
+import frappe
from frappe.utils import flt
from frappe.utils.make_random import get_random
-from erpnext.projects.doctype.timesheet.test_timesheet import make_timesheet
+
+import erpnext
from erpnext.demo.user.hr import make_sales_invoice_for_timesheet
+from erpnext.projects.doctype.timesheet.test_timesheet import make_timesheet
+
def run_projects(current_date):
frappe.set_user(frappe.db.get_global('demo_projects_user'))
diff --git a/erpnext/demo/user/purchase.py b/erpnext/demo/user/purchase.py
index b7aca79..ec32f97 100644
--- a/erpnext/demo/user/purchase.py
+++ b/erpnext/demo/user/purchase.py
@@ -3,15 +3,22 @@
from __future__ import unicode_literals
-import frappe, random, json, erpnext
-from frappe.utils.make_random import how_many, get_random
+import json
+import random
+
+import frappe
from frappe.desk import query_report
-from erpnext.setup.utils import get_exchange_rate
+from frappe.utils.make_random import get_random, how_many
+
+import erpnext
from erpnext.accounts.party import get_party_account_currency
+from erpnext.buying.doctype.request_for_quotation.request_for_quotation import (
+ make_supplier_quotation_from_rfq,
+)
from erpnext.exceptions import InvalidCurrency
+from erpnext.setup.utils import get_exchange_rate
from erpnext.stock.doctype.material_request.material_request import make_request_for_quotation
-from erpnext.buying.doctype.request_for_quotation.request_for_quotation import \
- make_supplier_quotation_from_rfq
+
def work():
frappe.set_user(frappe.db.get_global('demo_purchase_user'))
diff --git a/erpnext/demo/user/sales.py b/erpnext/demo/user/sales.py
index 8d5ba28..95494ee 100644
--- a/erpnext/demo/user/sales.py
+++ b/erpnext/demo/user/sales.py
@@ -3,12 +3,20 @@
from __future__ import unicode_literals
-import frappe, random, erpnext
+import random
+
+import frappe
from frappe.utils import flt
from frappe.utils.make_random import add_random_children, get_random
-from erpnext.setup.utils import get_exchange_rate
+
+import erpnext
+from erpnext.accounts.doctype.payment_request.payment_request import (
+ make_payment_entry,
+ make_payment_request,
+)
from erpnext.accounts.party import get_party_account_currency
-from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request, make_payment_entry
+from erpnext.setup.utils import get_exchange_rate
+
def work(domain="Manufacturing"):
frappe.set_user(frappe.db.get_global('demo_sales_user_2'))
diff --git a/erpnext/demo/user/stock.py b/erpnext/demo/user/stock.py
index d44da7d..188fc13 100644
--- a/erpnext/demo/user/stock.py
+++ b/erpnext/demo/user/stock.py
@@ -3,13 +3,18 @@
from __future__ import print_function, unicode_literals
-import frappe, random, erpnext
+import random
+
+import frappe
from frappe.desk import query_report
-from erpnext.stock.stock_ledger import NegativeStockError
-from erpnext.stock.doctype.serial_no.serial_no import SerialNoRequiredError, SerialNoQtyError
+
+import erpnext
from erpnext.stock.doctype.batch.batch import UnableToSelectBatchError
from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_return
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_return
+from erpnext.stock.doctype.serial_no.serial_no import SerialNoQtyError, SerialNoRequiredError
+from erpnext.stock.stock_ledger import NegativeStockError
+
def work():
frappe.set_user(frappe.db.get_global('demo_manufacturing_user'))
@@ -66,8 +71,10 @@
def make_stock_reconciliation():
# random set some items as damaged
- from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation \
- import OpeningEntryAccountError, EmptyStockReconciliationItemsError
+ from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import (
+ EmptyStockReconciliationItemsError,
+ OpeningEntryAccountError,
+ )
if random.random() < 0.4:
stock_reco = frappe.new_doc("Stock Reconciliation")
@@ -88,8 +95,11 @@
frappe.db.rollback()
def submit_draft_stock_entries():
- from erpnext.stock.doctype.stock_entry.stock_entry import IncorrectValuationRateError, \
- DuplicateEntryForWorkOrderError, OperationsNotCompleteError
+ from erpnext.stock.doctype.stock_entry.stock_entry import (
+ DuplicateEntryForWorkOrderError,
+ IncorrectValuationRateError,
+ OperationsNotCompleteError,
+ )
# try posting older drafts (if exists)
frappe.db.commit()
diff --git a/erpnext/education/__init__.py b/erpnext/education/__init__.py
index c0589bb..a3164b2 100644
--- a/erpnext/education/__init__.py
+++ b/erpnext/education/__init__.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
class StudentNotInGroupError(frappe.ValidationError): pass
def validate_student_belongs_to_group(student, student_group):
diff --git a/erpnext/education/api.py b/erpnext/education/api.py
index 4493a3f..d2a8805 100644
--- a/erpnext/education/api.py
+++ b/erpnext/education/api.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
+
+import frappe
from frappe import _
-from frappe.model.mapper import get_mapped_doc
-from frappe.utils import flt, cstr, getdate
from frappe.email.doctype.email_group.email_group import add_subscribers
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import cstr, flt, getdate
+
def get_course(program):
'''Return list of courses for a particular program
diff --git a/erpnext/education/doctype/academic_term/academic_term.py b/erpnext/education/doctype/academic_term/academic_term.py
index fa7f289..b8e22b6 100644
--- a/erpnext/education/doctype/academic_term/academic_term.py
+++ b/erpnext/education/doctype/academic_term/academic_term.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import getdate
from frappe.model.document import Document
+from frappe.utils import getdate
+
class AcademicTerm(Document):
def autoname(self):
diff --git a/erpnext/education/doctype/academic_term/academic_term_dashboard.py b/erpnext/education/doctype/academic_term/academic_term_dashboard.py
index eb2f907..a1087b8 100644
--- a/erpnext/education/doctype/academic_term/academic_term_dashboard.py
+++ b/erpnext/education/doctype/academic_term/academic_term_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'academic_term',
diff --git a/erpnext/education/doctype/academic_term/test_academic_term.py b/erpnext/education/doctype/academic_term/test_academic_term.py
index 0964a56..6329103 100644
--- a/erpnext/education/doctype/academic_term/test_academic_term.py
+++ b/erpnext/education/doctype/academic_term/test_academic_term.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Academic Term')
diff --git a/erpnext/education/doctype/academic_year/academic_year.py b/erpnext/education/doctype/academic_year/academic_year.py
index f2858a4..77b67d8 100644
--- a/erpnext/education/doctype/academic_year/academic_year.py
+++ b/erpnext/education/doctype/academic_year/academic_year.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import msgprint, _
+from frappe import _
from frappe.model.document import Document
+
class AcademicYear(Document):
def validate(self):
#Check that start of academic year is earlier than end of academic year
diff --git a/erpnext/education/doctype/academic_year/academic_year_dashboard.py b/erpnext/education/doctype/academic_year/academic_year_dashboard.py
index d3734df..49d68c3 100644
--- a/erpnext/education/doctype/academic_year/academic_year_dashboard.py
+++ b/erpnext/education/doctype/academic_year/academic_year_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'academic_year',
diff --git a/erpnext/education/doctype/academic_year/test_academic_year.py b/erpnext/education/doctype/academic_year/test_academic_year.py
index 9da75a7..31135c4 100644
--- a/erpnext/education/doctype/academic_year/test_academic_year.py
+++ b/erpnext/education/doctype/academic_year/test_academic_year.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Academic Year')
diff --git a/erpnext/education/doctype/article/article.py b/erpnext/education/doctype/article/article.py
index b5cc5cb..f3c7788 100644
--- a/erpnext/education/doctype/article/article.py
+++ b/erpnext/education/doctype/article/article.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class Article(Document):
def get_article(self):
pass
diff --git a/erpnext/education/doctype/article/test_article.py b/erpnext/education/doctype/article/test_article.py
index 2fce07f..cda79ad 100644
--- a/erpnext/education/doctype/article/test_article.py
+++ b/erpnext/education/doctype/article/test_article.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestArticle(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/assessment_criteria/assessment_criteria.py b/erpnext/education/doctype/assessment_criteria/assessment_criteria.py
index bfbf26c..f8f04bf 100644
--- a/erpnext/education/doctype/assessment_criteria/assessment_criteria.py
+++ b/erpnext/education/doctype/assessment_criteria/assessment_criteria.py
@@ -3,6 +3,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
diff --git a/erpnext/education/doctype/assessment_criteria/test_assessment_criteria.py b/erpnext/education/doctype/assessment_criteria/test_assessment_criteria.py
index fc0d745..1098d03 100644
--- a/erpnext/education/doctype/assessment_criteria/test_assessment_criteria.py
+++ b/erpnext/education/doctype/assessment_criteria/test_assessment_criteria.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Assessment Criteria')
diff --git a/erpnext/education/doctype/assessment_criteria_group/assessment_criteria_group.py b/erpnext/education/doctype/assessment_criteria_group/assessment_criteria_group.py
index 75381e1..e62c030 100644
--- a/erpnext/education/doctype/assessment_criteria_group/assessment_criteria_group.py
+++ b/erpnext/education/doctype/assessment_criteria_group/assessment_criteria_group.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class AssessmentCriteriaGroup(Document):
pass
diff --git a/erpnext/education/doctype/assessment_criteria_group/test_assessment_criteria_group.py b/erpnext/education/doctype/assessment_criteria_group/test_assessment_criteria_group.py
index 5b29337..d65f1e7 100644
--- a/erpnext/education/doctype/assessment_criteria_group/test_assessment_criteria_group.py
+++ b/erpnext/education/doctype/assessment_criteria_group/test_assessment_criteria_group.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Assessment Criteria Group')
diff --git a/erpnext/education/doctype/assessment_group/assessment_group.py b/erpnext/education/doctype/assessment_group/assessment_group.py
index 88acc12..3425109 100644
--- a/erpnext/education/doctype/assessment_group/assessment_group.py
+++ b/erpnext/education/doctype/assessment_group/assessment_group.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class AssessmentGroup(Document):
pass
diff --git a/erpnext/education/doctype/assessment_group/assessment_group_dashboard.py b/erpnext/education/doctype/assessment_group/assessment_group_dashboard.py
index 1a23606..83438c0 100644
--- a/erpnext/education/doctype/assessment_group/assessment_group_dashboard.py
+++ b/erpnext/education/doctype/assessment_group/assessment_group_dashboard.py
@@ -1,8 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'assessment_group',
diff --git a/erpnext/education/doctype/assessment_group/test_assessment_group.py b/erpnext/education/doctype/assessment_group/test_assessment_group.py
index 2fd98b6..822d65c 100644
--- a/erpnext/education/doctype/assessment_group/test_assessment_group.py
+++ b/erpnext/education/doctype/assessment_group/test_assessment_group.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Assessment Group')
diff --git a/erpnext/education/doctype/assessment_plan/assessment_plan.py b/erpnext/education/doctype/assessment_plan/assessment_plan.py
index 16136c1..2a58a31 100644
--- a/erpnext/education/doctype/assessment_plan/assessment_plan.py
+++ b/erpnext/education/doctype/assessment_plan/assessment_plan.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe.model.document import Document
+
import frappe
from frappe import _
+from frappe.model.document import Document
+
class AssessmentPlan(Document):
def validate(self):
diff --git a/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py b/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py
index 8ac3faf..6729538 100644
--- a/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py
+++ b/erpnext/education/doctype/assessment_plan/assessment_plan_dashboard.py
@@ -1,8 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'assessment_plan',
diff --git a/erpnext/education/doctype/assessment_plan/test_assessment_plan.py b/erpnext/education/doctype/assessment_plan/test_assessment_plan.py
index 2de4f23..9a6b886 100644
--- a/erpnext/education/doctype/assessment_plan/test_assessment_plan.py
+++ b/erpnext/education/doctype/assessment_plan/test_assessment_plan.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Assessment Plan')
diff --git a/erpnext/education/doctype/assessment_plan_criteria/assessment_plan_criteria.py b/erpnext/education/doctype/assessment_plan_criteria/assessment_plan_criteria.py
index 53b477f..795462d 100644
--- a/erpnext/education/doctype/assessment_plan_criteria/assessment_plan_criteria.py
+++ b/erpnext/education/doctype/assessment_plan_criteria/assessment_plan_criteria.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class AssessmentPlanCriteria(Document):
pass
diff --git a/erpnext/education/doctype/assessment_result/assessment_result.py b/erpnext/education/doctype/assessment_result/assessment_result.py
index 7dfe0cf..01f483f 100644
--- a/erpnext/education/doctype/assessment_result/assessment_result.py
+++ b/erpnext/education/doctype/assessment_result/assessment_result.py
@@ -3,14 +3,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt
from frappe.model.document import Document
-from erpnext.education.api import get_grade
-from erpnext.education.api import get_assessment_details
+from frappe.utils import flt
from frappe.utils.csvutils import getlink
+
import erpnext.education
+from erpnext.education.api import get_assessment_details, get_grade
+
class AssessmentResult(Document):
def validate(self):
diff --git a/erpnext/education/doctype/assessment_result/assessment_result_dashboard.py b/erpnext/education/doctype/assessment_result/assessment_result_dashboard.py
index 2526076..f9e2008 100644
--- a/erpnext/education/doctype/assessment_result/assessment_result_dashboard.py
+++ b/erpnext/education/doctype/assessment_result/assessment_result_dashboard.py
@@ -1,8 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'reports': [
diff --git a/erpnext/education/doctype/assessment_result/test_assessment_result.py b/erpnext/education/doctype/assessment_result/test_assessment_result.py
index adce577..fa0ad1f 100644
--- a/erpnext/education/doctype/assessment_result/test_assessment_result.py
+++ b/erpnext/education/doctype/assessment_result/test_assessment_result.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
from erpnext.education.api import get_grade
# test_records = frappe.get_test_records('Assessment Result')
diff --git a/erpnext/education/doctype/assessment_result_detail/assessment_result_detail.py b/erpnext/education/doctype/assessment_result_detail/assessment_result_detail.py
index d051593..234dff0 100644
--- a/erpnext/education/doctype/assessment_result_detail/assessment_result_detail.py
+++ b/erpnext/education/doctype/assessment_result_detail/assessment_result_detail.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class AssessmentResultDetail(Document):
pass
diff --git a/erpnext/education/doctype/assessment_result_tool/assessment_result_tool.py b/erpnext/education/doctype/assessment_result_tool/assessment_result_tool.py
index a0d286c..83b4f56 100644
--- a/erpnext/education/doctype/assessment_result_tool/assessment_result_tool.py
+++ b/erpnext/education/doctype/assessment_result_tool/assessment_result_tool.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class AssessmentResultTool(Document):
pass
diff --git a/erpnext/education/doctype/assessment_result_tool/test_assessment_result_tool.py b/erpnext/education/doctype/assessment_result_tool/test_assessment_result_tool.py
index f784ccb..bcc5722 100644
--- a/erpnext/education/doctype/assessment_result_tool/test_assessment_result_tool.py
+++ b/erpnext/education/doctype/assessment_result_tool/test_assessment_result_tool.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestAssessmentResultTool(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/content_activity/content_activity.py b/erpnext/education/doctype/content_activity/content_activity.py
index 2ae7a5c..076e2d3 100644
--- a/erpnext/education/doctype/content_activity/content_activity.py
+++ b/erpnext/education/doctype/content_activity/content_activity.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ContentActivity(Document):
pass
diff --git a/erpnext/education/doctype/content_question/content_question.py b/erpnext/education/doctype/content_question/content_question.py
index b239d21..9c24916 100644
--- a/erpnext/education/doctype/content_question/content_question.py
+++ b/erpnext/education/doctype/content_question/content_question.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ContentQuestion(Document):
pass
diff --git a/erpnext/education/doctype/content_question/test_content_question.py b/erpnext/education/doctype/content_question/test_content_question.py
index 268b9be..f6bd49b 100644
--- a/erpnext/education/doctype/content_question/test_content_question.py
+++ b/erpnext/education/doctype/content_question/test_content_question.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestContentQuestion(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/course/course.py b/erpnext/education/doctype/course/course.py
index 92f92ed..9cc373a 100644
--- a/erpnext/education/doctype/course/course.py
+++ b/erpnext/education/doctype/course/course.py
@@ -3,10 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
-from frappe.model.document import Document
+
+import frappe
from frappe import _
+from frappe.model.document import Document
+
class Course(Document):
def validate(self):
diff --git a/erpnext/education/doctype/course/course_dashboard.py b/erpnext/education/doctype/course/course_dashboard.py
index 8de91b1..8eca2a1 100644
--- a/erpnext/education/doctype/course/course_dashboard.py
+++ b/erpnext/education/doctype/course/course_dashboard.py
@@ -1,8 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'course',
diff --git a/erpnext/education/doctype/course/test_course.py b/erpnext/education/doctype/course/test_course.py
index 4667ac4..dd43ef4 100644
--- a/erpnext/education/doctype/course/test_course.py
+++ b/erpnext/education/doctype/course/test_course.py
@@ -2,11 +2,12 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
-from erpnext.education.doctype.topic.test_topic import make_topic
-from erpnext.education.doctype.topic.test_topic import make_topic_and_linked_content
+
+import unittest
import frappe
-import unittest
+
+from erpnext.education.doctype.topic.test_topic import make_topic, make_topic_and_linked_content
# test_records = frappe.get_test_records('Course')
diff --git a/erpnext/education/doctype/course_activity/course_activity.py b/erpnext/education/doctype/course_activity/course_activity.py
index 3aa1ea0..61b51a0 100644
--- a/erpnext/education/doctype/course_activity/course_activity.py
+++ b/erpnext/education/doctype/course_activity/course_activity.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
class CourseActivity(Document):
def validate(self):
self.check_if_enrolled()
diff --git a/erpnext/education/doctype/course_activity/test_course_activity.py b/erpnext/education/doctype/course_activity/test_course_activity.py
index 5269a6b..778cefe 100644
--- a/erpnext/education/doctype/course_activity/test_course_activity.py
+++ b/erpnext/education/doctype/course_activity/test_course_activity.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestCourseActivity(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/course_assessment_criteria/course_assessment_criteria.py b/erpnext/education/doctype/course_assessment_criteria/course_assessment_criteria.py
index ade2a39..df384c5 100644
--- a/erpnext/education/doctype/course_assessment_criteria/course_assessment_criteria.py
+++ b/erpnext/education/doctype/course_assessment_criteria/course_assessment_criteria.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class CourseAssessmentCriteria(Document):
pass
diff --git a/erpnext/education/doctype/course_content/course_content.py b/erpnext/education/doctype/course_content/course_content.py
index 0d2f85a..1dd08ad 100644
--- a/erpnext/education/doctype/course_content/course_content.py
+++ b/erpnext/education/doctype/course_content/course_content.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class CourseContent(Document):
pass
diff --git a/erpnext/education/doctype/course_content/test_course_content.py b/erpnext/education/doctype/course_content/test_course_content.py
index 9be4b1f..320fa11 100644
--- a/erpnext/education/doctype/course_content/test_course_content.py
+++ b/erpnext/education/doctype/course_content/test_course_content.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestCourseContent(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/course_enrollment/course_enrollment.py b/erpnext/education/doctype/course_enrollment/course_enrollment.py
index ce88990..21e7451 100644
--- a/erpnext/education/doctype/course_enrollment/course_enrollment.py
+++ b/erpnext/education/doctype/course_enrollment/course_enrollment.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+from functools import reduce
+
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import get_link_to_form
-from functools import reduce
+
class CourseEnrollment(Document):
def validate(self):
diff --git a/erpnext/education/doctype/course_enrollment/course_enrollment_dashboard.py b/erpnext/education/doctype/course_enrollment/course_enrollment_dashboard.py
index 37972fe..253325c 100644
--- a/erpnext/education/doctype/course_enrollment/course_enrollment_dashboard.py
+++ b/erpnext/education/doctype/course_enrollment/course_enrollment_dashboard.py
@@ -1,8 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'enrollment',
diff --git a/erpnext/education/doctype/course_enrollment/test_course_enrollment.py b/erpnext/education/doctype/course_enrollment/test_course_enrollment.py
index 874bf12..e5feb1b 100644
--- a/erpnext/education/doctype/course_enrollment/test_course_enrollment.py
+++ b/erpnext/education/doctype/course_enrollment/test_course_enrollment.py
@@ -3,14 +3,14 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
-from erpnext.education.doctype.student.test_student import create_student
-from erpnext.education.doctype.student.test_student import get_student
-from erpnext.education.doctype.program.test_program import setup_program
from erpnext.education.doctype.course_activity.test_course_activity import make_course_activity
+from erpnext.education.doctype.program.test_program import setup_program
+from erpnext.education.doctype.student.test_student import create_student, get_student
+
class TestCourseEnrollment(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/education/doctype/course_schedule/course_schedule.py b/erpnext/education/doctype/course_schedule/course_schedule.py
index 748728d..38379e4 100644
--- a/erpnext/education/doctype/course_schedule/course_schedule.py
+++ b/erpnext/education/doctype/course_schedule/course_schedule.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
class CourseSchedule(Document):
def validate(self):
self.instructor_name = frappe.db.get_value("Instructor", self.instructor, "instructor_name")
diff --git a/erpnext/education/doctype/course_schedule/course_schedule_dashboard.py b/erpnext/education/doctype/course_schedule/course_schedule_dashboard.py
index 22ce7e1..12a1735f 100644
--- a/erpnext/education/doctype/course_schedule/course_schedule_dashboard.py
+++ b/erpnext/education/doctype/course_schedule/course_schedule_dashboard.py
@@ -1,8 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'course_schedule',
diff --git a/erpnext/education/doctype/course_schedule/test_course_schedule.py b/erpnext/education/doctype/course_schedule/test_course_schedule.py
index 5bb4de8..1b45ced 100644
--- a/erpnext/education/doctype/course_schedule/test_course_schedule.py
+++ b/erpnext/education/doctype/course_schedule/test_course_schedule.py
@@ -3,13 +3,13 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
+import datetime
import unittest
-import datetime
-from frappe.utils import today, to_timedelta
+import frappe
+from frappe.utils import to_timedelta, today
+
from erpnext.education.utils import OverlapError
-from frappe.utils.make_random import get_random
# test_records = frappe.get_test_records('Course Schedule')
diff --git a/erpnext/education/doctype/course_scheduling_tool/course_scheduling_tool.py b/erpnext/education/doctype/course_scheduling_tool/course_scheduling_tool.py
index 0f2ea96..4f7ed36 100644
--- a/erpnext/education/doctype/course_scheduling_tool/course_scheduling_tool.py
+++ b/erpnext/education/doctype/course_scheduling_tool/course_scheduling_tool.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import calendar
+
+import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import add_days, getdate
+
from erpnext.education.utils import OverlapError
@@ -95,7 +98,7 @@
if self.day == calendar.day_name[getdate(d.schedule_date).weekday()]:
frappe.delete_doc("Course Schedule", d.name)
rescheduled.append(d.name)
- except:
+ except Exception:
reschedule_errors.append(d.name)
return rescheduled, reschedule_errors
diff --git a/erpnext/education/doctype/course_scheduling_tool/test_course_scheduling_tool.py b/erpnext/education/doctype/course_scheduling_tool/test_course_scheduling_tool.py
index d921f8e..27379b7 100644
--- a/erpnext/education/doctype/course_scheduling_tool/test_course_scheduling_tool.py
+++ b/erpnext/education/doctype/course_scheduling_tool/test_course_scheduling_tool.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestCourseSchedulingTool(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/course_topic/course_topic.py b/erpnext/education/doctype/course_topic/course_topic.py
index 2364f17..11eb457 100644
--- a/erpnext/education/doctype/course_topic/course_topic.py
+++ b/erpnext/education/doctype/course_topic/course_topic.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class CourseTopic(Document):
pass
diff --git a/erpnext/education/doctype/course_topic/test_course_topic.py b/erpnext/education/doctype/course_topic/test_course_topic.py
index 7ce46d2..0bba7f5 100644
--- a/erpnext/education/doctype/course_topic/test_course_topic.py
+++ b/erpnext/education/doctype/course_topic/test_course_topic.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestCourseTopic(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/education_settings/education_settings.py b/erpnext/education/doctype/education_settings/education_settings.py
index 6c7e95c..71d13f7 100644
--- a/erpnext/education/doctype/education_settings/education_settings.py
+++ b/erpnext/education/doctype/education_settings/education_settings.py
@@ -3,6 +3,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
import frappe.defaults
from frappe.model.document import Document
diff --git a/erpnext/education/doctype/education_settings/test_education_settings.py b/erpnext/education/doctype/education_settings/test_education_settings.py
index 038fb6e..3611cbe 100644
--- a/erpnext/education/doctype/education_settings/test_education_settings.py
+++ b/erpnext/education/doctype/education_settings/test_education_settings.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestEducationSettings(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/fee_category/fee_category.py b/erpnext/education/doctype/fee_category/fee_category.py
index 5523444..f531f8a 100644
--- a/erpnext/education/doctype/fee_category/fee_category.py
+++ b/erpnext/education/doctype/fee_category/fee_category.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class FeeCategory(Document):
pass
diff --git a/erpnext/education/doctype/fee_category/test_fee_category.py b/erpnext/education/doctype/fee_category/test_fee_category.py
index 48e7589..8755684 100644
--- a/erpnext/education/doctype/fee_category/test_fee_category.py
+++ b/erpnext/education/doctype/fee_category/test_fee_category.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Fee Category')
diff --git a/erpnext/education/doctype/fee_component/fee_component.py b/erpnext/education/doctype/fee_component/fee_component.py
index 8694610..dba39af 100644
--- a/erpnext/education/doctype/fee_component/fee_component.py
+++ b/erpnext/education/doctype/fee_component/fee_component.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class FeeComponent(Document):
pass
diff --git a/erpnext/education/doctype/fee_schedule/fee_schedule.py b/erpnext/education/doctype/fee_schedule/fee_schedule.py
index 0b025c7..6bf4667 100644
--- a/erpnext/education/doctype/fee_schedule/fee_schedule.py
+++ b/erpnext/education/doctype/fee_schedule/fee_schedule.py
@@ -3,13 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
+from frappe import _
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
-from frappe.utils import money_in_words
-from frappe.utils import cint, flt, cstr
+from frappe.utils import cint, cstr, flt, money_in_words
from frappe.utils.background_jobs import enqueue
-from frappe import _
+
+import erpnext
class FeeSchedule(Document):
diff --git a/erpnext/education/doctype/fee_schedule/fee_schedule_dashboard.py b/erpnext/education/doctype/fee_schedule/fee_schedule_dashboard.py
index 4d7da21..34f8705 100644
--- a/erpnext/education/doctype/fee_schedule/fee_schedule_dashboard.py
+++ b/erpnext/education/doctype/fee_schedule/fee_schedule_dashboard.py
@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
def get_data():
return {
'fieldname': 'fee_schedule',
diff --git a/erpnext/education/doctype/fee_schedule/test_fee_schedule.py b/erpnext/education/doctype/fee_schedule/test_fee_schedule.py
index 44e0756..86b74de 100644
--- a/erpnext/education/doctype/fee_schedule/test_fee_schedule.py
+++ b/erpnext/education/doctype/fee_schedule/test_fee_schedule.py
@@ -5,5 +5,6 @@
import unittest
+
class TestFeeSchedule(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/fee_schedule_program/fee_schedule_program.py b/erpnext/education/doctype/fee_schedule_program/fee_schedule_program.py
index 11d5697..5e9ed61 100644
--- a/erpnext/education/doctype/fee_schedule_program/fee_schedule_program.py
+++ b/erpnext/education/doctype/fee_schedule_program/fee_schedule_program.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class FeeScheduleProgram(Document):
pass
diff --git a/erpnext/education/doctype/fee_schedule_student_group/fee_schedule_student_group.py b/erpnext/education/doctype/fee_schedule_student_group/fee_schedule_student_group.py
index 776534d..ba30a91 100644
--- a/erpnext/education/doctype/fee_schedule_student_group/fee_schedule_student_group.py
+++ b/erpnext/education/doctype/fee_schedule_student_group/fee_schedule_student_group.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class FeeScheduleStudentGroup(Document):
pass
diff --git a/erpnext/education/doctype/fee_structure/fee_structure.py b/erpnext/education/doctype/fee_structure/fee_structure.py
index 9755717..a6cc701 100644
--- a/erpnext/education/doctype/fee_structure/fee_structure.py
+++ b/erpnext/education/doctype/fee_structure/fee_structure.py
@@ -3,6 +3,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
diff --git a/erpnext/education/doctype/fee_structure/fee_structure_dashboard.py b/erpnext/education/doctype/fee_structure/fee_structure_dashboard.py
index fdf7df7..c053b4e 100644
--- a/erpnext/education/doctype/fee_structure/fee_structure_dashboard.py
+++ b/erpnext/education/doctype/fee_structure/fee_structure_dashboard.py
@@ -1,8 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'fee_structure',
diff --git a/erpnext/education/doctype/fee_structure/test_fee_structure.py b/erpnext/education/doctype/fee_structure/test_fee_structure.py
index 785ae4e..1311f13 100644
--- a/erpnext/education/doctype/fee_structure/test_fee_structure.py
+++ b/erpnext/education/doctype/fee_structure/test_fee_structure.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Fee Structure')
diff --git a/erpnext/education/doctype/fees/fees.py b/erpnext/education/doctype/fees/fees.py
index 7e86704..a5dc0dc 100644
--- a/erpnext/education/doctype/fees/fees.py
+++ b/erpnext/education/doctype/fees/fees.py
@@ -3,14 +3,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe.model.document import Document
-import frappe, erpnext
+
+import frappe
from frappe import _
from frappe.utils import money_in_words
-from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request
from frappe.utils.csvutils import getlink
-from erpnext.controllers.accounts_controller import AccountsController
+
+import erpnext
+from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request
from erpnext.accounts.general_ledger import make_reverse_gl_entries
+from erpnext.controllers.accounts_controller import AccountsController
class Fees(AccountsController):
diff --git a/erpnext/education/doctype/fees/test_fees.py b/erpnext/education/doctype/fees/test_fees.py
index c6bb704..fbf7a57 100644
--- a/erpnext/education/doctype/fees/test_fees.py
+++ b/erpnext/education/doctype/fees/test_fees.py
@@ -3,10 +3,12 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from frappe.utils import nowdate
from frappe.utils.make_random import get_random
+
from erpnext.education.doctype.program.test_program import make_program_and_linked_courses
test_dependencies = ['Company']
diff --git a/erpnext/education/doctype/grading_scale/grading_scale.py b/erpnext/education/doctype/grading_scale/grading_scale.py
index 0e73297..ed75f31 100644
--- a/erpnext/education/doctype/grading_scale/grading_scale.py
+++ b/erpnext/education/doctype/grading_scale/grading_scale.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import cint
from frappe.model.document import Document
+from frappe.utils import cint
+
class GradingScale(Document):
def validate(self):
diff --git a/erpnext/education/doctype/grading_scale/grading_scale_dashboard.py b/erpnext/education/doctype/grading_scale/grading_scale_dashboard.py
index 2a3f13b..268871a 100644
--- a/erpnext/education/doctype/grading_scale/grading_scale_dashboard.py
+++ b/erpnext/education/doctype/grading_scale/grading_scale_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'grading_scale',
diff --git a/erpnext/education/doctype/grading_scale/test_grading_scale.py b/erpnext/education/doctype/grading_scale/test_grading_scale.py
index 5364d7c..e5d83c2 100644
--- a/erpnext/education/doctype/grading_scale/test_grading_scale.py
+++ b/erpnext/education/doctype/grading_scale/test_grading_scale.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Grading Scale')
diff --git a/erpnext/education/doctype/grading_scale_interval/grading_scale_interval.py b/erpnext/education/doctype/grading_scale_interval/grading_scale_interval.py
index 41ac5ff..6e55aac 100644
--- a/erpnext/education/doctype/grading_scale_interval/grading_scale_interval.py
+++ b/erpnext/education/doctype/grading_scale_interval/grading_scale_interval.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class GradingScaleInterval(Document):
pass
diff --git a/erpnext/education/doctype/guardian/guardian.py b/erpnext/education/doctype/guardian/guardian.py
index e82cc54..f79e131 100644
--- a/erpnext/education/doctype/guardian/guardian.py
+++ b/erpnext/education/doctype/guardian/guardian.py
@@ -3,11 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils.csvutils import getlink
+
class Guardian(Document):
def __setup__(self):
self.onload()
diff --git a/erpnext/education/doctype/guardian/test_guardian.py b/erpnext/education/doctype/guardian/test_guardian.py
index 61420f6..446e261 100644
--- a/erpnext/education/doctype/guardian/test_guardian.py
+++ b/erpnext/education/doctype/guardian/test_guardian.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Guardian')
diff --git a/erpnext/education/doctype/guardian_interest/guardian_interest.py b/erpnext/education/doctype/guardian_interest/guardian_interest.py
index f5c4cf1..4a3040f 100644
--- a/erpnext/education/doctype/guardian_interest/guardian_interest.py
+++ b/erpnext/education/doctype/guardian_interest/guardian_interest.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class GuardianInterest(Document):
pass
diff --git a/erpnext/education/doctype/guardian_student/guardian_student.py b/erpnext/education/doctype/guardian_student/guardian_student.py
index bf6f5c1..62867d8 100644
--- a/erpnext/education/doctype/guardian_student/guardian_student.py
+++ b/erpnext/education/doctype/guardian_student/guardian_student.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class GuardianStudent(Document):
pass
diff --git a/erpnext/education/doctype/instructor/instructor.py b/erpnext/education/doctype/instructor/instructor.py
index b1bfcbb..92fb8b0 100644
--- a/erpnext/education/doctype/instructor/instructor.py
+++ b/erpnext/education/doctype/instructor/instructor.py
@@ -3,11 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.model.naming import set_name_by_naming_series
+
class Instructor(Document):
def autoname(self):
naming_method = frappe.db.get_value("Education Settings", None, "instructor_created_by")
diff --git a/erpnext/education/doctype/instructor/instructor_dashboard.py b/erpnext/education/doctype/instructor/instructor_dashboard.py
index c19c859..bb08a54 100644
--- a/erpnext/education/doctype/instructor/instructor_dashboard.py
+++ b/erpnext/education/doctype/instructor/instructor_dashboard.py
@@ -1,8 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'heatmap': True,
diff --git a/erpnext/education/doctype/instructor/test_instructor.py b/erpnext/education/doctype/instructor/test_instructor.py
index 4061422..b698a20 100644
--- a/erpnext/education/doctype/instructor/test_instructor.py
+++ b/erpnext/education/doctype/instructor/test_instructor.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Instructor')
diff --git a/erpnext/education/doctype/instructor_log/instructor_log.py b/erpnext/education/doctype/instructor_log/instructor_log.py
index 75217b2..68ab7a6 100644
--- a/erpnext/education/doctype/instructor_log/instructor_log.py
+++ b/erpnext/education/doctype/instructor_log/instructor_log.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class InstructorLog(Document):
pass
diff --git a/erpnext/education/doctype/options/options.py b/erpnext/education/doctype/options/options.py
index a11d77a..a064384 100644
--- a/erpnext/education/doctype/options/options.py
+++ b/erpnext/education/doctype/options/options.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class Options(Document):
pass
diff --git a/erpnext/education/doctype/program/program.py b/erpnext/education/doctype/program/program.py
index 9d886b7..7de34cf 100644
--- a/erpnext/education/doctype/program/program.py
+++ b/erpnext/education/doctype/program/program.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class Program(Document):
def get_course_list(self):
diff --git a/erpnext/education/doctype/program/program_dashboard.py b/erpnext/education/doctype/program/program_dashboard.py
index 6c503e1..6696076 100644
--- a/erpnext/education/doctype/program/program_dashboard.py
+++ b/erpnext/education/doctype/program/program_dashboard.py
@@ -1,5 +1,6 @@
from frappe import _
+
def get_data():
return {
'fieldname': 'program',
diff --git a/erpnext/education/doctype/program/test_program.py b/erpnext/education/doctype/program/test_program.py
index 204f296..3222aa6 100644
--- a/erpnext/education/doctype/program/test_program.py
+++ b/erpnext/education/doctype/program/test_program.py
@@ -2,12 +2,13 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
-from erpnext.education.doctype.course.test_course import make_course
-from erpnext.education.doctype.topic.test_topic import make_topic_and_linked_content
-from erpnext.education.doctype.course.test_course import make_course_and_linked_topic
+
+import unittest
import frappe
-import unittest
+
+from erpnext.education.doctype.course.test_course import make_course, make_course_and_linked_topic
+from erpnext.education.doctype.topic.test_topic import make_topic_and_linked_content
test_data = {
"program_name": "_Test Program",
diff --git a/erpnext/education/doctype/program_course/program_course.py b/erpnext/education/doctype/program_course/program_course.py
index 684b6fa..d5236a1 100644
--- a/erpnext/education/doctype/program_course/program_course.py
+++ b/erpnext/education/doctype/program_course/program_course.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ProgramCourse(Document):
pass
diff --git a/erpnext/education/doctype/program_enrollment/program_enrollment.py b/erpnext/education/doctype/program_enrollment/program_enrollment.py
index dd4aa57..79c5a14 100644
--- a/erpnext/education/doctype/program_enrollment/program_enrollment.py
+++ b/erpnext/education/doctype/program_enrollment/program_enrollment.py
@@ -3,12 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import msgprint, _
+from frappe import _, msgprint
+from frappe.desk.reportview import get_match_cond
from frappe.model.document import Document
-from frappe.desk.reportview import get_match_cond, get_filters_cond
from frappe.utils import comma_and, get_link_to_form, getdate
-import erpnext.www.lms as lms
+
class ProgramEnrollment(Document):
def validate(self):
diff --git a/erpnext/education/doctype/program_enrollment/program_enrollment_dashboard.py b/erpnext/education/doctype/program_enrollment/program_enrollment_dashboard.py
index c47f866..f829276 100644
--- a/erpnext/education/doctype/program_enrollment/program_enrollment_dashboard.py
+++ b/erpnext/education/doctype/program_enrollment/program_enrollment_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'program_enrollment',
diff --git a/erpnext/education/doctype/program_enrollment/test_program_enrollment.py b/erpnext/education/doctype/program_enrollment/test_program_enrollment.py
index 497ee28..65de38a 100644
--- a/erpnext/education/doctype/program_enrollment/test_program_enrollment.py
+++ b/erpnext/education/doctype/program_enrollment/test_program_enrollment.py
@@ -3,13 +3,13 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.education.doctype.student.test_student import create_student
-from erpnext.education.doctype.student.test_student import get_student
+import frappe
+
from erpnext.education.doctype.program.test_program import make_program_and_linked_courses
-from erpnext.education.doctype.course_activity.test_course_activity import make_course_activity
+from erpnext.education.doctype.student.test_student import create_student, get_student
+
class TestProgramEnrollment(unittest.TestCase):
diff --git a/erpnext/education/doctype/program_enrollment_course/program_enrollment_course.py b/erpnext/education/doctype/program_enrollment_course/program_enrollment_course.py
index e1f564e..5c0706d 100644
--- a/erpnext/education/doctype/program_enrollment_course/program_enrollment_course.py
+++ b/erpnext/education/doctype/program_enrollment_course/program_enrollment_course.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ProgramEnrollmentCourse(Document):
pass
diff --git a/erpnext/education/doctype/program_enrollment_fee/program_enrollment_fee.py b/erpnext/education/doctype/program_enrollment_fee/program_enrollment_fee.py
index 03a311e..53bae7c 100644
--- a/erpnext/education/doctype/program_enrollment_fee/program_enrollment_fee.py
+++ b/erpnext/education/doctype/program_enrollment_fee/program_enrollment_fee.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ProgramEnrollmentFee(Document):
pass
diff --git a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py
index 5833b67..69fa665 100644
--- a/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py
+++ b/erpnext/education/doctype/program_enrollment_tool/program_enrollment_tool.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from erpnext.education.api import enroll_student
from frappe.utils import cint
+from erpnext.education.api import enroll_student
+
+
class ProgramEnrollmentTool(Document):
def onload(self):
academic_term_reqd = cint(frappe.db.get_single_value('Education Settings', 'academic_term_reqd'))
diff --git a/erpnext/education/doctype/program_enrollment_tool/test_program_enrollment_tool.py b/erpnext/education/doctype/program_enrollment_tool/test_program_enrollment_tool.py
index f22b3b1..55734cb 100644
--- a/erpnext/education/doctype/program_enrollment_tool/test_program_enrollment_tool.py
+++ b/erpnext/education/doctype/program_enrollment_tool/test_program_enrollment_tool.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestProgramEnrollmentTool(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/program_enrollment_tool_student/program_enrollment_tool_student.py b/erpnext/education/doctype/program_enrollment_tool_student/program_enrollment_tool_student.py
index 38dc1c8..6765345 100644
--- a/erpnext/education/doctype/program_enrollment_tool_student/program_enrollment_tool_student.py
+++ b/erpnext/education/doctype/program_enrollment_tool_student/program_enrollment_tool_student.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ProgramEnrollmentToolStudent(Document):
pass
diff --git a/erpnext/education/doctype/program_fee/program_fee.py b/erpnext/education/doctype/program_fee/program_fee.py
index cadcc4e..70105ee 100644
--- a/erpnext/education/doctype/program_fee/program_fee.py
+++ b/erpnext/education/doctype/program_fee/program_fee.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ProgramFee(Document):
pass
diff --git a/erpnext/education/doctype/question/question.py b/erpnext/education/doctype/question/question.py
index fb3b504..e74aa93 100644
--- a/erpnext/education/doctype/question/question.py
+++ b/erpnext/education/doctype/question/question.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
class Question(Document):
def validate(self):
diff --git a/erpnext/education/doctype/question/test_question.py b/erpnext/education/doctype/question/test_question.py
index 552872e..1ce10c0 100644
--- a/erpnext/education/doctype/question/test_question.py
+++ b/erpnext/education/doctype/question/test_question.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestQuestion(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/quiz/quiz.py b/erpnext/education/doctype/quiz/quiz.py
index a128e1f..474bea1 100644
--- a/erpnext/education/doctype/quiz/quiz.py
+++ b/erpnext/education/doctype/quiz/quiz.py
@@ -3,11 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-import json
from frappe import _
from frappe.model.document import Document
+
class Quiz(Document):
def validate(self):
if self.passing_score > 100:
diff --git a/erpnext/education/doctype/quiz/test_quiz.py b/erpnext/education/doctype/quiz/test_quiz.py
index 344fd54..22eb23d 100644
--- a/erpnext/education/doctype/quiz/test_quiz.py
+++ b/erpnext/education/doctype/quiz/test_quiz.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestQuiz(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/quiz_activity/quiz_activity.py b/erpnext/education/doctype/quiz_activity/quiz_activity.py
index 24c7175..0fc7603 100644
--- a/erpnext/education/doctype/quiz_activity/quiz_activity.py
+++ b/erpnext/education/doctype/quiz_activity/quiz_activity.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class QuizActivity(Document):
pass
diff --git a/erpnext/education/doctype/quiz_activity/test_quiz_activity.py b/erpnext/education/doctype/quiz_activity/test_quiz_activity.py
index fb0425d..44e3a3f 100644
--- a/erpnext/education/doctype/quiz_activity/test_quiz_activity.py
+++ b/erpnext/education/doctype/quiz_activity/test_quiz_activity.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestQuizActivity(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/quiz_question/quiz_question.py b/erpnext/education/doctype/quiz_question/quiz_question.py
index 317e75b..20cb9f7 100644
--- a/erpnext/education/doctype/quiz_question/quiz_question.py
+++ b/erpnext/education/doctype/quiz_question/quiz_question.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class QuizQuestion(Document):
pass
diff --git a/erpnext/education/doctype/quiz_result/quiz_result.py b/erpnext/education/doctype/quiz_result/quiz_result.py
index a4fd9f0..059d294 100644
--- a/erpnext/education/doctype/quiz_result/quiz_result.py
+++ b/erpnext/education/doctype/quiz_result/quiz_result.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class QuizResult(Document):
pass
diff --git a/erpnext/education/doctype/quiz_result/test_quiz_result.py b/erpnext/education/doctype/quiz_result/test_quiz_result.py
index 86ee52d..08ac481 100644
--- a/erpnext/education/doctype/quiz_result/test_quiz_result.py
+++ b/erpnext/education/doctype/quiz_result/test_quiz_result.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestQuizResult(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/room/room.py b/erpnext/education/doctype/room/room.py
index f26e9c4..dc68a0d 100644
--- a/erpnext/education/doctype/room/room.py
+++ b/erpnext/education/doctype/room/room.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class Room(Document):
pass
diff --git a/erpnext/education/doctype/room/room_dashboard.py b/erpnext/education/doctype/room/room_dashboard.py
index 7bcb97f..6a43b60 100644
--- a/erpnext/education/doctype/room/room_dashboard.py
+++ b/erpnext/education/doctype/room/room_dashboard.py
@@ -1,8 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'room',
diff --git a/erpnext/education/doctype/room/test_room.py b/erpnext/education/doctype/room/test_room.py
index 33ffd91..5718d51 100644
--- a/erpnext/education/doctype/room/test_room.py
+++ b/erpnext/education/doctype/room/test_room.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Room')
diff --git a/erpnext/education/doctype/school_house/school_house.py b/erpnext/education/doctype/school_house/school_house.py
index 8751e5c..2f9c5f4 100644
--- a/erpnext/education/doctype/school_house/school_house.py
+++ b/erpnext/education/doctype/school_house/school_house.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class SchoolHouse(Document):
pass
diff --git a/erpnext/education/doctype/school_house/test_school_house.py b/erpnext/education/doctype/school_house/test_school_house.py
index 5cf96d5..b58b7d4 100644
--- a/erpnext/education/doctype/school_house/test_school_house.py
+++ b/erpnext/education/doctype/school_house/test_school_house.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestSchoolHouse(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/student/student.py b/erpnext/education/doctype/student/student.py
index 6be9e71..ae498ba 100644
--- a/erpnext/education/doctype/student/student.py
+++ b/erpnext/education/doctype/student/student.py
@@ -3,12 +3,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
-from frappe.utils import getdate,today
from frappe import _
from frappe.desk.form.linked_with import get_linked_doctypes
+from frappe.model.document import Document
+from frappe.utils import getdate, today
+
from erpnext.education.utils import check_content_completion, check_quiz_completion
+
+
class Student(Document):
def validate(self):
self.title = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name]))
diff --git a/erpnext/education/doctype/student/student_dashboard.py b/erpnext/education/doctype/student/student_dashboard.py
index d261462..efff2e6 100644
--- a/erpnext/education/doctype/student/student_dashboard.py
+++ b/erpnext/education/doctype/student/student_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'heatmap': True,
diff --git a/erpnext/education/doctype/student/test_student.py b/erpnext/education/doctype/student/test_student.py
index fcb2b5f..ec6abb5 100644
--- a/erpnext/education/doctype/student/test_student.py
+++ b/erpnext/education/doctype/student/test_student.py
@@ -2,12 +2,12 @@
# Copyright (c) 2015, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
-from frappe.test_runner import make_test_records
-from erpnext.education.doctype.program.test_program import make_program_and_linked_courses
-from erpnext.education.doctype.course.test_course import make_course
+
+import unittest
import frappe
-import unittest
+
+from erpnext.education.doctype.program.test_program import make_program_and_linked_courses
test_records = frappe.get_test_records('Student')
class TestStudent(unittest.TestCase):
diff --git a/erpnext/education/doctype/student_admission/student_admission.py b/erpnext/education/doctype/student_admission/student_admission.py
index 0febb96..67ef67b 100644
--- a/erpnext/education/doctype/student_admission/student_admission.py
+++ b/erpnext/education/doctype/student_admission/student_admission.py
@@ -3,6 +3,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import nowdate
diff --git a/erpnext/education/doctype/student_admission/test_student_admission.py b/erpnext/education/doctype/student_admission/test_student_admission.py
index 748c7ae..c9cfbca 100644
--- a/erpnext/education/doctype/student_admission/test_student_admission.py
+++ b/erpnext/education/doctype/student_admission/test_student_admission.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Student Admission')
diff --git a/erpnext/education/doctype/student_admission_program/student_admission_program.py b/erpnext/education/doctype/student_admission_program/student_admission_program.py
index 406027c..2377d26 100644
--- a/erpnext/education/doctype/student_admission_program/student_admission_program.py
+++ b/erpnext/education/doctype/student_admission_program/student_admission_program.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class StudentAdmissionProgram(Document):
pass
diff --git a/erpnext/education/doctype/student_applicant/student_applicant.py b/erpnext/education/doctype/student_applicant/student_applicant.py
index 193b6d3..36a0757 100644
--- a/erpnext/education/doctype/student_applicant/student_applicant.py
+++ b/erpnext/education/doctype/student_applicant/student_applicant.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import print_function, unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import getdate, add_years, nowdate, date_diff
+from frappe.utils import add_years, date_diff, getdate, nowdate
+
class StudentApplicant(Document):
def autoname(self):
diff --git a/erpnext/education/doctype/student_applicant/test_student_applicant.py b/erpnext/education/doctype/student_applicant/test_student_applicant.py
index 9734a88..b7258a4 100644
--- a/erpnext/education/doctype/student_applicant/test_student_applicant.py
+++ b/erpnext/education/doctype/student_applicant/test_student_applicant.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Student Applicant')
diff --git a/erpnext/education/doctype/student_attendance/student_attendance.py b/erpnext/education/doctype/student_attendance/student_attendance.py
index 2e9e6cf..3826afb 100644
--- a/erpnext/education/doctype/student_attendance/student_attendance.py
+++ b/erpnext/education/doctype/student_attendance/student_attendance.py
@@ -3,14 +3,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
-from frappe.utils import get_link_to_form, getdate, formatdate
+from frappe.model.document import Document
+from frappe.utils import formatdate, get_link_to_form, getdate
+
from erpnext import get_default_company
from erpnext.education.api import get_student_group_students
from erpnext.hr.doctype.holiday_list.holiday_list import is_holiday
+
class StudentAttendance(Document):
def validate(self):
self.validate_mandatory()
diff --git a/erpnext/education/doctype/student_attendance/student_attendance_dashboard.py b/erpnext/education/doctype/student_attendance/student_attendance_dashboard.py
index e405b8a..489f64d 100644
--- a/erpnext/education/doctype/student_attendance/student_attendance_dashboard.py
+++ b/erpnext/education/doctype/student_attendance/student_attendance_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'reports': [
diff --git a/erpnext/education/doctype/student_attendance/test_student_attendance.py b/erpnext/education/doctype/student_attendance/test_student_attendance.py
index 9f41538..d453aed 100644
--- a/erpnext/education/doctype/student_attendance/test_student_attendance.py
+++ b/erpnext/education/doctype/student_attendance/test_student_attendance.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Student Attendance')
diff --git a/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.py b/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.py
index 972973f..96767de 100644
--- a/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.py
+++ b/erpnext/education/doctype/student_attendance_tool/student_attendance_tool.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class StudentAttendanceTool(Document):
pass
diff --git a/erpnext/education/doctype/student_attendance_tool/test_student_attendance_tool.py b/erpnext/education/doctype/student_attendance_tool/test_student_attendance_tool.py
index ffc42af..a94a3f2 100644
--- a/erpnext/education/doctype/student_attendance_tool/test_student_attendance_tool.py
+++ b/erpnext/education/doctype/student_attendance_tool/test_student_attendance_tool.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestStudentAttendanceTool(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/student_batch_name/student_batch_name.py b/erpnext/education/doctype/student_batch_name/student_batch_name.py
index e6d38ea..ce50716 100644
--- a/erpnext/education/doctype/student_batch_name/student_batch_name.py
+++ b/erpnext/education/doctype/student_batch_name/student_batch_name.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class StudentBatchName(Document):
pass
diff --git a/erpnext/education/doctype/student_batch_name/test_student_batch_name.py b/erpnext/education/doctype/student_batch_name/test_student_batch_name.py
index 09534f3..75ebeb2 100644
--- a/erpnext/education/doctype/student_batch_name/test_student_batch_name.py
+++ b/erpnext/education/doctype/student_batch_name/test_student_batch_name.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Student Batch Name')
diff --git a/erpnext/education/doctype/student_category/student_category.py b/erpnext/education/doctype/student_category/student_category.py
index bd3a835..bb362d5 100644
--- a/erpnext/education/doctype/student_category/student_category.py
+++ b/erpnext/education/doctype/student_category/student_category.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class StudentCategory(Document):
pass
diff --git a/erpnext/education/doctype/student_category/student_category_dashboard.py b/erpnext/education/doctype/student_category/student_category_dashboard.py
index f31c34b..9238623 100644
--- a/erpnext/education/doctype/student_category/student_category_dashboard.py
+++ b/erpnext/education/doctype/student_category/student_category_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'student_category',
diff --git a/erpnext/education/doctype/student_category/test_student_category.py b/erpnext/education/doctype/student_category/test_student_category.py
index 756cab8..0893769 100644
--- a/erpnext/education/doctype/student_category/test_student_category.py
+++ b/erpnext/education/doctype/student_category/test_student_category.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Student Category')
diff --git a/erpnext/education/doctype/student_group/student_group.py b/erpnext/education/doctype/student_group/student_group.py
index 3d4572a..2347d31 100644
--- a/erpnext/education/doctype/student_group/student_group.py
+++ b/erpnext/education/doctype/student_group/student_group.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
-from erpnext.education.utils import validate_duplicate_student
+from frappe.model.document import Document
from frappe.utils import cint
+from erpnext.education.utils import validate_duplicate_student
+
+
class StudentGroup(Document):
def validate(self):
self.validate_mandatory_fields()
diff --git a/erpnext/education/doctype/student_group/student_group_dashboard.py b/erpnext/education/doctype/student_group/student_group_dashboard.py
index d37445f..36329bd 100644
--- a/erpnext/education/doctype/student_group/student_group_dashboard.py
+++ b/erpnext/education/doctype/student_group/student_group_dashboard.py
@@ -1,8 +1,10 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'student_group',
diff --git a/erpnext/education/doctype/student_group/test_student_group.py b/erpnext/education/doctype/student_group/test_student_group.py
index 8b9b47d..0602251 100644
--- a/erpnext/education/doctype/student_group/test_student_group.py
+++ b/erpnext/education/doctype/student_group/test_student_group.py
@@ -3,10 +3,13 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
+
import erpnext.education
+
def get_random_group():
doc = frappe.get_doc({
"doctype": "Student Group",
diff --git a/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.py b/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.py
index 28ff7d6..2007f8a 100644
--- a/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.py
+++ b/erpnext/education/doctype/student_group_creation_tool/student_group_creation_tool.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
from erpnext.education.doctype.student_group.student_group import get_students
+
class StudentGroupCreationTool(Document):
@frappe.whitelist()
def get_courses(self):
diff --git a/erpnext/education/doctype/student_group_creation_tool/test_student_group_creation_tool.py b/erpnext/education/doctype/student_group_creation_tool/test_student_group_creation_tool.py
index 9ca5658..432da09 100644
--- a/erpnext/education/doctype/student_group_creation_tool/test_student_group_creation_tool.py
+++ b/erpnext/education/doctype/student_group_creation_tool/test_student_group_creation_tool.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestStudentGroupCreationTool(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/student_group_creation_tool_course/student_group_creation_tool_course.py b/erpnext/education/doctype/student_group_creation_tool_course/student_group_creation_tool_course.py
index b3411ea..b9d1e0d 100644
--- a/erpnext/education/doctype/student_group_creation_tool_course/student_group_creation_tool_course.py
+++ b/erpnext/education/doctype/student_group_creation_tool_course/student_group_creation_tool_course.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class StudentGroupCreationToolCourse(Document):
pass
diff --git a/erpnext/education/doctype/student_group_instructor/student_group_instructor.py b/erpnext/education/doctype/student_group_instructor/student_group_instructor.py
index b6cc588..81a7ed2 100644
--- a/erpnext/education/doctype/student_group_instructor/student_group_instructor.py
+++ b/erpnext/education/doctype/student_group_instructor/student_group_instructor.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class StudentGroupInstructor(Document):
pass
diff --git a/erpnext/education/doctype/student_group_student/student_group_student.py b/erpnext/education/doctype/student_group_student/student_group_student.py
index 1fe4ea1..7ee4cae 100644
--- a/erpnext/education/doctype/student_group_student/student_group_student.py
+++ b/erpnext/education/doctype/student_group_student/student_group_student.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class StudentGroupStudent(Document):
pass
diff --git a/erpnext/education/doctype/student_guardian/student_guardian.py b/erpnext/education/doctype/student_guardian/student_guardian.py
index 04445bc..56d7df7 100644
--- a/erpnext/education/doctype/student_guardian/student_guardian.py
+++ b/erpnext/education/doctype/student_guardian/student_guardian.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class StudentGuardian(Document):
pass
diff --git a/erpnext/education/doctype/student_language/student_language.py b/erpnext/education/doctype/student_language/student_language.py
index be6d5de..6ec0b1f 100644
--- a/erpnext/education/doctype/student_language/student_language.py
+++ b/erpnext/education/doctype/student_language/student_language.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class StudentLanguage(Document):
pass
diff --git a/erpnext/education/doctype/student_language/test_student_language.py b/erpnext/education/doctype/student_language/test_student_language.py
index 592b94a..1d7c003 100644
--- a/erpnext/education/doctype/student_language/test_student_language.py
+++ b/erpnext/education/doctype/student_language/test_student_language.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Student Language')
diff --git a/erpnext/education/doctype/student_leave_application/student_leave_application.py b/erpnext/education/doctype/student_leave_application/student_leave_application.py
index ef67012..50c14aa 100644
--- a/erpnext/education/doctype/student_leave_application/student_leave_application.py
+++ b/erpnext/education/doctype/student_leave_application/student_leave_application.py
@@ -3,13 +3,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+from datetime import timedelta
+
import frappe
from frappe import _
-from datetime import timedelta
-from frappe.utils import get_link_to_form, getdate, date_diff, flt
-from erpnext.hr.doctype.holiday_list.holiday_list import is_holiday
-from erpnext.education.doctype.student_attendance.student_attendance import get_holiday_list
from frappe.model.document import Document
+from frappe.utils import date_diff, flt, get_link_to_form, getdate
+
+from erpnext.education.doctype.student_attendance.student_attendance import get_holiday_list
+from erpnext.hr.doctype.holiday_list.holiday_list import is_holiday
+
class StudentLeaveApplication(Document):
def validate(self):
diff --git a/erpnext/education/doctype/student_leave_application/student_leave_application_dashboard.py b/erpnext/education/doctype/student_leave_application/student_leave_application_dashboard.py
index 0ff6d1a..2674f54 100644
--- a/erpnext/education/doctype/student_leave_application/student_leave_application_dashboard.py
+++ b/erpnext/education/doctype/student_leave_application/student_leave_application_dashboard.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_data():
return {
'fieldname': 'leave_application',
diff --git a/erpnext/education/doctype/student_leave_application/test_student_leave_application.py b/erpnext/education/doctype/student_leave_application/test_student_leave_application.py
index 9cae257..506dc73 100644
--- a/erpnext/education/doctype/student_leave_application/test_student_leave_application.py
+++ b/erpnext/education/doctype/student_leave_application/test_student_leave_application.py
@@ -3,12 +3,15 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import getdate, add_days, add_months
+
+import frappe
+from frappe.utils import add_days, add_months, getdate
+
from erpnext import get_default_company
-from erpnext.education.doctype.student_group.test_student_group import get_random_group
from erpnext.education.doctype.student.test_student import create_student
+from erpnext.education.doctype.student_group.test_student_group import get_random_group
+
class TestStudentLeaveApplication(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/education/doctype/student_log/student_log.py b/erpnext/education/doctype/student_log/student_log.py
index 8b12886..2ca49ca 100644
--- a/erpnext/education/doctype/student_log/student_log.py
+++ b/erpnext/education/doctype/student_log/student_log.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class StudentLog(Document):
pass
diff --git a/erpnext/education/doctype/student_log/test_student_log.py b/erpnext/education/doctype/student_log/test_student_log.py
index 1fe191f..533191f 100644
--- a/erpnext/education/doctype/student_log/test_student_log.py
+++ b/erpnext/education/doctype/student_log/test_student_log.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Student Log')
diff --git a/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.py b/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.py
index 17bc367..1cf7921 100644
--- a/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.py
+++ b/erpnext/education/doctype/student_report_generation_tool/student_report_generation_tool.py
@@ -3,13 +3,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json
+
+import json
+
+import frappe
from frappe import _
from frappe.model.document import Document
-from erpnext.education.api import get_grade
from frappe.utils.pdf import get_pdf
-from erpnext.education.report.course_wise_assessment_report.course_wise_assessment_report import get_formatted_result
-from erpnext.education.report.course_wise_assessment_report.course_wise_assessment_report import get_child_assessment_groups
+
+from erpnext.education.report.course_wise_assessment_report.course_wise_assessment_report import (
+ get_child_assessment_groups,
+ get_formatted_result,
+)
class StudentReportGenerationTool(Document):
diff --git a/erpnext/education/doctype/student_report_generation_tool/test_student_report_generation_tool.py b/erpnext/education/doctype/student_report_generation_tool/test_student_report_generation_tool.py
index 4178166..f622713 100644
--- a/erpnext/education/doctype/student_report_generation_tool/test_student_report_generation_tool.py
+++ b/erpnext/education/doctype/student_report_generation_tool/test_student_report_generation_tool.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestStudentReportGenerationTool(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/student_sibling/student_sibling.py b/erpnext/education/doctype/student_sibling/student_sibling.py
index 4adc3f3..b36cf59 100644
--- a/erpnext/education/doctype/student_sibling/student_sibling.py
+++ b/erpnext/education/doctype/student_sibling/student_sibling.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class StudentSibling(Document):
pass
diff --git a/erpnext/education/doctype/student_siblings/student_siblings.py b/erpnext/education/doctype/student_siblings/student_siblings.py
index 4e20d84..412cf05 100644
--- a/erpnext/education/doctype/student_siblings/student_siblings.py
+++ b/erpnext/education/doctype/student_siblings/student_siblings.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class StudentSiblings(Document):
pass
diff --git a/erpnext/education/doctype/topic/test_topic.py b/erpnext/education/doctype/topic/test_topic.py
index d03db1c..b6c6c75 100644
--- a/erpnext/education/doctype/topic/test_topic.py
+++ b/erpnext/education/doctype/topic/test_topic.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestTopic(unittest.TestCase):
def setUp(self):
make_topic_and_linked_content("_Test Topic 1", [{"type":"Article", "name": "_Test Article 1"}])
diff --git a/erpnext/education/doctype/topic/topic.py b/erpnext/education/doctype/topic/topic.py
index fb680d7..1834b2e 100644
--- a/erpnext/education/doctype/topic/topic.py
+++ b/erpnext/education/doctype/topic/topic.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
+
+import frappe
from frappe import _
from frappe.model.document import Document
+
class Topic(Document):
def get_contents(self):
try:
diff --git a/erpnext/education/doctype/topic_content/test_topic_content.py b/erpnext/education/doctype/topic_content/test_topic_content.py
index cf304f6..6fdcbda 100644
--- a/erpnext/education/doctype/topic_content/test_topic_content.py
+++ b/erpnext/education/doctype/topic_content/test_topic_content.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestTopicContent(unittest.TestCase):
pass
diff --git a/erpnext/education/doctype/topic_content/topic_content.py b/erpnext/education/doctype/topic_content/topic_content.py
index 9b2c90b..9339bbd 100644
--- a/erpnext/education/doctype/topic_content/topic_content.py
+++ b/erpnext/education/doctype/topic_content/topic_content.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class TopicContent(Document):
pass
diff --git a/erpnext/education/report/absent_student_report/absent_student_report.py b/erpnext/education/report/absent_student_report/absent_student_report.py
index c3487cc..d5b6675 100644
--- a/erpnext/education/report/absent_student_report/absent_student_report.py
+++ b/erpnext/education/report/absent_student_report/absent_student_report.py
@@ -2,12 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+from frappe import _, msgprint
from frappe.utils import formatdate
-from frappe import msgprint, _
+
from erpnext.education.doctype.student_attendance.student_attendance import get_holiday_list
from erpnext.hr.doctype.holiday_list.holiday_list import is_holiday
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/education/report/assessment_plan_status/assessment_plan_status.py b/erpnext/education/report/assessment_plan_status/assessment_plan_status.py
index 21184a6..64ceb42 100644
--- a/erpnext/education/report/assessment_plan_status/assessment_plan_status.py
+++ b/erpnext/education/report/assessment_plan_status/assessment_plan_status.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+from itertools import groupby
+
import frappe
from frappe import _
-from itertools import groupby
from frappe.utils import cint
DOCSTATUS = {
diff --git a/erpnext/education/report/course_wise_assessment_report/course_wise_assessment_report.py b/erpnext/education/report/course_wise_assessment_report/course_wise_assessment_report.py
index 1043e5b..ad07ee1 100644
--- a/erpnext/education/report/course_wise_assessment_report/course_wise_assessment_report.py
+++ b/erpnext/education/report/course_wise_assessment_report/course_wise_assessment_report.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+from collections import OrderedDict, defaultdict
+
import frappe
from frappe import _
-from frappe.utils import flt
-from collections import defaultdict, OrderedDict
+
from erpnext.education.api import get_grade
diff --git a/erpnext/education/report/final_assessment_grades/final_assessment_grades.py b/erpnext/education/report/final_assessment_grades/final_assessment_grades.py
index e6e0ba2..ae7f34b 100644
--- a/erpnext/education/report/final_assessment_grades/final_assessment_grades.py
+++ b/erpnext/education/report/final_assessment_grades/final_assessment_grades.py
@@ -2,12 +2,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe import _
+
from collections import defaultdict
-from erpnext.education.report.course_wise_assessment_report.course_wise_assessment_report import get_formatted_result
-from erpnext.education.report.course_wise_assessment_report.course_wise_assessment_report import get_chart_data
+import frappe
+from frappe import _
+
+from erpnext.education.report.course_wise_assessment_report.course_wise_assessment_report import (
+ get_chart_data,
+ get_formatted_result,
+)
def execute(filters=None):
diff --git a/erpnext/education/report/program_wise_fee_collection/program_wise_fee_collection.py b/erpnext/education/report/program_wise_fee_collection/program_wise_fee_collection.py
index c0ec035..1717ed5 100644
--- a/erpnext/education/report/program_wise_fee_collection/program_wise_fee_collection.py
+++ b/erpnext/education/report/program_wise_fee_collection/program_wise_fee_collection.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
if not filters:
filters = {}
diff --git a/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py b/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py
index 5bebd43..a21a936 100644
--- a/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py
+++ b/erpnext/education/report/student_and_guardian_contact_details/student_and_guardian_contact_details.py
@@ -2,6 +2,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
diff --git a/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.py b/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.py
index e2576a0..b65350f 100644
--- a/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.py
+++ b/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.py
@@ -2,12 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+from frappe import _, msgprint
from frappe.utils import formatdate
-from frappe import msgprint, _
+
from erpnext.education.doctype.student_attendance.student_attendance import get_holiday_list
from erpnext.hr.doctype.holiday_list.holiday_list import is_holiday
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/education/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py b/erpnext/education/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py
index 04dc8c0..f6d9c5a 100644
--- a/erpnext/education/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py
+++ b/erpnext/education/report/student_monthly_attendance_sheet/student_monthly_attendance_sheet.py
@@ -2,14 +2,16 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import cstr, cint, getdate, get_first_day, get_last_day, date_diff, add_days
-from frappe import msgprint, _
-from calendar import monthrange
+from frappe import _
+from frappe.utils import add_days, cstr, date_diff, get_first_day, get_last_day, getdate
+
from erpnext.education.api import get_student_group_students
from erpnext.education.doctype.student_attendance.student_attendance import get_holiday_list
from erpnext.support.doctype.issue.issue import get_holidays
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/education/utils.py b/erpnext/education/utils.py
index 3070e6a..33394e1 100644
--- a/erpnext/education/utils.py
+++ b/erpnext/education/utils.py
@@ -1,10 +1,12 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and contributors
-from __future__ import unicode_literals, division
+from __future__ import division, unicode_literals
+
import frappe
from frappe import _
+
class OverlapError(frappe.ValidationError): pass
def validate_overlap_for(doc, doctype, fieldname, value=None):
@@ -219,7 +221,7 @@
try:
quiz = frappe.get_doc("Quiz", quiz_name)
questions = quiz.get_questions()
- except:
+ except Exception:
frappe.throw(_("Quiz {0} does not exist").format(quiz_name), frappe.DoesNotExistError)
return None
diff --git a/erpnext/education/web_form/student_applicant/student_applicant.py b/erpnext/education/web_form/student_applicant/student_applicant.py
index 2334f8b..f57de91 100644
--- a/erpnext/education/web_form/student_applicant/student_applicant.py
+++ b/erpnext/education/web_form/student_applicant/student_applicant.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals
-import frappe
def get_context(context):
# do your magic here
diff --git a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
index a505ee0..192ec14 100644
--- a/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
+++ b/erpnext/erpnext_integrations/connectors/woocommerce_connection.py
@@ -1,8 +1,15 @@
from __future__ import unicode_literals
-import frappe, base64, hashlib, hmac, json
-from frappe.utils import cstr
+
+import base64
+import hashlib
+import hmac
+import json
+
+import frappe
from frappe import _
+from frappe.utils import cstr
+
def verify_request():
woocommerce_settings = frappe.get_doc("Woocommerce Settings")
diff --git a/erpnext/erpnext_integrations/data_migration_mapping/issue_to_task/__init__.py b/erpnext/erpnext_integrations/data_migration_mapping/issue_to_task/__init__.py
index aeb5352..5a4a57c 100644
--- a/erpnext/erpnext_integrations/data_migration_mapping/issue_to_task/__init__.py
+++ b/erpnext/erpnext_integrations/data_migration_mapping/issue_to_task/__init__.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def pre_process(issue):
project = frappe.db.get_value('Project', filters={'project_name': issue.milestone})
diff --git a/erpnext/erpnext_integrations/data_migration_mapping/milestone_to_project/__init__.py b/erpnext/erpnext_integrations/data_migration_mapping/milestone_to_project/__init__.py
index 9d3f02e..bab8031 100644
--- a/erpnext/erpnext_integrations/data_migration_mapping/milestone_to_project/__init__.py
+++ b/erpnext/erpnext_integrations/data_migration_mapping/milestone_to_project/__init__.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def pre_process(milestone):
return {
'title': milestone.title,
diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py
index 148c1a6..a757a43 100644
--- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py
+++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py
@@ -3,10 +3,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, time, dateutil, math, csv
-from six import StringIO
-import erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_mws_api as mws
+
+import csv
+import math
+import time
+
+import dateutil
+import frappe
from frappe import _
+from six import StringIO
+
+import erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_mws_api as mws
+
#Get and Create Products
def get_products_details():
diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py
index 7fd3b34..652fa92 100755
--- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py
+++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_api.py
@@ -6,24 +6,24 @@
# Extended to include finances object
from __future__ import unicode_literals
-import urllib
-from urllib.parse import quote
+import base64
import hashlib
import hmac
-import base64
-import six
-from erpnext.erpnext_integrations.doctype.amazon_mws_settings import xml_utils
import re
+from urllib.parse import quote
+
+from erpnext.erpnext_integrations.doctype.amazon_mws_settings import xml_utils
+
try:
from xml.etree.ElementTree import ParseError as XMLError
except ImportError:
from xml.parsers.expat import ExpatError as XMLError
-from time import strftime, gmtime
+
+from time import gmtime, strftime
from requests import request
from requests.exceptions import HTTPError
-
__all__ = [
'Feeds',
'Inventory',
diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py
index 9c59840..ac59eb7 100644
--- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py
+++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_mws_settings.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.model.document import Document
+
import dateutil
+import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+from frappe.model.document import Document
+
from erpnext.erpnext_integrations.doctype.amazon_mws_settings.amazon_methods import get_orders
+
class AmazonMWSSettings(Document):
def validate(self):
if self.enable_amazon == 1:
diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/test_amazon_mws_settings.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/test_amazon_mws_settings.py
index 7b40014..844df59 100644
--- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/test_amazon_mws_settings.py
+++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/test_amazon_mws_settings.py
@@ -5,5 +5,6 @@
import unittest
+
class TestAmazonMWSSettings(unittest.TestCase):
pass
diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/xml_utils.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/xml_utils.py
index 99ede8f..88ef64d 100644
--- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/xml_utils.py
+++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/xml_utils.py
@@ -8,8 +8,8 @@
"""
from __future__ import unicode_literals
-import xml.etree.ElementTree as ET
import re
+import xml.etree.ElementTree as ET
class object_dict(dict):
@@ -88,7 +88,7 @@
ns = http://cs.sfsu.edu/csc867/myscheduler
name = patients
"""
- result = re.compile("\{(.*)\}(.*)").search(tag)
+ result = re.compile(r"\{(.*)\}(.*)").search(tag)
if result:
value.namespace, tag = result.groups()
diff --git a/erpnext/erpnext_integrations/doctype/exotel_settings/exotel_settings.py b/erpnext/erpnext_integrations/doctype/exotel_settings/exotel_settings.py
index bff928c..f1314fc 100644
--- a/erpnext/erpnext_integrations/doctype/exotel_settings/exotel_settings.py
+++ b/erpnext/erpnext_integrations/doctype/exotel_settings/exotel_settings.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe.model.document import Document
-import requests
+
import frappe
+import requests
from frappe import _
+from frappe.model.document import Document
+
class ExotelSettings(Document):
def validate(self):
diff --git a/erpnext/erpnext_integrations/doctype/gocardless_mandate/gocardless_mandate.py b/erpnext/erpnext_integrations/doctype/gocardless_mandate/gocardless_mandate.py
index 9c9df65..b416ce8 100644
--- a/erpnext/erpnext_integrations/doctype/gocardless_mandate/gocardless_mandate.py
+++ b/erpnext/erpnext_integrations/doctype/gocardless_mandate/gocardless_mandate.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class GoCardlessMandate(Document):
pass
diff --git a/erpnext/erpnext_integrations/doctype/gocardless_mandate/test_gocardless_mandate.py b/erpnext/erpnext_integrations/doctype/gocardless_mandate/test_gocardless_mandate.py
index d77a352..1b76ee5 100644
--- a/erpnext/erpnext_integrations/doctype/gocardless_mandate/test_gocardless_mandate.py
+++ b/erpnext/erpnext_integrations/doctype/gocardless_mandate/test_gocardless_mandate.py
@@ -5,5 +5,6 @@
import unittest
+
class TestGoCardlessMandate(unittest.TestCase):
pass
diff --git a/erpnext/erpnext_integrations/doctype/gocardless_settings/__init__.py b/erpnext/erpnext_integrations/doctype/gocardless_settings/__init__.py
index 25784a5..d003edb 100644
--- a/erpnext/erpnext_integrations/doctype/gocardless_settings/__init__.py
+++ b/erpnext/erpnext_integrations/doctype/gocardless_settings/__init__.py
@@ -3,10 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-import json
-import hmac
+
import hashlib
+import hmac
+import json
+
+import frappe
+
@frappe.whitelist(allow_guest=True)
def webhooks():
diff --git a/erpnext/erpnext_integrations/doctype/gocardless_settings/gocardless_settings.py b/erpnext/erpnext_integrations/doctype/gocardless_settings/gocardless_settings.py
index c65e3ce..6484973 100644
--- a/erpnext/erpnext_integrations/doctype/gocardless_settings/gocardless_settings.py
+++ b/erpnext/erpnext_integrations/doctype/gocardless_settings/gocardless_settings.py
@@ -3,13 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
import gocardless_pro
from frappe import _
+from frappe.integrations.utils import create_payment_gateway, create_request_log
+from frappe.model.document import Document
+from frappe.utils import call_hook_method, cint, flt, get_url
from six.moves.urllib.parse import urlencode
-from frappe.utils import get_url, call_hook_method, flt, cint
-from frappe.integrations.utils import create_request_log, create_payment_gateway
+
class GoCardlessSettings(Document):
supported_currencies = ["EUR", "DKK", "GBP", "SEK"]
diff --git a/erpnext/erpnext_integrations/doctype/gocardless_settings/test_gocardless_settings.py b/erpnext/erpnext_integrations/doctype/gocardless_settings/test_gocardless_settings.py
index e377f34..b17aef5 100644
--- a/erpnext/erpnext_integrations/doctype/gocardless_settings/test_gocardless_settings.py
+++ b/erpnext/erpnext_integrations/doctype/gocardless_settings/test_gocardless_settings.py
@@ -5,5 +5,6 @@
import unittest
+
class TestGoCardlessSettings(unittest.TestCase):
pass
diff --git a/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_connector.py b/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_connector.py
index d1adeee..6d46a1c 100644
--- a/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_connector.py
+++ b/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_connector.py
@@ -1,7 +1,9 @@
import base64
+import datetime
+
import requests
from requests.auth import HTTPBasicAuth
-import datetime
+
class MpesaConnector():
def __init__(self, env="sandbox", app_key=None, app_secret=None, sandbox_url="https://sandbox.safaricom.co.ke",
diff --git a/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_custom_fields.py b/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_custom_fields.py
index 139e2fb..368139b 100644
--- a/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_custom_fields.py
+++ b/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_custom_fields.py
@@ -1,6 +1,7 @@
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+
def create_custom_pos_fields():
"""Create custom fields corresponding to POS Settings and POS Invoice."""
pos_field = {
diff --git a/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_settings.py b/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_settings.py
index de93357..4ce85e5 100644
--- a/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_settings.py
+++ b/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_settings.py
@@ -4,17 +4,21 @@
from __future__ import unicode_literals
-from json import loads, dumps
+
+from json import dumps, loads
import frappe
-from frappe.model.document import Document
from frappe import _
-from frappe.utils import call_hook_method, fmt_money
-from frappe.integrations.utils import create_request_log, create_payment_gateway
-from frappe.utils import get_request_site_address
-from erpnext.erpnext_integrations.utils import create_mode_of_payment
+from frappe.integrations.utils import create_payment_gateway, create_request_log
+from frappe.model.document import Document
+from frappe.utils import call_hook_method, fmt_money, get_request_site_address
+
from erpnext.erpnext_integrations.doctype.mpesa_settings.mpesa_connector import MpesaConnector
-from erpnext.erpnext_integrations.doctype.mpesa_settings.mpesa_custom_fields import create_custom_pos_fields
+from erpnext.erpnext_integrations.doctype.mpesa_settings.mpesa_custom_fields import (
+ create_custom_pos_fields,
+)
+from erpnext.erpnext_integrations.utils import create_mode_of_payment
+
class MpesaSettings(Document):
supported_currencies = ["KES"]
@@ -39,7 +43,9 @@
for i, amount in enumerate(request_amounts):
args.request_amount = amount
if frappe.flags.in_test:
- from erpnext.erpnext_integrations.doctype.mpesa_settings.test_mpesa_settings import get_payment_request_response_payload
+ from erpnext.erpnext_integrations.doctype.mpesa_settings.test_mpesa_settings import (
+ get_payment_request_response_payload,
+ )
response = frappe._dict(get_payment_request_response_payload(amount))
else:
response = frappe._dict(generate_stk_push(**args))
@@ -71,7 +77,9 @@
)
if frappe.flags.in_test:
- from erpnext.erpnext_integrations.doctype.mpesa_settings.test_mpesa_settings import get_test_account_balance_response
+ from erpnext.erpnext_integrations.doctype.mpesa_settings.test_mpesa_settings import (
+ get_test_account_balance_response,
+ )
response = frappe._dict(get_test_account_balance_response())
else:
response = frappe._dict(get_account_balance(payload))
diff --git a/erpnext/erpnext_integrations/doctype/mpesa_settings/test_mpesa_settings.py b/erpnext/erpnext_integrations/doctype/mpesa_settings/test_mpesa_settings.py
index d4cb6b9..de81b82 100644
--- a/erpnext/erpnext_integrations/doctype/mpesa_settings/test_mpesa_settings.py
+++ b/erpnext/erpnext_integrations/doctype/mpesa_settings/test_mpesa_settings.py
@@ -2,13 +2,20 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
-from json import dumps
-import frappe
+
import unittest
-from erpnext.erpnext_integrations.doctype.mpesa_settings.mpesa_settings import process_balance_info, verify_transaction
+from json import dumps
+
+import frappe
+
from erpnext.accounts.doctype.pos_invoice.test_pos_invoice import create_pos_invoice
+from erpnext.erpnext_integrations.doctype.mpesa_settings.mpesa_settings import (
+ process_balance_info,
+ verify_transaction,
+)
from erpnext.erpnext_integrations.utils import create_mode_of_payment
+
class TestMpesaSettings(unittest.TestCase):
def setUp(self):
# create payment gateway in setup
diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_connector.py b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_connector.py
index 73f5927..d4cf56a 100644
--- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_connector.py
+++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_connector.py
@@ -2,12 +2,11 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
+import frappe
import plaid
import requests
-from plaid.errors import APIError, ItemError, InvalidRequestError
-
-import frappe
from frappe import _
+from plaid.errors import APIError, InvalidRequestError, ItemError
class PlaidConnector():
diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py
index eddcb34..d2748c2 100644
--- a/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py
+++ b/erpnext/erpnext_integrations/doctype/plaid_settings/plaid_settings.py
@@ -5,15 +5,16 @@
import json
import frappe
-from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account
-from erpnext.erpnext_integrations.doctype.plaid_settings.plaid_connector import PlaidConnector
from frappe import _
from frappe.desk.doctype.tag.tag import add_tag
from frappe.model.document import Document
from frappe.utils import add_months, formatdate, getdate, today
-
from plaid.errors import ItemError
+from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account
+from erpnext.erpnext_integrations.doctype.plaid_settings.plaid_connector import PlaidConnector
+
+
class PlaidSettings(Document):
@staticmethod
@frappe.whitelist()
diff --git a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py
index e2243ea..32b5b8f 100644
--- a/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py
+++ b/erpnext/erpnext_integrations/doctype/plaid_settings/test_plaid_settings.py
@@ -6,11 +6,16 @@
import unittest
import frappe
+from frappe.utils.response import json_handler
+
from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account
from erpnext.erpnext_integrations.doctype.plaid_settings.plaid_settings import (
- add_account_subtype, add_account_type, add_bank_accounts,
- new_bank_transaction, get_plaid_configuration)
-from frappe.utils.response import json_handler
+ add_account_subtype,
+ add_account_type,
+ add_bank_accounts,
+ get_plaid_configuration,
+ new_bank_transaction,
+)
class TestPlaidSettings(unittest.TestCase):
diff --git a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py
index 866ea66..39b9bb2 100644
--- a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py
+++ b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py
@@ -3,15 +3,19 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+import json
+import traceback
+
import frappe
+import requests
from frappe import _
from frappe.model.document import Document
from requests_oauthlib import OAuth2Session
-import json
-import requests
-import traceback
+
from erpnext import encode_company_abbr
+
# QuickBooks requires a redirect URL, User will be redirect to this URL
# This will be a GET request
# Request parameters will have two parameters `code` and `realmId`
@@ -253,8 +257,9 @@
try:
# Assumes that exactly one fiscal year has been created so far
# Creates fiscal years till oldest ledger entry date is covered
- from frappe.utils.data import add_years, getdate
from itertools import chain
+
+ from frappe.utils.data import add_years, getdate
smallest_ledger_entry_date = getdate(min(entry["date"] for entry in chain(*self.gl_entries.values()) if entry["date"]))
oldest_fiscal_year = frappe.get_all("Fiscal Year",
fields=["year_start_date", "year_end_date"],
diff --git a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/test_quickbooks_migrator.py b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/test_quickbooks_migrator.py
index 6ce7c92..5604b40 100644
--- a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/test_quickbooks_migrator.py
+++ b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/test_quickbooks_migrator.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestQuickBooksMigrator(unittest.TestCase):
pass
diff --git a/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py b/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py
index 907a223..e1e7f62 100644
--- a/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py
+++ b/erpnext/erpnext_integrations/doctype/tally_migration/tally_migration.py
@@ -11,19 +11,19 @@
import zipfile
from decimal import Decimal
-from bs4 import BeautifulSoup as bs
-
import frappe
-from erpnext import encode_company_abbr
-from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import create_charts
-from erpnext.accounts.doctype.chart_of_accounts_importer.chart_of_accounts_importer import unset_existing_data
-
+from bs4 import BeautifulSoup as bs
from frappe import _
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
from frappe.model.document import Document
-from frappe.model.naming import getseries, revert_series_if_last
from frappe.utils.data import format_datetime
+from erpnext import encode_company_abbr
+from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import create_charts
+from erpnext.accounts.doctype.chart_of_accounts_importer.chart_of_accounts_importer import (
+ unset_existing_data,
+)
+
PRIMARY_ACCOUNT = "Primary"
VOUCHER_CHUNK_SIZE = 500
@@ -266,7 +266,7 @@
self.is_master_data_processed = 1
- except:
+ except Exception:
self.publish("Process Master Data", _("Process Failed"), -1, 5)
self.log()
@@ -302,14 +302,14 @@
try:
party_doc = frappe.get_doc(party)
party_doc.insert()
- except:
+ except Exception:
self.log(party_doc)
addresses_file = frappe.get_doc("File", {"file_url": addresses_file_url})
for address in json.loads(addresses_file.get_content()):
try:
address_doc = frappe.get_doc(address)
address_doc.insert(ignore_mandatory=True)
- except:
+ except Exception:
self.log(address_doc)
def create_items_uoms(items_file_url, uoms_file_url):
@@ -319,7 +319,7 @@
try:
uom_doc = frappe.get_doc(uom)
uom_doc.insert()
- except:
+ except Exception:
self.log(uom_doc)
items_file = frappe.get_doc("File", {"file_url": items_file_url})
@@ -327,7 +327,7 @@
try:
item_doc = frappe.get_doc(item)
item_doc.insert()
- except:
+ except Exception:
self.log(item_doc)
try:
@@ -346,7 +346,7 @@
self.is_master_data_imported = 1
frappe.db.commit()
- except:
+ except Exception:
self.publish("Import Master Data", _("Process Failed"), -1, 5)
frappe.db.rollback()
self.log()
@@ -370,7 +370,7 @@
if processed_voucher:
vouchers.append(processed_voucher)
frappe.db.commit()
- except:
+ except Exception:
frappe.db.rollback()
self.log(voucher)
return vouchers
@@ -494,7 +494,7 @@
self.is_day_book_data_processed = 1
- except:
+ except Exception:
self.publish("Process Day Book Data", _("Process Failed"), -1, 5)
self.log()
@@ -564,7 +564,7 @@
is_last = True
frappe.enqueue_doc(self.doctype, self.name, "_import_vouchers", queue="long", timeout=3600, start=index+1, total=total, is_last=is_last)
- except:
+ except Exception:
self.log()
finally:
@@ -583,7 +583,7 @@
voucher_doc.submit()
self.publish("Importing Vouchers", _("{} of {}").format(index, total), index, total)
frappe.db.commit()
- except:
+ except Exception:
frappe.db.rollback()
self.log(voucher_doc)
diff --git a/erpnext/erpnext_integrations/doctype/tally_migration/test_tally_migration.py b/erpnext/erpnext_integrations/doctype/tally_migration/test_tally_migration.py
index 9f67e55..aae8f6d 100644
--- a/erpnext/erpnext_integrations/doctype/tally_migration/test_tally_migration.py
+++ b/erpnext/erpnext_integrations/doctype/tally_migration/test_tally_migration.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestTallyMigration(unittest.TestCase):
pass
diff --git a/erpnext/erpnext_integrations/doctype/taxjar_settings/taxjar_settings.py b/erpnext/erpnext_integrations/doctype/taxjar_settings/taxjar_settings.py
index 7f5f0f0..9dd4817 100644
--- a/erpnext/erpnext_integrations/doctype/taxjar_settings/taxjar_settings.py
+++ b/erpnext/erpnext_integrations/doctype/taxjar_settings/taxjar_settings.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class TaxJarSettings(Document):
pass
diff --git a/erpnext/erpnext_integrations/doctype/taxjar_settings/test_taxjar_settings.py b/erpnext/erpnext_integrations/doctype/taxjar_settings/test_taxjar_settings.py
index 7cdfd00..c871b05 100644
--- a/erpnext/erpnext_integrations/doctype/taxjar_settings/test_taxjar_settings.py
+++ b/erpnext/erpnext_integrations/doctype/taxjar_settings/test_taxjar_settings.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestTaxJarSettings(unittest.TestCase):
pass
diff --git a/erpnext/erpnext_integrations/doctype/woocommerce_settings/test_woocommerce_settings.py b/erpnext/erpnext_integrations/doctype/woocommerce_settings/test_woocommerce_settings.py
index 458a23f..3d18458 100644
--- a/erpnext/erpnext_integrations/doctype/woocommerce_settings/test_woocommerce_settings.py
+++ b/erpnext/erpnext_integrations/doctype/woocommerce_settings/test_woocommerce_settings.py
@@ -5,5 +5,6 @@
import unittest
+
class TestWoocommerceSettings(unittest.TestCase):
pass
diff --git a/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py b/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py
index 45f2610..2e15fab 100644
--- a/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py
+++ b/erpnext/erpnext_integrations/doctype/woocommerce_settings/woocommerce_settings.py
@@ -3,12 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils.nestedset import get_root_of
-from frappe.model.document import Document
-from six.moves.urllib.parse import urlparse
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
+from frappe.model.document import Document
+from frappe.utils.nestedset import get_root_of
+from six.moves.urllib.parse import urlparse
+
class WoocommerceSettings(Document):
def validate(self):
diff --git a/erpnext/erpnext_integrations/stripe_integration.py b/erpnext/erpnext_integrations/stripe_integration.py
index 820c740..f0315eb 100644
--- a/erpnext/erpnext_integrations/stripe_integration.py
+++ b/erpnext/erpnext_integrations/stripe_integration.py
@@ -2,9 +2,8 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-import stripe
-
import frappe
+import stripe
from frappe import _
from frappe.integrations.utils import create_request_log
diff --git a/erpnext/erpnext_integrations/taxjar_integration.py b/erpnext/erpnext_integrations/taxjar_integration.py
index f960998..870a4ef 100644
--- a/erpnext/erpnext_integrations/taxjar_integration.py
+++ b/erpnext/erpnext_integrations/taxjar_integration.py
@@ -1,11 +1,12 @@
import traceback
-import taxjar
-
import frappe
-from erpnext import get_default_company
+import taxjar
from frappe import _
from frappe.contacts.doctype.address.address import get_company_address
+from frappe.utils import cint
+
+from erpnext import get_default_company
TAX_ACCOUNT_HEAD = frappe.db.get_single_value("TaxJar Settings", "tax_account_head")
SHIP_ACCOUNT_HEAD = frappe.db.get_single_value("TaxJar Settings", "shipping_account_head")
@@ -14,6 +15,10 @@
SUPPORTED_COUNTRY_CODES = ["AT", "AU", "BE", "BG", "CA", "CY", "CZ", "DE", "DK", "EE", "ES", "FI",
"FR", "GB", "GR", "HR", "HU", "IE", "IT", "LT", "LU", "LV", "MT", "NL", "PL", "PT", "RO",
"SE", "SI", "SK", "US"]
+SUPPORTED_STATE_CODES = ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI', 'ID', 'IL',
+ 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE',
+ 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD',
+ 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY']
def get_client():
@@ -27,7 +32,11 @@
api_url = taxjar.SANDBOX_API_URL
if api_key and api_url:
- return taxjar.Client(api_key=api_key, api_url=api_url)
+ client = taxjar.Client(api_key=api_key, api_url=api_url)
+ client.set_api_config('headers', {
+ 'x-api-version': '2020-08-07'
+ })
+ return client
def create_transaction(doc, method):
@@ -57,7 +66,10 @@
tax_dict['amount'] = doc.total + tax_dict['shipping']
try:
- client.create_order(tax_dict)
+ if doc.is_return:
+ client.create_refund(tax_dict)
+ else:
+ client.create_order(tax_dict)
except taxjar.exceptions.TaxJarResponseError as err:
frappe.throw(_(sanitize_error_response(err)))
except Exception as ex:
@@ -89,13 +101,15 @@
to_country_code = frappe.db.get_value("Country", to_address.country, "code")
to_country_code = to_country_code.upper()
- if to_country_code not in SUPPORTED_COUNTRY_CODES:
- return
-
shipping = sum([tax.tax_amount for tax in doc.taxes if tax.account_head == SHIP_ACCOUNT_HEAD])
- if to_shipping_state is not None:
- to_shipping_state = get_iso_3166_2_state_code(to_address)
+ line_items = [get_line_item_dict(item) for item in doc.items]
+
+ if from_shipping_state not in SUPPORTED_STATE_CODES:
+ from_shipping_state = get_state_code(from_address, 'Company')
+
+ if to_shipping_state not in SUPPORTED_STATE_CODES:
+ to_shipping_state = get_state_code(to_address, 'Shipping')
tax_dict = {
'from_country': from_country_code,
@@ -109,11 +123,29 @@
'to_street': to_address.address_line1,
'to_state': to_shipping_state,
'shipping': shipping,
- 'amount': doc.net_total
+ 'amount': doc.net_total,
+ 'plugin': 'erpnext',
+ 'line_items': line_items
}
-
return tax_dict
+def get_state_code(address, location):
+ if address is not None:
+ state_code = get_iso_3166_2_state_code(address)
+ if state_code not in SUPPORTED_STATE_CODES:
+ frappe.throw(_("Please enter a valid State in the {0} Address").format(location))
+ else:
+ frappe.throw(_("Please enter a valid State in the {0} Address").format(location))
+
+ return state_code
+
+def get_line_item_dict(item):
+ return dict(
+ id = item.get('idx'),
+ quantity = item.get('qty'),
+ unit_price = item.get('rate'),
+ product_tax_code = item.get('product_tax_category')
+ )
def set_sales_tax(doc, method):
if not TAXJAR_CALCULATE_TAX:
@@ -122,17 +154,7 @@
if not doc.items:
return
- # if the party is exempt from sales tax, then set all tax account heads to zero
- sales_tax_exempted = hasattr(doc, "exempt_from_sales_tax") and doc.exempt_from_sales_tax \
- or frappe.db.has_column("Customer", "exempt_from_sales_tax") and frappe.db.get_value("Customer", doc.customer, "exempt_from_sales_tax")
-
- if sales_tax_exempted:
- for tax in doc.taxes:
- if tax.account_head == TAX_ACCOUNT_HEAD:
- tax.tax_amount = 0
- break
-
- doc.run_method("calculate_taxes_and_totals")
+ if check_sales_tax_exemption(doc):
return
tax_dict = get_tax_data(doc)
@@ -143,7 +165,6 @@
return
tax_data = validate_tax_request(tax_dict)
-
if tax_data is not None:
if not tax_data.amount_to_collect:
setattr(doc, "taxes", [tax for tax in doc.taxes if tax.account_head != TAX_ACCOUNT_HEAD])
@@ -163,9 +184,28 @@
"account_head": TAX_ACCOUNT_HEAD,
"tax_amount": tax_data.amount_to_collect
})
+ # Assigning values to tax_collectable and taxable_amount fields in sales item table
+ for item in tax_data.breakdown.line_items:
+ doc.get('items')[cint(item.id)-1].tax_collectable = item.tax_collectable
+ doc.get('items')[cint(item.id)-1].taxable_amount = item.taxable_amount
doc.run_method("calculate_taxes_and_totals")
+def check_sales_tax_exemption(doc):
+ # if the party is exempt from sales tax, then set all tax account heads to zero
+ sales_tax_exempted = hasattr(doc, "exempt_from_sales_tax") and doc.exempt_from_sales_tax \
+ or frappe.db.has_column("Customer", "exempt_from_sales_tax") \
+ and frappe.db.get_value("Customer", doc.customer, "exempt_from_sales_tax")
+
+ if sales_tax_exempted:
+ for tax in doc.taxes:
+ if tax.account_head == TAX_ACCOUNT_HEAD:
+ tax.tax_amount = 0
+ break
+ doc.run_method("calculate_taxes_and_totals")
+ return True
+ else:
+ return False
def validate_tax_request(tax_dict):
"""Return the sales tax that should be collected for a given order."""
@@ -200,6 +240,8 @@
if doc.shipping_address_name:
shipping_address = frappe.get_doc("Address", doc.shipping_address_name)
+ elif doc.customer_address:
+ shipping_address = frappe.get_doc("Address", doc.customer_address_name)
else:
shipping_address = get_company_address_details(doc)
diff --git a/erpnext/erpnext_integrations/utils.py b/erpnext/erpnext_integrations/utils.py
index caafc08..bb5c0c2 100644
--- a/erpnext/erpnext_integrations/utils.py
+++ b/erpnext/erpnext_integrations/utils.py
@@ -1,10 +1,16 @@
from __future__ import unicode_literals
+
+import base64
+import hashlib
+import hmac
+
import frappe
from frappe import _
-import base64, hashlib, hmac
from six.moves.urllib.parse import urlparse
+
from erpnext import get_default_company
+
def validate_webhooks_request(doctype, hmac_key, secret_key='secret'):
def innerfn(fn):
settings = frappe.get_doc(doctype)
diff --git a/erpnext/exceptions.py b/erpnext/exceptions.py
index 04291cd..9c6b13f 100644
--- a/erpnext/exceptions.py
+++ b/erpnext/exceptions.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
# accounts
class PartyFrozen(frappe.ValidationError): pass
class InvalidAccountCurrency(frappe.ValidationError): pass
diff --git a/erpnext/healthcare/dashboard_chart/clinical_procedures/clinical_procedures.json b/erpnext/healthcare/dashboard_chart/clinical_procedures/clinical_procedures.json
index a59f149..6803528 100644
--- a/erpnext/healthcare/dashboard_chart/clinical_procedures/clinical_procedures.json
+++ b/erpnext/healthcare/dashboard_chart/clinical_procedures/clinical_procedures.json
@@ -12,15 +12,15 @@
"idx": 0,
"is_public": 1,
"is_standard": 1,
- "last_synced_on": "2020-07-22 13:22:47.008622",
- "modified": "2020-07-22 13:36:48.114479",
+ "last_synced_on": "2021-01-30 21:03:30.086891",
+ "modified": "2021-02-01 13:36:04.469863",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Clinical Procedures",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
- "type": "Percentage",
+ "type": "Bar",
"use_report_chart": 0,
"y_axis": []
}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart/clinical_procedures_status/clinical_procedures_status.json b/erpnext/healthcare/dashboard_chart/clinical_procedures_status/clinical_procedures_status.json
index 6d560f7..dae9db1 100644
--- a/erpnext/healthcare/dashboard_chart/clinical_procedures_status/clinical_procedures_status.json
+++ b/erpnext/healthcare/dashboard_chart/clinical_procedures_status/clinical_procedures_status.json
@@ -12,15 +12,15 @@
"idx": 0,
"is_public": 1,
"is_standard": 1,
- "last_synced_on": "2020-07-22 13:22:46.691764",
- "modified": "2020-07-22 13:40:17.215775",
+ "last_synced_on": "2021-02-01 13:36:38.787783",
+ "modified": "2021-02-01 13:37:18.718275",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Clinical Procedures Status",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
- "type": "Pie",
+ "type": "Bar",
"use_report_chart": 0,
"y_axis": []
}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart/diagnoses/diagnoses.json b/erpnext/healthcare/dashboard_chart/diagnoses/diagnoses.json
index 0195aac..82145d6 100644
--- a/erpnext/healthcare/dashboard_chart/diagnoses/diagnoses.json
+++ b/erpnext/healthcare/dashboard_chart/diagnoses/diagnoses.json
@@ -5,21 +5,22 @@
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "Patient Encounter Diagnosis",
+ "dynamic_filters_json": "",
"filters_json": "[]",
"group_by_based_on": "diagnosis",
"group_by_type": "Count",
"idx": 0,
"is_public": 1,
"is_standard": 1,
- "last_synced_on": "2020-07-22 13:22:47.895521",
- "modified": "2020-07-22 13:43:32.369481",
+ "last_synced_on": "2021-01-30 21:03:33.729487",
+ "modified": "2021-02-01 13:34:57.385335",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Diagnoses",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
- "type": "Percentage",
+ "type": "Bar",
"use_report_chart": 0,
"y_axis": []
}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart/lab_tests/lab_tests.json b/erpnext/healthcare/dashboard_chart/lab_tests/lab_tests.json
index 0524835..70293b1 100644
--- a/erpnext/healthcare/dashboard_chart/lab_tests/lab_tests.json
+++ b/erpnext/healthcare/dashboard_chart/lab_tests/lab_tests.json
@@ -12,15 +12,15 @@
"idx": 0,
"is_public": 1,
"is_standard": 1,
- "last_synced_on": "2020-07-22 13:22:47.344055",
- "modified": "2020-07-22 13:37:34.490129",
+ "last_synced_on": "2021-01-30 21:03:28.272914",
+ "modified": "2021-02-01 13:36:08.391433",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Lab Tests",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
- "type": "Percentage",
+ "type": "Bar",
"use_report_chart": 0,
"y_axis": []
}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart/symptoms/symptoms.json b/erpnext/healthcare/dashboard_chart/symptoms/symptoms.json
index 8fc86a1..65e5472 100644
--- a/erpnext/healthcare/dashboard_chart/symptoms/symptoms.json
+++ b/erpnext/healthcare/dashboard_chart/symptoms/symptoms.json
@@ -12,15 +12,15 @@
"idx": 0,
"is_public": 1,
"is_standard": 1,
- "last_synced_on": "2020-07-22 13:22:47.296748",
- "modified": "2020-07-22 13:40:59.655129",
+ "last_synced_on": "2021-01-30 21:03:32.067473",
+ "modified": "2021-02-01 13:35:30.953718",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Symptoms",
"number_of_groups": 0,
"owner": "Administrator",
"timeseries": 0,
- "type": "Percentage",
+ "type": "Bar",
"use_report_chart": 0,
"y_axis": []
}
\ No newline at end of file
diff --git a/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.py b/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.py
index eca7143..9c71ce8 100644
--- a/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.py
+++ b/erpnext/healthcare/dashboard_chart_source/department_wise_patient_appointments/department_wise_patient_appointments.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.utils.dashboard import cache_source
+
@frappe.whitelist()
@cache_source
def get(chart_name = None, chart = None, no_cache = None, filters = None, from_date = None,
diff --git a/erpnext/healthcare/doctype/antibiotic/antibiotic.py b/erpnext/healthcare/doctype/antibiotic/antibiotic.py
index 8236c8a..6a4b764 100644
--- a/erpnext/healthcare/doctype/antibiotic/antibiotic.py
+++ b/erpnext/healthcare/doctype/antibiotic/antibiotic.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class Antibiotic(Document):
pass
diff --git a/erpnext/healthcare/doctype/antibiotic/test_antibiotic.py b/erpnext/healthcare/doctype/antibiotic/test_antibiotic.py
index 6ac4f4f..b6ec79f 100644
--- a/erpnext/healthcare/doctype/antibiotic/test_antibiotic.py
+++ b/erpnext/healthcare/doctype/antibiotic/test_antibiotic.py
@@ -2,7 +2,9 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestAntibiotic(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/appointment_type/appointment_type.py b/erpnext/healthcare/doctype/appointment_type/appointment_type.py
index 67a24f3..94d023f 100644
--- a/erpnext/healthcare/doctype/appointment_type/appointment_type.py
+++ b/erpnext/healthcare/doctype/appointment_type/appointment_type.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe.model.document import Document
+
import frappe
+from frappe.model.document import Document
+
class AppointmentType(Document):
def validate(self):
diff --git a/erpnext/healthcare/doctype/appointment_type/appointment_type_dashboard.py b/erpnext/healthcare/doctype/appointment_type/appointment_type_dashboard.py
index 845e446..b9c6edb 100644
--- a/erpnext/healthcare/doctype/appointment_type/appointment_type_dashboard.py
+++ b/erpnext/healthcare/doctype/appointment_type/appointment_type_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'appointment_type',
diff --git a/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.py b/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.py
index b2e0e82..026d5d7 100644
--- a/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.py
+++ b/erpnext/healthcare/doctype/appointment_type_service_item/appointment_type_service_item.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class AppointmentTypeServiceItem(Document):
pass
diff --git a/erpnext/healthcare/doctype/body_part/body_part.py b/erpnext/healthcare/doctype/body_part/body_part.py
index 300493a..77e8dd9 100644
--- a/erpnext/healthcare/doctype/body_part/body_part.py
+++ b/erpnext/healthcare/doctype/body_part/body_part.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class BodyPart(Document):
pass
diff --git a/erpnext/healthcare/doctype/body_part/test_body_part.py b/erpnext/healthcare/doctype/body_part/test_body_part.py
index cb3a611..a81ba17 100644
--- a/erpnext/healthcare/doctype/body_part/test_body_part.py
+++ b/erpnext/healthcare/doctype/body_part/test_body_part.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestBodyPart(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/body_part_link/body_part_link.py b/erpnext/healthcare/doctype/body_part_link/body_part_link.py
index 0371529..07488f0 100644
--- a/erpnext/healthcare/doctype/body_part_link/body_part_link.py
+++ b/erpnext/healthcare/doctype/body_part_link/body_part_link.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class BodyPartLink(Document):
pass
diff --git a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py
index cbf89ee..df4c2ef 100644
--- a/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py
+++ b/erpnext/healthcare/doctype/clinical_procedure/clinical_procedure.py
@@ -3,15 +3,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import flt, nowdate, nowtime, cstr
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import flt, nowdate, nowtime
+
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_account
from erpnext.healthcare.doctype.lab_test.lab_test import create_sample_doc
-from erpnext.stock.stock_ledger import get_previous_sle
from erpnext.stock.get_item_details import get_item_details
-from frappe.model.mapper import get_mapped_doc
+from erpnext.stock.stock_ledger import get_previous_sle
+
class ClinicalProcedure(Document):
def validate(self):
diff --git a/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py b/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py
index 0326e5e..b5c3744 100644
--- a/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py
+++ b/erpnext/healthcare/doctype/clinical_procedure/test_clinical_procedure.py
@@ -4,8 +4,13 @@
from __future__ import unicode_literals
import unittest
+
import frappe
-from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_healthcare_docs, create_clinical_procedure_template
+
+from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import (
+ create_clinical_procedure_template,
+ create_healthcare_docs,
+)
test_dependencies = ['Item']
diff --git a/erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.py b/erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.py
index d59e517..16c5369 100644
--- a/erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.py
+++ b/erpnext/healthcare/doctype/clinical_procedure_item/clinical_procedure_item.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class ClinicalProcedureItem(Document):
pass
diff --git a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py
index 58194f1..16e0969 100644
--- a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py
+++ b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template.py
@@ -3,11 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json
+
+import json
+
+import frappe
from frappe import _
from frappe.model.document import Document
from frappe.model.rename_doc import rename_doc
+
class ClinicalProcedureTemplate(Document):
def validate(self):
self.enable_disable_item()
diff --git a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template_dashboard.py b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template_dashboard.py
index 9aab521..a69899d 100644
--- a/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template_dashboard.py
+++ b/erpnext/healthcare/doctype/clinical_procedure_template/clinical_procedure_template_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'procedure_template',
diff --git a/erpnext/healthcare/doctype/clinical_procedure_template/test_clinical_procedure_template.py b/erpnext/healthcare/doctype/clinical_procedure_template/test_clinical_procedure_template.py
index 62e138b..f754c76 100644
--- a/erpnext/healthcare/doctype/clinical_procedure_template/test_clinical_procedure_template.py
+++ b/erpnext/healthcare/doctype/clinical_procedure_template/test_clinical_procedure_template.py
@@ -2,7 +2,9 @@
# Copyright (c) 2017, earthians and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestClinicalProcedureTemplate(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/codification_table/codification_table.py b/erpnext/healthcare/doctype/codification_table/codification_table.py
index ae29c03..232d92c 100644
--- a/erpnext/healthcare/doctype/codification_table/codification_table.py
+++ b/erpnext/healthcare/doctype/codification_table/codification_table.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class CodificationTable(Document):
pass
diff --git a/erpnext/healthcare/doctype/complaint/complaint.py b/erpnext/healthcare/doctype/complaint/complaint.py
index 717f9db..20e00f6 100644
--- a/erpnext/healthcare/doctype/complaint/complaint.py
+++ b/erpnext/healthcare/doctype/complaint/complaint.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class Complaint(Document):
pass
diff --git a/erpnext/healthcare/doctype/complaint/test_complaint.py b/erpnext/healthcare/doctype/complaint/test_complaint.py
index 2b9273a..d3e1069 100644
--- a/erpnext/healthcare/doctype/complaint/test_complaint.py
+++ b/erpnext/healthcare/doctype/complaint/test_complaint.py
@@ -2,7 +2,9 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestComplaint(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.py b/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.py
index 7ccf6b5..c086046 100644
--- a/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.py
+++ b/erpnext/healthcare/doctype/descriptive_test_result/descriptive_test_result.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class DescriptiveTestResult(Document):
pass
diff --git a/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.py b/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.py
index 281f32d..84184fb 100644
--- a/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.py
+++ b/erpnext/healthcare/doctype/descriptive_test_template/descriptive_test_template.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class DescriptiveTestTemplate(Document):
pass
diff --git a/erpnext/healthcare/doctype/diagnosis/diagnosis.py b/erpnext/healthcare/doctype/diagnosis/diagnosis.py
index f56e790..05add1b 100644
--- a/erpnext/healthcare/doctype/diagnosis/diagnosis.py
+++ b/erpnext/healthcare/doctype/diagnosis/diagnosis.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class Diagnosis(Document):
pass
diff --git a/erpnext/healthcare/doctype/dosage_form/dosage_form.py b/erpnext/healthcare/doctype/dosage_form/dosage_form.py
index 046af08..6b2d88b 100644
--- a/erpnext/healthcare/doctype/dosage_form/dosage_form.py
+++ b/erpnext/healthcare/doctype/dosage_form/dosage_form.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class DosageForm(Document):
pass
diff --git a/erpnext/healthcare/doctype/dosage_form/test_dosage_form.py b/erpnext/healthcare/doctype/dosage_form/test_dosage_form.py
index 81cfcf6..0161b82 100644
--- a/erpnext/healthcare/doctype/dosage_form/test_dosage_form.py
+++ b/erpnext/healthcare/doctype/dosage_form/test_dosage_form.py
@@ -5,5 +5,6 @@
import unittest
+
class TestDosageForm(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/dosage_strength/dosage_strength.py b/erpnext/healthcare/doctype/dosage_strength/dosage_strength.py
index e36a016..9e74743 100644
--- a/erpnext/healthcare/doctype/dosage_strength/dosage_strength.py
+++ b/erpnext/healthcare/doctype/dosage_strength/dosage_strength.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class DosageStrength(Document):
pass
diff --git a/erpnext/healthcare/doctype/drug_prescription/drug_prescription.py b/erpnext/healthcare/doctype/drug_prescription/drug_prescription.py
index 68a2dc5..744bdb0 100755
--- a/erpnext/healthcare/doctype/drug_prescription/drug_prescription.py
+++ b/erpnext/healthcare/doctype/drug_prescription/drug_prescription.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class DrugPrescription(Document):
def get_quantity(self):
quantity = 0
diff --git a/erpnext/healthcare/doctype/exercise/exercise.py b/erpnext/healthcare/doctype/exercise/exercise.py
index efd8999..5d2b1f1 100644
--- a/erpnext/healthcare/doctype/exercise/exercise.py
+++ b/erpnext/healthcare/doctype/exercise/exercise.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class Exercise(Document):
pass
diff --git a/erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.py b/erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.py
index 17e97b8..bbb2972 100644
--- a/erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.py
+++ b/erpnext/healthcare/doctype/exercise_difficulty_level/exercise_difficulty_level.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ExerciseDifficultyLevel(Document):
pass
diff --git a/erpnext/healthcare/doctype/exercise_difficulty_level/test_exercise_difficulty_level.py b/erpnext/healthcare/doctype/exercise_difficulty_level/test_exercise_difficulty_level.py
index 80ef3a7..dcaea08 100644
--- a/erpnext/healthcare/doctype/exercise_difficulty_level/test_exercise_difficulty_level.py
+++ b/erpnext/healthcare/doctype/exercise_difficulty_level/test_exercise_difficulty_level.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestExerciseDifficultyLevel(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/exercise_type/exercise_type.py b/erpnext/healthcare/doctype/exercise_type/exercise_type.py
index ae44a2b..48eb6ba2 100644
--- a/erpnext/healthcare/doctype/exercise_type/exercise_type.py
+++ b/erpnext/healthcare/doctype/exercise_type/exercise_type.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ExerciseType(Document):
def autoname(self):
if self.difficulty_level:
diff --git a/erpnext/healthcare/doctype/exercise_type/test_exercise_type.py b/erpnext/healthcare/doctype/exercise_type/test_exercise_type.py
index bf217e8..583aea9 100644
--- a/erpnext/healthcare/doctype/exercise_type/test_exercise_type.py
+++ b/erpnext/healthcare/doctype/exercise_type/test_exercise_type.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestExerciseType(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/exercise_type_step/exercise_type_step.py b/erpnext/healthcare/doctype/exercise_type_step/exercise_type_step.py
index 13d7e57..412ef32 100644
--- a/erpnext/healthcare/doctype/exercise_type_step/exercise_type_step.py
+++ b/erpnext/healthcare/doctype/exercise_type_step/exercise_type_step.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ExerciseTypeStep(Document):
pass
diff --git a/erpnext/healthcare/doctype/fee_validity/fee_validity.py b/erpnext/healthcare/doctype/fee_validity/fee_validity.py
index 59586e0..aa30bec 100644
--- a/erpnext/healthcare/doctype/fee_validity/fee_validity.py
+++ b/erpnext/healthcare/doctype/fee_validity/fee_validity.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe.model.document import Document
-import frappe
-from frappe.utils import getdate
+
import datetime
+import frappe
+from frappe.model.document import Document
+from frappe.utils import getdate
+
+
class FeeValidity(Document):
def validate(self):
self.update_status()
diff --git a/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
index 957f852..ce1947f 100644
--- a/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
+++ b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py
@@ -3,11 +3,17 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import nowdate, add_days
-from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_healthcare_docs, create_appointment, create_healthcare_service_items
+
+import frappe
+from frappe.utils import add_days, nowdate
+
from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
+from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import (
+ create_appointment,
+ create_healthcare_docs,
+ create_healthcare_service_items,
+)
test_dependencies = ["Company"]
diff --git a/erpnext/healthcare/doctype/fee_validity_reference/fee_validity_reference.py b/erpnext/healthcare/doctype/fee_validity_reference/fee_validity_reference.py
index c819280..c03978a 100644
--- a/erpnext/healthcare/doctype/fee_validity_reference/fee_validity_reference.py
+++ b/erpnext/healthcare/doctype/fee_validity_reference/fee_validity_reference.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class FeeValidityReference(Document):
pass
diff --git a/erpnext/healthcare/doctype/healthcare.py b/erpnext/healthcare/doctype/healthcare.py
index 6fd2015..f8e008e 100644
--- a/erpnext/healthcare/doctype/healthcare.py
+++ b/erpnext/healthcare/doctype/healthcare.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_data():
return []
diff --git a/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.py b/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.py
index 5da5a06..4550e7a 100644
--- a/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.py
+++ b/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner.py
@@ -3,13 +3,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
-from erpnext.accounts.party import validate_party_accounts
-from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
+from frappe.contacts.address_and_contact import (
+ delete_contact_and_address,
+ load_address_and_contact,
+)
+from frappe.model.document import Document
from frappe.model.naming import append_number_if_name_exists
-from frappe.desk.reportview import build_match_conditions, get_filters_cond
+
+from erpnext.accounts.party import validate_party_accounts
+
class HealthcarePractitioner(Document):
def onload(self):
diff --git a/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner_dashboard.py b/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner_dashboard.py
index bcee444..8e0292e 100644
--- a/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner_dashboard.py
+++ b/erpnext/healthcare/doctype/healthcare_practitioner/healthcare_practitioner_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'heatmap': True,
diff --git a/erpnext/healthcare/doctype/healthcare_practitioner/test_healthcare_practitioner.py b/erpnext/healthcare/doctype/healthcare_practitioner/test_healthcare_practitioner.py
index de8201b..214bcd2 100644
--- a/erpnext/healthcare/doctype/healthcare_practitioner/test_healthcare_practitioner.py
+++ b/erpnext/healthcare/doctype/healthcare_practitioner/test_healthcare_practitioner.py
@@ -2,7 +2,9 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestHealthcarePractitioner(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/healthcare_schedule_time_slot/healthcare_schedule_time_slot.py b/erpnext/healthcare/doctype/healthcare_schedule_time_slot/healthcare_schedule_time_slot.py
index e58ea53..721da24 100644
--- a/erpnext/healthcare/doctype/healthcare_schedule_time_slot/healthcare_schedule_time_slot.py
+++ b/erpnext/healthcare/doctype/healthcare_schedule_time_slot/healthcare_schedule_time_slot.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class HealthcareScheduleTimeSlot(Document):
pass
diff --git a/erpnext/healthcare/doctype/healthcare_service_unit/healthcare_service_unit.py b/erpnext/healthcare/doctype/healthcare_service_unit/healthcare_service_unit.py
index 989d426..550b9fb 100644
--- a/erpnext/healthcare/doctype/healthcare_service_unit/healthcare_service_unit.py
+++ b/erpnext/healthcare/doctype/healthcare_service_unit/healthcare_service_unit.py
@@ -4,11 +4,12 @@
from __future__ import unicode_literals
-from frappe.utils.nestedset import NestedSet
-from frappe.utils import cint, cstr
+import json
+
import frappe
from frappe import _
-import json
+from frappe.utils import cint, cstr
+from frappe.utils.nestedset import NestedSet
class HealthcareServiceUnit(NestedSet):
@@ -30,7 +31,7 @@
self.validate_one_root()
def set_service_unit_properties(self):
- if self.is_group:
+ if cint(self.is_group):
self.allow_appointments = False
self.overlap_appointments = False
self.inpatient_occupancy = False
diff --git a/erpnext/healthcare/doctype/healthcare_service_unit/test_healthcare_service_unit.py b/erpnext/healthcare/doctype/healthcare_service_unit/test_healthcare_service_unit.py
index bced2fe..84197e5 100644
--- a/erpnext/healthcare/doctype/healthcare_service_unit/test_healthcare_service_unit.py
+++ b/erpnext/healthcare/doctype/healthcare_service_unit/test_healthcare_service_unit.py
@@ -5,5 +5,6 @@
import unittest
+
class TestHealthcareServiceUnit(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/healthcare_service_unit_type/healthcare_service_unit_type.py b/erpnext/healthcare/doctype/healthcare_service_unit_type/healthcare_service_unit_type.py
index a318e50..181cb52 100644
--- a/erpnext/healthcare/doctype/healthcare_service_unit_type/healthcare_service_unit_type.py
+++ b/erpnext/healthcare/doctype/healthcare_service_unit_type/healthcare_service_unit_type.py
@@ -3,11 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.model.rename_doc import rename_doc
+
class HealthcareServiceUnitType(Document):
def validate(self):
if self.allow_appointments and self.inpatient_occupancy:
diff --git a/erpnext/healthcare/doctype/healthcare_service_unit_type/healthcare_service_unit_type_dashboard.py b/erpnext/healthcare/doctype/healthcare_service_unit_type/healthcare_service_unit_type_dashboard.py
index 0ac548b..7421ec3 100644
--- a/erpnext/healthcare/doctype/healthcare_service_unit_type/healthcare_service_unit_type_dashboard.py
+++ b/erpnext/healthcare/doctype/healthcare_service_unit_type/healthcare_service_unit_type_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'service_unit_type',
diff --git a/erpnext/healthcare/doctype/healthcare_service_unit_type/test_healthcare_service_unit_type.py b/erpnext/healthcare/doctype/healthcare_service_unit_type/test_healthcare_service_unit_type.py
index 3ee3377..839e1d6 100644
--- a/erpnext/healthcare/doctype/healthcare_service_unit_type/test_healthcare_service_unit_type.py
+++ b/erpnext/healthcare/doctype/healthcare_service_unit_type/test_healthcare_service_unit_type.py
@@ -2,9 +2,12 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
import frappe
+
class TestHealthcareServiceUnitType(unittest.TestCase):
def test_item_creation(self):
unit_type = get_unit_type()
diff --git a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
index a16fceb..9ab8881 100644
--- a/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
+++ b/erpnext/healthcare/doctype/healthcare_settings/healthcare_settings.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+import json
+
import frappe
from frappe import _
-from frappe.model.document import Document
from frappe.core.doctype.sms_settings.sms_settings import send_sms
-import json
+from frappe.model.document import Document
+
class HealthcareSettings(Document):
def validate(self):
diff --git a/erpnext/healthcare/doctype/healthcare_settings/test_healthcare_settings.py b/erpnext/healthcare/doctype/healthcare_settings/test_healthcare_settings.py
index 1b620d5..af2f2b4 100644
--- a/erpnext/healthcare/doctype/healthcare_settings/test_healthcare_settings.py
+++ b/erpnext/healthcare/doctype/healthcare_settings/test_healthcare_settings.py
@@ -2,7 +2,9 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestHealthcareSettings(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/inpatient_medication_entry/inpatient_medication_entry.py b/erpnext/healthcare/doctype/inpatient_medication_entry/inpatient_medication_entry.py
index 3a299ed..b28e37a 100644
--- a/erpnext/healthcare/doctype/inpatient_medication_entry/inpatient_medication_entry.py
+++ b/erpnext/healthcare/doctype/inpatient_medication_entry/inpatient_medication_entry.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import flt, get_link_to_form, getdate, nowtime
-from erpnext.stock.utils import get_latest_stock_qty
+from frappe.utils import flt, get_link_to_form
+
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_account
+from erpnext.stock.utils import get_latest_stock_qty
+
class InpatientMedicationEntry(Document):
def validate(self):
diff --git a/erpnext/healthcare/doctype/inpatient_medication_entry/inpatient_medication_entry_dashboard.py b/erpnext/healthcare/doctype/inpatient_medication_entry/inpatient_medication_entry_dashboard.py
index a4bec45..ca9364d 100644
--- a/erpnext/healthcare/doctype/inpatient_medication_entry/inpatient_medication_entry_dashboard.py
+++ b/erpnext/healthcare/doctype/inpatient_medication_entry/inpatient_medication_entry_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'against_imoe',
diff --git a/erpnext/healthcare/doctype/inpatient_medication_entry/test_inpatient_medication_entry.py b/erpnext/healthcare/doctype/inpatient_medication_entry/test_inpatient_medication_entry.py
index ff9e212..dde7739 100644
--- a/erpnext/healthcare/doctype/inpatient_medication_entry/test_inpatient_medication_entry.py
+++ b/erpnext/healthcare/doctype/inpatient_medication_entry/test_inpatient_medication_entry.py
@@ -3,14 +3,32 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from frappe.utils import add_days, getdate, now_datetime
-from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import create_patient, create_inpatient, get_healthcare_service_unit, mark_invoiced_inpatient_occupancy
-from erpnext.healthcare.doctype.inpatient_record.inpatient_record import admit_patient, discharge_patient, schedule_discharge
-from erpnext.healthcare.doctype.inpatient_medication_order.test_inpatient_medication_order import create_ipmo, create_ipme
-from erpnext.healthcare.doctype.inpatient_medication_entry.inpatient_medication_entry import get_drug_shortage_map, make_difference_stock_entry
+
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_account
+from erpnext.healthcare.doctype.inpatient_medication_entry.inpatient_medication_entry import (
+ get_drug_shortage_map,
+ make_difference_stock_entry,
+)
+from erpnext.healthcare.doctype.inpatient_medication_order.test_inpatient_medication_order import (
+ create_ipme,
+ create_ipmo,
+)
+from erpnext.healthcare.doctype.inpatient_record.inpatient_record import (
+ admit_patient,
+ discharge_patient,
+ schedule_discharge,
+)
+from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import (
+ create_inpatient,
+ create_patient,
+ get_healthcare_service_unit,
+ mark_invoiced_inpatient_occupancy,
+)
+
class TestInpatientMedicationEntry(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/healthcare/doctype/inpatient_medication_entry_detail/inpatient_medication_entry_detail.py b/erpnext/healthcare/doctype/inpatient_medication_entry_detail/inpatient_medication_entry_detail.py
index 644898d..9173431 100644
--- a/erpnext/healthcare/doctype/inpatient_medication_entry_detail/inpatient_medication_entry_detail.py
+++ b/erpnext/healthcare/doctype/inpatient_medication_entry_detail/inpatient_medication_entry_detail.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class InpatientMedicationEntryDetail(Document):
pass
diff --git a/erpnext/healthcare/doctype/inpatient_medication_order/inpatient_medication_order.py b/erpnext/healthcare/doctype/inpatient_medication_order/inpatient_medication_order.py
index b379e98..2e6d732 100644
--- a/erpnext/healthcare/doctype/inpatient_medication_order/inpatient_medication_order.py
+++ b/erpnext/healthcare/doctype/inpatient_medication_order/inpatient_medication_order.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import cstr
+
from erpnext.healthcare.doctype.patient_encounter.patient_encounter import get_prescription_dates
+
class InpatientMedicationOrder(Document):
def validate(self):
self.validate_inpatient()
diff --git a/erpnext/healthcare/doctype/inpatient_medication_order/test_inpatient_medication_order.py b/erpnext/healthcare/doctype/inpatient_medication_order/test_inpatient_medication_order.py
index 7989762..477f8c9 100644
--- a/erpnext/healthcare/doctype/inpatient_medication_order/test_inpatient_medication_order.py
+++ b/erpnext/healthcare/doctype/inpatient_medication_order/test_inpatient_medication_order.py
@@ -3,11 +3,23 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from frappe.utils import add_days, getdate, now_datetime
-from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import create_patient, create_inpatient, get_healthcare_service_unit, mark_invoiced_inpatient_occupancy
-from erpnext.healthcare.doctype.inpatient_record.inpatient_record import admit_patient, discharge_patient, schedule_discharge
+
+from erpnext.healthcare.doctype.inpatient_record.inpatient_record import (
+ admit_patient,
+ discharge_patient,
+ schedule_discharge,
+)
+from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import (
+ create_inpatient,
+ create_patient,
+ get_healthcare_service_unit,
+ mark_invoiced_inpatient_occupancy,
+)
+
class TestInpatientMedicationOrder(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/healthcare/doctype/inpatient_medication_order_entry/inpatient_medication_order_entry.py b/erpnext/healthcare/doctype/inpatient_medication_order_entry/inpatient_medication_order_entry.py
index ebfe366..15800ad 100644
--- a/erpnext/healthcare/doctype/inpatient_medication_order_entry/inpatient_medication_order_entry.py
+++ b/erpnext/healthcare/doctype/inpatient_medication_order_entry/inpatient_medication_order_entry.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class InpatientMedicationOrderEntry(Document):
pass
diff --git a/erpnext/healthcare/doctype/inpatient_occupancy/inpatient_occupancy.py b/erpnext/healthcare/doctype/inpatient_occupancy/inpatient_occupancy.py
index 52de25b..c8f3296 100644
--- a/erpnext/healthcare/doctype/inpatient_occupancy/inpatient_occupancy.py
+++ b/erpnext/healthcare/doctype/inpatient_occupancy/inpatient_occupancy.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class InpatientOccupancy(Document):
pass
diff --git a/erpnext/healthcare/doctype/inpatient_record/inpatient_record.py b/erpnext/healthcare/doctype/inpatient_record/inpatient_record.py
index f4d1eaf..2e26677 100644
--- a/erpnext/healthcare/doctype/inpatient_record/inpatient_record.py
+++ b/erpnext/healthcare/doctype/inpatient_record/inpatient_record.py
@@ -3,11 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json
+
+import json
+
+import frappe
from frappe import _
-from frappe.utils import today, now_datetime, getdate, get_datetime, get_link_to_form
-from frappe.model.document import Document
from frappe.desk.reportview import get_match_cond
+from frappe.model.document import Document
+from frappe.utils import get_datetime, get_link_to_form, getdate, now_datetime, today
+
class InpatientRecord(Document):
def after_insert(self):
diff --git a/erpnext/healthcare/doctype/inpatient_record/inpatient_record_dashboard.py b/erpnext/healthcare/doctype/inpatient_record/inpatient_record_dashboard.py
index 92cc610..0f4adce 100644
--- a/erpnext/healthcare/doctype/inpatient_record/inpatient_record_dashboard.py
+++ b/erpnext/healthcare/doctype/inpatient_record/inpatient_record_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'inpatient_record',
diff --git a/erpnext/healthcare/doctype/inpatient_record/test_inpatient_record.py b/erpnext/healthcare/doctype/inpatient_record/test_inpatient_record.py
index b4a9612..58934e6 100644
--- a/erpnext/healthcare/doctype/inpatient_record/test_inpatient_record.py
+++ b/erpnext/healthcare/doctype/inpatient_record/test_inpatient_record.py
@@ -3,14 +3,21 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from frappe.utils import now_datetime, today
from frappe.utils.make_random import get_random
-from erpnext.healthcare.doctype.inpatient_record.inpatient_record import admit_patient, discharge_patient, schedule_discharge
+
+from erpnext.healthcare.doctype.inpatient_record.inpatient_record import (
+ admit_patient,
+ discharge_patient,
+ schedule_discharge,
+)
from erpnext.healthcare.doctype.lab_test.test_lab_test import create_patient_encounter
from erpnext.healthcare.utils import get_encounters_to_invoice
+
class TestInpatientRecord(unittest.TestCase):
def test_admit_and_discharge(self):
frappe.db.sql("""delete from `tabInpatient Record`""")
diff --git a/erpnext/healthcare/doctype/lab_prescription/lab_prescription.py b/erpnext/healthcare/doctype/lab_prescription/lab_prescription.py
index b788a0d..a3f9aa2 100644
--- a/erpnext/healthcare/doctype/lab_prescription/lab_prescription.py
+++ b/erpnext/healthcare/doctype/lab_prescription/lab_prescription.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class LabPrescription(Document):
pass
diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.py b/erpnext/healthcare/doctype/lab_test/lab_test.py
index 4b57cd0..7db497c 100644
--- a/erpnext/healthcare/doctype/lab_test/lab_test.py
+++ b/erpnext/healthcare/doctype/lab_test/lab_test.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import getdate, cstr, get_link_to_form
+from frappe.utils import get_link_to_form, getdate
+
class LabTest(Document):
def validate(self):
@@ -34,7 +36,7 @@
frappe.db.set_value('Lab Prescription', self.prescription, 'lab_test_created', 1)
if frappe.db.get_value('Lab Prescription', self.prescription, 'invoiced'):
self.invoiced = True
- if not self.lab_test_name and self.template:
+ if self.template:
self.load_test_from_template()
self.reload()
@@ -48,9 +50,9 @@
if item.result_value and item.secondary_uom and item.conversion_factor:
try:
item.secondary_uom_result = float(item.result_value) * float(item.conversion_factor)
- except:
+ except Exception:
item.secondary_uom_result = ''
- frappe.msgprint(_('Row #{0}: Result for Secondary UOM not calculated'.format(item.idx)), title = _('Warning'))
+ frappe.msgprint(_('Row #{0}: Result for Secondary UOM not calculated').format(item.idx), title = _('Warning'))
def validate_result_values(self):
if self.normal_test_items:
@@ -229,9 +231,9 @@
sample_collection = frappe.get_doc('Sample Collection', sample_exists[0][0])
quantity = int(sample_collection.sample_qty) + int(template.sample_qty)
if template.sample_details:
- sample_details = sample_collection.sample_details + '\n-\n' + _('Test: ')
+ sample_details = sample_collection.sample_details + '\n-\n' + _('Test :')
sample_details += (template.get('lab_test_name') or template.get('template')) + '\n'
- sample_details += _('Collection Details: ') + '\n\t' + template.sample_details
+ sample_details += _('Collection Details:') + '\n\t' + template.sample_details
frappe.db.set_value('Sample Collection', sample_collection.name, 'sample_details', sample_details)
frappe.db.set_value('Sample Collection', sample_collection.name, 'sample_qty', quantity)
diff --git a/erpnext/healthcare/doctype/lab_test/test_lab_test.py b/erpnext/healthcare/doctype/lab_test/test_lab_test.py
index c9f0029..da10bd8 100644
--- a/erpnext/healthcare/doctype/lab_test/test_lab_test.py
+++ b/erpnext/healthcare/doctype/lab_test/test_lab_test.py
@@ -2,13 +2,22 @@
# Copyright (c) 2015, ESS LLP and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
import frappe
from frappe.utils import getdate, nowtime
-from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_patient
+
+from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import (
+ get_income_account,
+ get_receivable_account,
+)
from erpnext.healthcare.doctype.lab_test.lab_test import create_multiple
-from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account, get_income_account
-from erpnext.healthcare.doctype.patient_medical_record.test_patient_medical_record import create_lab_test_template as create_blood_test_template
+from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_patient
+from erpnext.healthcare.doctype.patient_medical_record.test_patient_medical_record import (
+ create_lab_test_template as create_blood_test_template,
+)
+
class TestLabTest(unittest.TestCase):
def test_lab_test_item(self):
diff --git a/erpnext/healthcare/doctype/lab_test_group_template/lab_test_group_template.py b/erpnext/healthcare/doctype/lab_test_group_template/lab_test_group_template.py
index 1e2cef4..2e3c409 100644
--- a/erpnext/healthcare/doctype/lab_test_group_template/lab_test_group_template.py
+++ b/erpnext/healthcare/doctype/lab_test_group_template/lab_test_group_template.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class LabTestGroupTemplate(Document):
pass
diff --git a/erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.py b/erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.py
index 4c66b72..3a765fe 100644
--- a/erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.py
+++ b/erpnext/healthcare/doctype/lab_test_sample/lab_test_sample.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class LabTestSample(Document):
pass
diff --git a/erpnext/healthcare/doctype/lab_test_sample/test_lab_test_sample.py b/erpnext/healthcare/doctype/lab_test_sample/test_lab_test_sample.py
index 2bc56bd..8896572 100644
--- a/erpnext/healthcare/doctype/lab_test_sample/test_lab_test_sample.py
+++ b/erpnext/healthcare/doctype/lab_test_sample/test_lab_test_sample.py
@@ -2,7 +2,9 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestLabTestSample(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py
index 543dee2..c052693 100644
--- a/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py
+++ b/erpnext/healthcare/doctype/lab_test_template/lab_test_template.py
@@ -3,10 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json
+
+import json
+
+import frappe
+from frappe import _
from frappe.model.document import Document
from frappe.model.rename_doc import rename_doc
-from frappe import _
+
class LabTestTemplate(Document):
def after_insert(self):
diff --git a/erpnext/healthcare/doctype/lab_test_template/lab_test_template_dashboard.py b/erpnext/healthcare/doctype/lab_test_template/lab_test_template_dashboard.py
index 94dfeea..a4f9d4b 100644
--- a/erpnext/healthcare/doctype/lab_test_template/lab_test_template_dashboard.py
+++ b/erpnext/healthcare/doctype/lab_test_template/lab_test_template_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'template',
diff --git a/erpnext/healthcare/doctype/lab_test_template/test_lab_test_template.py b/erpnext/healthcare/doctype/lab_test_template/test_lab_test_template.py
index 4c9f55a..8d8ac64 100644
--- a/erpnext/healthcare/doctype/lab_test_template/test_lab_test_template.py
+++ b/erpnext/healthcare/doctype/lab_test_template/test_lab_test_template.py
@@ -2,6 +2,7 @@
# Copyright (c) 2015, ESS and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
# test_records = frappe.get_test_records('Lab Test Template')
diff --git a/erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.py b/erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.py
index 7ce8d2d..ce11c0f 100644
--- a/erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.py
+++ b/erpnext/healthcare/doctype/lab_test_uom/lab_test_uom.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class LabTestUOM(Document):
pass
diff --git a/erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.py b/erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.py
index 0b3f516..9fe2de5 100644
--- a/erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.py
+++ b/erpnext/healthcare/doctype/lab_test_uom/test_lab_test_uom.py
@@ -2,6 +2,7 @@
# Copyright (c) 2015, ESS and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
# test_records = frappe.get_test_records('Lab Test UOM')
diff --git a/erpnext/healthcare/doctype/medical_code/medical_code.py b/erpnext/healthcare/doctype/medical_code/medical_code.py
index 0deaac3..4ed3d31 100644
--- a/erpnext/healthcare/doctype/medical_code/medical_code.py
+++ b/erpnext/healthcare/doctype/medical_code/medical_code.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class MedicalCode(Document):
def autoname(self):
self.name = self.medical_code_standard+" "+self.code
diff --git a/erpnext/healthcare/doctype/medical_code/test_medical_code.py b/erpnext/healthcare/doctype/medical_code/test_medical_code.py
index b1e0402..7584b05 100644
--- a/erpnext/healthcare/doctype/medical_code/test_medical_code.py
+++ b/erpnext/healthcare/doctype/medical_code/test_medical_code.py
@@ -2,7 +2,9 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestMedicalCode(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/medical_code_standard/medical_code_standard.py b/erpnext/healthcare/doctype/medical_code_standard/medical_code_standard.py
index 7b2731c..be0ea89 100644
--- a/erpnext/healthcare/doctype/medical_code_standard/medical_code_standard.py
+++ b/erpnext/healthcare/doctype/medical_code_standard/medical_code_standard.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class MedicalCodeStandard(Document):
pass
diff --git a/erpnext/healthcare/doctype/medical_code_standard/test_medical_code_standard.py b/erpnext/healthcare/doctype/medical_code_standard/test_medical_code_standard.py
index fde095d..3b046e3 100644
--- a/erpnext/healthcare/doctype/medical_code_standard/test_medical_code_standard.py
+++ b/erpnext/healthcare/doctype/medical_code_standard/test_medical_code_standard.py
@@ -2,7 +2,9 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestMedicalCodeStandard(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/medical_department/medical_department.py b/erpnext/healthcare/doctype/medical_department/medical_department.py
index 0f2d4fc..7be5a1a 100644
--- a/erpnext/healthcare/doctype/medical_department/medical_department.py
+++ b/erpnext/healthcare/doctype/medical_department/medical_department.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class MedicalDepartment(Document):
pass
diff --git a/erpnext/healthcare/doctype/medical_department/test_medical_department.py b/erpnext/healthcare/doctype/medical_department/test_medical_department.py
index 543750a..6435a23 100644
--- a/erpnext/healthcare/doctype/medical_department/test_medical_department.py
+++ b/erpnext/healthcare/doctype/medical_department/test_medical_department.py
@@ -2,6 +2,7 @@
# Copyright (c) 2015, ESS LLP and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
# test_records = frappe.get_test_records('Medical Department')
diff --git a/erpnext/healthcare/doctype/normal_test_result/normal_test_result.py b/erpnext/healthcare/doctype/normal_test_result/normal_test_result.py
index 63abf02..e72f726 100644
--- a/erpnext/healthcare/doctype/normal_test_result/normal_test_result.py
+++ b/erpnext/healthcare/doctype/normal_test_result/normal_test_result.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class NormalTestResult(Document):
pass
diff --git a/erpnext/healthcare/doctype/normal_test_template/normal_test_template.py b/erpnext/healthcare/doctype/normal_test_template/normal_test_template.py
index bc2c991..9df4855 100644
--- a/erpnext/healthcare/doctype/normal_test_template/normal_test_template.py
+++ b/erpnext/healthcare/doctype/normal_test_template/normal_test_template.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class NormalTestTemplate(Document):
pass
diff --git a/erpnext/healthcare/doctype/organism/organism.py b/erpnext/healthcare/doctype/organism/organism.py
index 1ead762..dfb9c0d 100644
--- a/erpnext/healthcare/doctype/organism/organism.py
+++ b/erpnext/healthcare/doctype/organism/organism.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class Organism(Document):
pass
diff --git a/erpnext/healthcare/doctype/organism/test_organism.py b/erpnext/healthcare/doctype/organism/test_organism.py
index ecb9665..9d7ea0b 100644
--- a/erpnext/healthcare/doctype/organism/test_organism.py
+++ b/erpnext/healthcare/doctype/organism/test_organism.py
@@ -2,7 +2,9 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestOrganism(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/organism_test_item/organism_test_item.py b/erpnext/healthcare/doctype/organism_test_item/organism_test_item.py
index 019a55b..6bb8e8f 100644
--- a/erpnext/healthcare/doctype/organism_test_item/organism_test_item.py
+++ b/erpnext/healthcare/doctype/organism_test_item/organism_test_item.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class OrganismTestItem(Document):
pass
diff --git a/erpnext/healthcare/doctype/organism_test_result/organism_test_result.py b/erpnext/healthcare/doctype/organism_test_result/organism_test_result.py
index 02393c2..3428403 100644
--- a/erpnext/healthcare/doctype/organism_test_result/organism_test_result.py
+++ b/erpnext/healthcare/doctype/organism_test_result/organism_test_result.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class OrganismTestResult(Document):
pass
diff --git a/erpnext/healthcare/doctype/patient/patient.py b/erpnext/healthcare/doctype/patient/patient.py
index 9dae1f6..970c000 100644
--- a/erpnext/healthcare/doctype/patient/patient.py
+++ b/erpnext/healthcare/doctype/patient/patient.py
@@ -3,18 +3,25 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+import dateutil
import frappe
from frappe import _
-from frappe.model.document import Document
-from frappe.utils import cint, cstr, getdate
-import dateutil
from frappe.contacts.address_and_contact import load_address_and_contact
from frappe.contacts.doctype.contact.contact import get_default_contact
+from frappe.model.document import Document
from frappe.model.naming import set_name_by_naming_series
+from frappe.utils import cint, cstr, getdate
from frappe.utils.nestedset import get_root_of
+
from erpnext import get_default_currency
-from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account, get_income_account, send_registration_sms
from erpnext.accounts.party import get_dashboard_info
+from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import (
+ get_income_account,
+ get_receivable_account,
+ send_registration_sms,
+)
+
class Patient(Document):
def onload(self):
diff --git a/erpnext/healthcare/doctype/patient/patient_dashboard.py b/erpnext/healthcare/doctype/patient/patient_dashboard.py
index 7f7cfa8..a388b74 100644
--- a/erpnext/healthcare/doctype/patient/patient_dashboard.py
+++ b/erpnext/healthcare/doctype/patient/patient_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'heatmap': True,
diff --git a/erpnext/healthcare/doctype/patient/test_patient.py b/erpnext/healthcare/doctype/patient/test_patient.py
index 9274b6f..4b8c732 100644
--- a/erpnext/healthcare/doctype/patient/test_patient.py
+++ b/erpnext/healthcare/doctype/patient/test_patient.py
@@ -4,9 +4,12 @@
from __future__ import unicode_literals
import unittest
+
import frappe
+
from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_patient
+
class TestPatient(unittest.TestCase):
def test_customer_created(self):
frappe.db.sql("""delete from `tabPatient`""")
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
index 36047c4..dcbcda0 100755
--- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
+++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py
@@ -3,17 +3,28 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.model.document import Document
-import json
-from frappe.utils import getdate, get_time, flt
-from frappe.model.mapper import get_mapped_doc
-from frappe import _
+
import datetime
+import json
+
+import frappe
+from frappe import _
from frappe.core.doctype.sms_settings.sms_settings import send_sms
+from frappe.model.document import Document
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import flt, get_link_to_form, get_time, getdate
+
+from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import (
+ get_income_account,
+ get_receivable_account,
+)
+from erpnext.healthcare.utils import (
+ check_fee_validity,
+ get_service_item_and_practitioner_charge,
+ manage_fee_validity,
+)
from erpnext.hr.doctype.employee.employee import is_holiday
-from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account, get_income_account
-from erpnext.healthcare.utils import check_fee_validity, get_service_item_and_practitioner_charge, manage_fee_validity
+
class MaximumCapacityError(frappe.ValidationError):
pass
@@ -100,7 +111,9 @@
def validate_service_unit(self):
if self.inpatient_record and self.service_unit:
- from erpnext.healthcare.doctype.inpatient_medication_entry.inpatient_medication_entry import get_current_healthcare_service_unit
+ from erpnext.healthcare.doctype.inpatient_medication_entry.inpatient_medication_entry import (
+ get_current_healthcare_service_unit,
+ )
is_inpatient_occupancy_unit = frappe.db.get_value('Healthcare Service Unit', self.service_unit,
'inpatient_occupancy')
@@ -333,17 +346,13 @@
def get_available_slots(practitioner_doc, date):
- available_slots = []
- slot_details = []
+ available_slots = slot_details = []
weekday = date.strftime('%A')
practitioner = practitioner_doc.name
for schedule_entry in practitioner_doc.practitioner_schedules:
- if schedule_entry.schedule:
- practitioner_schedule = frappe.get_doc('Practitioner Schedule', schedule_entry.schedule)
- else:
- frappe.throw(_('{0} does not have a Healthcare Practitioner Schedule. Add it in Healthcare Practitioner').format(
- frappe.bold(practitioner)), title=_('Practitioner Schedule Not Found'))
+ validate_practitioner_schedules(schedule_entry, practitioner)
+ practitioner_schedule = frappe.get_doc('Practitioner Schedule', schedule_entry.schedule)
if practitioner_schedule:
available_slots = []
@@ -386,6 +395,19 @@
return slot_details
+def validate_practitioner_schedules(schedule_entry, practitioner):
+ if schedule_entry.schedule:
+ if not schedule_entry.service_unit:
+ frappe.throw(_('Practitioner {0} does not have a Service Unit set against the Practitioner Schedule {1}.').format(
+ get_link_to_form('Healthcare Practitioner', practitioner), frappe.bold(schedule_entry.schedule)),
+ title=_('Service Unit Not Found'))
+
+ else:
+ frappe.throw(_('Practitioner {0} does not have a Practitioner Schedule assigned.').format(
+ get_link_to_form('Healthcare Practitioner', practitioner)),
+ title=_('Practitioner Schedule Not Found'))
+
+
@frappe.whitelist()
def update_status(appointment_id, status):
frappe.db.set_value('Patient Appointment', appointment_id, 'status', status)
diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment_dashboard.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment_dashboard.py
index 085c4f6..43c63c9 100644
--- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment_dashboard.py
+++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'appointment',
diff --git a/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py
index f5477c0..8ca30b8 100644
--- a/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py
+++ b/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py
@@ -2,12 +2,19 @@
# Copyright (c) 2015, ESS LLP and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
import frappe
-from erpnext.healthcare.doctype.patient_appointment.patient_appointment import update_status, make_encounter, check_payment_fields_reqd, check_is_new_patient
-from frappe.utils import nowdate, add_days, now_datetime
-from frappe.utils.make_random import get_random
+from frappe.utils import add_days, now_datetime, nowdate
+
from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
+from erpnext.healthcare.doctype.patient_appointment.patient_appointment import (
+ check_is_new_patient,
+ check_payment_fields_reqd,
+ make_encounter,
+ update_status,
+)
class TestPatientAppointment(unittest.TestCase):
@@ -66,7 +73,7 @@
medical_department = create_medical_department()
frappe.db.set_value('Healthcare Settings', None, 'enable_free_follow_ups', 0)
frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1)
- appointment_type = create_appointment_type()
+ appointment_type = create_appointment_type({'medical_department': medical_department})
appointment = create_appointment(patient, practitioner, add_days(nowdate(), 2),
invoice=1, appointment_type=appointment_type.name, department=medical_department)
@@ -91,9 +98,9 @@
'op_consulting_charge': 300
}]
appointment_type = create_appointment_type(args={
- 'name': 'Generic Appointment Type charge',
- 'items': items
- })
+ 'name': 'Generic Appointment Type charge',
+ 'items': items
+ })
appointment = create_appointment(patient, practitioner, add_days(nowdate(), 2),
invoice=1, appointment_type=appointment_type.name)
@@ -131,9 +138,16 @@
self.assertEqual(frappe.db.get_value('Sales Invoice', sales_invoice_name, 'status'), 'Cancelled')
def test_appointment_booking_for_admission_service_unit(self):
- from erpnext.healthcare.doctype.inpatient_record.inpatient_record import admit_patient, discharge_patient, schedule_discharge
- from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import \
- create_inpatient, get_healthcare_service_unit, mark_invoiced_inpatient_occupancy
+ from erpnext.healthcare.doctype.inpatient_record.inpatient_record import (
+ admit_patient,
+ discharge_patient,
+ schedule_discharge,
+ )
+ from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import (
+ create_inpatient,
+ get_healthcare_service_unit,
+ mark_invoiced_inpatient_occupancy,
+ )
frappe.db.sql("""delete from `tabInpatient Record`""")
patient, practitioner = create_healthcare_docs()
@@ -157,9 +171,16 @@
discharge_patient(ip_record1)
def test_invalid_healthcare_service_unit_validation(self):
- from erpnext.healthcare.doctype.inpatient_record.inpatient_record import admit_patient, discharge_patient, schedule_discharge
- from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import \
- create_inpatient, get_healthcare_service_unit, mark_invoiced_inpatient_occupancy
+ from erpnext.healthcare.doctype.inpatient_record.inpatient_record import (
+ admit_patient,
+ discharge_patient,
+ schedule_discharge,
+ )
+ from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import (
+ create_inpatient,
+ get_healthcare_service_unit,
+ mark_invoiced_inpatient_occupancy,
+ )
frappe.db.sql("""delete from `tabInpatient Record`""")
patient, practitioner = create_healthcare_docs()
@@ -259,7 +280,10 @@
self.assertRaises(OverlapError, appointment.save)
def test_service_unit_capacity(self):
- from erpnext.healthcare.doctype.patient_appointment.patient_appointment import MaximumCapacityError, OverlapError
+ from erpnext.healthcare.doctype.patient_appointment.patient_appointment import (
+ MaximumCapacityError,
+ OverlapError,
+ )
practitioner = create_practitioner()
capacity = 3
overlap_service_unit_type = create_service_unit_type(id=10, allow_appointments=1, overlap_appointments=1)
@@ -408,9 +432,9 @@
else:
item = create_healthcare_service_items()
items = [{
- 'medical_department': '_Test Medical Department',
- 'op_consulting_charge_item': item,
- 'op_consulting_charge': 200
+ 'medical_department': args.get('medical_department') or '_Test Medical Department',
+ 'op_consulting_charge_item': item,
+ 'op_consulting_charge': 200
}]
return frappe.get_doc({
'doctype': 'Appointment Type',
diff --git a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.py b/erpnext/healthcare/doctype/patient_assessment/patient_assessment.py
index 7bad20d..90cb300 100644
--- a/erpnext/healthcare/doctype/patient_assessment/patient_assessment.py
+++ b/erpnext/healthcare/doctype/patient_assessment/patient_assessment.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
+
class PatientAssessment(Document):
def validate(self):
self.set_total_score()
diff --git a/erpnext/healthcare/doctype/patient_assessment/test_patient_assessment.py b/erpnext/healthcare/doctype/patient_assessment/test_patient_assessment.py
index 3fda855..0ffbd1f 100644
--- a/erpnext/healthcare/doctype/patient_assessment/test_patient_assessment.py
+++ b/erpnext/healthcare/doctype/patient_assessment/test_patient_assessment.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestPatientAssessment(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/patient_assessment_detail/patient_assessment_detail.py b/erpnext/healthcare/doctype/patient_assessment_detail/patient_assessment_detail.py
index 0519599..4da679b 100644
--- a/erpnext/healthcare/doctype/patient_assessment_detail/patient_assessment_detail.py
+++ b/erpnext/healthcare/doctype/patient_assessment_detail/patient_assessment_detail.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class PatientAssessmentDetail(Document):
pass
diff --git a/erpnext/healthcare/doctype/patient_assessment_parameter/patient_assessment_parameter.py b/erpnext/healthcare/doctype/patient_assessment_parameter/patient_assessment_parameter.py
index b8e0074..783c537 100644
--- a/erpnext/healthcare/doctype/patient_assessment_parameter/patient_assessment_parameter.py
+++ b/erpnext/healthcare/doctype/patient_assessment_parameter/patient_assessment_parameter.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class PatientAssessmentParameter(Document):
pass
diff --git a/erpnext/healthcare/doctype/patient_assessment_parameter/test_patient_assessment_parameter.py b/erpnext/healthcare/doctype/patient_assessment_parameter/test_patient_assessment_parameter.py
index e722f99..f06fffb 100644
--- a/erpnext/healthcare/doctype/patient_assessment_parameter/test_patient_assessment_parameter.py
+++ b/erpnext/healthcare/doctype/patient_assessment_parameter/test_patient_assessment_parameter.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestPatientAssessmentParameter(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/patient_assessment_sheet/patient_assessment_sheet.py b/erpnext/healthcare/doctype/patient_assessment_sheet/patient_assessment_sheet.py
index 40da763..4686e9e 100644
--- a/erpnext/healthcare/doctype/patient_assessment_sheet/patient_assessment_sheet.py
+++ b/erpnext/healthcare/doctype/patient_assessment_sheet/patient_assessment_sheet.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class PatientAssessmentSheet(Document):
pass
diff --git a/erpnext/healthcare/doctype/patient_assessment_template/patient_assessment_template.py b/erpnext/healthcare/doctype/patient_assessment_template/patient_assessment_template.py
index 083cab5..e0d8fca 100644
--- a/erpnext/healthcare/doctype/patient_assessment_template/patient_assessment_template.py
+++ b/erpnext/healthcare/doctype/patient_assessment_template/patient_assessment_template.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class PatientAssessmentTemplate(Document):
pass
diff --git a/erpnext/healthcare/doctype/patient_assessment_template/test_patient_assessment_template.py b/erpnext/healthcare/doctype/patient_assessment_template/test_patient_assessment_template.py
index 86dbd54..7d639cb 100644
--- a/erpnext/healthcare/doctype/patient_assessment_template/test_patient_assessment_template.py
+++ b/erpnext/healthcare/doctype/patient_assessment_template/test_patient_assessment_template.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestPatientAssessmentTemplate(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py
index 7a745ae..2daa6c1 100644
--- a/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py
+++ b/erpnext/healthcare/doctype/patient_encounter/patient_encounter.py
@@ -3,12 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import cstr, getdate, add_days
-from frappe import _
from frappe.model.mapper import get_mapped_doc
+from frappe.utils import add_days, getdate
class PatientEncounter(Document):
diff --git a/erpnext/healthcare/doctype/patient_encounter/patient_encounter_dashboard.py b/erpnext/healthcare/doctype/patient_encounter/patient_encounter_dashboard.py
index 39e54f5..3b64d98 100644
--- a/erpnext/healthcare/doctype/patient_encounter/patient_encounter_dashboard.py
+++ b/erpnext/healthcare/doctype/patient_encounter/patient_encounter_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'encounter',
diff --git a/erpnext/healthcare/doctype/patient_encounter/test_patient_encounter.py b/erpnext/healthcare/doctype/patient_encounter/test_patient_encounter.py
index 9697682..fa643a3 100644
--- a/erpnext/healthcare/doctype/patient_encounter/test_patient_encounter.py
+++ b/erpnext/healthcare/doctype/patient_encounter/test_patient_encounter.py
@@ -2,9 +2,11 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
import frappe
+
from erpnext.healthcare.doctype.patient_encounter.patient_encounter import PatientEncounter
diff --git a/erpnext/healthcare/doctype/patient_encounter_diagnosis/patient_encounter_diagnosis.py b/erpnext/healthcare/doctype/patient_encounter_diagnosis/patient_encounter_diagnosis.py
index 34b0cf8..e4d2069 100644
--- a/erpnext/healthcare/doctype/patient_encounter_diagnosis/patient_encounter_diagnosis.py
+++ b/erpnext/healthcare/doctype/patient_encounter_diagnosis/patient_encounter_diagnosis.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class PatientEncounterDiagnosis(Document):
pass
diff --git a/erpnext/healthcare/doctype/patient_encounter_symptom/patient_encounter_symptom.py b/erpnext/healthcare/doctype/patient_encounter_symptom/patient_encounter_symptom.py
index bdb7bb2..47f2a2b 100644
--- a/erpnext/healthcare/doctype/patient_encounter_symptom/patient_encounter_symptom.py
+++ b/erpnext/healthcare/doctype/patient_encounter_symptom/patient_encounter_symptom.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class PatientEncounterSymptom(Document):
pass
diff --git a/erpnext/healthcare/doctype/patient_history_custom_document_type/patient_history_custom_document_type.py b/erpnext/healthcare/doctype/patient_history_custom_document_type/patient_history_custom_document_type.py
index f0a1f92..34e15dc 100644
--- a/erpnext/healthcare/doctype/patient_history_custom_document_type/patient_history_custom_document_type.py
+++ b/erpnext/healthcare/doctype/patient_history_custom_document_type/patient_history_custom_document_type.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class PatientHistoryCustomDocumentType(Document):
pass
diff --git a/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.py b/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.py
index 63b0085..b763591 100644
--- a/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.py
+++ b/erpnext/healthcare/doctype/patient_history_settings/patient_history_settings.py
@@ -3,13 +3,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
+
+import frappe
from frappe import _
-from frappe.utils import cstr, cint
from frappe.model.document import Document
+from frappe.utils import cint, cstr
+
from erpnext.healthcare.page.patient_history.patient_history import get_patient_history_doctypes
+
class PatientHistorySettings(Document):
def validate(self):
self.validate_submittable_doctypes()
@@ -18,7 +22,7 @@
def validate_submittable_doctypes(self):
for entry in self.custom_doctypes:
if not cint(frappe.db.get_value('DocType', entry.document_type, 'is_submittable')):
- msg = _('Row #{0}: Document Type {1} is not submittable. ').format(
+ msg = _('Row #{0}: Document Type {1} is not submittable.').format(
entry.idx, frappe.bold(entry.document_type))
msg += _('Patient Medical Record can only be created for submittable document types.')
frappe.throw(msg)
@@ -116,12 +120,12 @@
fieldname = entry.get('fieldname')
if entry.get('fieldtype') == 'Table' and doc.get(fieldname):
formatted_value = get_formatted_value_for_table_field(doc.get(fieldname), meta.get_field(fieldname))
- subject += frappe.bold(_(entry.get('label')) + ': ') + '<br>' + cstr(formatted_value) + '<br>'
+ subject += frappe.bold(_(entry.get('label')) + ':') + '<br>' + cstr(formatted_value) + '<br>'
else:
if doc.get(fieldname):
formatted_value = format_value(doc.get(fieldname), meta.get_field(fieldname), doc)
- subject += frappe.bold(_(entry.get('label')) + ': ') + cstr(formatted_value) + '<br>'
+ subject += frappe.bold(_(entry.get('label')) + ':') + cstr(formatted_value) + '<br>'
return subject
diff --git a/erpnext/healthcare/doctype/patient_history_settings/test_patient_history_settings.py b/erpnext/healthcare/doctype/patient_history_settings/test_patient_history_settings.py
index 33119d8..c37a2ad 100644
--- a/erpnext/healthcare/doctype/patient_history_settings/test_patient_history_settings.py
+++ b/erpnext/healthcare/doctype/patient_history_settings/test_patient_history_settings.py
@@ -3,12 +3,15 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
-import unittest
import json
+import unittest
+
+import frappe
from frappe.utils import getdate, strip_html
+
from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_patient
+
class TestPatientHistorySettings(unittest.TestCase):
def setUp(self):
dt = create_custom_doctype()
@@ -38,13 +41,12 @@
# tests for medical record creation of standard doctypes in test_patient_medical_record.py
patient = create_patient()
doc = create_doc(patient)
-
# check for medical record
medical_rec = frappe.db.exists("Patient Medical Record", {"status": "Open", "reference_name": doc.name})
self.assertTrue(medical_rec)
medical_rec = frappe.get_doc("Patient Medical Record", medical_rec)
- expected_subject = "Date: {0}Rating: 3Feedback: Test Patient History Settings".format(
+ expected_subject = "Date:{0}Rating:3Feedback:Test Patient History Settings".format(
frappe.utils.format_date(getdate()))
self.assertEqual(strip_html(medical_rec.subject), expected_subject)
self.assertEqual(medical_rec.patient, patient)
diff --git a/erpnext/healthcare/doctype/patient_history_standard_document_type/patient_history_standard_document_type.py b/erpnext/healthcare/doctype/patient_history_standard_document_type/patient_history_standard_document_type.py
index 2d94911..b7dd09b 100644
--- a/erpnext/healthcare/doctype/patient_history_standard_document_type/patient_history_standard_document_type.py
+++ b/erpnext/healthcare/doctype/patient_history_standard_document_type/patient_history_standard_document_type.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class PatientHistoryStandardDocumentType(Document):
pass
diff --git a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.py b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.py
index 35e42bd..ac2cffa 100644
--- a/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.py
+++ b/erpnext/healthcare/doctype/patient_medical_record/patient_medical_record.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class PatientMedicalRecord(Document):
def after_insert(self):
if self.reference_doctype == "Patient Medical Record" :
diff --git a/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py b/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py
index 5b7d8d6..099146c 100644
--- a/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py
+++ b/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py
@@ -2,11 +2,20 @@
# Copyright (c) 2015, ESS LLP and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
import frappe
from frappe.utils import nowdate
-from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_encounter, create_healthcare_docs, create_appointment, create_medical_department
+
from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
+from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import (
+ create_appointment,
+ create_encounter,
+ create_healthcare_docs,
+ create_medical_department,
+)
+
class TestPatientMedicalRecord(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/healthcare/doctype/patient_relation/patient_relation.py b/erpnext/healthcare/doctype/patient_relation/patient_relation.py
index 150b962..17bc209 100644
--- a/erpnext/healthcare/doctype/patient_relation/patient_relation.py
+++ b/erpnext/healthcare/doctype/patient_relation/patient_relation.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class PatientRelation(Document):
pass
diff --git a/erpnext/healthcare/doctype/practitioner_schedule/practitioner_schedule.py b/erpnext/healthcare/doctype/practitioner_schedule/practitioner_schedule.py
index 8bd0937..7fa31e5 100644
--- a/erpnext/healthcare/doctype/practitioner_schedule/practitioner_schedule.py
+++ b/erpnext/healthcare/doctype/practitioner_schedule/practitioner_schedule.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class PractitionerSchedule(Document):
def autoname(self):
self.name = self.schedule_name
diff --git a/erpnext/healthcare/doctype/practitioner_schedule/test_practitioner_schedule.py b/erpnext/healthcare/doctype/practitioner_schedule/test_practitioner_schedule.py
index 52638cb..1ecaa47 100644
--- a/erpnext/healthcare/doctype/practitioner_schedule/test_practitioner_schedule.py
+++ b/erpnext/healthcare/doctype/practitioner_schedule/test_practitioner_schedule.py
@@ -2,7 +2,9 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestPractitionerSchedule(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/practitioner_service_unit_schedule/practitioner_service_unit_schedule.py b/erpnext/healthcare/doctype/practitioner_service_unit_schedule/practitioner_service_unit_schedule.py
index c18a440..4eba1fb 100644
--- a/erpnext/healthcare/doctype/practitioner_service_unit_schedule/practitioner_service_unit_schedule.py
+++ b/erpnext/healthcare/doctype/practitioner_service_unit_schedule/practitioner_service_unit_schedule.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class PractitionerServiceUnitSchedule(Document):
pass
diff --git a/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.py b/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.py
index dea263d..19f9b70 100644
--- a/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.py
+++ b/erpnext/healthcare/doctype/prescription_dosage/prescription_dosage.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class PrescriptionDosage(Document):
pass
diff --git a/erpnext/healthcare/doctype/prescription_dosage/test_prescription_dosage.py b/erpnext/healthcare/doctype/prescription_dosage/test_prescription_dosage.py
index e61a418..cabfd35 100644
--- a/erpnext/healthcare/doctype/prescription_dosage/test_prescription_dosage.py
+++ b/erpnext/healthcare/doctype/prescription_dosage/test_prescription_dosage.py
@@ -2,7 +2,9 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestPrescriptionDosage(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/prescription_duration/prescription_duration.py b/erpnext/healthcare/doctype/prescription_duration/prescription_duration.py
index 96ddf8d..988276d 100644
--- a/erpnext/healthcare/doctype/prescription_duration/prescription_duration.py
+++ b/erpnext/healthcare/doctype/prescription_duration/prescription_duration.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
from frappe.utils import cstr
+
class PrescriptionDuration(Document):
def autoname(self):
self.name = " ".join(filter(None,
diff --git a/erpnext/healthcare/doctype/prescription_duration/test_prescription_duration.py b/erpnext/healthcare/doctype/prescription_duration/test_prescription_duration.py
index fe5524c..197bb3e 100644
--- a/erpnext/healthcare/doctype/prescription_duration/test_prescription_duration.py
+++ b/erpnext/healthcare/doctype/prescription_duration/test_prescription_duration.py
@@ -2,7 +2,9 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestPrescriptionDuration(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/procedure_prescription/procedure_prescription.py b/erpnext/healthcare/doctype/procedure_prescription/procedure_prescription.py
index 62ea9f1..f4d29fa 100644
--- a/erpnext/healthcare/doctype/procedure_prescription/procedure_prescription.py
+++ b/erpnext/healthcare/doctype/procedure_prescription/procedure_prescription.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class ProcedurePrescription(Document):
pass
diff --git a/erpnext/healthcare/doctype/sample_collection/sample_collection.py b/erpnext/healthcare/doctype/sample_collection/sample_collection.py
index 461f809..7de6ac0 100644
--- a/erpnext/healthcare/doctype/sample_collection/sample_collection.py
+++ b/erpnext/healthcare/doctype/sample_collection/sample_collection.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
+from frappe import _
from frappe.model.document import Document
from frappe.utils import flt
-from frappe import _
+
class SampleCollection(Document):
def validate(self):
diff --git a/erpnext/healthcare/doctype/sensitivity/sensitivity.py b/erpnext/healthcare/doctype/sensitivity/sensitivity.py
index bf7c36b..f61781d 100644
--- a/erpnext/healthcare/doctype/sensitivity/sensitivity.py
+++ b/erpnext/healthcare/doctype/sensitivity/sensitivity.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class Sensitivity(Document):
pass
diff --git a/erpnext/healthcare/doctype/sensitivity/test_sensitivity.py b/erpnext/healthcare/doctype/sensitivity/test_sensitivity.py
index 1616d2d..c772c72 100644
--- a/erpnext/healthcare/doctype/sensitivity/test_sensitivity.py
+++ b/erpnext/healthcare/doctype/sensitivity/test_sensitivity.py
@@ -2,6 +2,7 @@
# Copyright (c) 2015, ESS and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
# test_records = frappe.get_test_records('Sensitivity')
diff --git a/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.py b/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.py
index 64f1e6c..53f7acc 100644
--- a/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.py
+++ b/erpnext/healthcare/doctype/sensitivity_test_result/sensitivity_test_result.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class SensitivityTestResult(Document):
pass
diff --git a/erpnext/healthcare/doctype/therapy_plan/test_therapy_plan.py b/erpnext/healthcare/doctype/therapy_plan/test_therapy_plan.py
index 983fba9..4f96f6a 100644
--- a/erpnext/healthcare/doctype/therapy_plan/test_therapy_plan.py
+++ b/erpnext/healthcare/doctype/therapy_plan/test_therapy_plan.py
@@ -3,13 +3,23 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import getdate, flt, nowdate
+
+import frappe
+from frappe.utils import flt, getdate, nowdate
+
+from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import (
+ create_appointment,
+ create_healthcare_docs,
+ create_medical_department,
+ create_patient,
+)
+from erpnext.healthcare.doctype.therapy_plan.therapy_plan import (
+ make_sales_invoice,
+ make_therapy_session,
+)
from erpnext.healthcare.doctype.therapy_type.test_therapy_type import create_therapy_type
-from erpnext.healthcare.doctype.therapy_plan.therapy_plan import make_therapy_session, make_sales_invoice
-from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import \
- create_healthcare_docs, create_patient, create_appointment, create_medical_department
+
class TestTherapyPlan(unittest.TestCase):
def test_creation_on_encounter_submission(self):
@@ -31,7 +41,7 @@
self.assertEqual(frappe.db.get_value('Therapy Plan', plan.name, 'status'), 'Completed')
patient, practitioner = create_healthcare_docs()
- appointment = create_appointment(patient, practitioner, nowdate())
+ appointment = create_appointment(patient, practitioner, nowdate())
session = make_therapy_session(plan.name, plan.patient, 'Basic Rehab', '_Test Company', appointment.name)
session = frappe.get_doc(session)
diff --git a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.py b/erpnext/healthcare/doctype/therapy_plan/therapy_plan.py
index e209660..6d63f39 100644
--- a/erpnext/healthcare/doctype/therapy_plan/therapy_plan.py
+++ b/erpnext/healthcare/doctype/therapy_plan/therapy_plan.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
from frappe.utils import flt, today
+
class TherapyPlan(Document):
def validate(self):
self.set_totals()
diff --git a/erpnext/healthcare/doctype/therapy_plan/therapy_plan_dashboard.py b/erpnext/healthcare/doctype/therapy_plan/therapy_plan_dashboard.py
index 6526acd..25c8df1 100644
--- a/erpnext/healthcare/doctype/therapy_plan/therapy_plan_dashboard.py
+++ b/erpnext/healthcare/doctype/therapy_plan/therapy_plan_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'therapy_plan',
diff --git a/erpnext/healthcare/doctype/therapy_plan_detail/therapy_plan_detail.py b/erpnext/healthcare/doctype/therapy_plan_detail/therapy_plan_detail.py
index 44211f3..1842fc2 100644
--- a/erpnext/healthcare/doctype/therapy_plan_detail/therapy_plan_detail.py
+++ b/erpnext/healthcare/doctype/therapy_plan_detail/therapy_plan_detail.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class TherapyPlanDetail(Document):
pass
diff --git a/erpnext/healthcare/doctype/therapy_plan_template/test_therapy_plan_template.py b/erpnext/healthcare/doctype/therapy_plan_template/test_therapy_plan_template.py
index 33ee29d..cd3d568 100644
--- a/erpnext/healthcare/doctype/therapy_plan_template/test_therapy_plan_template.py
+++ b/erpnext/healthcare/doctype/therapy_plan_template/test_therapy_plan_template.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestTherapyPlanTemplate(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.py b/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.py
index 635d4be..f5512be 100644
--- a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.py
+++ b/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
from frappe.utils import cint, flt
+
from erpnext.healthcare.doctype.therapy_type.therapy_type import make_item_price
+
class TherapyPlanTemplate(Document):
def after_insert(self):
self.create_item_from_template()
diff --git a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template_dashboard.py b/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template_dashboard.py
index c748fbf..def5c48 100644
--- a/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template_dashboard.py
+++ b/erpnext/healthcare/doctype/therapy_plan_template/therapy_plan_template_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'therapy_plan_template',
diff --git a/erpnext/healthcare/doctype/therapy_plan_template_detail/therapy_plan_template_detail.py b/erpnext/healthcare/doctype/therapy_plan_template_detail/therapy_plan_template_detail.py
index 7b979fe..104c1bf 100644
--- a/erpnext/healthcare/doctype/therapy_plan_template_detail/therapy_plan_template_detail.py
+++ b/erpnext/healthcare/doctype/therapy_plan_template_detail/therapy_plan_template_detail.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class TherapyPlanTemplateDetail(Document):
pass
diff --git a/erpnext/healthcare/doctype/therapy_session/test_therapy_session.py b/erpnext/healthcare/doctype/therapy_session/test_therapy_session.py
index 75bb8df..e4afacf 100644
--- a/erpnext/healthcare/doctype/therapy_session/test_therapy_session.py
+++ b/erpnext/healthcare/doctype/therapy_session/test_therapy_session.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestTherapySession(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/therapy_session/therapy_session.py b/erpnext/healthcare/doctype/therapy_session/therapy_session.py
index 51f267f..915e6e4 100644
--- a/erpnext/healthcare/doctype/therapy_session/therapy_session.py
+++ b/erpnext/healthcare/doctype/therapy_session/therapy_session.py
@@ -3,14 +3,20 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import datetime
-from frappe.model.document import Document
-from frappe.utils import get_time, flt
-from frappe.model.mapper import get_mapped_doc
+
+import frappe
from frappe import _
-from frappe.utils import cstr, getdate, get_link_to_form
-from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account, get_income_account
+from frappe.model.document import Document
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import flt, get_link_to_form, get_time, getdate
+
+from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import (
+ get_income_account,
+ get_receivable_account,
+)
+
class TherapySession(Document):
def validate(self):
diff --git a/erpnext/healthcare/doctype/therapy_session/therapy_session_dashboard.py b/erpnext/healthcare/doctype/therapy_session/therapy_session_dashboard.py
index 9de7e29..b8a3782 100644
--- a/erpnext/healthcare/doctype/therapy_session/therapy_session_dashboard.py
+++ b/erpnext/healthcare/doctype/therapy_session/therapy_session_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'therapy_session',
diff --git a/erpnext/healthcare/doctype/therapy_type/test_therapy_type.py b/erpnext/healthcare/doctype/therapy_type/test_therapy_type.py
index 80fc83f..23d5422 100644
--- a/erpnext/healthcare/doctype/therapy_type/test_therapy_type.py
+++ b/erpnext/healthcare/doctype/therapy_type/test_therapy_type.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestTherapyType(unittest.TestCase):
def test_therapy_type_item(self):
therapy_type = create_therapy_type()
diff --git a/erpnext/healthcare/doctype/therapy_type/therapy_type.py b/erpnext/healthcare/doctype/therapy_type/therapy_type.py
index 3f6a36a..3517ef2 100644
--- a/erpnext/healthcare/doctype/therapy_type/therapy_type.py
+++ b/erpnext/healthcare/doctype/therapy_type/therapy_type.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
+
+import frappe
from frappe import _
-from frappe.utils import cint
from frappe.model.document import Document
from frappe.model.rename_doc import rename_doc
+from frappe.utils import cint
+
class TherapyType(Document):
def validate(self):
diff --git a/erpnext/healthcare/doctype/treatment_plan_template/test_treatment_plan_template.py b/erpnext/healthcare/doctype/treatment_plan_template/test_treatment_plan_template.py
index 21ede71..b8a1dd7 100644
--- a/erpnext/healthcare/doctype/treatment_plan_template/test_treatment_plan_template.py
+++ b/erpnext/healthcare/doctype/treatment_plan_template/test_treatment_plan_template.py
@@ -4,5 +4,6 @@
# import frappe
import unittest
+
class TestTreatmentPlanTemplate(unittest.TestCase):
pass
diff --git a/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template.py b/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template.py
index a92e266..dbe0e9a 100644
--- a/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template.py
+++ b/erpnext/healthcare/doctype/treatment_plan_template/treatment_plan_template.py
@@ -5,6 +5,7 @@
from frappe import _
from frappe.model.document import Document
+
class TreatmentPlanTemplate(Document):
def validate(self):
self.validate_age()
diff --git a/erpnext/healthcare/doctype/treatment_plan_template_item/treatment_plan_template_item.py b/erpnext/healthcare/doctype/treatment_plan_template_item/treatment_plan_template_item.py
index 5f58b06..8b8d89f 100644
--- a/erpnext/healthcare/doctype/treatment_plan_template_item/treatment_plan_template_item.py
+++ b/erpnext/healthcare/doctype/treatment_plan_template_item/treatment_plan_template_item.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class TreatmentPlanTemplateItem(Document):
pass
diff --git a/erpnext/healthcare/doctype/treatment_plan_template_practitioner/treatment_plan_template_practitioner.py b/erpnext/healthcare/doctype/treatment_plan_template_practitioner/treatment_plan_template_practitioner.py
index 6d34568..c2d08bc 100644
--- a/erpnext/healthcare/doctype/treatment_plan_template_practitioner/treatment_plan_template_practitioner.py
+++ b/erpnext/healthcare/doctype/treatment_plan_template_practitioner/treatment_plan_template_practitioner.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class TreatmentPlanTemplatePractitioner(Document):
pass
diff --git a/erpnext/healthcare/doctype/vital_signs/test_vital_signs.py b/erpnext/healthcare/doctype/vital_signs/test_vital_signs.py
index 5d3e007..22b52fb 100644
--- a/erpnext/healthcare/doctype/vital_signs/test_vital_signs.py
+++ b/erpnext/healthcare/doctype/vital_signs/test_vital_signs.py
@@ -2,6 +2,7 @@
# Copyright (c) 2015, ESS LLP and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
# test_records = frappe.get_test_records('Vital Signs')
diff --git a/erpnext/healthcare/doctype/vital_signs/vital_signs.py b/erpnext/healthcare/doctype/vital_signs/vital_signs.py
index 4bb3940..29dbeb4 100644
--- a/erpnext/healthcare/doctype/vital_signs/vital_signs.py
+++ b/erpnext/healthcare/doctype/vital_signs/vital_signs.py
@@ -3,10 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
-from frappe.utils import cstr
from frappe import _
+from frappe.model.document import Document
+
class VitalSigns(Document):
def validate(self):
diff --git a/erpnext/healthcare/module_onboarding/healthcare/healthcare.json b/erpnext/healthcare/module_onboarding/healthcare/healthcare.json
index 56c3c13..0aa8f9a 100644
--- a/erpnext/healthcare/module_onboarding/healthcare/healthcare.json
+++ b/erpnext/healthcare/module_onboarding/healthcare/healthcare.json
@@ -10,7 +10,7 @@
"documentation_url": "https://docs.erpnext.com/docs/user/manual/en/healthcare",
"idx": 0,
"is_complete": 0,
- "modified": "2020-07-08 14:06:19.512946",
+ "modified": "2021-01-30 19:22:20.273766",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Healthcare",
diff --git a/erpnext/healthcare/onboarding_step/create_healthcare_practitioner/create_healthcare_practitioner.json b/erpnext/healthcare/onboarding_step/create_healthcare_practitioner/create_healthcare_practitioner.json
index c45a347..3f25a9d 100644
--- a/erpnext/healthcare/onboarding_step/create_healthcare_practitioner/create_healthcare_practitioner.json
+++ b/erpnext/healthcare/onboarding_step/create_healthcare_practitioner/create_healthcare_practitioner.json
@@ -5,14 +5,14 @@
"doctype": "Onboarding Step",
"idx": 0,
"is_complete": 0,
- "is_mandatory": 1,
"is_single": 0,
"is_skipped": 0,
- "modified": "2020-05-26 23:16:31.965521",
+ "modified": "2021-01-30 12:02:22.849260",
"modified_by": "Administrator",
"name": "Create Healthcare Practitioner",
"owner": "Administrator",
"reference_document": "Healthcare Practitioner",
+ "show_form_tour": 0,
"show_full_form": 1,
"title": "Create Healthcare Practitioner",
"validate_action": 1
diff --git a/erpnext/healthcare/onboarding_step/create_patient/create_patient.json b/erpnext/healthcare/onboarding_step/create_patient/create_patient.json
index 77bc5bd..b46bb15 100644
--- a/erpnext/healthcare/onboarding_step/create_patient/create_patient.json
+++ b/erpnext/healthcare/onboarding_step/create_patient/create_patient.json
@@ -5,14 +5,14 @@
"doctype": "Onboarding Step",
"idx": 0,
"is_complete": 0,
- "is_mandatory": 1,
"is_single": 0,
"is_skipped": 0,
- "modified": "2020-05-19 12:26:24.023418",
- "modified_by": "Administrator",
+ "modified": "2021-01-30 00:09:28.786428",
+ "modified_by": "ruchamahabal2@gmail.com",
"name": "Create Patient",
"owner": "Administrator",
"reference_document": "Patient",
+ "show_form_tour": 0,
"show_full_form": 1,
"title": "Create Patient",
"validate_action": 1
diff --git a/erpnext/healthcare/onboarding_step/create_practitioner_schedule/create_practitioner_schedule.json b/erpnext/healthcare/onboarding_step/create_practitioner_schedule/create_practitioner_schedule.json
index 65980ef..7ce122d 100644
--- a/erpnext/healthcare/onboarding_step/create_practitioner_schedule/create_practitioner_schedule.json
+++ b/erpnext/healthcare/onboarding_step/create_practitioner_schedule/create_practitioner_schedule.json
@@ -5,14 +5,14 @@
"doctype": "Onboarding Step",
"idx": 0,
"is_complete": 0,
- "is_mandatory": 1,
"is_single": 0,
"is_skipped": 0,
- "modified": "2020-05-19 12:27:09.437825",
- "modified_by": "Administrator",
+ "modified": "2021-01-30 00:09:28.794602",
+ "modified_by": "ruchamahabal2@gmail.com",
"name": "Create Practitioner Schedule",
"owner": "Administrator",
"reference_document": "Practitioner Schedule",
+ "show_form_tour": 0,
"show_full_form": 1,
"title": "Create Practitioner Schedule",
"validate_action": 1
diff --git a/erpnext/healthcare/onboarding_step/explore_clinical_procedure_templates/explore_clinical_procedure_templates.json b/erpnext/healthcare/onboarding_step/explore_clinical_procedure_templates/explore_clinical_procedure_templates.json
index 697b761..dfe9f71 100644
--- a/erpnext/healthcare/onboarding_step/explore_clinical_procedure_templates/explore_clinical_procedure_templates.json
+++ b/erpnext/healthcare/onboarding_step/explore_clinical_procedure_templates/explore_clinical_procedure_templates.json
@@ -5,14 +5,14 @@
"doctype": "Onboarding Step",
"idx": 0,
"is_complete": 0,
- "is_mandatory": 0,
"is_single": 0,
"is_skipped": 0,
- "modified": "2020-05-26 23:10:24.504030",
+ "modified": "2021-01-30 19:22:08.257160",
"modified_by": "Administrator",
"name": "Explore Clinical Procedure Templates",
"owner": "Administrator",
"reference_document": "Clinical Procedure Template",
+ "show_form_tour": 0,
"show_full_form": 0,
"title": "Explore Clinical Procedure Templates",
"validate_action": 1
diff --git a/erpnext/healthcare/onboarding_step/explore_healthcare_settings/explore_healthcare_settings.json b/erpnext/healthcare/onboarding_step/explore_healthcare_settings/explore_healthcare_settings.json
index b2d5aef..2d952f3 100644
--- a/erpnext/healthcare/onboarding_step/explore_healthcare_settings/explore_healthcare_settings.json
+++ b/erpnext/healthcare/onboarding_step/explore_healthcare_settings/explore_healthcare_settings.json
@@ -5,14 +5,14 @@
"doctype": "Onboarding Step",
"idx": 0,
"is_complete": 0,
- "is_mandatory": 1,
"is_single": 1,
"is_skipped": 0,
- "modified": "2020-05-26 23:10:24.507648",
+ "modified": "2021-01-30 19:22:07.275735",
"modified_by": "Administrator",
"name": "Explore Healthcare Settings",
"owner": "Administrator",
"reference_document": "Healthcare Settings",
+ "show_form_tour": 0,
"show_full_form": 0,
"title": "Explore Healthcare Settings",
"validate_action": 1
diff --git a/erpnext/healthcare/onboarding_step/introduction_to_healthcare_practitioner/introduction_to_healthcare_practitioner.json b/erpnext/healthcare/onboarding_step/introduction_to_healthcare_practitioner/introduction_to_healthcare_practitioner.json
index fa4c903..baa8358 100644
--- a/erpnext/healthcare/onboarding_step/introduction_to_healthcare_practitioner/introduction_to_healthcare_practitioner.json
+++ b/erpnext/healthcare/onboarding_step/introduction_to_healthcare_practitioner/introduction_to_healthcare_practitioner.json
@@ -6,14 +6,14 @@
"field": "schedule",
"idx": 0,
"is_complete": 0,
- "is_mandatory": 1,
"is_single": 0,
"is_skipped": 0,
- "modified": "2020-05-26 22:07:07.482530",
- "modified_by": "Administrator",
+ "modified": "2021-01-30 00:09:28.807129",
+ "modified_by": "ruchamahabal2@gmail.com",
"name": "Introduction to Healthcare Practitioner",
"owner": "Administrator",
"reference_document": "Healthcare Practitioner",
+ "show_form_tour": 0,
"show_full_form": 0,
"title": "Introduction to Healthcare Practitioner",
"validate_action": 0
diff --git a/erpnext/healthcare/page/patient_history/patient_history.css b/erpnext/healthcare/page/patient_history/patient_history.css
index 1bb5891..74b5e7e 100644
--- a/erpnext/healthcare/page/patient_history/patient_history.css
+++ b/erpnext/healthcare/page/patient_history/patient_history.css
@@ -9,6 +9,26 @@
cursor: pointer;
}
+.patient-image-container {
+ margin-top: 17px;
+ }
+
+.patient-image {
+ display: inline-block;
+ width: 100%;
+ height: 0;
+ padding: 50% 0px;
+ background-size: cover;
+ background-repeat: no-repeat;
+ background-position: center center;
+ border-radius: 4px;
+}
+
+.patient-name {
+ font-size: 20px;
+ margin-top: 25px;
+}
+
.medical_record-label {
max-width: 100px;
margin-bottom: -4px;
@@ -19,19 +39,19 @@
}
.date-indicator {
- background:none;
- font-size:12px;
- vertical-align:middle;
- font-weight:bold;
- color:#6c7680;
+ background:none;
+ font-size:12px;
+ vertical-align:middle;
+ font-weight:bold;
+ color:#6c7680;
}
.date-indicator::after {
- margin:0 -4px 0 12px;
- content:'';
- display:inline-block;
- height:8px;
- width:8px;
- border-radius:8px;
+ margin:0 -4px 0 12px;
+ content:'';
+ display:inline-block;
+ height:8px;
+ width:8px;
+ border-radius:8px;
background: #d1d8dd;
}
diff --git a/erpnext/healthcare/page/patient_history/patient_history.html b/erpnext/healthcare/page/patient_history/patient_history.html
index f170655..d16b386 100644
--- a/erpnext/healthcare/page/patient_history/patient_history.html
+++ b/erpnext/healthcare/page/patient_history/patient_history.html
@@ -1,26 +1,18 @@
-<div class="col-sm-12">
- <div class="col-sm-3">
- <p class="patient" style="margin: auto; max-width: 300px; margin-bottom: 20px;"></p>
- <div class="patient_details" style="z-index=0"></div>
+<div class="row patient-documents">
+ <div class="col-sm-12">
+ <div class="col-sm-12 show_chart_btns" align="center">
+ </div>
+ <div id="chart" class="col-sm-12 patient_vital_charts">
+ </div>
</div>
- <div class="col-sm-9 patient_documents">
- <div class="col-sm-12">
- <div class="col-sm-12 show_chart_btns" align="center">
- </div>
- <div id="chart" class="col-sm-12 patient_vital_charts">
- </div>
- </div>
- <div class="header-separator col-sm-12 d-flex border-bottom py-3" style="display:none"></div>
- <div class="row">
- <div class="col-sm-12 d-flex">
- <div class="patient-history-filter doctype-filter"></div>
- <div class="patient-history-filter date-filter"></div>
- </div>
- </div>
- <div class="col-sm-12 patient_documents_list">
- </div>
- <div class="col-sm-12 text-center py-3">
- <a class="btn btn-sm btn-default btn-get-records" style="display:none">More..</a>
- </div>
+ <div class="header-separator col-sm-12 d-flex border-bottom py-3" style="display:none"></div>
+ <div class="col-sm-12 d-flex">
+ <div class="patient-history-filter doctype-filter"></div>
+ <div class="patient-history-filter date-filter"></div>
+ </div>
+ <div class="col-sm-12 patient_documents_list">
+ </div>
+ <div class="col-sm-12 text-center py-3">
+ <a class="btn btn-sm btn-default btn-get-records" style="display:none">More..</a>
</div>
</div>
diff --git a/erpnext/healthcare/page/patient_history/patient_history.js b/erpnext/healthcare/page/patient_history/patient_history.js
index 54343aa..ed2dc52 100644
--- a/erpnext/healthcare/page/patient_history/patient_history.js
+++ b/erpnext/healthcare/page/patient_history/patient_history.js
@@ -1,403 +1,455 @@
frappe.provide('frappe.patient_history');
frappe.pages['patient_history'].on_page_load = function(wrapper) {
- let me = this;
- let page = frappe.ui.make_app_page({
+ frappe.ui.make_app_page({
parent: wrapper,
- title: 'Patient History',
- single_column: true
+ title: __('Patient History')
});
- frappe.breadcrumbs.add('Healthcare');
- let pid = '';
- page.main.html(frappe.render_template('patient_history', {}));
- page.main.find('.header-separator').hide();
-
- let patient = frappe.ui.form.make_control({
- parent: page.main.find('.patient'),
- df: {
- fieldtype: 'Link',
- options: 'Patient',
- fieldname: 'patient',
- placeholder: __('Select Patient'),
- only_select: true,
- change: function() {
- let patient_id = patient.get_value();
- if (pid != patient_id && patient_id) {
- me.start = 0;
- me.page.main.find('.patient_documents_list').html('');
- setup_filters(patient_id, me);
- get_documents(patient_id, me);
- show_patient_info(patient_id, me);
- show_patient_vital_charts(patient_id, me, 'bp', 'mmHg', 'Blood Pressure');
- }
- pid = patient_id;
- }
- },
- });
- patient.refresh();
-
- if (frappe.route_options) {
- patient.set_value(frappe.route_options.patient);
- }
-
- this.page.main.on('click', '.btn-show-chart', function() {
- let btn_show_id = $(this).attr('data-show-chart-id'), pts = $(this).attr('data-pts');
- let title = $(this).attr('data-title');
- show_patient_vital_charts(patient.get_value(), me, btn_show_id, pts, title);
- });
-
- this.page.main.on('click', '.btn-more', function() {
- let doctype = $(this).attr('data-doctype'), docname = $(this).attr('data-docname');
- if (me.page.main.find('.'+docname).parent().find('.document-html').attr('data-fetched') == '1') {
- me.page.main.find('.'+docname).hide();
- me.page.main.find('.'+docname).parent().find('.document-html').show();
- } else {
- if (doctype && docname) {
- let exclude = ['patient', 'patient_name', 'patient_sex', 'encounter_date'];
- frappe.call({
- method: 'erpnext.healthcare.utils.render_doc_as_html',
- args:{
- doctype: doctype,
- docname: docname,
- exclude_fields: exclude
- },
- freeze: true,
- callback: function(r) {
- if (r.message) {
- me.page.main.find('.' + docname).hide();
-
- me.page.main.find('.' + docname).parent().find('.document-html').html(
- `${r.message.html}
- <div align='center'>
- <a class='btn octicon octicon-chevron-up btn-default btn-xs btn-less'
- data-doctype='${doctype}'
- data-docname='${docname}'>
- </a>
- </div>
- `);
-
- me.page.main.find('.' + docname).parent().find('.document-html').show();
- me.page.main.find('.' + docname).parent().find('.document-html').attr('data-fetched', '1');
- }
- }
- });
- }
- }
- });
-
- this.page.main.on('click', '.btn-less', function() {
- let docname = $(this).attr('data-docname');
- me.page.main.find('.' + docname).parent().find('.document-id').show();
- me.page.main.find('.' + docname).parent().find('.document-html').hide();
- });
- me.start = 0;
- me.page.main.on('click', '.btn-get-records', function() {
- get_documents(patient.get_value(), me);
+ let patient_history = new PatientHistory(wrapper);
+ $(wrapper).bind('show', ()=> {
+ patient_history.show();
});
};
-let setup_filters = function(patient, me) {
- $('.doctype-filter').empty();
- frappe.xcall(
- 'erpnext.healthcare.page.patient_history.patient_history.get_patient_history_doctypes'
- ).then(document_types => {
- let doctype_filter = frappe.ui.form.make_control({
- parent: $('.doctype-filter'),
+class PatientHistory {
+ constructor(wrapper) {
+ this.wrapper = $(wrapper);
+ this.page = wrapper.page;
+ this.sidebar = this.wrapper.find('.layout-side-section');
+ this.main_section = this.wrapper.find('.layout-main-section');
+ this.start = 0;
+ }
+
+ show() {
+ frappe.breadcrumbs.add('Healthcare');
+ this.sidebar.empty();
+
+ let me = this;
+ let patient = frappe.ui.form.make_control({
+ parent: me.sidebar,
df: {
- fieldtype: 'MultiSelectList',
- fieldname: 'document_type',
- placeholder: __('Select Document Type'),
- input_class: 'input-xs',
+ fieldtype: 'Link',
+ options: 'Patient',
+ fieldname: 'patient',
+ placeholder: __('Select Patient'),
+ only_select: true,
change: () => {
- me.start = 0;
- me.page.main.find('.patient_documents_list').html('');
- get_documents(patient, me, doctype_filter.get_value(), date_range_field.get_value());
- },
- get_data: () => {
- return document_types.map(document_type => {
- return {
- description: document_type,
- value: document_type
- };
- });
- },
+ me.patient_id = '';
+ if (me.patient_id != patient.get_value() && patient.get_value()) {
+ me.start = 0;
+ me.patient_id = patient.get_value();
+ me.make_patient_profile();
+ }
+ }
}
});
- doctype_filter.refresh();
+ patient.refresh();
- $('.date-filter').empty();
- let date_range_field = frappe.ui.form.make_control({
- df: {
- fieldtype: 'DateRange',
- fieldname: 'date_range',
- placeholder: __('Date Range'),
- input_class: 'input-xs',
- change: () => {
- let selected_date_range = date_range_field.get_value();
- if (selected_date_range && selected_date_range.length === 2) {
+ if (frappe.route_options && !this.patient_id) {
+ patient.set_value(frappe.route_options.patient);
+ this.patient_id = frappe.route_options.patient;
+ }
+
+ this.sidebar.find('[data-fieldname="patient"]').append('<div class="patient-info"></div>');
+ }
+
+ make_patient_profile() {
+ this.page.set_title(__('Patient History'));
+ this.main_section.empty().append(frappe.render_template('patient_history'));
+ this.setup_filters();
+ this.setup_documents();
+ this.show_patient_info();
+ this.setup_buttons();
+ this.show_patient_vital_charts('bp', 'mmHg', 'Blood Pressure');
+ }
+
+ setup_filters() {
+ $('.doctype-filter').empty();
+ let me = this;
+
+ frappe.xcall(
+ 'erpnext.healthcare.page.patient_history.patient_history.get_patient_history_doctypes'
+ ).then(document_types => {
+ let doctype_filter = frappe.ui.form.make_control({
+ parent: $('.doctype-filter'),
+ df: {
+ fieldtype: 'MultiSelectList',
+ fieldname: 'document_type',
+ placeholder: __('Select Document Type'),
+ change: () => {
me.start = 0;
me.page.main.find('.patient_documents_list').html('');
- get_documents(patient, me, doctype_filter.get_value(), selected_date_range);
- }
+ this.setup_documents(doctype_filter.get_value(), date_range_field.get_value());
+ },
+ get_data: () => {
+ return document_types.map(document_type => {
+ return {
+ description: document_type,
+ value: document_type
+ };
+ });
+ },
}
- },
- parent: $('.date-filter')
+ });
+ doctype_filter.refresh();
+
+ $('.date-filter').empty();
+ let date_range_field = frappe.ui.form.make_control({
+ df: {
+ fieldtype: 'DateRange',
+ fieldname: 'date_range',
+ placeholder: __('Date Range'),
+ input_class: 'input-xs',
+ change: () => {
+ let selected_date_range = date_range_field.get_value();
+ if (selected_date_range && selected_date_range.length === 2) {
+ me.start = 0;
+ me.page.main.find('.patient_documents_list').html('');
+ this.setup_documents(doctype_filter.get_value(), date_range_field.get_value());
+ }
+ }
+ },
+ parent: $('.date-filter')
+ });
+ date_range_field.refresh();
});
- date_range_field.refresh();
- });
-};
+ }
-let get_documents = function(patient, me, document_types="", selected_date_range="") {
- let filters = {
- name: patient,
- start: me.start,
- page_length: 20
- };
- if (document_types)
- filters['document_types'] = document_types;
- if (selected_date_range)
- filters['date_range'] = selected_date_range;
+ setup_documents(document_types="", selected_date_range="") {
+ let filters = {
+ name: this.patient_id,
+ start: this.start,
+ page_length: 20
+ };
+ if (document_types)
+ filters['document_types'] = document_types;
+ if (selected_date_range)
+ filters['date_range'] = selected_date_range;
- frappe.call({
- 'method': 'erpnext.healthcare.page.patient_history.patient_history.get_feed',
- args: filters,
- callback: function(r) {
- let data = r.message;
- if (data.length) {
- add_to_records(me, data);
- } else {
- me.page.main.find('.patient_documents_list').append(`
- <div class='text-muted' align='center'>
- <br><br>${__('No more records..')}<br><br>
- </div>`);
- me.page.main.find('.btn-get-records').hide();
+ let me = this;
+ frappe.call({
+ 'method': 'erpnext.healthcare.page.patient_history.patient_history.get_feed',
+ args: filters,
+ callback: function(r) {
+ let data = r.message;
+ if (data.length) {
+ me.add_to_records(data);
+ } else {
+ me.page.main.find('.patient_documents_list').append(`
+ <div class='text-muted' align='center'>
+ <br><br>${__('No more records..')}<br><br>
+ </div>`);
+ me.page.main.find('.btn-get-records').hide();
+ }
}
- }
- });
-};
+ });
+ }
-let add_to_records = function(me, data) {
- let details = "<ul class='nav nav-pills nav-stacked'>";
- let i;
- for (i=0; i<data.length; i++) {
- if (data[i].reference_doctype) {
- let label = '';
- if (data[i].subject) {
- label += "<br/>" + data[i].subject;
- }
- data[i] = add_date_separator(data[i]);
+ add_to_records(data) {
+ let details = "";
+ let i;
+ for (i=0; i<data.length; i++) {
+ if (data[i].reference_doctype) {
+ let label = '';
+ if (data[i].subject) {
+ label += "<br/>" + data[i].subject;
+ }
+ data[i] = this.add_date_separator(data[i]);
- if (frappe.user_info(data[i].owner).image) {
- data[i].imgsrc = frappe.utils.get_file_link(frappe.user_info(data[i].owner).image);
- } else {
- data[i].imgsrc = false;
- }
+ if (frappe.user_info(data[i].owner).image) {
+ data[i].imgsrc = frappe.utils.get_file_link(frappe.user_info(data[i].owner).image);
+ } else {
+ data[i].imgsrc = false;
+ }
- let time_line_heading = data[i].practitioner ? `${data[i].practitioner} ` : ``;
- time_line_heading += data[i].reference_doctype + " - " +
- `<a onclick="frappe.set_route('Form', '${data[i].reference_doctype}', '${data[i].reference_name}');">
- ${data[i].reference_name}
- </a>`;
+ let time_line_heading = data[i].practitioner ? `${data[i].practitioner} ` : ``;
+ time_line_heading += data[i].reference_doctype + " - " +
+ `<a onclick="frappe.set_route('Form', '${data[i].reference_doctype}', '${data[i].reference_name}');">
+ ${data[i].reference_name}
+ </a>`;
- details += `
- <li data-toggle='pill' class='patient_doc_menu'
- data-doctype='${data[i].reference_doctype}' data-docname='${data[i].reference_name}'>
- <div class='col-sm-12 d-flex border-bottom py-3'>`;
-
- if (data[i].imgsrc) {
details += `
- <span class='mr-3'>
- <img class='avtar' src='${data[i].imgsrc}' width='32' height='32'></img>
- </span>`;
- } else {
- details += `<span class='mr-3 avatar avatar-small' style='width:32px; height:32px;'>
- <div align='center' class='standard-image' style='background-color: #fafbfc;'>
- ${data[i].practitioner ? data[i].practitioner.charAt(0) : 'U'}
- </div>
- </span>`;
- }
+ <div data-toggle='pill' class='patient_doc_menu'
+ data-doctype='${data[i].reference_doctype}' data-docname='${data[i].reference_name}'>
+ <div class='col-sm-12 d-flex border-bottom py-3'>`;
- details += `<div class='d-flex flex-column width-full'>
- <div>
- `+time_line_heading+`
- <span>
- ${data[i].date_sep}
+ if (data[i].imgsrc) {
+ details += `<span class='mr-3 avatar avatar-small' style='width:32px; height:32px;'>
+ <img class='avatar-frame' src='${data[i].imgsrc}' width='32' height='32'></img>
+ </span>`;
+ } else {
+ details += `<span class='mr-3 avatar avatar-small' style='width:32px; height:32px;'>
+ <div align='center' class='avatar-frame' style='background-color: #fafbfc;'>
+ ${data[i].practitioner ? data[i].practitioner.charAt(0) : 'U'}
+ </div>
+ </span>`;
+ }
+
+ details += `<div class='d-flex flex-column width-full'>
+ <div>
+ `+time_line_heading+`
+ <span>
+ ${data[i].date_sep}
+ </span>
+ </div>
+ <div class='frappe-card p-5 mt-3'>
+ <span class='${data[i].reference_name} document-id'>${label}
+ <br>
+ <div align='center'>
+ <a class='btn octicon octicon-chevron-down btn-default btn-xs btn-more'
+ data-doctype='${data[i].reference_doctype}' data-docname='${data[i].reference_name}'>
+ </a>
+ </div>
</span>
- </div>
- <div class='Box p-3 mt-2'>
- <span class='${data[i].reference_name} document-id'>${label}
- <div align='center'>
- <a class='btn octicon octicon-chevron-down btn-default btn-xs btn-more'
- data-doctype='${data[i].reference_doctype}' data-docname='${data[i].reference_name}'>
- </a>
- </div>
- </span>
- <span class='document-html' hidden data-fetched="0">
- </span>
+
+ <span class='document-html' hidden data-fetched='0'>
+ </span>
+ </div>
</div>
</div>
- </div>
- </li>`;
+ </div>`;
+ }
+ }
+
+ this.page.main.find('.patient_documents_list').append(details);
+ this.start += data.length;
+
+ if (data.length === 20) {
+ this.page.main.find(".btn-get-records").show();
+ } else {
+ this.page.main.find(".btn-get-records").hide();
+ this.page.main.find(".patient_documents_list").append(`
+ <div class='text-muted' align='center'>
+ <br><br>${__('No more records..')}<br><br>
+ </div>`);
}
}
- details += '</ul>';
- me.page.main.find('.patient_documents_list').append(details);
- me.start += data.length;
+ add_date_separator(data) {
+ let date = frappe.datetime.str_to_obj(data.communication_date);
+ let pdate = '';
+ let diff = frappe.datetime.get_day_diff(frappe.datetime.get_today(),
+ frappe.datetime.obj_to_str(date));
- if (data.length === 20) {
- me.page.main.find(".btn-get-records").show();
- } else {
- me.page.main.find(".btn-get-records").hide();
- me.page.main.find(".patient_documents_list").append(`
- <div class='text-muted' align='center'>
- <br><br>${__('No more records..')}<br><br>
- </div>`);
- }
-};
-
-let add_date_separator = function(data) {
- let date = frappe.datetime.str_to_obj(data.communication_date);
- let pdate = '';
- let diff = frappe.datetime.get_day_diff(frappe.datetime.get_today(), frappe.datetime.obj_to_str(date));
-
- if (diff < 1) {
- pdate = __('Today');
- } else if (diff < 2) {
- pdate = __('Yesterday');
- } else {
- pdate = __('on ') + frappe.datetime.global_date_format(date);
- }
- data.date_sep = pdate;
- return data;
-};
-
-let show_patient_info = function(patient, me) {
- frappe.call({
- 'method': 'erpnext.healthcare.doctype.patient.patient.get_patient_detail',
- args: {
- patient: patient
- },
- callback: function(r) {
- let data = r.message;
- let details = '';
- if (data.image) {
- details += `<div><img class='thumbnail' width=75% src='${data.image}'></div>`;
- }
-
- details += `<b> ${data.patient_name} </b><br> ${data.sex}`;
- if (data.email) details += `<br> ${data.email}`;
- if (data.mobile) details += `<br> ${data.mobile}`;
- if (data.occupation) details += `<br><br><b> ${__('Occupation')} : </b> ${data.occupation}`;
- if (data.blood_group) details += `<br><b> ${__('Blood Group')} : </b> ${data.blood_group}`;
- if (data.allergies) details += `<br><br><b> ${__('Allerigies')} : </b> ${data.allergies.replace("\n", ", ")}`;
- if (data.medication) details += `<br><b> ${__('Medication')} : </b> ${data.medication.replace("\n", ", ")}`;
- if (data.alcohol_current_use) details += `<br><br><b> ${__('Alcohol use')} : </b> ${data.alcohol_current_use}`;
- if (data.alcohol_past_use) details += `<br><b> ${__('Alcohol past use')} : </b> ${data.alcohol_past_use}`;
- if (data.tobacco_current_use) details += `<br><b> ${__('Tobacco use')} : </b> ${data.tobacco_current_use}`;
- if (data.tobacco_past_use) details += `<br><b> ${__('Tobacco past use')} : </b> ${data.tobacco_past_use}`;
- if (data.medical_history) details += `<br><br><b> ${__('Medical history')} : </b> ${data.medical_history.replace("\n", ", ")}`;
- if (data.surgical_history) details += `<br><b> ${__('Surgical history')} : </b> ${data.surgical_history.replace("\n", ", ")}`;
- if (data.surrounding_factors) details += `<br><br><b> ${__('Occupational hazards')} : </b> ${data.surrounding_factors.replace("\n", ", ")}`;
- if (data.other_risk_factors) details += `<br><b> ${__('Other risk factors')} : </b> ${data.other_risk_factors.replace("\n", ", ")}`;
- if (data.patient_details) details += `<br><br><b> ${__('More info')} : </b> ${data.patient_details.replace("\n", ", ")}`;
-
- if (details) {
- details = `<div style='padding-left:10px; font-size:13px;' align='left'>` + details + `</div>`;
- }
- me.page.main.find('.patient_details').html(details);
+ if (diff < 1) {
+ pdate = __('Today');
+ } else if (diff < 2) {
+ pdate = __('Yesterday');
+ } else {
+ pdate = __('on {0}', [frappe.datetime.global_date_format(date)]);
}
- });
-};
+ data.date_sep = pdate;
+ return data;
+ }
-let show_patient_vital_charts = function(patient, me, btn_show_id, pts, title) {
- frappe.call({
- method: 'erpnext.healthcare.utils.get_patient_vitals',
- args:{
- patient: patient
- },
- callback: function(r) {
- if (r.message) {
- let show_chart_btns_html = `
- <div style='padding-top:10px;'>
- <a class='btn btn-default btn-xs btn-show-chart' data-show-chart-id='bp' data-pts='mmHg' data-title='Blood Pressure'>
- ${__('Blood Pressure')}
- </a>
- <a class='btn btn-default btn-xs btn-show-chart' data-show-chart-id='pulse_rate' data-pts='per Minutes' data-title='Respiratory/Pulse Rate'>
- ${__('Respiratory/Pulse Rate')}
- </a>
- <a class='btn btn-default btn-xs btn-show-chart' data-show-chart-id='temperature' data-pts='°C or °F' data-title='Temperature'>
- ${__('Temperature')}
- </a>
- <a class='btn btn-default btn-xs btn-show-chart' data-show-chart-id='bmi' data-pts='' data-title='BMI'>
- ${__('BMI')}
- </a>
- </div>`;
+ show_patient_info() {
+ this.get_patient_info().then(() => {
+ $('.patient-info').empty().append(frappe.render_template('patient_history_sidebar', {
+ patient_image: this.patient.image,
+ patient_name: this.patient.patient_name,
+ patient_gender: this.patient.sex,
+ patient_mobile: this.patient.mobile
+ }));
+ this.show_patient_details();
+ });
+ }
- me.page.main.find('.show_chart_btns').html(show_chart_btns_html);
+ show_patient_details() {
+ let me = this;
+ frappe.call({
+ 'method': 'erpnext.healthcare.doctype.patient.patient.get_patient_detail',
+ args: {
+ patient: me.patient_id
+ },
+ callback: function(r) {
let data = r.message;
- let labels = [], datasets = [];
- let bp_systolic = [], bp_diastolic = [], temperature = [];
- let pulse = [], respiratory_rate = [], bmi = [], height = [], weight = [];
+ let details = ``;
- for (let i=0; i<data.length; i++) {
- labels.push(data[i].signs_date+'||'+data[i].signs_time);
+ if (data.occupation) details += `<br><br><b> ${__('Occupation')} : </b> ${data.occupation}`;
+ if (data.blood_group) details += `<br><b> ${__('Blood Group')} : </b> ${data.blood_group}`;
+ if (data.allergies) details += `<br><br><b> ${__('Allerigies')} : </b> ${data.allergies.replace("\n", ", ")}`;
+ if (data.medication) details += `<br><b> ${__('Medication')} : </b> ${data.medication.replace("\n", ", ")}`;
+ if (data.alcohol_current_use) details += `<br><br><b> ${__('Alcohol use')} : </b> ${data.alcohol_current_use}`;
+ if (data.alcohol_past_use) details += `<br><b> ${__('Alcohol past use')} : </b> ${data.alcohol_past_use}`;
+ if (data.tobacco_current_use) details += `<br><b> ${__('Tobacco use')} : </b> ${data.tobacco_current_use}`;
+ if (data.tobacco_past_use) details += `<br><b> ${__('Tobacco past use')} : </b> ${data.tobacco_past_use}`;
+ if (data.medical_history) details += `<br><br><b> ${__('Medical history')} : </b> ${data.medical_history.replace("\n", ", ")}`;
+ if (data.surgical_history) details += `<br><b> ${__('Surgical history')} : </b> ${data.surgical_history.replace("\n", ", ")}`;
+ if (data.surrounding_factors) details += `<br><br><b> ${__('Occupational hazards')} : </b> ${data.surrounding_factors.replace("\n", ", ")}`;
+ if (data.other_risk_factors) details += `<br><b> ${__('Other risk factors')} : </b> ${data.other_risk_factors.replace("\n", ", ")}`;
+ if (data.patient_details) details += `<br><br><b> ${__('More info')} : </b> ${data.patient_details.replace("\n", ", ")}`;
- if (btn_show_id === 'bp') {
- bp_systolic.push(data[i].bp_systolic);
- bp_diastolic.push(data[i].bp_diastolic);
- }
- if (btn_show_id === 'temperature') {
- temperature.push(data[i].temperature);
- }
- if (btn_show_id === 'pulse_rate') {
- pulse.push(data[i].pulse);
- respiratory_rate.push(data[i].respiratory_rate);
- }
- if (btn_show_id === 'bmi') {
- bmi.push(data[i].bmi);
- height.push(data[i].height);
- weight.push(data[i].weight);
- }
+ if (details) {
+ details = `<div style='font-size:13px;' align='left'>` + details + `</div>`;
}
- if (btn_show_id === 'temperature') {
- datasets.push({name: 'Temperature', values: temperature, chartType: 'line'});
- }
- if (btn_show_id === 'bmi') {
- datasets.push({name: 'BMI', values: bmi, chartType: 'line'});
- datasets.push({name: 'Height', values: height, chartType: 'line'});
- datasets.push({name: 'Weight', values: weight, chartType: 'line'});
- }
- if (btn_show_id === 'bp') {
- datasets.push({name: 'BP Systolic', values: bp_systolic, chartType: 'line'});
- datasets.push({name: 'BP Diastolic', values: bp_diastolic, chartType: 'line'});
- }
- if (btn_show_id === 'pulse_rate') {
- datasets.push({name: 'Heart Rate / Pulse', values: pulse, chartType: 'line'});
- datasets.push({name: 'Respiratory Rate', values: respiratory_rate, chartType: 'line'});
- }
- new frappe.Chart('.patient_vital_charts', {
- data: {
- labels: labels,
- datasets: datasets
- },
- title: title,
- type: 'axis-mixed',
- height: 200,
- colors: ['purple', '#ffa3ef', 'light-blue'],
-
- tooltipOptions: {
- formatTooltipX: d => (d + '').toUpperCase(),
- formatTooltipY: d => d + ' ' + pts,
- }
- });
- me.page.main.find('.header-separator').show();
- } else {
- me.page.main.find('.patient_vital_charts').html('');
- me.page.main.find('.show_chart_btns').html('');
- me.page.main.find('.header-separator').hide();
+ me.sidebar.find('.patient-details').html(details);
}
- }
- });
-};
+ });
+ }
+
+ get_patient_info() {
+ return frappe.xcall('frappe.client.get', {
+ doctype: 'Patient',
+ name: this.patient_id,
+ }).then((patient) => {
+ if (patient) {
+ this.patient = patient;
+ }
+ });
+ }
+
+ setup_buttons() {
+ let me = this;
+ this.page.main.on("click", ".btn-show-chart", function() {
+ let btn_id = $(this).attr("data-show-chart-id"), scale_unit = $(this).attr("data-pts");
+ let title = $(this).attr("data-title");
+ me.show_patient_vital_charts(btn_id, scale_unit, title);
+ });
+
+ this.page.main.on('click', '.btn-more', function() {
+ let doctype = $(this).attr('data-doctype'), docname = $(this).attr('data-docname');
+ if (me.page.main.find('.'+docname).parent().find('.document-html').attr('data-fetched') == '1') {
+ me.page.main.find('.'+docname).hide();
+ me.page.main.find('.'+docname).parent().find('.document-html').show();
+ } else {
+ if (doctype && docname) {
+ let exclude = ['patient', 'patient_name', 'patient_sex', 'encounter_date', 'naming_series'];
+ frappe.call({
+ method: 'erpnext.healthcare.utils.render_doc_as_html',
+ args: {
+ doctype: doctype,
+ docname: docname,
+ exclude_fields: exclude
+ },
+ freeze: true,
+ callback: function(r) {
+ if (r.message) {
+ me.page.main.find('.' + docname).hide();
+
+ me.page.main.find('.' + docname).parent().find('.document-html').html(
+ `${r.message.html}
+ <br>
+ <div align='center'>
+ <a class='btn octicon octicon-chevron-up btn-default btn-xs btn-less'
+ data-doctype='${doctype}'
+ data-docname='${docname}'>
+ </a>
+ </div>
+ `);
+
+ me.page.main.find('.' + docname).parent().find('.document-html').attr('hidden', false);
+ me.page.main.find('.' + docname).parent().find('.document-html').attr('data-fetched', '1');
+ }
+ }
+ });
+ }
+ }
+ });
+
+ this.page.main.on('click', '.btn-less', function() {
+ let docname = $(this).attr('data-docname');
+ me.page.main.find('.' + docname).parent().find('.document-id').show();
+ me.page.main.find('.' + docname).parent().find('.document-html').hide();
+ });
+
+ me.page.main.on('click', '.btn-get-records', function() {
+ this.setup_documents();
+ });
+ }
+
+ show_patient_vital_charts(btn_id, scale_unit, title) {
+ let me = this;
+
+ frappe.call({
+ method: 'erpnext.healthcare.utils.get_patient_vitals',
+ args: {
+ patient: me.patient_id
+ },
+ callback: function(r) {
+ if (r.message) {
+ let show_chart_btns_html = `
+ <div style='padding-top:10px;'>
+ <a class='btn btn-default btn-xs btn-show-chart' data-show-chart-id='bp' data-pts='mmHg' data-title='Blood Pressure'>
+ ${__('Blood Pressure')}
+ </a>
+ <a class='btn btn-default btn-xs btn-show-chart' data-show-chart-id='pulse_rate' data-pts='per Minutes' data-title='Respiratory/Pulse Rate'>
+ ${__('Respiratory/Pulse Rate')}
+ </a>
+ <a class='btn btn-default btn-xs btn-show-chart' data-show-chart-id='temperature' data-pts='°C or °F' data-title='Temperature'>
+ ${__('Temperature')}
+ </a>
+ <a class='btn btn-default btn-xs btn-show-chart' data-show-chart-id='bmi' data-pts='' data-title='BMI'>
+ ${__('BMI')}
+ </a>
+ </div>`;
+
+ me.page.main.find('.show_chart_btns').html(show_chart_btns_html);
+ let data = r.message;
+ let labels = [], datasets = [];
+ let bp_systolic = [], bp_diastolic = [], temperature = [];
+ let pulse = [], respiratory_rate = [], bmi = [], height = [], weight = [];
+
+ for (let i=0; i<data.length; i++) {
+ labels.push(data[i].signs_date+' | '+data[i].signs_time);
+
+ if (btn_id === 'bp') {
+ bp_systolic.push(data[i].bp_systolic);
+ bp_diastolic.push(data[i].bp_diastolic);
+ }
+ if (btn_id === 'temperature') {
+ temperature.push(data[i].temperature);
+ }
+ if (btn_id === 'pulse_rate') {
+ pulse.push(data[i].pulse);
+ respiratory_rate.push(data[i].respiratory_rate);
+ }
+ if (btn_id === 'bmi') {
+ bmi.push(data[i].bmi);
+ height.push(data[i].height);
+ weight.push(data[i].weight);
+ }
+ }
+ if (btn_id === 'temperature') {
+ datasets.push({name: 'Temperature', values: temperature, chartType: 'line'});
+ }
+ if (btn_id === 'bmi') {
+ datasets.push({name: 'BMI', values: bmi, chartType: 'line'});
+ datasets.push({name: 'Height', values: height, chartType: 'line'});
+ datasets.push({name: 'Weight', values: weight, chartType: 'line'});
+ }
+ if (btn_id === 'bp') {
+ datasets.push({name: 'BP Systolic', values: bp_systolic, chartType: 'line'});
+ datasets.push({name: 'BP Diastolic', values: bp_diastolic, chartType: 'line'});
+ }
+ if (btn_id === 'pulse_rate') {
+ datasets.push({name: 'Heart Rate / Pulse', values: pulse, chartType: 'line'});
+ datasets.push({name: 'Respiratory Rate', values: respiratory_rate, chartType: 'line'});
+ }
+
+ new frappe.Chart('.patient_vital_charts', {
+ data: {
+ labels: labels,
+ datasets: datasets
+ },
+
+ title: title,
+ type: 'axis-mixed',
+ height: 200,
+ colors: ['purple', '#ffa3ef', 'light-blue'],
+
+ tooltipOptions: {
+ formatTooltipX: d => (d + '').toUpperCase(),
+ formatTooltipY: d => d + ' ' + scale_unit,
+ }
+ });
+ me.page.main.find('.header-separator').show();
+ } else {
+ me.page.main.find('.patient_vital_charts').html('');
+ me.page.main.find('.show_chart_btns').html('');
+ me.page.main.find('.header-separator').hide();
+ }
+ }
+ });
+ }
+}
diff --git a/erpnext/healthcare/page/patient_history/patient_history.py b/erpnext/healthcare/page/patient_history/patient_history.py
index 4cdfd64..77d8846 100644
--- a/erpnext/healthcare/page/patient_history/patient_history.py
+++ b/erpnext/healthcare/page/patient_history/patient_history.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
+
+import frappe
from frappe.utils import cint
-from erpnext.healthcare.utils import render_docs_as_html
+
@frappe.whitelist()
def get_feed(name, document_types=None, date_range=None, start=0, page_length=20):
diff --git a/erpnext/healthcare/page/patient_history/patient_history_sidebar.html b/erpnext/healthcare/page/patient_history/patient_history_sidebar.html
new file mode 100644
index 0000000..fc7eab0
--- /dev/null
+++ b/erpnext/healthcare/page/patient_history/patient_history_sidebar.html
@@ -0,0 +1,20 @@
+<div class="patient-history-sidebar">
+ <div class="patient-image-container">
+ {% if patient_image %}
+ <div class="patient-image" src={{patient_image}} style="background-image: url(\'{%= patient_image %}\')"></div>
+ {% endif %}
+ </div>
+ <div class="patient-intro">
+ {% if patient_name %}
+ <p class="patient-name bold">{{patient_name}}</p>
+ {% endif %}
+ {% if patient_gender %}
+ <p class="patient-gender text-muted">{%=__("Gender: ") %} {{patient_gender}}</p>
+ {% endif %}
+ {% if patient_mobile %}
+ <p class="patient-mobile text-muted">{%=__("Contact: ") %} {{patient_mobile}}</p>
+ {% endif %}
+ </div>
+ <div class="patient-details">
+ </div>
+</div>
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress.css b/erpnext/healthcare/page/patient_progress/patient_progress.css
index 5d85a74..737b2e0 100644
--- a/erpnext/healthcare/page/patient_progress/patient_progress.css
+++ b/erpnext/healthcare/page/patient_progress/patient_progress.css
@@ -29,6 +29,7 @@
.patient-name {
font-size: 20px;
+ margin-top: 25px;
}
/* heatmap */
@@ -55,6 +56,7 @@
}
.heatmap-container .chart-filter {
+ z-index: 1;
position: relative;
top: 5px;
margin-right: 10px;
@@ -111,10 +113,13 @@
}
.chart-column-container {
- border-bottom: 1px solid #d1d8dd;
margin: 5px 0;
}
+.progress-graphs .progress-container {
+ margin-bottom: var(--margin-xl);
+}
+
.line-chart-container .frappe-chart {
margin-top: -20px;
}
@@ -146,6 +151,7 @@
}
.percentage-chart-container .chart-filter {
+ z-index: 1;
position: relative;
top: 12px;
margin-right: 10px;
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress.html b/erpnext/healthcare/page/patient_progress/patient_progress.html
index 30064bd..ee60065 100644
--- a/erpnext/healthcare/page/patient_progress/patient_progress.html
+++ b/erpnext/healthcare/page/patient_progress/patient_progress.html
@@ -1,14 +1,15 @@
<div class="row patient-progress">
<div class="col-md-12">
<div class="progress-graphs">
- <div class="chart-column-container heatmap-container hidden-xs hidden-sm">
+ <div class="progress-container chart-column-container heatmap-container hidden-xs hidden-sm frappe-card">
<div class="patient-heatmap"></div>
</div>
- <div class="chart-column-container percentage-chart-container">
+
+ <div class="progress-container chart-column-container percentage-chart-container frappe-card">
<div class="therapy-session-percentage-chart"></div>
</div>
- <div class="therapy-progress">
+ <div class="progress-container therapy-progress frappe-card">
<div class="chart-head">
<text class="title" text-anchor="start">Therapy Progress</text>
<div class="chart-control pull-right"></div>
@@ -22,7 +23,7 @@
</div>
</div>
- <div class="assessment-results">
+ <div class="progress-container assessment-results frappe-card">
<div class="chart-head">
<text class="title" text-anchor="start">Assessment Results</text>
<div class="chart-control pull-right"></div>
@@ -36,7 +37,7 @@
</div>
</div>
- <div class="therapy-assessment-correlation progress-line-chart">
+ <div class="progress-container therapy-assessment-correlation progress-line-chart frappe-card">
<div class="chart-head">
<text class="title" text-anchor="start">Therapy Type and Assessment Correlation</text>
<div class="chart-control pull-right"></div>
@@ -50,7 +51,7 @@
</div>
</div>
- <div class="assessment-parameter-progress progress-line-chart">
+ <div class="progress-container assessment-parameter-progress progress-line-chart frappe-card">
<div class="chart-head">
<text class="title" text-anchor="start">Assessment Parameter Wise Progress</text>
<div class="chart-control pull-right"></div>
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress.js b/erpnext/healthcare/page/patient_progress/patient_progress.js
index 4b7599d..3f06f1f 100644
--- a/erpnext/healthcare/page/patient_progress/patient_progress.js
+++ b/erpnext/healthcare/page/patient_progress/patient_progress.js
@@ -133,8 +133,11 @@
type: 'heatmap',
countLabel: 'Interactions',
data: {},
- discreteDomains: 0
+ discreteDomains: 1,
+ radius: 3,
+ height: 150
});
+
this.update_heatmap_data();
this.create_heatmap_chart_filters();
}
@@ -164,33 +167,35 @@
}
render_percentage_chart(field, title) {
- frappe.xcall(
- 'erpnext.healthcare.page.patient_progress.patient_progress.get_therapy_sessions_distribution_data', {
- patient: this.patient_id,
- field: field
- }
- ).then(chart => {
- if (chart.labels.length) {
- this.percentage_chart = new frappe.Chart('.therapy-session-percentage-chart', {
- title: title,
- type: 'percentage',
- data: {
- labels: chart.labels,
- datasets: chart.datasets
- },
- truncateLegends: 1,
- barOptions: {
- height: 11,
- depth: 1
- },
- height: 160,
- maxSlices: 8,
- colors: ['#5e64ff', '#743ee2', '#ff5858', '#ffa00a', '#feef72', '#28a745', '#98d85b', '#a9a7ac'],
- });
- } else {
- this.wrapper.find('.percentage-chart-container').hide();
- }
- });
+ // REDESIGN-TODO: chart seems to be broken. Enable this once fixed.
+ this.wrapper.find('.percentage-chart-container').hide();
+ // frappe.xcall(
+ // 'erpnext.healthcare.page.patient_progress.patient_progress.get_therapy_sessions_distribution_data', {
+ // patient: this.patient_id,
+ // field: field
+ // }
+ // ).then(chart => {
+ // if (chart.labels.length) {
+ // this.percentage_chart = new frappe.Chart('.therapy-session-percentage-chart', {
+ // title: title,
+ // type: 'percentage',
+ // data: {
+ // labels: chart.labels,
+ // datasets: chart.datasets
+ // },
+ // truncateLegends: 1,
+ // barOptions: {
+ // height: 11,
+ // depth: 1
+ // },
+ // height: 160,
+ // maxSlices: 8,
+ // colors: ['#5e64ff', '#743ee2', '#ff5858', '#ffa00a', '#feef72', '#28a745', '#98d85b', '#a9a7ac'],
+ // });
+ // } else {
+ // this.wrapper.find('.percentage-chart-container').hide();
+ // }
+ // });
}
create_percentage_chart_filters() {
@@ -311,7 +316,7 @@
},
axisOptions: {
xIsSeries: 1
- },
+ }
});
} else {
$(parent).find('.chart-container').show();
@@ -377,7 +382,7 @@
xIsSeries: 1
},
tooltipOptions: {
- formatTooltipY: d => d + __(' out of ') + chart.max_score
+ formatTooltipY: d => __('{0} out of {1}', [d, chart.max_score])
}
});
} else {
diff --git a/erpnext/healthcare/page/patient_progress/patient_progress.py b/erpnext/healthcare/page/patient_progress/patient_progress.py
index 46bfb3d..c17f105 100644
--- a/erpnext/healthcare/page/patient_progress/patient_progress.py
+++ b/erpnext/healthcare/page/patient_progress/patient_progress.py
@@ -1,8 +1,10 @@
-import frappe
-from datetime import datetime
-from frappe import _
-from frappe.utils import getdate, get_timespan_date_range
import json
+from datetime import datetime
+
+import frappe
+from frappe import _
+from frappe.utils import get_timespan_date_range, getdate
+
@frappe.whitelist()
def get_therapy_sessions_count(patient):
diff --git a/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.py b/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.py
index 28b60bd..2e809fb 100644
--- a/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.py
+++ b/erpnext/healthcare/report/inpatient_medication_orders/inpatient_medication_orders.py
@@ -2,8 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from erpnext.healthcare.doctype.inpatient_medication_entry.inpatient_medication_entry import get_current_healthcare_service_unit
+
+from erpnext.healthcare.doctype.inpatient_medication_entry.inpatient_medication_entry import (
+ get_current_healthcare_service_unit,
+)
+
def execute(filters=None):
columns = get_columns()
diff --git a/erpnext/healthcare/report/inpatient_medication_orders/test_inpatient_medication_orders.py b/erpnext/healthcare/report/inpatient_medication_orders/test_inpatient_medication_orders.py
index fae5ece..7f7bebf 100644
--- a/erpnext/healthcare/report/inpatient_medication_orders/test_inpatient_medication_orders.py
+++ b/erpnext/healthcare/report/inpatient_medication_orders/test_inpatient_medication_orders.py
@@ -2,14 +2,32 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import unittest
-import frappe
+
import datetime
+import unittest
+
+import frappe
from frappe.utils import getdate, now_datetime
-from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import create_patient, create_inpatient, get_healthcare_service_unit, mark_invoiced_inpatient_occupancy
-from erpnext.healthcare.doctype.inpatient_record.inpatient_record import admit_patient, discharge_patient, schedule_discharge
-from erpnext.healthcare.doctype.inpatient_medication_order.test_inpatient_medication_order import create_ipmo, create_ipme
-from erpnext.healthcare.report.inpatient_medication_orders.inpatient_medication_orders import execute
+
+from erpnext.healthcare.doctype.inpatient_medication_order.test_inpatient_medication_order import (
+ create_ipme,
+ create_ipmo,
+)
+from erpnext.healthcare.doctype.inpatient_record.inpatient_record import (
+ admit_patient,
+ discharge_patient,
+ schedule_discharge,
+)
+from erpnext.healthcare.doctype.inpatient_record.test_inpatient_record import (
+ create_inpatient,
+ create_patient,
+ get_healthcare_service_unit,
+ mark_invoiced_inpatient_occupancy,
+)
+from erpnext.healthcare.report.inpatient_medication_orders.inpatient_medication_orders import (
+ execute,
+)
+
class TestInpatientMedicationOrders(unittest.TestCase):
@classmethod
diff --git a/erpnext/healthcare/report/lab_test_report/lab_test_report.py b/erpnext/healthcare/report/lab_test_report/lab_test_report.py
index 2e59bed..e2a53bb 100644
--- a/erpnext/healthcare/report/lab_test_report/lab_test_report.py
+++ b/erpnext/healthcare/report/lab_test_report/lab_test_report.py
@@ -2,8 +2,10 @@
# License: See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import msgprint, _
+from frappe import _, msgprint
+
def execute(filters=None):
if not filters: filters = {}
@@ -169,7 +171,7 @@
'labels': labels,
'datasets': datasets
},
- 'type': 'donut',
+ 'type': 'bar',
'height': 300,
}
diff --git a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py b/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py
index 9a4840a..1afb5da 100644
--- a/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py
+++ b/erpnext/healthcare/report/patient_appointment_analytics/patient_appointment_analytics.py
@@ -2,12 +2,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import getdate, flt, add_to_date, add_days
-from frappe import _ , scrub
+from frappe import _, scrub
+from frappe.utils import add_days, add_to_date, flt, getdate
from six import iteritems
+
from erpnext.accounts.utils import get_fiscal_year
+
def execute(filters=None):
return Analytics(filters).run()
@@ -26,7 +29,7 @@
return self.columns, self.data, None, self.chart
def get_period_date_ranges(self):
- from dateutil.relativedelta import relativedelta, MO
+ from dateutil.relativedelta import MO, relativedelta
from_date, to_date = getdate(self.filters.from_date), getdate(self.filters.to_date)
increment = {
diff --git a/erpnext/healthcare/utils.py b/erpnext/healthcare/utils.py
index ffecf4d..cae3008 100644
--- a/erpnext/healthcare/utils.py
+++ b/erpnext/healthcare/utils.py
@@ -3,17 +3,20 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import math
-import frappe
+
import json
+import math
+
+import frappe
from frappe import _
+from frappe.utils import cstr, rounded, time_diff_in_hours
from frappe.utils.formatters import format_value
-from frappe.utils import time_diff_in_hours, rounded
-from six import string_types
-from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_income_account
+
from erpnext.healthcare.doctype.fee_validity.fee_validity import create_fee_validity
+from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_income_account
from erpnext.healthcare.doctype.lab_test.lab_test import create_multiple
+
@frappe.whitelist()
def get_healthcare_services_to_invoice(patient, company):
patient = frappe.get_doc('Patient', patient)
@@ -181,9 +184,9 @@
service_item = frappe.db.get_single_value('Healthcare Settings', 'clinical_procedure_consumable_item')
if not service_item:
- msg = _('Please Configure Clinical Procedure Consumable Item in ')
- msg += '''<b><a href='/app/Form/Healthcare Settings'>Healthcare Settings</a></b>'''
- frappe.throw(msg, title=_('Missing Configuration'))
+ frappe.throw(_('Please configure Clinical Procedure Consumable Item in {0}').format(
+ frappe.utils.get_link_to_form('Healthcare Settings', 'Healthcare Settings')),
+ title=_('Missing Configuration'))
clinical_procedures_to_invoice.append({
'reference_type': 'Clinical Procedure',
@@ -312,7 +315,7 @@
@frappe.whitelist()
def get_service_item_and_practitioner_charge(doc):
- if isinstance(doc, string_types):
+ if isinstance(doc, str):
doc = json.loads(doc)
doc = frappe.get_doc(doc)
@@ -340,7 +343,9 @@
def get_appointment_type_service_item(appointment_type, department, is_inpatient):
- from erpnext.healthcare.doctype.appointment_type.appointment_type import get_service_item_based_on_department
+ from erpnext.healthcare.doctype.appointment_type.appointment_type import (
+ get_service_item_based_on_department,
+ )
item_list = get_service_item_based_on_department(appointment_type, department)
service_item = None
@@ -607,101 +612,147 @@
@frappe.whitelist()
def render_doc_as_html(doctype, docname, exclude_fields = []):
- #render document as html, three column layout will break
+ """
+ Render document as HTML
+ """
+
doc = frappe.get_doc(doctype, docname)
meta = frappe.get_meta(doctype)
- doc_html = "<div class='col-md-12 col-sm-12'>"
- section_html = ''
- section_label = ''
- html = ''
- sec_on = False
+ doc_html = section_html = section_label = html = ""
+ sec_on = has_data = False
col_on = 0
- has_data = False
+
for df in meta.fields:
- #on section break append append previous section and html to doc html
+ # on section break append previous section and html to doc html
if df.fieldtype == "Section Break":
if has_data and col_on and sec_on:
doc_html += section_html + html + "</div>"
+
elif has_data and not col_on and sec_on:
- doc_html += "<div class='col-md-12 col-sm-12'\
- ><div class='col-md-12 col-sm-12'>" \
- + section_html + html +"</div></div>"
+ doc_html += """
+ <br>
+ <div class='row'>
+ <div class='col-md-12 col-sm-12'>
+ <b>{0}</b>
+ </div>
+ </div>
+ <div class='row'>
+ <div class='col-md-12 col-sm-12'>
+ {1} {2}
+ </div>
+ </div>
+ """.format(section_label, section_html, html)
+
+ # close divs for columns
while col_on:
doc_html += "</div>"
col_on -= 1
+
sec_on = True
- has_data= False
+ has_data = False
col_on = 0
- section_html = ''
- html = ''
+ section_html = html = ""
+
if df.label:
section_label = df.label
continue
- #on column break append html to section html or doc html
+
+ # on column break append html to section html or doc html
if df.fieldtype == "Column Break":
- if sec_on and has_data:
- section_html += "<div class='col-md-12 col-sm-12'\
- ><div class='col-md-6 col\
- -sm-6'><b>" + section_label + "</b>" + html + "</div><div \
- class='col-md-6 col-sm-6'>"
- elif has_data:
- doc_html += "<div class='col-md-12 col-sm-12'><div class='col-m\
- d-6 col-sm-6'>" + html + "</div><div class='col-md-6 col-sm-6'>"
- elif sec_on and not col_on:
- section_html += "<div class='col-md-6 col-sm-6'>"
- html = ''
+ if sec_on and not col_on and has_data:
+ section_html += """
+ <br>
+ <div class='row'>
+ <div class='col-md-12 col-sm-12'>
+ <b>{0}</b>
+ </div>
+ </div>
+ <div class='row'>
+ <div class='col-md-4 col-sm-4'>
+ {1}
+ </div>
+ """.format(section_label, html)
+ elif col_on == 1 and has_data:
+ section_html += "<div class='col-md-4 col-sm-4'>" + html + "</div>"
+ elif col_on > 1 and has_data:
+ doc_html += "<div class='col-md-4 col-sm-4'>" + html + "</div>"
+ else:
+ doc_html += """
+ <div class='row'>
+ <div class='col-md-12 col-sm-12'>
+ {0}
+ </div>
+ </div>
+ """.format(html)
+
+ html = ""
col_on += 1
+
if df.label:
- html += '<br>' + df.label
+ html += "<br>" + df.label
continue
- #on table iterate in items and create table based on in_list_view, append to section html or doc html
- if df.fieldtype == 'Table':
+
+ # on table iterate through items and create table
+ # based on the in_list_view property
+ # append to section html or doc html
+ if df.fieldtype == "Table":
items = doc.get(df.fieldname)
- if not items: continue
+ if not items:
+ continue
child_meta = frappe.get_meta(df.options)
- if not has_data : has_data = True
- table_head = ''
- table_row = ''
+
+ if not has_data:
+ has_data = True
+ table_head = table_row = ""
create_head = True
+
for item in items:
- table_row += '<tr>'
+ table_row += "<tr>"
for cdf in child_meta.fields:
if cdf.in_list_view:
if create_head:
- table_head += '<th>' + cdf.label + '</th>'
+ table_head += "<th class='text-muted'>" + cdf.label + "</th>"
if item.get(cdf.fieldname):
- table_row += '<td>' + str(item.get(cdf.fieldname)) \
- + '</td>'
+ table_row += "<td>" + cstr(item.get(cdf.fieldname)) + "</td>"
else:
- table_row += '<td></td>'
+ table_row += "<td></td>"
+
create_head = False
- table_row += '</tr>'
+ table_row += "</tr>"
+
if sec_on:
- section_html += "<table class='table table-condensed \
- bordered'>" + table_head + table_row + '</table>'
+ section_html += """
+ <table class='table table-condensed bordered'>
+ {0} {1}
+ </table>
+ """.format(table_head, table_row)
else:
- html += "<table class='table table-condensed table-bordered'>" \
- + table_head + table_row + "</table>"
+ html += """
+ <table class='table table-condensed table-bordered'>
+ {0} {1}
+ </table>
+ """.format(table_head, table_row)
continue
- #on other field types add label and value to html
+ # on any other field type add label and value to html
if not df.hidden and not df.print_hide and doc.get(df.fieldname) and df.fieldname not in exclude_fields:
- if doc.get(df.fieldname):
- formatted_value = format_value(doc.get(df.fieldname), meta.get_field(df.fieldname), doc)
- html += '<br>{0} : {1}'.format(df.label or df.fieldname, formatted_value)
+ formatted_value = format_value(doc.get(df.fieldname), meta.get_field(df.fieldname), doc)
+ html += "<br>{0} : {1}".format(df.label or df.fieldname, formatted_value)
if not has_data : has_data = True
if sec_on and col_on and has_data:
- doc_html += section_html + html + '</div></div>'
+ doc_html += section_html + html + "</div></div>"
elif sec_on and not col_on and has_data:
- doc_html += "<div class='col-md-12 col-sm-12'\
- ><div class='col-md-12 col-sm-12'>" \
- + section_html + html +'</div></div>'
- if doc_html:
- doc_html = "<div class='small'><div class='col-md-12 text-right'><a class='btn btn-default btn-xs' href='/app/Form/%s/%s'></a></div>" %(doctype, docname) + doc_html + '</div>'
+ doc_html += """
+ <div class='col-md-12 col-sm-12'>
+ <div class='col-md-12 col-sm-12'>
+ {0} {1}
+ </div>
+ </div>
+ """.format(section_html, html)
- return {'html': doc_html}
+ return {"html": doc_html}
def update_address_links(address, method):
diff --git a/erpnext/healthcare/web_form/lab_test/lab_test.py b/erpnext/healthcare/web_form/lab_test/lab_test.py
index 5a8c8a4..ec08985 100644
--- a/erpnext/healthcare/web_form/lab_test/lab_test.py
+++ b/erpnext/healthcare/web_form/lab_test/lab_test.py
@@ -2,6 +2,7 @@
import frappe
+
def get_context(context):
context.read_only = 1
diff --git a/erpnext/healthcare/web_form/patient_appointments/patient_appointments.py b/erpnext/healthcare/web_form/patient_appointments/patient_appointments.py
index 09bcb42..80c12fd 100644
--- a/erpnext/healthcare/web_form/patient_appointments/patient_appointments.py
+++ b/erpnext/healthcare/web_form/patient_appointments/patient_appointments.py
@@ -2,6 +2,7 @@
import frappe
+
def get_context(context):
context.read_only = 1
diff --git a/erpnext/healthcare/web_form/patient_registration/patient_registration.py b/erpnext/healthcare/web_form/patient_registration/patient_registration.py
index 1bc4d18..f57de91 100644
--- a/erpnext/healthcare/web_form/patient_registration/patient_registration.py
+++ b/erpnext/healthcare/web_form/patient_registration/patient_registration.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_context(context):
# do your magic here
pass
diff --git a/erpnext/healthcare/web_form/prescription/prescription.py b/erpnext/healthcare/web_form/prescription/prescription.py
index efdeaa9..f6f273a 100644
--- a/erpnext/healthcare/web_form/prescription/prescription.py
+++ b/erpnext/healthcare/web_form/prescription/prescription.py
@@ -2,6 +2,7 @@
import frappe
+
def get_context(context):
context.read_only = 1
diff --git a/erpnext/healthcare/workspace/healthcare/healthcare.json b/erpnext/healthcare/workspace/healthcare/healthcare.json
index 55132f3..f69604c 100644
--- a/erpnext/healthcare/workspace/healthcare/healthcare.json
+++ b/erpnext/healthcare/workspace/healthcare/healthcare.json
@@ -7,7 +7,7 @@
}
],
"charts_label": "",
- "content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Healthcare\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Patient Appointments\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Patient Appointment\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Patient\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Healthcare Service Unit\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Healthcare Practitioner\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Patient History\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Masters\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Consultation Setup\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Consultation\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Laboratory Setup\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Laboratory\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Rehabilitation and Physiotherapy\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Records and History\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}]",
+ "content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Healthcare\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Patient Appointments\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Patient Appointment\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Patient\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Healthcare Service Unit\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Healthcare Practitioner\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Patient History\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Masters\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Consultation Setup\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Consultation\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Facility Management\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Inpatient\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Laboratory Setup\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Laboratory\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Rehabilitation and Physiotherapy\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Records and History\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}]",
"creation": "2020-03-02 17:23:17.919682",
"developer_mode_only": 0,
"disable_user_customization": 0,
@@ -76,54 +76,9 @@
"type": "Link"
},
{
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Healthcare Service Unit Type",
- "link_count": 0,
- "link_to": "Healthcare Service Unit Type",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Healthcare Service Unit",
- "link_count": 0,
- "link_to": "Healthcare Service Unit",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Medical Code Standard",
- "link_count": 0,
- "link_to": "Medical Code Standard",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Medical Code",
- "link_count": 0,
- "link_to": "Medical Code",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
"hidden": 0,
"is_query_report": 0,
"label": "Consultation Setup",
- "link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@@ -132,7 +87,6 @@
"hidden": 0,
"is_query_report": 0,
"label": "Appointment Type",
- "link_count": 0,
"link_to": "Appointment Type",
"link_type": "DocType",
"onboard": 0,
@@ -143,7 +97,6 @@
"hidden": 0,
"is_query_report": 0,
"label": "Clinical Procedure Template",
- "link_count": 0,
"link_to": "Clinical Procedure Template",
"link_type": "DocType",
"onboard": 0,
@@ -154,7 +107,6 @@
"hidden": 0,
"is_query_report": 0,
"label": "Prescription Dosage",
- "link_count": 0,
"link_to": "Prescription Dosage",
"link_type": "DocType",
"onboard": 0,
@@ -165,7 +117,6 @@
"hidden": 0,
"is_query_report": 0,
"label": "Prescription Duration",
- "link_count": 0,
"link_to": "Prescription Duration",
"link_type": "DocType",
"onboard": 0,
@@ -176,70 +127,16 @@
"hidden": 0,
"is_query_report": 0,
"label": "Antibiotic",
- "link_count": 0,
"link_to": "Antibiotic",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
},
{
- "hidden": 0,
- "is_query_report": 0,
- "label": "Consultation",
- "link_count": 0,
- "onboard": 0,
- "type": "Card Break"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Patient Appointment",
- "link_count": 0,
- "link_to": "Patient Appointment",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Clinical Procedure",
- "link_count": 0,
- "link_to": "Clinical Procedure",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Patient Encounter",
- "link_count": 0,
- "link_to": "Patient Encounter",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
- "dependencies": "",
- "hidden": 0,
- "is_query_report": 0,
- "label": "Vital Signs",
- "link_count": 0,
- "link_to": "Vital Signs",
- "link_type": "DocType",
- "onboard": 0,
- "type": "Link"
- },
- {
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Complaint",
- "link_count": 0,
"link_to": "Complaint",
"link_type": "DocType",
"onboard": 0,
@@ -250,18 +147,63 @@
"hidden": 0,
"is_query_report": 0,
"label": "Diagnosis",
- "link_count": 0,
"link_to": "Diagnosis",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
},
{
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Consultation",
+ "onboard": 0,
+ "type": "Card Break"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Patient Appointment",
+ "link_to": "Patient Appointment",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Clinical Procedure",
+ "link_to": "Clinical Procedure",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Patient Encounter",
+ "link_to": "Patient Encounter",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Vital Signs",
+ "link_to": "Vital Signs",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Fee Validity",
- "link_count": 0,
"link_to": "Fee Validity",
"link_type": "DocType",
"onboard": 0,
@@ -270,6 +212,62 @@
{
"hidden": 0,
"is_query_report": 0,
+ "label": "Facility Management",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Card Break"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Healthcare Service Unit Type",
+ "link_to": "Healthcare Service Unit Type",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Healthcare Service Unit",
+ "link_to": "Healthcare Service Unit",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Medical Coding",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Card Break"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Medical Code Standard",
+ "link_to": "Medical Code Standard",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Medical Code",
+ "link_to": "Medical Code",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "hidden": 0,
+ "is_query_report": 0,
"label": "Settings",
"link_count": 0,
"onboard": 0,
@@ -339,6 +337,16 @@
"type": "Link"
},
{
+ "dependencies": "",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Dosage Form",
+ "link_to": "Dosage Form",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
"hidden": 0,
"is_query_report": 0,
"label": "Laboratory",
@@ -369,12 +377,36 @@
"type": "Link"
},
{
- "dependencies": "",
"hidden": 0,
"is_query_report": 0,
- "label": "Dosage Form",
- "link_count": 0,
- "link_to": "Dosage Form",
+ "label": "Inpatient",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Card Break"
+ },
+ {
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Inpatient Medication Order",
+ "link_to": "Inpatient Medication Order",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Inpatient Record",
+ "link_to": "Inpatient Record",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Inpatient Medication Entry",
+ "link_to": "Inpatient Medication Entry",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
@@ -536,7 +568,7 @@
"type": "Link"
}
],
- "modified": "2021-08-05 12:15:59.434612",
+ "modified": "2021-08-30 17:37:45.316999",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Healthcare",
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index b1a64f9..5b6e1ee 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
from frappe import _
app_name = "erpnext"
@@ -286,6 +287,7 @@
]
},
"Payment Entry": {
+ "validate": "erpnext.regional.india.utils.update_place_of_supply",
"on_submit": ["erpnext.regional.create_transaction_log", "erpnext.accounts.doctype.payment_request.payment_request.update_payment_req_status", "erpnext.accounts.doctype.dunning.dunning.resolve_dunning"],
"on_trash": "erpnext.regional.check_deletion_permission"
},
@@ -316,6 +318,9 @@
},
"Company": {
"on_trash": "erpnext.regional.india.utils.delete_gst_settings_for_company"
+ },
+ "Integration Request": {
+ "validate": "erpnext.accounts.doctype.payment_request.payment_request.validate_payment"
}
}
diff --git a/erpnext/hotels/doctype/hotel_room/hotel_room.py b/erpnext/hotels/doctype/hotel_room/hotel_room.py
index 6a2fc02..93a62c9 100644
--- a/erpnext/hotels/doctype/hotel_room/hotel_room.py
+++ b/erpnext/hotels/doctype/hotel_room/hotel_room.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class HotelRoom(Document):
def validate(self):
if not self.capacity:
diff --git a/erpnext/hotels/doctype/hotel_room/test_hotel_room.py b/erpnext/hotels/doctype/hotel_room/test_hotel_room.py
index e307b5a..4fedbd4 100644
--- a/erpnext/hotels/doctype/hotel_room/test_hotel_room.py
+++ b/erpnext/hotels/doctype/hotel_room/test_hotel_room.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
test_dependencies = ["Hotel Room Package"]
test_records = [
dict(doctype="Hotel Room", name="1001",
diff --git a/erpnext/hotels/doctype/hotel_room_amenity/hotel_room_amenity.py b/erpnext/hotels/doctype/hotel_room_amenity/hotel_room_amenity.py
index 69da007..982b3ef 100644
--- a/erpnext/hotels/doctype/hotel_room_amenity/hotel_room_amenity.py
+++ b/erpnext/hotels/doctype/hotel_room_amenity/hotel_room_amenity.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class HotelRoomAmenity(Document):
pass
diff --git a/erpnext/hotels/doctype/hotel_room_package/hotel_room_package.py b/erpnext/hotels/doctype/hotel_room_package/hotel_room_package.py
index 8a62eea..1864081 100644
--- a/erpnext/hotels/doctype/hotel_room_package/hotel_room_package.py
+++ b/erpnext/hotels/doctype/hotel_room_package/hotel_room_package.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class HotelRoomPackage(Document):
def validate(self):
if not self.item:
diff --git a/erpnext/hotels/doctype/hotel_room_package/test_hotel_room_package.py b/erpnext/hotels/doctype/hotel_room_package/test_hotel_room_package.py
index ebf7f2b..fe5d79d 100644
--- a/erpnext/hotels/doctype/hotel_room_package/test_hotel_room_package.py
+++ b/erpnext/hotels/doctype/hotel_room_package/test_hotel_room_package.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
test_records = [
dict(doctype='Item', item_code='Breakfast',
item_group='Products', is_stock_item=0),
diff --git a/erpnext/hotels/doctype/hotel_room_pricing/hotel_room_pricing.py b/erpnext/hotels/doctype/hotel_room_pricing/hotel_room_pricing.py
index 8eee0f2..5797fef 100644
--- a/erpnext/hotels/doctype/hotel_room_pricing/hotel_room_pricing.py
+++ b/erpnext/hotels/doctype/hotel_room_pricing/hotel_room_pricing.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class HotelRoomPricing(Document):
pass
diff --git a/erpnext/hotels/doctype/hotel_room_pricing/test_hotel_room_pricing.py b/erpnext/hotels/doctype/hotel_room_pricing/test_hotel_room_pricing.py
index b73fd44..72030c6 100644
--- a/erpnext/hotels/doctype/hotel_room_pricing/test_hotel_room_pricing.py
+++ b/erpnext/hotels/doctype/hotel_room_pricing/test_hotel_room_pricing.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
test_dependencies = ["Hotel Room Package"]
test_records = [
dict(doctype="Hotel Room Pricing", enabled=1,
diff --git a/erpnext/hotels/doctype/hotel_room_pricing_item/hotel_room_pricing_item.py b/erpnext/hotels/doctype/hotel_room_pricing_item/hotel_room_pricing_item.py
index 6bf01bf..4a344df 100644
--- a/erpnext/hotels/doctype/hotel_room_pricing_item/hotel_room_pricing_item.py
+++ b/erpnext/hotels/doctype/hotel_room_pricing_item/hotel_room_pricing_item.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class HotelRoomPricingItem(Document):
pass
diff --git a/erpnext/hotels/doctype/hotel_room_pricing_package/hotel_room_pricing_package.py b/erpnext/hotels/doctype/hotel_room_pricing_package/hotel_room_pricing_package.py
index 9ae9fcf..f594ac7 100644
--- a/erpnext/hotels/doctype/hotel_room_pricing_package/hotel_room_pricing_package.py
+++ b/erpnext/hotels/doctype/hotel_room_pricing_package/hotel_room_pricing_package.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class HotelRoomPricingPackage(Document):
pass
diff --git a/erpnext/hotels/doctype/hotel_room_pricing_package/test_hotel_room_pricing_package.py b/erpnext/hotels/doctype/hotel_room_pricing_package/test_hotel_room_pricing_package.py
index fec1c86..ea258cc 100644
--- a/erpnext/hotels/doctype/hotel_room_pricing_package/test_hotel_room_pricing_package.py
+++ b/erpnext/hotels/doctype/hotel_room_pricing_package/test_hotel_room_pricing_package.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestHotelRoomPricingPackage(unittest.TestCase):
pass
diff --git a/erpnext/hotels/doctype/hotel_room_reservation/hotel_room_reservation.py b/erpnext/hotels/doctype/hotel_room_reservation/hotel_room_reservation.py
index a8ebe86..4944862 100644
--- a/erpnext/hotels/doctype/hotel_room_reservation/hotel_room_reservation.py
+++ b/erpnext/hotels/doctype/hotel_room_reservation/hotel_room_reservation.py
@@ -3,10 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json
-from frappe.model.document import Document
+
+import json
+
+import frappe
from frappe import _
-from frappe.utils import date_diff, add_days, flt
+from frappe.model.document import Document
+from frappe.utils import add_days, date_diff, flt
+
class HotelRoomUnavailableError(frappe.ValidationError): pass
class HotelRoomPricingNotSetError(frappe.ValidationError): pass
diff --git a/erpnext/hotels/doctype/hotel_room_reservation/test_hotel_room_reservation.py b/erpnext/hotels/doctype/hotel_room_reservation/test_hotel_room_reservation.py
index d497996..e03005c 100644
--- a/erpnext/hotels/doctype/hotel_room_reservation/test_hotel_room_reservation.py
+++ b/erpnext/hotels/doctype/hotel_room_reservation/test_hotel_room_reservation.py
@@ -3,9 +3,15 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.hotels.doctype.hotel_room_reservation.hotel_room_reservation import HotelRoomPricingNotSetError, HotelRoomUnavailableError
+
+import frappe
+
+from erpnext.hotels.doctype.hotel_room_reservation.hotel_room_reservation import (
+ HotelRoomPricingNotSetError,
+ HotelRoomUnavailableError,
+)
+
test_dependencies = ["Hotel Room Package", "Hotel Room Pricing", "Hotel Room"]
class TestHotelRoomReservation(unittest.TestCase):
diff --git a/erpnext/hotels/doctype/hotel_room_reservation_item/hotel_room_reservation_item.py b/erpnext/hotels/doctype/hotel_room_reservation_item/hotel_room_reservation_item.py
index 3406fae..0cf8547 100644
--- a/erpnext/hotels/doctype/hotel_room_reservation_item/hotel_room_reservation_item.py
+++ b/erpnext/hotels/doctype/hotel_room_reservation_item/hotel_room_reservation_item.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class HotelRoomReservationItem(Document):
pass
diff --git a/erpnext/hotels/doctype/hotel_room_type/hotel_room_type.py b/erpnext/hotels/doctype/hotel_room_type/hotel_room_type.py
index 1fc1303..610cf18 100644
--- a/erpnext/hotels/doctype/hotel_room_type/hotel_room_type.py
+++ b/erpnext/hotels/doctype/hotel_room_type/hotel_room_type.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class HotelRoomType(Document):
pass
diff --git a/erpnext/hotels/doctype/hotel_room_type/test_hotel_room_type.py b/erpnext/hotels/doctype/hotel_room_type/test_hotel_room_type.py
index 3b243e9..6dba7b7 100644
--- a/erpnext/hotels/doctype/hotel_room_type/test_hotel_room_type.py
+++ b/erpnext/hotels/doctype/hotel_room_type/test_hotel_room_type.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestHotelRoomType(unittest.TestCase):
pass
diff --git a/erpnext/hotels/doctype/hotel_settings/hotel_settings.py b/erpnext/hotels/doctype/hotel_settings/hotel_settings.py
index d78bca1..f8f8fe9 100644
--- a/erpnext/hotels/doctype/hotel_settings/hotel_settings.py
+++ b/erpnext/hotels/doctype/hotel_settings/hotel_settings.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class HotelSettings(Document):
pass
diff --git a/erpnext/hotels/doctype/hotel_settings/test_hotel_settings.py b/erpnext/hotels/doctype/hotel_settings/test_hotel_settings.py
index a081acc..5cf58b9 100644
--- a/erpnext/hotels/doctype/hotel_settings/test_hotel_settings.py
+++ b/erpnext/hotels/doctype/hotel_settings/test_hotel_settings.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestHotelSettings(unittest.TestCase):
pass
diff --git a/erpnext/hotels/report/hotel_room_occupancy/hotel_room_occupancy.py b/erpnext/hotels/report/hotel_room_occupancy/hotel_room_occupancy.py
index 259edb9..f02baeb 100644
--- a/erpnext/hotels/report/hotel_room_occupancy/hotel_room_occupancy.py
+++ b/erpnext/hotels/report/hotel_room_occupancy/hotel_room_occupancy.py
@@ -2,12 +2,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import add_days, date_diff
from erpnext.hotels.doctype.hotel_room_reservation.hotel_room_reservation import get_rooms_booked
+
def execute(filters=None):
columns = get_columns(filters)
data = get_data(filters)
diff --git a/erpnext/hr/doctype/appointment_letter/appointment_letter.py b/erpnext/hr/doctype/appointment_letter/appointment_letter.py
index 85b82c5..b9a8ec6 100644
--- a/erpnext/hr/doctype/appointment_letter/appointment_letter.py
+++ b/erpnext/hr/doctype/appointment_letter/appointment_letter.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class AppointmentLetter(Document):
pass
diff --git a/erpnext/hr/doctype/appointment_letter/test_appointment_letter.py b/erpnext/hr/doctype/appointment_letter/test_appointment_letter.py
index b9ce981..88637b9 100644
--- a/erpnext/hr/doctype/appointment_letter/test_appointment_letter.py
+++ b/erpnext/hr/doctype/appointment_letter/test_appointment_letter.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestAppointmentLetter(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/appointment_letter_content/appointment_letter_content.py b/erpnext/hr/doctype/appointment_letter_content/appointment_letter_content.py
index a1a49e5..f4db456 100644
--- a/erpnext/hr/doctype/appointment_letter_content/appointment_letter_content.py
+++ b/erpnext/hr/doctype/appointment_letter_content/appointment_letter_content.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class AppointmentLettercontent(Document):
pass
diff --git a/erpnext/hr/doctype/appointment_letter_template/appointment_letter_template.py b/erpnext/hr/doctype/appointment_letter_template/appointment_letter_template.py
index c23881f..acb5c1f 100644
--- a/erpnext/hr/doctype/appointment_letter_template/appointment_letter_template.py
+++ b/erpnext/hr/doctype/appointment_letter_template/appointment_letter_template.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class AppointmentLetterTemplate(Document):
pass
diff --git a/erpnext/hr/doctype/appointment_letter_template/test_appointment_letter_template.py b/erpnext/hr/doctype/appointment_letter_template/test_appointment_letter_template.py
index 3d061ac..46dd3e1 100644
--- a/erpnext/hr/doctype/appointment_letter_template/test_appointment_letter_template.py
+++ b/erpnext/hr/doctype/appointment_letter_template/test_appointment_letter_template.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestAppointmentLetterTemplate(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/appraisal/appraisal.py b/erpnext/hr/doctype/appraisal/appraisal.py
index c2ed457..96a4ffa 100644
--- a/erpnext/hr/doctype/appraisal/appraisal.py
+++ b/erpnext/hr/doctype/appraisal/appraisal.py
@@ -2,15 +2,16 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+import frappe
+from frappe import _
+from frappe.model.document import Document
+from frappe.model.mapper import get_mapped_doc
from frappe.utils import flt, getdate
-from frappe import _
-from frappe.model.mapper import get_mapped_doc
-from frappe.model.document import Document
from erpnext.hr.utils import set_employee_name, validate_active_employee
+
class Appraisal(Document):
def validate(self):
if not self.status:
diff --git a/erpnext/hr/doctype/appraisal/test_appraisal.py b/erpnext/hr/doctype/appraisal/test_appraisal.py
index f70dc48..cf2bd7c 100644
--- a/erpnext/hr/doctype/appraisal/test_appraisal.py
+++ b/erpnext/hr/doctype/appraisal/test_appraisal.py
@@ -2,7 +2,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Appraisal')
diff --git a/erpnext/hr/doctype/appraisal_goal/appraisal_goal.py b/erpnext/hr/doctype/appraisal_goal/appraisal_goal.py
index 11d9f39..d9789a0 100644
--- a/erpnext/hr/doctype/appraisal_goal/appraisal_goal.py
+++ b/erpnext/hr/doctype/appraisal_goal/appraisal_goal.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class AppraisalGoal(Document):
pass
diff --git a/erpnext/hr/doctype/appraisal_template/appraisal_template.py b/erpnext/hr/doctype/appraisal_template/appraisal_template.py
index d0dfad4..d10a0de 100644
--- a/erpnext/hr/doctype/appraisal_template/appraisal_template.py
+++ b/erpnext/hr/doctype/appraisal_template/appraisal_template.py
@@ -2,11 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import cint, flt
-from frappe import _
+import frappe
+from frappe import _
from frappe.model.document import Document
+from frappe.utils import cint, flt
+
class AppraisalTemplate(Document):
def validate(self):
diff --git a/erpnext/hr/doctype/appraisal_template/appraisal_template_dashboard.py b/erpnext/hr/doctype/appraisal_template/appraisal_template_dashboard.py
index 392b370..b8d0494 100644
--- a/erpnext/hr/doctype/appraisal_template/appraisal_template_dashboard.py
+++ b/erpnext/hr/doctype/appraisal_template/appraisal_template_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/hr/doctype/appraisal_template/test_appraisal_template.py b/erpnext/hr/doctype/appraisal_template/test_appraisal_template.py
index e3029d9..a814ec8 100644
--- a/erpnext/hr/doctype/appraisal_template/test_appraisal_template.py
+++ b/erpnext/hr/doctype/appraisal_template/test_appraisal_template.py
@@ -2,7 +2,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Appraisal Template')
diff --git a/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.py b/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.py
index b3c5704..1b15fbd 100644
--- a/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.py
+++ b/erpnext/hr/doctype/appraisal_template_goal/appraisal_template_goal.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class AppraisalTemplateGoal(Document):
pass
diff --git a/erpnext/hr/doctype/attendance/attendance.py b/erpnext/hr/doctype/attendance/attendance.py
index c1a7c8f..002f9bb 100644
--- a/erpnext/hr/doctype/attendance/attendance.py
+++ b/erpnext/hr/doctype/attendance/attendance.py
@@ -2,14 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import getdate, nowdate
+import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import cstr, get_datetime, formatdate
+from frappe.utils import cstr, formatdate, get_datetime, getdate, nowdate
+
from erpnext.hr.utils import validate_active_employee
+
class Attendance(Document):
def validate(self):
from erpnext.controllers.status_updater import validate_status
@@ -134,7 +135,6 @@
@frappe.whitelist()
def mark_bulk_attendance(data):
import json
- from pprint import pprint
if isinstance(data, str):
data = json.loads(data)
data = frappe._dict(data)
diff --git a/erpnext/hr/doctype/attendance/attendance_dashboard.py b/erpnext/hr/doctype/attendance/attendance_dashboard.py
index 5dd9403..bbe67df 100644
--- a/erpnext/hr/doctype/attendance/attendance_dashboard.py
+++ b/erpnext/hr/doctype/attendance/attendance_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/hr/doctype/attendance/test_attendance.py b/erpnext/hr/doctype/attendance/test_attendance.py
index 838b704..ab44377 100644
--- a/erpnext/hr/doctype/attendance/test_attendance.py
+++ b/erpnext/hr/doctype/attendance/test_attendance.py
@@ -2,8 +2,9 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from frappe.utils import nowdate
test_records = frappe.get_test_records('Attendance')
diff --git a/erpnext/hr/doctype/attendance_request/attendance_request.py b/erpnext/hr/doctype/attendance_request/attendance_request.py
index 7f88fed..1e74296 100644
--- a/erpnext/hr/doctype/attendance_request/attendance_request.py
+++ b/erpnext/hr/doctype/attendance_request/attendance_request.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import date_diff, add_days, getdate
+from frappe.utils import add_days, date_diff, getdate
+
from erpnext.hr.doctype.employee.employee import is_holiday
-from erpnext.hr.utils import validate_dates, validate_active_employee
+from erpnext.hr.utils import validate_active_employee, validate_dates
+
class AttendanceRequest(Document):
def validate(self):
diff --git a/erpnext/hr/doctype/attendance_request/attendance_request_dashboard.py b/erpnext/hr/doctype/attendance_request/attendance_request_dashboard.py
index 2d3eb00..8feb6f2 100644
--- a/erpnext/hr/doctype/attendance_request/attendance_request_dashboard.py
+++ b/erpnext/hr/doctype/attendance_request/attendance_request_dashboard.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_data():
return {
'fieldname': 'attendance_request',
diff --git a/erpnext/hr/doctype/attendance_request/test_attendance_request.py b/erpnext/hr/doctype/attendance_request/test_attendance_request.py
index 9e668aa..a9db74c 100644
--- a/erpnext/hr/doctype/attendance_request/test_attendance_request.py
+++ b/erpnext/hr/doctype/attendance_request/test_attendance_request.py
@@ -3,11 +3,12 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import nowdate
from datetime import date
+import frappe
+from frappe.utils import nowdate
+
test_dependencies = ["Employee"]
class TestAttendanceRequest(unittest.TestCase):
diff --git a/erpnext/hr/doctype/branch/branch.py b/erpnext/hr/doctype/branch/branch.py
index a847c8e..c770dc3 100644
--- a/erpnext/hr/doctype/branch/branch.py
+++ b/erpnext/hr/doctype/branch/branch.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class Branch(Document):
pass
diff --git a/erpnext/hr/doctype/branch/test_branch.py b/erpnext/hr/doctype/branch/test_branch.py
index 807698b..7bf9b39 100644
--- a/erpnext/hr/doctype/branch/test_branch.py
+++ b/erpnext/hr/doctype/branch/test_branch.py
@@ -2,6 +2,6 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
import frappe
+
test_records = frappe.get_test_records('Branch')
diff --git a/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.py b/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.py
index 3db8165..f24483b 100644
--- a/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.py
+++ b/erpnext/hr/doctype/compensatory_leave_request/compensatory_leave_request.py
@@ -3,12 +3,21 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import date_diff, add_days, getdate, cint, format_date
from frappe.model.document import Document
-from erpnext.hr.utils import validate_dates, validate_overlap, get_leave_period, validate_active_employee, \
- create_additional_leave_ledger_entry, get_holiday_dates_for_employee
+from frappe.utils import add_days, cint, date_diff, format_date, getdate
+
+from erpnext.hr.utils import (
+ create_additional_leave_ledger_entry,
+ get_holiday_dates_for_employee,
+ get_leave_period,
+ validate_active_employee,
+ validate_dates,
+ validate_overlap,
+)
+
class CompensatoryLeaveRequest(Document):
diff --git a/erpnext/hr/doctype/compensatory_leave_request/test_compensatory_leave_request.py b/erpnext/hr/doctype/compensatory_leave_request/test_compensatory_leave_request.py
index 3b99c57..95bdd51 100644
--- a/erpnext/hr/doctype/compensatory_leave_request/test_compensatory_leave_request.py
+++ b/erpnext/hr/doctype/compensatory_leave_request/test_compensatory_leave_request.py
@@ -3,12 +3,14 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import today, add_months, add_days
+
+import frappe
+from frappe.utils import add_days, add_months, today
+
from erpnext.hr.doctype.attendance_request.test_attendance_request import get_employee
-from erpnext.hr.doctype.leave_period.test_leave_period import create_leave_period
from erpnext.hr.doctype.leave_application.leave_application import get_leave_balance_on
+from erpnext.hr.doctype.leave_period.test_leave_period import create_leave_period
test_dependencies = ["Employee"]
diff --git a/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py b/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py
index 1cc2381..92cf6aa 100644
--- a/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py
+++ b/erpnext/hr/doctype/daily_work_summary/daily_work_summary.py
@@ -3,11 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
-from frappe import _
from email_reply_parser import EmailReplyParser
-from erpnext.hr.doctype.employee.employee import is_holiday
+from frappe import _
+from frappe.model.document import Document
from frappe.utils import global_date_format
from six import string_types
@@ -82,7 +82,7 @@
crop=True
)
d.image = thumbnail_image
- except:
+ except Exception:
d.image = original_image
if d.sender in did_not_reply:
diff --git a/erpnext/hr/doctype/daily_work_summary/test_daily_work_summary.py b/erpnext/hr/doctype/daily_work_summary/test_daily_work_summary.py
index 3868479..bed12e3 100644
--- a/erpnext/hr/doctype/daily_work_summary/test_daily_work_summary.py
+++ b/erpnext/hr/doctype/daily_work_summary/test_daily_work_summary.py
@@ -4,8 +4,9 @@
from __future__ import unicode_literals
import os
-import frappe
import unittest
+
+import frappe
import frappe.utils
# test_records = frappe.get_test_records('Daily Work Summary')
@@ -64,8 +65,7 @@
filters=dict(email=('!=', 'test@example.com')))
self.setup_groups(hour)
- from erpnext.hr.doctype.daily_work_summary_group.daily_work_summary_group \
- import trigger_emails
+ from erpnext.hr.doctype.daily_work_summary_group.daily_work_summary_group import trigger_emails
trigger_emails()
# check if emails are created
diff --git a/erpnext/hr/doctype/daily_work_summary_group/daily_work_summary_group.py b/erpnext/hr/doctype/daily_work_summary_group/daily_work_summary_group.py
index ece331a..152b1a9 100644
--- a/erpnext/hr/doctype/daily_work_summary_group/daily_work_summary_group.py
+++ b/erpnext/hr/doctype/daily_work_summary_group/daily_work_summary_group.py
@@ -3,13 +3,16 @@
# # For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
import frappe.utils
from frappe import _
+from frappe.model.document import Document
+
from erpnext.hr.doctype.daily_work_summary.daily_work_summary import get_user_emails_from_group
from erpnext.hr.doctype.holiday_list.holiday_list import is_holiday
+
class DailyWorkSummaryGroup(Document):
def validate(self):
if self.users:
diff --git a/erpnext/hr/doctype/daily_work_summary_group_user/daily_work_summary_group_user.py b/erpnext/hr/doctype/daily_work_summary_group_user/daily_work_summary_group_user.py
index eefcc0c..d69a7fb 100644
--- a/erpnext/hr/doctype/daily_work_summary_group_user/daily_work_summary_group_user.py
+++ b/erpnext/hr/doctype/daily_work_summary_group_user/daily_work_summary_group_user.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class DailyWorkSummaryGroupUser(Document):
pass
diff --git a/erpnext/hr/doctype/department/department.py b/erpnext/hr/doctype/department/department.py
index 539a360..b4771b3 100644
--- a/erpnext/hr/doctype/department/department.py
+++ b/erpnext/hr/doctype/department/department.py
@@ -2,10 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.utils.nestedset import NestedSet, get_root_of
+
from erpnext.utilities.transaction_base import delete_events
-from frappe.model.document import Document
+
class Department(NestedSet):
nsm_parent_field = 'parent_department'
diff --git a/erpnext/hr/doctype/department/test_department.py b/erpnext/hr/doctype/department/test_department.py
index e4f6645..2fb3b95 100644
--- a/erpnext/hr/doctype/department/test_department.py
+++ b/erpnext/hr/doctype/department/test_department.py
@@ -1,9 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
import unittest
+import frappe
+
test_ignore = ["Leave Block List"]
class TestDepartment(unittest.TestCase):
def test_remove_department_data(self):
diff --git a/erpnext/hr/doctype/department_approver/department_approver.py b/erpnext/hr/doctype/department_approver/department_approver.py
index d337959..113ea18 100644
--- a/erpnext/hr/doctype/department_approver/department_approver.py
+++ b/erpnext/hr/doctype/department_approver/department_approver.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
class DepartmentApprover(Document):
pass
diff --git a/erpnext/hr/doctype/designation/designation.py b/erpnext/hr/doctype/designation/designation.py
index a3f84aa..0291a99 100644
--- a/erpnext/hr/doctype/designation/designation.py
+++ b/erpnext/hr/doctype/designation/designation.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class Designation(Document):
pass
diff --git a/erpnext/hr/doctype/designation/test_designation.py b/erpnext/hr/doctype/designation/test_designation.py
index 2778862..33aa243 100644
--- a/erpnext/hr/doctype/designation/test_designation.py
+++ b/erpnext/hr/doctype/designation/test_designation.py
@@ -2,8 +2,8 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
import frappe
+
# test_records = frappe.get_test_records('Designation')
def create_designation(**args):
diff --git a/erpnext/hr/doctype/designation_skill/designation_skill.py b/erpnext/hr/doctype/designation_skill/designation_skill.py
index c37d21f..2074dc9 100644
--- a/erpnext/hr/doctype/designation_skill/designation_skill.py
+++ b/erpnext/hr/doctype/designation_skill/designation_skill.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class DesignationSkill(Document):
pass
diff --git a/erpnext/hr/doctype/driver/driver.py b/erpnext/hr/doctype/driver/driver.py
index 2cd22cd..5c428b5 100644
--- a/erpnext/hr/doctype/driver/driver.py
+++ b/erpnext/hr/doctype/driver/driver.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class Driver(Document):
pass
diff --git a/erpnext/hr/doctype/driver/test_driver.py b/erpnext/hr/doctype/driver/test_driver.py
index 4bc4a8f..fa36237 100644
--- a/erpnext/hr/doctype/driver/test_driver.py
+++ b/erpnext/hr/doctype/driver/test_driver.py
@@ -5,5 +5,6 @@
import unittest
+
class TestDriver(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/driving_license_category/driving_license_category.py b/erpnext/hr/doctype/driving_license_category/driving_license_category.py
index 33ba138..63ac418 100644
--- a/erpnext/hr/doctype/driving_license_category/driving_license_category.py
+++ b/erpnext/hr/doctype/driving_license_category/driving_license_category.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class DrivingLicenseCategory(Document):
pass
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index 643f3da..79e8f61 100755
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -1,15 +1,21 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
-
-from frappe.utils import getdate, validate_email_address, today, add_years, cstr
+from frappe import _, scrub, throw
from frappe.model.naming import set_name_by_naming_series
-from frappe import throw, _, scrub
-from frappe.permissions import add_user_permission, remove_user_permission, \
- set_user_permission_if_allowed, has_permission, get_doc_permissions
-from erpnext.utilities.transaction_base import delete_events
+from frappe.permissions import (
+ add_user_permission,
+ get_doc_permissions,
+ has_permission,
+ remove_user_permission,
+ set_user_permission_if_allowed,
+)
+from frappe.utils import add_years, cstr, getdate, today, validate_email_address
from frappe.utils.nestedset import NestedSet
+from erpnext.utilities.transaction_base import delete_events
+
+
class EmployeeUserDisabledError(frappe.ValidationError):
pass
class InactiveEmployeeStatusError(frappe.ValidationError):
diff --git a/erpnext/hr/doctype/employee/employee_dashboard.py b/erpnext/hr/doctype/employee/employee_dashboard.py
index e853bee..ce307be 100644
--- a/erpnext/hr/doctype/employee/employee_dashboard.py
+++ b/erpnext/hr/doctype/employee/employee_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'heatmap': True,
diff --git a/erpnext/hr/doctype/employee/employee_reminders.py b/erpnext/hr/doctype/employee/employee_reminders.py
index 2155c02..fc01866 100644
--- a/erpnext/hr/doctype/employee/employee_reminders.py
+++ b/erpnext/hr/doctype/employee/employee_reminders.py
@@ -3,10 +3,12 @@
import frappe
from frappe import _
-from frappe.utils import comma_sep, getdate, today, add_months, add_days
+from frappe.utils import add_days, add_months, comma_sep, getdate, today
+
from erpnext.hr.doctype.employee.employee import get_all_employee_emails, get_employee_email
from erpnext.hr.utils import get_holidays_for_employee
+
# -----------------
# HOLIDAY REMINDERS
# -----------------
diff --git a/erpnext/hr/doctype/employee/test_employee.py b/erpnext/hr/doctype/employee/test_employee.py
index 5feb6de..8d6dfa2 100644
--- a/erpnext/hr/doctype/employee/test_employee.py
+++ b/erpnext/hr/doctype/employee/test_employee.py
@@ -1,10 +1,12 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-import frappe
-import erpnext
import unittest
+
+import frappe
import frappe.utils
+
+import erpnext
from erpnext.hr.doctype.employee.employee import InactiveEmployeeStatusError
test_records = frappe.get_test_records('Employee')
@@ -23,9 +25,9 @@
self.assertRaises(InactiveEmployeeStatusError, employee1_doc.save)
def test_employee_status_inactive(self):
- from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
- from erpnext.payroll.doctype.salary_structure.salary_structure import make_salary_slip
from erpnext.payroll.doctype.salary_slip.test_salary_slip import make_holiday_list
+ from erpnext.payroll.doctype.salary_structure.salary_structure import make_salary_slip
+ from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
employee = make_employee("test_employee_status@company.com")
employee_doc = frappe.get_doc("Employee", employee)
diff --git a/erpnext/hr/doctype/employee/test_employee_reminders.py b/erpnext/hr/doctype/employee/test_employee_reminders.py
index 7e560f5..52c0098 100644
--- a/erpnext/hr/doctype/employee/test_employee_reminders.py
+++ b/erpnext/hr/doctype/employee/test_employee_reminders.py
@@ -1,11 +1,12 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-import frappe
import unittest
-
-from frappe.utils import getdate
from datetime import timedelta
+
+import frappe
+from frappe.utils import getdate
+
from erpnext.hr.doctype.employee.test_employee import make_employee
from erpnext.hr.doctype.hr_settings.hr_settings import set_proceed_with_frequency_change
@@ -18,7 +19,7 @@
# Create a test holiday list
test_holiday_dates = cls.get_test_holiday_dates()
test_holiday_list = make_holiday_list(
- 'TestHolidayRemindersList',
+ 'TestHolidayRemindersList',
holiday_dates=[
{'holiday_date': test_holiday_dates[0], 'description': 'test holiday1'},
{'holiday_date': test_holiday_dates[1], 'description': 'test holiday2'},
@@ -49,8 +50,8 @@
def get_test_holiday_dates(cls):
today_date = getdate()
return [
- today_date,
- today_date-timedelta(days=4),
+ today_date,
+ today_date-timedelta(days=4),
today_date-timedelta(days=3),
today_date+timedelta(days=1),
today_date+timedelta(days=3),
@@ -63,7 +64,7 @@
def test_is_holiday(self):
from erpnext.hr.doctype.employee.employee import is_holiday
-
+
self.assertTrue(is_holiday(self.test_employee.name))
self.assertTrue(is_holiday(self.test_employee.name, date=self.test_holiday_dates[1]))
self.assertFalse(is_holiday(self.test_employee.name, date=getdate()-timedelta(days=1)))
@@ -84,7 +85,10 @@
employee.company = "_Test Company"
employee.save()
- from erpnext.hr.doctype.employee.employee_reminders import get_employees_who_are_born_today, send_birthday_reminders
+ from erpnext.hr.doctype.employee.employee_reminders import (
+ get_employees_who_are_born_today,
+ send_birthday_reminders,
+ )
employees_born_today = get_employees_who_are_born_today()
self.assertTrue(employees_born_today.get("_Test Company"))
@@ -105,7 +109,10 @@
employee.company = "_Test Company"
employee.save()
- from erpnext.hr.doctype.employee.employee_reminders import get_employees_having_an_event_today, send_work_anniversary_reminders
+ from erpnext.hr.doctype.employee.employee_reminders import (
+ get_employees_having_an_event_today,
+ send_work_anniversary_reminders,
+ )
employees_having_work_anniversary = get_employees_having_an_event_today('work_anniversary')
self.assertTrue(employees_having_work_anniversary.get("_Test Company"))
@@ -118,10 +125,10 @@
email_queue = frappe.db.sql("""select * from `tabEmail Queue`""", as_dict=True)
self.assertTrue("Subject: Work Anniversary Reminder" in email_queue[0].message)
-
+
def test_send_holidays_reminder_in_advance(self):
- from erpnext.hr.utils import get_holidays_for_employee
from erpnext.hr.doctype.employee.employee_reminders import send_holidays_reminder_in_advance
+ from erpnext.hr.utils import get_holidays_for_employee
# Get HR settings and enable advance holiday reminders
hr_settings = frappe.get_doc("HR Settings", "HR Settings")
@@ -133,10 +140,10 @@
holidays = get_holidays_for_employee(
self.test_employee.get('name'),
getdate(), getdate() + timedelta(days=3),
- only_non_weekly=True,
+ only_non_weekly=True,
raise_exception=False
)
-
+
send_holidays_reminder_in_advance(
self.test_employee.get('name'),
holidays
@@ -147,6 +154,7 @@
def test_advance_holiday_reminders_monthly(self):
from erpnext.hr.doctype.employee.employee_reminders import send_reminders_in_advance_monthly
+
# Get HR settings and enable advance holiday reminders
hr_settings = frappe.get_doc("HR Settings", "HR Settings")
hr_settings.send_holiday_reminders = 1
@@ -158,9 +166,10 @@
email_queue = frappe.db.sql("""select * from `tabEmail Queue`""", as_dict=True)
self.assertTrue(len(email_queue) > 0)
-
+
def test_advance_holiday_reminders_weekly(self):
from erpnext.hr.doctype.employee.employee_reminders import send_reminders_in_advance_weekly
+
# Get HR settings and enable advance holiday reminders
hr_settings = frappe.get_doc("HR Settings", "HR Settings")
hr_settings.send_holiday_reminders = 1
diff --git a/erpnext/hr/doctype/employee_advance/employee_advance.py b/erpnext/hr/doctype/employee_advance/employee_advance.py
index cbb3cc8..87d42d3 100644
--- a/erpnext/hr/doctype/employee_advance/employee_advance.py
+++ b/erpnext/hr/doctype/employee_advance/employee_advance.py
@@ -3,13 +3,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import flt, nowdate
+
+import erpnext
from erpnext.accounts.doctype.journal_entry.journal_entry import get_default_bank_cash_account
from erpnext.hr.utils import validate_active_employee
+
class EmployeeAdvanceOverPayment(frappe.ValidationError):
pass
diff --git a/erpnext/hr/doctype/employee_advance/employee_advance_dashboard.py b/erpnext/hr/doctype/employee_advance/employee_advance_dashboard.py
index 2f493e2..17d5bd2 100644
--- a/erpnext/hr/doctype/employee_advance/employee_advance_dashboard.py
+++ b/erpnext/hr/doctype/employee_advance/employee_advance_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/hr/doctype/employee_advance/test_employee_advance.py b/erpnext/hr/doctype/employee_advance/test_employee_advance.py
index 100968b..f8e5f53 100644
--- a/erpnext/hr/doctype/employee_advance/test_employee_advance.py
+++ b/erpnext/hr/doctype/employee_advance/test_employee_advance.py
@@ -3,12 +3,18 @@
# See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
import unittest
+
+import frappe
from frappe.utils import nowdate
-from erpnext.hr.doctype.employee_advance.employee_advance import make_bank_entry
-from erpnext.hr.doctype.employee_advance.employee_advance import EmployeeAdvanceOverPayment
+
+import erpnext
from erpnext.hr.doctype.employee.test_employee import make_employee
+from erpnext.hr.doctype.employee_advance.employee_advance import (
+ EmployeeAdvanceOverPayment,
+ make_bank_entry,
+)
+
class TestEmployeeAdvance(unittest.TestCase):
def test_paid_amount_and_status(self):
diff --git a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.py b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.py
index 16c1a32..7c751a4 100644
--- a/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.py
+++ b/erpnext/hr/doctype/employee_attendance_tool/employee_attendance_tool.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
+
+import frappe
from frappe.model.document import Document
from frappe.utils import getdate
diff --git a/erpnext/hr/doctype/employee_boarding_activity/employee_boarding_activity.py b/erpnext/hr/doctype/employee_boarding_activity/employee_boarding_activity.py
index 496f165..48c85f4 100644
--- a/erpnext/hr/doctype/employee_boarding_activity/employee_boarding_activity.py
+++ b/erpnext/hr/doctype/employee_boarding_activity/employee_boarding_activity.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class EmployeeBoardingActivity(Document):
pass
diff --git a/erpnext/hr/doctype/employee_checkin/employee_checkin.py b/erpnext/hr/doctype/employee_checkin/employee_checkin.py
index 6c0cd4f..1ae9b1f 100644
--- a/erpnext/hr/doctype/employee_checkin/employee_checkin.py
+++ b/erpnext/hr/doctype/employee_checkin/employee_checkin.py
@@ -3,14 +3,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import now, cint, get_datetime
-from frappe.model.document import Document
-from frappe import _
-from erpnext.hr.doctype.shift_assignment.shift_assignment import get_actual_start_end_datetime_of_shift
+import frappe
+from frappe import _
+from frappe.model.document import Document
+from frappe.utils import cint, get_datetime
+
+from erpnext.hr.doctype.shift_assignment.shift_assignment import (
+ get_actual_start_end_datetime_of_shift,
+)
from erpnext.hr.utils import validate_active_employee
+
class EmployeeCheckin(Document):
def validate(self):
validate_active_employee(self.employee)
diff --git a/erpnext/hr/doctype/employee_checkin/test_employee_checkin.py b/erpnext/hr/doctype/employee_checkin/test_employee_checkin.py
index 7ba511f..71c6498 100644
--- a/erpnext/hr/doctype/employee_checkin/test_employee_checkin.py
+++ b/erpnext/hr/doctype/employee_checkin/test_employee_checkin.py
@@ -3,13 +3,19 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import now_datetime, nowdate, to_timedelta
import unittest
from datetime import timedelta
-from erpnext.hr.doctype.employee_checkin.employee_checkin import add_log_based_on_employee_field, mark_attendance_and_link_log, calculate_working_hours
+import frappe
+from frappe.utils import now_datetime, nowdate
+
from erpnext.hr.doctype.employee.test_employee import make_employee
+from erpnext.hr.doctype.employee_checkin.employee_checkin import (
+ add_log_based_on_employee_field,
+ calculate_working_hours,
+ mark_attendance_and_link_log,
+)
+
class TestEmployeeCheckin(unittest.TestCase):
def test_add_log_based_on_employee_field(self):
diff --git a/erpnext/hr/doctype/employee_education/employee_education.py b/erpnext/hr/doctype/employee_education/employee_education.py
index f0a7617..cadf5d6 100644
--- a/erpnext/hr/doctype/employee_education/employee_education.py
+++ b/erpnext/hr/doctype/employee_education/employee_education.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class EmployeeEducation(Document):
pass
diff --git a/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.py b/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.py
index 517ef57..4d0e8d9 100644
--- a/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.py
+++ b/erpnext/hr/doctype/employee_external_work_history/employee_external_work_history.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class EmployeeExternalWorkHistory(Document):
pass
diff --git a/erpnext/hr/doctype/employee_grade/employee_grade.py b/erpnext/hr/doctype/employee_grade/employee_grade.py
index 42a9f16..b097038 100644
--- a/erpnext/hr/doctype/employee_grade/employee_grade.py
+++ b/erpnext/hr/doctype/employee_grade/employee_grade.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class EmployeeGrade(Document):
pass
diff --git a/erpnext/hr/doctype/employee_grade/employee_grade_dashboard.py b/erpnext/hr/doctype/employee_grade/employee_grade_dashboard.py
index df67910..92d9fa0 100644
--- a/erpnext/hr/doctype/employee_grade/employee_grade_dashboard.py
+++ b/erpnext/hr/doctype/employee_grade/employee_grade_dashboard.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_data():
return {
'transactions': [
diff --git a/erpnext/hr/doctype/employee_grade/test_employee_grade.py b/erpnext/hr/doctype/employee_grade/test_employee_grade.py
index 93058cf..cd4fcb5 100644
--- a/erpnext/hr/doctype/employee_grade/test_employee_grade.py
+++ b/erpnext/hr/doctype/employee_grade/test_employee_grade.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestEmployeeGrade(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/employee_grievance/employee_grievance.py b/erpnext/hr/doctype/employee_grievance/employee_grievance.py
index 1705582..fd9a33b 100644
--- a/erpnext/hr/doctype/employee_grievance/employee_grievance.py
+++ b/erpnext/hr/doctype/employee_grievance/employee_grievance.py
@@ -5,6 +5,7 @@
from frappe import _, bold
from frappe.model.document import Document
+
class EmployeeGrievance(Document):
def on_submit(self):
if self.status not in ["Invalid", "Resolved"]:
diff --git a/erpnext/hr/doctype/employee_grievance/test_employee_grievance.py b/erpnext/hr/doctype/employee_grievance/test_employee_grievance.py
index ed897ee..e2d0002 100644
--- a/erpnext/hr/doctype/employee_grievance/test_employee_grievance.py
+++ b/erpnext/hr/doctype/employee_grievance/test_employee_grievance.py
@@ -1,10 +1,14 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
-import frappe
import unittest
+
+import frappe
from frappe.utils import today
+
from erpnext.hr.doctype.employee.test_employee import make_employee
+
+
class TestEmployeeGrievance(unittest.TestCase):
def test_create_employee_grievance(self):
create_employee_grievance()
diff --git a/erpnext/hr/doctype/employee_group/employee_group.py b/erpnext/hr/doctype/employee_group/employee_group.py
index 3025877..b2fe5eb 100644
--- a/erpnext/hr/doctype/employee_group/employee_group.py
+++ b/erpnext/hr/doctype/employee_group/employee_group.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class EmployeeGroup(Document):
pass
diff --git a/erpnext/hr/doctype/employee_group/test_employee_group.py b/erpnext/hr/doctype/employee_group/test_employee_group.py
index 26a61c4..053e840 100644
--- a/erpnext/hr/doctype/employee_group/test_employee_group.py
+++ b/erpnext/hr/doctype/employee_group/test_employee_group.py
@@ -2,10 +2,14 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
-import frappe
+
import unittest
+
+import frappe
+
from erpnext.hr.doctype.employee.test_employee import make_employee
+
class TestEmployeeGroup(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/employee_group_table/employee_group_table.py b/erpnext/hr/doctype/employee_group_table/employee_group_table.py
index 816611d..d9407a9 100644
--- a/erpnext/hr/doctype/employee_group_table/employee_group_table.py
+++ b/erpnext/hr/doctype/employee_group_table/employee_group_table.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class EmployeeGroupTable(Document):
pass
diff --git a/erpnext/hr/doctype/employee_health_insurance/employee_health_insurance.py b/erpnext/hr/doctype/employee_health_insurance/employee_health_insurance.py
index abc01ef..4f2d1a0 100644
--- a/erpnext/hr/doctype/employee_health_insurance/employee_health_insurance.py
+++ b/erpnext/hr/doctype/employee_health_insurance/employee_health_insurance.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class EmployeeHealthInsurance(Document):
pass
diff --git a/erpnext/hr/doctype/employee_health_insurance/test_employee_health_insurance.py b/erpnext/hr/doctype/employee_health_insurance/test_employee_health_insurance.py
index f0787f5..38e3ee3 100644
--- a/erpnext/hr/doctype/employee_health_insurance/test_employee_health_insurance.py
+++ b/erpnext/hr/doctype/employee_health_insurance/test_employee_health_insurance.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestEmployeeHealthInsurance(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.py b/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.py
index 2f385a8..6076abb 100644
--- a/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.py
+++ b/erpnext/hr/doctype/employee_internal_work_history/employee_internal_work_history.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class EmployeeInternalWorkHistory(Document):
pass
diff --git a/erpnext/hr/doctype/employee_onboarding/employee_onboarding.py b/erpnext/hr/doctype/employee_onboarding/employee_onboarding.py
index ca9b298..e96447b 100644
--- a/erpnext/hr/doctype/employee_onboarding/employee_onboarding.py
+++ b/erpnext/hr/doctype/employee_onboarding/employee_onboarding.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from erpnext.controllers.employee_boarding_controller import EmployeeBoardingController
from frappe.model.mapper import get_mapped_doc
+from erpnext.controllers.employee_boarding_controller import EmployeeBoardingController
+
+
class IncompleteTaskError(frappe.ValidationError): pass
class EmployeeOnboarding(EmployeeBoardingController):
diff --git a/erpnext/hr/doctype/employee_onboarding/test_employee_onboarding.py b/erpnext/hr/doctype/employee_onboarding/test_employee_onboarding.py
index ea46aa2..eae600d 100644
--- a/erpnext/hr/doctype/employee_onboarding/test_employee_onboarding.py
+++ b/erpnext/hr/doctype/employee_onboarding/test_employee_onboarding.py
@@ -3,13 +3,18 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from frappe.utils import getdate
-from erpnext.hr.doctype.employee_onboarding.employee_onboarding import make_employee
-from erpnext.payroll.doctype.salary_slip.test_salary_slip import make_holiday_list
-from erpnext.hr.doctype.employee_onboarding.employee_onboarding import IncompleteTaskError
+
+from erpnext.hr.doctype.employee_onboarding.employee_onboarding import (
+ IncompleteTaskError,
+ make_employee,
+)
from erpnext.hr.doctype.job_offer.test_job_offer import create_job_offer
+from erpnext.payroll.doctype.salary_slip.test_salary_slip import make_holiday_list
+
class TestEmployeeOnboarding(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template.py b/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template.py
index 6f1c316..a46b3cd 100644
--- a/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template.py
+++ b/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class EmployeeOnboardingTemplate(Document):
pass
diff --git a/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template_dashboard.py b/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template_dashboard.py
index ab0eb2f..1d2e8ae 100644
--- a/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template_dashboard.py
+++ b/erpnext/hr/doctype/employee_onboarding_template/employee_onboarding_template_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/hr/doctype/employee_onboarding_template/test_employee_onboarding_template.py b/erpnext/hr/doctype/employee_onboarding_template/test_employee_onboarding_template.py
index f4b5b88..92a328b 100644
--- a/erpnext/hr/doctype/employee_onboarding_template/test_employee_onboarding_template.py
+++ b/erpnext/hr/doctype/employee_onboarding_template/test_employee_onboarding_template.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestEmployeeOnboardingTemplate(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/employee_promotion/employee_promotion.py b/erpnext/hr/doctype/employee_promotion/employee_promotion.py
index a3a6183..164d48b 100644
--- a/erpnext/hr/doctype/employee_promotion/employee_promotion.py
+++ b/erpnext/hr/doctype/employee_promotion/employee_promotion.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import getdate
+
from erpnext.hr.utils import update_employee, validate_active_employee
+
class EmployeePromotion(Document):
def validate(self):
validate_active_employee(self.employee)
diff --git a/erpnext/hr/doctype/employee_promotion/test_employee_promotion.py b/erpnext/hr/doctype/employee_promotion/test_employee_promotion.py
index 9e7d318..39af6ff 100644
--- a/erpnext/hr/doctype/employee_promotion/test_employee_promotion.py
+++ b/erpnext/hr/doctype/employee_promotion/test_employee_promotion.py
@@ -3,11 +3,14 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import getdate, add_days
+
+import frappe
+from frappe.utils import add_days, getdate
+
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_employee
+
class TestEmployeePromotion(unittest.TestCase):
def setUp(self):
self.employee = make_employee("employee@promotions.com")
diff --git a/erpnext/hr/doctype/employee_property_history/employee_property_history.py b/erpnext/hr/doctype/employee_property_history/employee_property_history.py
index fb67852..9e25492 100644
--- a/erpnext/hr/doctype/employee_property_history/employee_property_history.py
+++ b/erpnext/hr/doctype/employee_property_history/employee_property_history.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class EmployeePropertyHistory(Document):
pass
diff --git a/erpnext/hr/doctype/employee_referral/employee_referral.js b/erpnext/hr/doctype/employee_referral/employee_referral.js
index 9c99bbb..8722019 100644
--- a/erpnext/hr/doctype/employee_referral/employee_referral.js
+++ b/erpnext/hr/doctype/employee_referral/employee_referral.js
@@ -43,8 +43,6 @@
});
}
-
-
},
create_job_applicant: function(frm) {
frappe.model.open_mapped_doc({
diff --git a/erpnext/hr/doctype/employee_referral/employee_referral.py b/erpnext/hr/doctype/employee_referral/employee_referral.py
index 547a95e..5cb5bb5 100644
--- a/erpnext/hr/doctype/employee_referral/employee_referral.py
+++ b/erpnext/hr/doctype/employee_referral/employee_referral.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import get_link_to_form
from frappe.model.document import Document
+from frappe.utils import get_link_to_form
+
from erpnext.hr.utils import validate_active_employee
+
class EmployeeReferral(Document):
def validate(self):
validate_active_employee(self.referrer)
@@ -56,6 +59,7 @@
@frappe.whitelist()
def create_additional_salary(doc):
import json
+
from six import string_types
if isinstance(doc, string_types):
diff --git a/erpnext/hr/doctype/employee_referral/employee_referral_dashboard.py b/erpnext/hr/doctype/employee_referral/employee_referral_dashboard.py
index caca296..85d6c20 100644
--- a/erpnext/hr/doctype/employee_referral/employee_referral_dashboard.py
+++ b/erpnext/hr/doctype/employee_referral/employee_referral_dashboard.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_data():
return {
'fieldname': 'employee_referral',
diff --git a/erpnext/hr/doctype/employee_referral/test_employee_referral.py b/erpnext/hr/doctype/employee_referral/test_employee_referral.py
index 599f326..d0ee2fc 100644
--- a/erpnext/hr/doctype/employee_referral/test_employee_referral.py
+++ b/erpnext/hr/doctype/employee_referral/test_employee_referral.py
@@ -3,12 +3,18 @@
# See license.txt
from __future__ import unicode_literals
+import unittest
+
import frappe
from frappe.utils import today
+
from erpnext.hr.doctype.designation.test_designation import create_designation
-from erpnext.hr.doctype.employee_referral.employee_referral import create_job_applicant, create_additional_salary
from erpnext.hr.doctype.employee.test_employee import make_employee
-import unittest
+from erpnext.hr.doctype.employee_referral.employee_referral import (
+ create_additional_salary,
+ create_job_applicant,
+)
+
class TestEmployeeReferral(unittest.TestCase):
def test_workflow_and_status_sync(self):
diff --git a/erpnext/hr/doctype/employee_separation/employee_separation.py b/erpnext/hr/doctype/employee_separation/employee_separation.py
index 8afee25..ad279e8 100644
--- a/erpnext/hr/doctype/employee_separation/employee_separation.py
+++ b/erpnext/hr/doctype/employee_separation/employee_separation.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from erpnext.controllers.employee_boarding_controller import EmployeeBoardingController
+
class EmployeeSeparation(EmployeeBoardingController):
def validate(self):
super(EmployeeSeparation, self).validate()
diff --git a/erpnext/hr/doctype/employee_separation/test_employee_separation.py b/erpnext/hr/doctype/employee_separation/test_employee_separation.py
index 2c11cbb..c7068dd 100644
--- a/erpnext/hr/doctype/employee_separation/test_employee_separation.py
+++ b/erpnext/hr/doctype/employee_separation/test_employee_separation.py
@@ -3,9 +3,10 @@
# See license.txt
from __future__ import unicode_literals
+import unittest
+
import frappe
from frappe.utils import getdate
-import unittest
test_dependencies = ['Employee Onboarding']
diff --git a/erpnext/hr/doctype/employee_separation_template/employee_separation_template.py b/erpnext/hr/doctype/employee_separation_template/employee_separation_template.py
index 0508fc4..7a263dc 100644
--- a/erpnext/hr/doctype/employee_separation_template/employee_separation_template.py
+++ b/erpnext/hr/doctype/employee_separation_template/employee_separation_template.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class EmployeeSeparationTemplate(Document):
pass
diff --git a/erpnext/hr/doctype/employee_separation_template/employee_separation_template_dashboard.py b/erpnext/hr/doctype/employee_separation_template/employee_separation_template_dashboard.py
index 75f985c..970ba26 100644
--- a/erpnext/hr/doctype/employee_separation_template/employee_separation_template_dashboard.py
+++ b/erpnext/hr/doctype/employee_separation_template/employee_separation_template_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/hr/doctype/employee_separation_template/test_employee_separation_template.py b/erpnext/hr/doctype/employee_separation_template/test_employee_separation_template.py
index 3fd3d39..4c91a79 100644
--- a/erpnext/hr/doctype/employee_separation_template/test_employee_separation_template.py
+++ b/erpnext/hr/doctype/employee_separation_template/test_employee_separation_template.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestEmployeeSeparationTemplate(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/employee_skill/employee_skill.py b/erpnext/hr/doctype/employee_skill/employee_skill.py
index ac05fba..6f860c6 100644
--- a/erpnext/hr/doctype/employee_skill/employee_skill.py
+++ b/erpnext/hr/doctype/employee_skill/employee_skill.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class EmployeeSkill(Document):
pass
diff --git a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.py b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.py
index 073f02f..d93c22f 100644
--- a/erpnext/hr/doctype/employee_skill_map/employee_skill_map.py
+++ b/erpnext/hr/doctype/employee_skill_map/employee_skill_map.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class EmployeeSkillMap(Document):
pass
diff --git a/erpnext/hr/doctype/employee_training/employee_training.py b/erpnext/hr/doctype/employee_training/employee_training.py
index 810796d..068116a 100644
--- a/erpnext/hr/doctype/employee_training/employee_training.py
+++ b/erpnext/hr/doctype/employee_training/employee_training.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class EmployeeTraining(Document):
pass
diff --git a/erpnext/hr/doctype/employee_transfer/employee_transfer.py b/erpnext/hr/doctype/employee_transfer/employee_transfer.py
index c200774..b1f6609 100644
--- a/erpnext/hr/doctype/employee_transfer/employee_transfer.py
+++ b/erpnext/hr/doctype/employee_transfer/employee_transfer.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import getdate
+
from erpnext.hr.utils import update_employee
+
class EmployeeTransfer(Document):
def before_submit(self):
if getdate(self.transfer_date) > getdate():
diff --git a/erpnext/hr/doctype/employee_transfer/test_employee_transfer.py b/erpnext/hr/doctype/employee_transfer/test_employee_transfer.py
index 93fc7a2..ad2f3ad 100644
--- a/erpnext/hr/doctype/employee_transfer/test_employee_transfer.py
+++ b/erpnext/hr/doctype/employee_transfer/test_employee_transfer.py
@@ -3,11 +3,14 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import getdate, add_days
+
+import frappe
+from frappe.utils import add_days, getdate
+
from erpnext.hr.doctype.employee.test_employee import make_employee
+
class TestEmployeeTransfer(unittest.TestCase):
def setUp(self):
make_employee("employee2@transfers.com")
diff --git a/erpnext/hr/doctype/employee_transfer_property/employee_transfer_property.py b/erpnext/hr/doctype/employee_transfer_property/employee_transfer_property.py
index 1a665dc..f67fd7c 100644
--- a/erpnext/hr/doctype/employee_transfer_property/employee_transfer_property.py
+++ b/erpnext/hr/doctype/employee_transfer_property/employee_transfer_property.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class EmployeeTransferProperty(Document):
pass
diff --git a/erpnext/hr/doctype/employee_transfer_property/test_employee_transfer_property.py b/erpnext/hr/doctype/employee_transfer_property/test_employee_transfer_property.py
index 39c20a6..287dac6 100644
--- a/erpnext/hr/doctype/employee_transfer_property/test_employee_transfer_property.py
+++ b/erpnext/hr/doctype/employee_transfer_property/test_employee_transfer_property.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestEmployeeTransferProperty(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/employment_type/employment_type.py b/erpnext/hr/doctype/employment_type/employment_type.py
index 00aa6bb..e2a5557 100644
--- a/erpnext/hr/doctype/employment_type/employment_type.py
+++ b/erpnext/hr/doctype/employment_type/employment_type.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class EmploymentType(Document):
pass
diff --git a/erpnext/hr/doctype/employment_type/test_employment_type.py b/erpnext/hr/doctype/employment_type/test_employment_type.py
index 0297ffa..2ba4e8c 100644
--- a/erpnext/hr/doctype/employment_type/test_employment_type.py
+++ b/erpnext/hr/doctype/employment_type/test_employment_type.py
@@ -2,6 +2,6 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
import frappe
+
test_records = frappe.get_test_records('Employment Type')
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py
index 4dc089c..d785db7 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.py
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.py
@@ -2,17 +2,17 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
-from frappe.utils import get_fullname, flt, cstr, get_link_to_form
-from frappe.model.document import Document
-from erpnext.hr.utils import set_employee_name, share_doc_with_approver, validate_active_employee
-from erpnext.accounts.party import get_party_account
-from erpnext.accounts.general_ledger import make_gl_entries
+from frappe.utils import cstr, flt, get_link_to_form
+
+import erpnext
from erpnext.accounts.doctype.sales_invoice.sales_invoice import get_bank_cash_account
+from erpnext.accounts.general_ledger import make_gl_entries
from erpnext.controllers.accounts_controller import AccountsController
-from frappe.utils.csvutils import getlink
-from erpnext.accounts.utils import get_account_currency
+from erpnext.hr.utils import set_employee_name, share_doc_with_approver, validate_active_employee
+
class InvalidExpenseApproverError(frappe.ValidationError): pass
class ExpenseApproverIdentityError(frappe.ValidationError): pass
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim_dashboard.py b/erpnext/hr/doctype/expense_claim/expense_claim_dashboard.py
index fe97350..a5682dc 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim_dashboard.py
+++ b/erpnext/hr/doctype/expense_claim/expense_claim_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'reference_name',
diff --git a/erpnext/hr/doctype/expense_claim/test_expense_claim.py b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
index b5fc1fb..9cb65f7 100644
--- a/erpnext/hr/doctype/expense_claim/test_expense_claim.py
+++ b/erpnext/hr/doctype/expense_claim/test_expense_claim.py
@@ -2,12 +2,14 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import random_string, nowdate, flt
-from erpnext.hr.doctype.expense_claim.expense_claim import make_bank_entry
+
+import frappe
+from frappe.utils import flt, nowdate, random_string
+
from erpnext.accounts.doctype.account.test_account import create_account
from erpnext.hr.doctype.employee.test_employee import make_employee
+from erpnext.hr.doctype.expense_claim.expense_claim import make_bank_entry
test_records = frappe.get_test_records('Expense Claim')
test_dependencies = ['Employee']
@@ -144,20 +146,20 @@
expense_claim = make_expense_claim(payable_account, 5500, 5500, "_Test Company", "Travel Expenses - _TC")
expense_claim.save()
expense_claim.submit()
-
+
# Payment entry 1: paying 500
make_payment_entry(expense_claim, payable_account,500)
outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim)
self.assertEqual(outstanding_amount, 5000)
self.assertEqual(total_amount_reimbursed, 500)
-
+
# Payment entry 1: paying 2000
make_payment_entry(expense_claim, payable_account,2000)
outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim)
self.assertEqual(outstanding_amount, 3000)
self.assertEqual(total_amount_reimbursed, 2500)
-
- # Payment entry 1: paying 3000
+
+ # Payment entry 1: paying 3000
make_payment_entry(expense_claim, payable_account,3000)
outstanding_amount, total_amount_reimbursed = get_outstanding_and_total_reimbursed_amounts(expense_claim)
self.assertEqual(outstanding_amount, 0)
@@ -221,7 +223,7 @@
outstanding_amount = flt(frappe.db.get_value("Expense Claim", expense_claim.name, "total_sanctioned_amount")) - \
flt(frappe.db.get_value("Expense Claim", expense_claim.name, "total_amount_reimbursed"))
total_amount_reimbursed = flt(frappe.db.get_value("Expense Claim", expense_claim.name, "total_amount_reimbursed"))
-
+
return outstanding_amount,total_amount_reimbursed
def make_payment_entry(expense_claim, payable_account, amt):
@@ -234,5 +236,4 @@
pe.paid_to = payable_account
pe.references[0].allocated_amount = amt
pe.insert()
- pe.submit()
-
+ pe.submit()
diff --git a/erpnext/hr/doctype/expense_claim_account/expense_claim_account.py b/erpnext/hr/doctype/expense_claim_account/expense_claim_account.py
index f34633c..a982002 100644
--- a/erpnext/hr/doctype/expense_claim_account/expense_claim_account.py
+++ b/erpnext/hr/doctype/expense_claim_account/expense_claim_account.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ExpenseClaimAccount(Document):
pass
diff --git a/erpnext/hr/doctype/expense_claim_advance/expense_claim_advance.py b/erpnext/hr/doctype/expense_claim_advance/expense_claim_advance.py
index c4e7b02..5607f41 100644
--- a/erpnext/hr/doctype/expense_claim_advance/expense_claim_advance.py
+++ b/erpnext/hr/doctype/expense_claim_advance/expense_claim_advance.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ExpenseClaimAdvance(Document):
pass
diff --git a/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.py b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.py
index 5d48990..019e9f4 100644
--- a/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.py
+++ b/erpnext/hr/doctype/expense_claim_detail/expense_claim_detail.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class ExpenseClaimDetail(Document):
pass
diff --git a/erpnext/hr/doctype/expense_claim_type/expense_claim_type.py b/erpnext/hr/doctype/expense_claim_type/expense_claim_type.py
index a637a54..101461c 100644
--- a/erpnext/hr/doctype/expense_claim_type/expense_claim_type.py
+++ b/erpnext/hr/doctype/expense_claim_type/expense_claim_type.py
@@ -2,10 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
class ExpenseClaimType(Document):
def validate(self):
self.validate_accounts()
diff --git a/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.py b/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.py
index 1d89430..f0c900e 100644
--- a/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.py
+++ b/erpnext/hr/doctype/expense_claim_type/test_expense_claim_type.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Expense Claim Type')
diff --git a/erpnext/hr/doctype/expense_taxes_and_charges/expense_taxes_and_charges.py b/erpnext/hr/doctype/expense_taxes_and_charges/expense_taxes_and_charges.py
index 4103bef..596e8c7 100644
--- a/erpnext/hr/doctype/expense_taxes_and_charges/expense_taxes_and_charges.py
+++ b/erpnext/hr/doctype/expense_taxes_and_charges/expense_taxes_and_charges.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ExpenseTaxesandCharges(Document):
pass
diff --git a/erpnext/hr/doctype/full_and_final_asset/__init__.py b/erpnext/hr/doctype/full_and_final_asset/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_asset/__init__.py
diff --git a/erpnext/hr/doctype/full_and_final_asset/full_and_final_asset.js b/erpnext/hr/doctype/full_and_final_asset/full_and_final_asset.js
new file mode 100644
index 0000000..1965b46
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_asset/full_and_final_asset.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Full and Final Asset', {
+ // refresh: function(frm) {
+
+ // }
+});
diff --git a/erpnext/hr/doctype/full_and_final_asset/full_and_final_asset.json b/erpnext/hr/doctype/full_and_final_asset/full_and_final_asset.json
new file mode 100644
index 0000000..3ad8335
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_asset/full_and_final_asset.json
@@ -0,0 +1,64 @@
+{
+ "actions": [],
+ "creation": "2021-06-28 13:36:58.658985",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "reference",
+ "asset_name",
+ "date",
+ "status",
+ "description"
+ ],
+ "fields": [
+ {
+ "fieldname": "reference",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Reference",
+ "options": "Asset Movement",
+ "read_only": 1,
+ "reqd": 1
+ },
+ {
+ "fieldname": "status",
+ "fieldtype": "Select",
+ "in_list_view": 1,
+ "label": "Status",
+ "options": "Owned\nReturned",
+ "reqd": 1
+ },
+ {
+ "fieldname": "description",
+ "fieldtype": "Small Text",
+ "label": "Description"
+ },
+ {
+ "fieldname": "asset_name",
+ "fieldtype": "Data",
+ "in_list_view": 1,
+ "label": "Asset Name",
+ "read_only": 1
+ },
+ {
+ "fieldname": "date",
+ "fieldtype": "Datetime",
+ "in_list_view": 1,
+ "label": "Date",
+ "read_only": 1
+ }
+ ],
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2021-07-15 15:17:31.309834",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Full and Final Asset",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/full_and_final_asset/full_and_final_asset.py b/erpnext/hr/doctype/full_and_final_asset/full_and_final_asset.py
new file mode 100644
index 0000000..661af7d
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_asset/full_and_final_asset.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+
+class FullandFinalAsset(Document):
+ pass
diff --git a/erpnext/hr/doctype/full_and_final_asset/test_full_and_final_asset.py b/erpnext/hr/doctype/full_and_final_asset/test_full_and_final_asset.py
new file mode 100644
index 0000000..9afe0f2
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_asset/test_full_and_final_asset.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+
+# import frappe
+import unittest
+
+
+class TestFullandFinalAsset(unittest.TestCase):
+ pass
diff --git a/erpnext/hr/doctype/full_and_final_outstanding_statement/__init__.py b/erpnext/hr/doctype/full_and_final_outstanding_statement/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_outstanding_statement/__init__.py
diff --git a/erpnext/hr/doctype/full_and_final_outstanding_statement/full_and_final_outstanding_statement.json b/erpnext/hr/doctype/full_and_final_outstanding_statement/full_and_final_outstanding_statement.json
new file mode 100644
index 0000000..be242e2
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_outstanding_statement/full_and_final_outstanding_statement.json
@@ -0,0 +1,96 @@
+{
+ "actions": [],
+ "creation": "2021-06-28 13:32:02.167317",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "component",
+ "reference_document_type",
+ "reference_document",
+ "account",
+ "paid_via_salary_slip",
+ "column_break_4",
+ "amount",
+ "status",
+ "remark"
+ ],
+ "fields": [
+ {
+ "fieldname": "column_break_4",
+ "fieldtype": "Column Break"
+ },
+ {
+ "columns": 2,
+ "default": "Unsettled",
+ "fieldname": "status",
+ "fieldtype": "Select",
+ "in_list_view": 1,
+ "label": "Status",
+ "options": "Settled\nUnsettled"
+ },
+ {
+ "fieldname": "remark",
+ "fieldtype": "Small Text",
+ "label": "Remark"
+ },
+ {
+ "columns": 2,
+ "depends_on": "reference_document_type",
+ "fieldname": "reference_document",
+ "fieldtype": "Dynamic Link",
+ "in_list_view": 1,
+ "label": "Reference Document",
+ "mandatory_depends_on": "reference_document_type",
+ "options": "reference_document_type",
+ "search_index": 1
+ },
+ {
+ "columns": 2,
+ "fieldname": "component",
+ "fieldtype": "Data",
+ "in_list_view": 1,
+ "label": "Component",
+ "reqd": 1
+ },
+ {
+ "fieldname": "account",
+ "fieldtype": "Link",
+ "label": "Account",
+ "options": "Account"
+ },
+ {
+ "columns": 2,
+ "fieldname": "amount",
+ "fieldtype": "Currency",
+ "in_list_view": 1,
+ "label": "Amount"
+ },
+ {
+ "columns": 2,
+ "fieldname": "reference_document_type",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Reference Document Type",
+ "options": "DocType"
+ },
+ {
+ "default": "0",
+ "fieldname": "paid_via_salary_slip",
+ "fieldtype": "Check",
+ "label": "Paid via Salary Slip"
+ }
+ ],
+ "index_web_pages_for_search": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2021-07-20 16:59:34.447934",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Full and Final Outstanding Statement",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/full_and_final_outstanding_statement/full_and_final_outstanding_statement.py b/erpnext/hr/doctype/full_and_final_outstanding_statement/full_and_final_outstanding_statement.py
new file mode 100644
index 0000000..4b239ab
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_outstanding_statement/full_and_final_outstanding_statement.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+
+class FullandFinalOutstandingStatement(Document):
+ pass
diff --git a/erpnext/hr/doctype/full_and_final_statement/__init__.py b/erpnext/hr/doctype/full_and_final_statement/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_statement/__init__.py
diff --git a/erpnext/hr/doctype/full_and_final_statement/full_and_final_statement.js b/erpnext/hr/doctype/full_and_final_statement/full_and_final_statement.js
new file mode 100644
index 0000000..074d85b
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_statement/full_and_final_statement.js
@@ -0,0 +1,115 @@
+// Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Full and Final Statement', {
+ refresh: function(frm) {
+ frm.events.set_queries(frm, "payables");
+ frm.events.set_queries(frm, "receivables");
+
+ if (frm.doc.docstatus == 1 && frm.doc.status == "Unpaid") {
+ frm.add_custom_button(__("Create Journal Entry"), function () {
+ frm.events.create_journal_entry(frm);
+ });
+ }
+ },
+
+ set_queries: function(frm, type) {
+ frm.set_query("reference_document_type", type, function () {
+ let modules = ["HR", "Payroll", "Loan Management"];
+ return {
+ filters: {
+ istable: 0,
+ issingle: 0,
+ module: ["In", modules]
+ }
+ };
+ });
+
+ let filters = {};
+
+ frm.set_query('reference_document', type, function(doc, cdt, cdn) {
+ let fnf_doc = frappe.get_doc(cdt, cdn);
+
+ frappe.model.with_doctype(fnf_doc.reference_document_type, function() {
+ if (frappe.model.is_tree(fnf_doc.reference_document_type)) {
+ filters['is_group'] = 0;
+ }
+
+ if (frappe.meta.has_field(fnf_doc.reference_document_type, 'company')) {
+ filters['company'] = frm.doc.company;
+ }
+
+ if (frappe.meta.has_field(fnf_doc.reference_document_type, 'employee')) {
+ filters['employee'] = frm.doc.employee;
+ }
+ });
+
+ return {
+ filters: filters
+ };
+ });
+ },
+
+ employee: function(frm) {
+ frm.events.get_outstanding_statements(frm);
+ },
+
+ get_outstanding_statements: function(frm) {
+ if (frm.doc.employee) {
+ frappe.call({
+ method: "get_outstanding_statements",
+ doc: frm.doc,
+ callback: function() {
+ frm.refresh();
+ }
+ });
+ }
+ },
+
+ create_journal_entry: function(frm) {
+ frappe.call({
+ method: "create_journal_entry",
+ doc: frm.doc,
+ callback: function(r) {
+ var doclist = frappe.model.sync(r.message);
+ frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
+ }
+ });
+ }
+});
+
+frappe.ui.form.on("Full and Final Outstanding Statement", {
+ reference_document: function(frm, cdt, cdn) {
+ var child = locals[cdt][cdn];
+ if (child.reference_document_type && child.reference_document) {
+ frappe.call({
+ method: "erpnext.hr.doctype.full_and_final_statement.full_and_final_statement.get_account_and_amount",
+ args: {
+ ref_doctype: child.reference_document_type,
+ ref_document: child.reference_document
+ },
+ callback: function(r) {
+ if (r.message) {
+ frappe.model.set_value(cdt, cdn, "account", r.message[0]);
+ frappe.model.set_value(cdt, cdn, "amount", r.message[1]);
+ }
+ }
+ });
+ }
+ },
+
+ amount: function(frm) {
+ var total_payable_amount = 0;
+ var total_receivable_amount = 0;
+
+ frm.doc.payables.forEach(element => {
+ total_payable_amount = total_payable_amount + element.amount;
+ });
+
+ frm.doc.receivables.forEach(element => {
+ total_receivable_amount = total_receivable_amount + element.amount;
+ });
+ frm.set_value("total_payable_amount", flt(total_payable_amount));
+ frm.set_value("total_receivable_amount", flt(total_receivable_amount));
+ }
+});
diff --git a/erpnext/hr/doctype/full_and_final_statement/full_and_final_statement.json b/erpnext/hr/doctype/full_and_final_statement/full_and_final_statement.json
new file mode 100644
index 0000000..ebcf36d
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_statement/full_and_final_statement.json
@@ -0,0 +1,231 @@
+{
+ "actions": [],
+ "autoname": "HR-FNF-.YYYY.-.#####",
+ "creation": "2021-06-28 13:17:36.050459",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "employee",
+ "employee_name",
+ "transaction_date",
+ "column_break_12",
+ "company",
+ "status",
+ "amended_from",
+ "employee_details_section",
+ "date_of_joining",
+ "relieving_date",
+ "column_break_4",
+ "designation",
+ "department",
+ "section_break_8",
+ "payables",
+ "section_break_10",
+ "receivables",
+ "totals_section",
+ "total_payable_amount",
+ "column_break_21",
+ "total_receivable_amount",
+ "section_break_15",
+ "assets_allocated"
+ ],
+ "fields": [
+ {
+ "fieldname": "employee",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Employee",
+ "options": "Employee",
+ "reqd": 1
+ },
+ {
+ "fetch_from": "employee.employee_name",
+ "fieldname": "employee_name",
+ "fieldtype": "Data",
+ "label": "Employee Name",
+ "read_only": 1
+ },
+ {
+ "fetch_from": "employee.designation",
+ "fieldname": "designation",
+ "fieldtype": "Link",
+ "label": "Designation",
+ "options": "Designation",
+ "read_only": 1
+ },
+ {
+ "fieldname": "column_break_4",
+ "fieldtype": "Column Break"
+ },
+ {
+ "default": "Unpaid",
+ "fieldname": "status",
+ "fieldtype": "Select",
+ "label": "Status",
+ "options": "Paid\nUnpaid",
+ "read_only": 1
+ },
+ {
+ "fetch_from": "employee.department",
+ "fieldname": "department",
+ "fieldtype": "Link",
+ "label": "Department",
+ "options": "Department",
+ "read_only": 1
+ },
+ {
+ "fieldname": "amended_from",
+ "fieldtype": "Link",
+ "label": "Amended From",
+ "no_copy": 1,
+ "options": "Full and Final Statement",
+ "print_hide": 1,
+ "read_only": 1
+ },
+ {
+ "fieldname": "section_break_8",
+ "fieldtype": "Section Break",
+ "label": "Payables"
+ },
+ {
+ "fieldname": "section_break_10",
+ "fieldtype": "Section Break",
+ "label": "Receivables"
+ },
+ {
+ "fieldname": "assets_allocated",
+ "fieldtype": "Table",
+ "options": "Full and Final Asset"
+ },
+ {
+ "fetch_from": "employee.relieving_date",
+ "fieldname": "relieving_date",
+ "fieldtype": "Date",
+ "label": "Relieving Date ",
+ "read_only": 1,
+ "reqd": 1
+ },
+ {
+ "fetch_from": "employee.date_of_joining",
+ "fieldname": "date_of_joining",
+ "fieldtype": "Date",
+ "label": "Date of Joining",
+ "read_only": 1
+ },
+ {
+ "fieldname": "section_break_15",
+ "fieldtype": "Section Break",
+ "label": "Assets Allocated"
+ },
+ {
+ "fetch_from": "employee.company",
+ "fieldname": "company",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "in_standard_filter": 1,
+ "label": "Company",
+ "options": "Company",
+ "read_only": 1
+ },
+ {
+ "fieldname": "column_break_12",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "payables",
+ "fieldtype": "Table",
+ "options": "Full and Final Outstanding Statement"
+ },
+ {
+ "fieldname": "receivables",
+ "fieldtype": "Table",
+ "options": "Full and Final Outstanding Statement"
+ },
+ {
+ "fieldname": "employee_details_section",
+ "fieldtype": "Section Break",
+ "label": "Employee Details"
+ },
+ {
+ "fieldname": "transaction_date",
+ "fieldtype": "Date",
+ "in_standard_filter": 1,
+ "label": "Transaction Date",
+ "reqd": 1
+ },
+ {
+ "fieldname": "totals_section",
+ "fieldtype": "Section Break",
+ "label": "Totals"
+ },
+ {
+ "fieldname": "total_payable_amount",
+ "fieldtype": "Currency",
+ "in_list_view": 1,
+ "label": "Total Payable Amount",
+ "read_only": 1
+ },
+ {
+ "fieldname": "column_break_21",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "total_receivable_amount",
+ "fieldtype": "Currency",
+ "in_list_view": 1,
+ "label": "Total Receivable Amount",
+ "read_only": 1
+ }
+ ],
+ "index_web_pages_for_search": 1,
+ "is_submittable": 1,
+ "links": [],
+ "modified": "2021-08-30 21:11:09.892560",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Full and Final Statement",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "System Manager",
+ "share": 1,
+ "write": 1
+ },
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "HR User",
+ "share": 1,
+ "write": 1
+ },
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "HR Manager",
+ "share": 1,
+ "write": 1
+ }
+ ],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "title_field": "employee_name",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/full_and_final_statement/full_and_final_statement.py b/erpnext/hr/doctype/full_and_final_statement/full_and_final_statement.py
new file mode 100644
index 0000000..f539537
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_statement/full_and_final_statement.py
@@ -0,0 +1,177 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+import frappe
+from frappe import _
+from frappe.model.document import Document
+from frappe.utils import flt, get_link_to_form, today
+
+
+class FullandFinalStatement(Document):
+ def validate(self):
+ self.get_outstanding_statements()
+ if self.docstatus == 1:
+ self.validate_settlement("payables")
+ self.validate_settlement("receivables")
+ self.validate_asset()
+
+ def validate_settlement(self, component_type):
+ for data in self.get(component_type, []):
+ if data.status == "Unsettled":
+ frappe.throw(_("Settle all Payables and Receivables before submission"))
+
+ def validate_asset(self):
+ for data in self.assets_allocated:
+ if data.status == "Owned":
+ frappe.throw(_("All allocated assets should be returned before submission"))
+
+ @frappe.whitelist()
+ def get_outstanding_statements(self):
+ if self.relieving_date:
+ if not len(self.get("payables", [])):
+ components = self.get_payable_component()
+ self.create_component_row(components, "payables")
+ if not len(self.get("receivables", [])):
+ components = self.get_receivable_component()
+ self.create_component_row(components, "receivables")
+
+ if not len(self.get("assets_allocated", [])):
+ for data in self.get_assets_movement():
+ self.append("assets_allocated", data)
+ else:
+ frappe.throw(_("Set Relieving Date for Employee: {0}").format(get_link_to_form("Employee", self.employee)))
+
+ def create_component_row(self, components, component_type):
+ for component in components:
+ self.append(component_type, {
+ "status": "Unsettled",
+ "reference_document_type": component if component != "Bonus" else "Additional Salary",
+ "component": component
+ })
+
+
+ def get_payable_component(self):
+ return [
+ "Salary Slip",
+ "Gratuity",
+ "Expense Claim",
+ "Bonus",
+ "Leave Encashment",
+ ]
+
+ def get_receivable_component(self):
+ return [
+ "Loan",
+ "Employee Advance",
+ ]
+
+ def get_assets_movement(self):
+ asset_movements = frappe.get_all("Asset Movement Item",
+ filters = {"docstatus": 1},
+ fields = ["asset", "from_employee", "to_employee", "parent", "asset_name"],
+ or_filters = {
+ "from_employee": self.employee,
+ "to_employee": self.employee
+ }
+ )
+
+ data = []
+ inward_movements = []
+ outward_movements = []
+ for movement in asset_movements:
+ if movement.to_employee and movement.to_employee == self.employee:
+ inward_movements.append(movement)
+
+ if movement.from_employee and movement.from_employee == self.employee:
+ outward_movements.append(movement)
+
+ for movement in inward_movements:
+ outwards_count = [movement.asset for movement in outward_movements].count(movement.asset)
+ inwards_counts = [movement.asset for movement in inward_movements].count(movement.asset)
+
+ if inwards_counts > outwards_count:
+ data.append({
+ "reference": movement.parent,
+ "asset_name": movement.asset_name,
+ "date": frappe.db.get_value("Asset Movement", movement.parent, "transaction_date"),
+ "status": "Owned"
+ })
+ return data
+
+ @frappe.whitelist()
+ def create_journal_entry(self):
+ precision = frappe.get_precision("Journal Entry Account", "debit_in_account_currency")
+ jv = frappe.new_doc("Journal Entry")
+ jv.company = self.company
+ jv.voucher_type = "Bank Entry"
+ jv.posting_date = today()
+
+ difference = self.total_payable_amount - self.total_receivable_amount
+
+ for data in self.payables:
+ if data.amount > 0 and not data.paid_via_salary_slip:
+ account_dict = {
+ "account": data.account,
+ "debit_in_account_currency": flt(data.amount, precision)
+ }
+ if data.reference_document_type == "Expense Claim":
+ account_dict["party_type"] = "Employee"
+ account_dict["party"] = self.employee
+
+ jv.append("accounts", account_dict)
+
+ for data in self.receivables:
+ if data.amount > 0:
+ account_dict = {
+ "account": data.account,
+ "credit_in_account_currency": flt(data.amount, precision)
+ }
+ if data.reference_document_type == "Employee Advance":
+ account_dict["party_type"] = "Employee"
+ account_dict["party"] = self.employee
+
+ jv.append("accounts", account_dict)
+
+ jv.append("accounts", {
+ "credit_in_account_currency": difference if difference > 0 else 0,
+ "debit_in_account_currency": -(difference) if difference < 0 else 0,
+ "reference_type": self.doctype,
+ "reference_name": self.name
+ })
+ return jv
+
+@frappe.whitelist()
+def get_account_and_amount(ref_doctype, ref_document):
+ if not ref_doctype or not ref_document:
+ return None
+
+ if ref_doctype == "Salary Slip":
+ salary_details = frappe.db.get_value("Salary Slip", ref_document, ["payroll_entry", "net_pay"], as_dict=1)
+ amount = salary_details.net_pay
+ payable_account = frappe.db.get_value("Payroll Entry", salary_details.payroll_entry, "payroll_payable_account") if salary_details.payroll_entry else None
+ return [payable_account, amount]
+
+ if ref_doctype == "Gratuity":
+ payable_account, amount = frappe.db.get_value("Gratuity", ref_document, ["payable_account", "amount"])
+ return [payable_account, amount]
+
+ if ref_doctype == "Expense Claim":
+ details = frappe.db.get_value("Expense Claim", ref_document,
+ ["payable_account", "grand_total", "total_amount_reimbursed", "total_advance_amount"], as_dict=True)
+ payable_account = details.payable_account
+ amount = details.grand_total - (details.total_amount_reimbursed + details.total_advance_amount)
+ return [payable_account, amount]
+
+ if ref_doctype == "Loan":
+ details = frappe.db.get_value("Loan", ref_document,
+ ["payment_account", "total_payment", "total_amount_paid"], as_dict=1)
+ payment_account = details.payment_account
+ amount = details.total_payment - details.total_amount_paid
+ return [payment_account, amount]
+
+ if ref_doctype == "Employee Advance":
+ details = frappe.db.get_value("Employee Advance", ref_document,
+ ["advance_account","paid_amount", "claimed_amount", "return_amount"], as_dict = 1)
+ payment_account = details.advance_account
+ amount = details.paid_amount - (details.claimed_amount + details.return_amount)
+ return [payment_account, amount]
diff --git a/erpnext/hr/doctype/full_and_final_statement/full_and_final_statement_list.js b/erpnext/hr/doctype/full_and_final_statement/full_and_final_statement_list.js
new file mode 100644
index 0000000..4aedec7
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_statement/full_and_final_statement_list.js
@@ -0,0 +1,11 @@
+frappe.listview_settings["Full and Final Statement"] = {
+ get_indicator: function(doc) {
+ var colors = {
+ "Draft": "red",
+ "Unpaid": "orange",
+ "Paid": "green",
+ "Cancelled": "red"
+ };
+ return [__(doc.status), colors[doc.status], "status,=," + doc.status];
+ }
+};
diff --git a/erpnext/hr/doctype/full_and_final_statement/test_full_and_final_statement.py b/erpnext/hr/doctype/full_and_final_statement/test_full_and_final_statement.py
new file mode 100644
index 0000000..f6c1d15
--- /dev/null
+++ b/erpnext/hr/doctype/full_and_final_statement/test_full_and_final_statement.py
@@ -0,0 +1,74 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+
+import unittest
+
+import frappe
+from frappe.utils import add_days, today
+
+from erpnext.assets.doctype.asset.test_asset import create_asset_data
+from erpnext.hr.doctype.employee.test_employee import make_employee
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
+
+
+class TestFullandFinalStatement(unittest.TestCase):
+
+ def setUp(self):
+ create_asset_data()
+
+ def tearDown(self):
+ frappe.db.sql("Delete from `tabFull and Final Statement`")
+ frappe.db.sql("Delete from `tabAsset`")
+ frappe.db.sql("Delete from `tabAsset Movement`")
+
+ def test_check_bootstraped_data_asset_movement_and_jv_creation(self):
+ employee = make_employee("test_fnf@example.com", company="_Test Company")
+ movement = create_asset_movement(employee)
+ frappe.db.set_value("Employee", employee, "relieving_date", add_days(today(), 30))
+ fnf = create_full_and_final_statement(employee)
+
+ payables_bootstraped_component = ["Salary Slip", "Gratuity",
+ "Expense Claim", "Bonus", "Leave Encashment"]
+
+ receivable_bootstraped_component = ["Loan", "Employee Advance"]
+
+ #checking payable s and receivables bootstraped value
+ self.assertEqual([payable.component for payable in fnf.payables], payables_bootstraped_component)
+ self.assertEqual([receivable.component for receivable in fnf.receivables], receivable_bootstraped_component)
+
+ #checking allocated asset
+ self.assertIn(movement, [asset.reference for asset in fnf.assets_allocated])
+
+def create_full_and_final_statement(employee):
+ fnf = frappe.new_doc("Full and Final Statement")
+ fnf.employee = employee
+ fnf.transaction_date = today()
+ fnf.save()
+ return fnf
+
+def create_asset_movement(employee):
+ asset_name = create_asset()
+ movement = frappe.new_doc("Asset Movement")
+ movement.company = "_Test Company"
+ movement.purpose = "Issue"
+ movement.transaction_date = today()
+
+ movement.append("assets", {
+ "asset": asset_name,
+ "to_employee": employee
+ })
+
+ movement.save()
+ movement.submit()
+ return movement.name
+
+def create_asset():
+ pr = make_purchase_receipt(item_code="Macbook Pro",
+ qty=1, rate=100000.0, location="Test Location")
+
+ asset_name = frappe.db.get_value("Asset", {"purchase_receipt": pr.name}, "name")
+ asset = frappe.get_doc("Asset", asset_name)
+ asset.calculate_depreciation = 0
+ asset.available_for_use_date = today()
+ asset.submit()
+ return asset_name
diff --git a/erpnext/hr/doctype/grievance_type/grievance_type.py b/erpnext/hr/doctype/grievance_type/grievance_type.py
index 618cf0a..5d8d41c 100644
--- a/erpnext/hr/doctype/grievance_type/grievance_type.py
+++ b/erpnext/hr/doctype/grievance_type/grievance_type.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class GrievanceType(Document):
pass
diff --git a/erpnext/hr/doctype/grievance_type/test_grievance_type.py b/erpnext/hr/doctype/grievance_type/test_grievance_type.py
index a02a34d..481f4e5 100644
--- a/erpnext/hr/doctype/grievance_type/test_grievance_type.py
+++ b/erpnext/hr/doctype/grievance_type/test_grievance_type.py
@@ -4,5 +4,6 @@
# import frappe
import unittest
+
class TestGrievanceType(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/holiday/holiday.py b/erpnext/hr/doctype/holiday/holiday.py
index 78a95b9..fbfe756 100644
--- a/erpnext/hr/doctype/holiday/holiday.py
+++ b/erpnext/hr/doctype/holiday/holiday.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class Holiday(Document):
pass
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list.py b/erpnext/hr/doctype/holiday_list/holiday_list.py
index f65e6e1..f46f14d 100644
--- a/erpnext/hr/doctype/holiday_list/holiday_list.py
+++ b/erpnext/hr/doctype/holiday_list/holiday_list.py
@@ -3,11 +3,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
import json
-from frappe.utils import cint, getdate, formatdate, today
-from frappe import throw, _
+
+import frappe
+from frappe import _, throw
from frappe.model.document import Document
+from frappe.utils import cint, formatdate, getdate, today
+
class OverlapError(frappe.ValidationError): pass
@@ -44,9 +47,10 @@
def get_weekly_off_date_list(self, start_date, end_date):
start_date, end_date = getdate(start_date), getdate(end_date)
- from dateutil import relativedelta
- from datetime import timedelta
import calendar
+ from datetime import timedelta
+
+ from dateutil import relativedelta
date_list = []
existing_date_list = []
diff --git a/erpnext/hr/doctype/holiday_list/holiday_list_dashboard.py b/erpnext/hr/doctype/holiday_list/holiday_list_dashboard.py
index 05641c7..bbba36a 100644
--- a/erpnext/hr/doctype/holiday_list/holiday_list_dashboard.py
+++ b/erpnext/hr/doctype/holiday_list/holiday_list_dashboard.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_data():
return {
'fieldname': 'holiday_list',
diff --git a/erpnext/hr/doctype/holiday_list/test_holiday_list.py b/erpnext/hr/doctype/holiday_list/test_holiday_list.py
index 64bed66..2713193 100644
--- a/erpnext/hr/doctype/holiday_list/test_holiday_list.py
+++ b/erpnext/hr/doctype/holiday_list/test_holiday_list.py
@@ -2,11 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import getdate
from datetime import timedelta
+import frappe
+from frappe.utils import getdate
+
class TestHolidayList(unittest.TestCase):
def test_holiday_list(self):
diff --git a/erpnext/hr/doctype/hr_settings/hr_settings.py b/erpnext/hr/doctype/hr_settings/hr_settings.py
index a474093..c295bcb 100644
--- a/erpnext/hr/doctype/hr_settings/hr_settings.py
+++ b/erpnext/hr/doctype/hr_settings/hr_settings.py
@@ -4,7 +4,6 @@
# For license information, please see license.txt
import frappe
-
from frappe.model.document import Document
from frappe.utils import format_date
diff --git a/erpnext/hr/doctype/hr_settings/test_hr_settings.py b/erpnext/hr/doctype/hr_settings/test_hr_settings.py
index b0b07b0..69a060a 100644
--- a/erpnext/hr/doctype/hr_settings/test_hr_settings.py
+++ b/erpnext/hr/doctype/hr_settings/test_hr_settings.py
@@ -3,11 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.hr.doctype.employee.test_employee import make_employee
-from frappe.utils import now_datetime
-from datetime import timedelta
+
class TestHRSettings(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/identification_document_type/identification_document_type.py b/erpnext/hr/doctype/identification_document_type/identification_document_type.py
index d9d81d2..862cd37 100644
--- a/erpnext/hr/doctype/identification_document_type/identification_document_type.py
+++ b/erpnext/hr/doctype/identification_document_type/identification_document_type.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class IdentificationDocumentType(Document):
pass
diff --git a/erpnext/hr/doctype/identification_document_type/test_identification_document_type.py b/erpnext/hr/doctype/identification_document_type/test_identification_document_type.py
index 1265afa..87f3024 100644
--- a/erpnext/hr/doctype/identification_document_type/test_identification_document_type.py
+++ b/erpnext/hr/doctype/identification_document_type/test_identification_document_type.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestIdentificationDocumentType(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/interest/interest.py b/erpnext/hr/doctype/interest/interest.py
index 2a9c19c..1b8f49f 100644
--- a/erpnext/hr/doctype/interest/interest.py
+++ b/erpnext/hr/doctype/interest/interest.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class Interest(Document):
pass
diff --git a/erpnext/hr/doctype/interest/test_interest.py b/erpnext/hr/doctype/interest/test_interest.py
index a7fe83b..f3727be 100644
--- a/erpnext/hr/doctype/interest/test_interest.py
+++ b/erpnext/hr/doctype/interest/test_interest.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Interest')
diff --git a/erpnext/hr/doctype/job_applicant/job_applicant.py b/erpnext/hr/doctype/job_applicant/job_applicant.py
index 14aeb03..6971e5b 100644
--- a/erpnext/hr/doctype/job_applicant/job_applicant.py
+++ b/erpnext/hr/doctype/job_applicant/job_applicant.py
@@ -4,11 +4,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe.model.document import Document
+
import frappe
from frappe import _
+from frappe.model.document import Document
from frappe.utils import comma_and, validate_email_address
+
class DuplicationError(frappe.ValidationError): pass
class JobApplicant(Document):
diff --git a/erpnext/hr/doctype/job_applicant/job_applicant_dashboard.py b/erpnext/hr/doctype/job_applicant/job_applicant_dashboard.py
index ed97978..c005943 100644
--- a/erpnext/hr/doctype/job_applicant/job_applicant_dashboard.py
+++ b/erpnext/hr/doctype/job_applicant/job_applicant_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/hr/doctype/job_applicant/test_job_applicant.py b/erpnext/hr/doctype/job_applicant/test_job_applicant.py
index 8728342..e583e25 100644
--- a/erpnext/hr/doctype/job_applicant/test_job_applicant.py
+++ b/erpnext/hr/doctype/job_applicant/test_job_applicant.py
@@ -3,9 +3,10 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
# test_records = frappe.get_test_records('Job Applicant')
class TestJobApplicant(unittest.TestCase):
diff --git a/erpnext/hr/doctype/job_applicant_source/job_applicant_source.py b/erpnext/hr/doctype/job_applicant_source/job_applicant_source.py
index 5f543d2..9139584 100644
--- a/erpnext/hr/doctype/job_applicant_source/job_applicant_source.py
+++ b/erpnext/hr/doctype/job_applicant_source/job_applicant_source.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class JobApplicantSource(Document):
pass
diff --git a/erpnext/hr/doctype/job_applicant_source/test_job_applicant_source.py b/erpnext/hr/doctype/job_applicant_source/test_job_applicant_source.py
index f318df2..0c29124 100644
--- a/erpnext/hr/doctype/job_applicant_source/test_job_applicant_source.py
+++ b/erpnext/hr/doctype/job_applicant_source/test_job_applicant_source.py
@@ -5,5 +5,6 @@
import unittest
+
class TestJobApplicantSource(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/job_offer/job_offer.py b/erpnext/hr/doctype/job_offer/job_offer.py
index 7e650f7..07a7809 100644
--- a/erpnext/hr/doctype/job_offer/job_offer.py
+++ b/erpnext/hr/doctype/job_offer/job_offer.py
@@ -2,13 +2,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import cint
+from frappe import _
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
-from frappe import _
+from frappe.utils import cint
from frappe.utils.data import get_link_to_form
+
class JobOffer(Document):
def onload(self):
employee = frappe.db.get_value("Employee", {"job_applicant": self.job_applicant}, "name") or ""
diff --git a/erpnext/hr/doctype/job_offer/test_job_offer.py b/erpnext/hr/doctype/job_offer/test_job_offer.py
index edb2132..3f3eca1 100644
--- a/erpnext/hr/doctype/job_offer/test_job_offer.py
+++ b/erpnext/hr/doctype/job_offer/test_job_offer.py
@@ -2,11 +2,13 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import nowdate, add_days
-from erpnext.hr.doctype.job_applicant.test_job_applicant import create_job_applicant
+
+import frappe
+from frappe.utils import add_days, nowdate
+
from erpnext.hr.doctype.designation.test_designation import create_designation
+from erpnext.hr.doctype.job_applicant.test_job_applicant import create_job_applicant
from erpnext.hr.doctype.staffing_plan.test_staffing_plan import make_company
# test_records = frappe.get_test_records('Job Offer')
diff --git a/erpnext/hr/doctype/job_offer_term/job_offer_term.py b/erpnext/hr/doctype/job_offer_term/job_offer_term.py
index 6dbe675..573cc6a 100644
--- a/erpnext/hr/doctype/job_offer_term/job_offer_term.py
+++ b/erpnext/hr/doctype/job_offer_term/job_offer_term.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class JobOfferTerm(Document):
pass
diff --git a/erpnext/hr/doctype/job_opening/job_opening.py b/erpnext/hr/doctype/job_opening/job_opening.py
index 1e89767..38d9a71 100644
--- a/erpnext/hr/doctype/job_opening/job_opening.py
+++ b/erpnext/hr/doctype/job_opening/job_opening.py
@@ -4,11 +4,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.website.website_generator import WebsiteGenerator
+import frappe
from frappe import _
-from erpnext.hr.doctype.staffing_plan.staffing_plan import get_designation_counts, get_active_staffing_plan_details
+from frappe.website.website_generator import WebsiteGenerator
+
+from erpnext.hr.doctype.staffing_plan.staffing_plan import (
+ get_active_staffing_plan_details,
+ get_designation_counts,
+)
+
class JobOpening(WebsiteGenerator):
website = frappe._dict(
diff --git a/erpnext/hr/doctype/job_opening/job_opening_dashboard.py b/erpnext/hr/doctype/job_opening/job_opening_dashboard.py
index 31ef33e..a13e2a7 100644
--- a/erpnext/hr/doctype/job_opening/job_opening_dashboard.py
+++ b/erpnext/hr/doctype/job_opening/job_opening_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/hr/doctype/job_opening/test_job_opening.py b/erpnext/hr/doctype/job_opening/test_job_opening.py
index 815ce5b..a66975c 100644
--- a/erpnext/hr/doctype/job_opening/test_job_opening.py
+++ b/erpnext/hr/doctype/job_opening/test_job_opening.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Job Opening')
diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation.py b/erpnext/hr/doctype/leave_allocation/leave_allocation.py
index 4757cd3..e4886d7 100755
--- a/erpnext/hr/doctype/leave_allocation/leave_allocation.py
+++ b/erpnext/hr/doctype/leave_allocation/leave_allocation.py
@@ -2,13 +2,19 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import flt, date_diff, formatdate, add_days, today, getdate
from frappe import _
from frappe.model.document import Document
-from erpnext.hr.utils import set_employee_name, get_leave_period
-from erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry import expire_allocation, create_leave_ledger_entry
+from frappe.utils import add_days, date_diff, flt, formatdate, getdate
+
from erpnext.hr.doctype.leave_application.leave_application import get_approved_leaves_for_period
+from erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry import (
+ create_leave_ledger_entry,
+ expire_allocation,
+)
+from erpnext.hr.utils import get_leave_period, set_employee_name
+
class OverlapError(frappe.ValidationError): pass
class BackDatedAllocationError(frappe.ValidationError): pass
diff --git a/erpnext/hr/doctype/leave_allocation/leave_allocation_dashboard.py b/erpnext/hr/doctype/leave_allocation/leave_allocation_dashboard.py
index 7a063d9..84423bd 100644
--- a/erpnext/hr/doctype/leave_allocation/leave_allocation_dashboard.py
+++ b/erpnext/hr/doctype/leave_allocation/leave_allocation_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/hr/doctype/leave_allocation/test_leave_allocation.py b/erpnext/hr/doctype/leave_allocation/test_leave_allocation.py
index fdcd533..b185056 100644
--- a/erpnext/hr/doctype/leave_allocation/test_leave_allocation.py
+++ b/erpnext/hr/doctype/leave_allocation/test_leave_allocation.py
@@ -1,10 +1,15 @@
from __future__ import unicode_literals
-import frappe
-import erpnext
+
import unittest
-from frappe.utils import nowdate, add_months, getdate, add_days
+
+import frappe
+from frappe.utils import add_days, add_months, getdate, nowdate
+
+import erpnext
+from erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry import process_expired_allocation
from erpnext.hr.doctype.leave_type.test_leave_type import create_leave_type
-from erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry import process_expired_allocation, expire_allocation
+
+
class TestLeaveAllocation(unittest.TestCase):
@classmethod
def setUpClass(cls):
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index 93fb19f..9e6fc6d 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -2,14 +2,33 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import cint, cstr, date_diff, flt, formatdate, getdate, get_link_to_form, get_fullname, add_days, nowdate
-from erpnext.hr.utils import set_employee_name, get_leave_period, share_doc_with_approver, validate_active_employee
-from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates
-from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
+from frappe.utils import (
+ add_days,
+ cint,
+ cstr,
+ date_diff,
+ flt,
+ formatdate,
+ get_fullname,
+ get_link_to_form,
+ getdate,
+ nowdate,
+)
+
from erpnext.buying.doctype.supplier_scorecard.supplier_scorecard import daterange
+from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
+from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates
from erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry import create_leave_ledger_entry
+from erpnext.hr.utils import (
+ get_leave_period,
+ set_employee_name,
+ share_doc_with_approver,
+ validate_active_employee,
+)
+
class LeaveDayBlockedError(frappe.ValidationError): pass
class OverlapError(frappe.ValidationError): pass
@@ -17,6 +36,8 @@
class NotAnOptionalHoliday(frappe.ValidationError): pass
from frappe.model.document import Document
+
+
class LeaveApplication(Document):
def get_feed(self):
return _("{0}: From {0} of type {1}").format(self.employee_name, self.leave_type)
@@ -662,26 +683,30 @@
@frappe.whitelist()
def get_events(start, end, filters=None):
+ from frappe.desk.reportview import get_filters_cond
events = []
- employee = frappe.db.get_value("Employee", {"user_id": frappe.session.user}, ["name", "company"],
- as_dict=True)
+ employee = frappe.db.get_value("Employee",
+ filters={"user_id": frappe.session.user},
+ fieldname=["name", "company"],
+ as_dict=True
+ )
+
if employee:
employee, company = employee.name, employee.company
else:
- employee=''
- company=frappe.db.get_value("Global Defaults", None, "default_company")
+ employee = ''
+ company = frappe.db.get_value("Global Defaults", None, "default_company")
- from frappe.desk.reportview import get_filters_cond
conditions = get_filters_cond("Leave Application", filters, [])
# show department leaves for employee
if "Employee" in frappe.get_roles():
add_department_leaves(events, start, end, employee, company)
add_leaves(events, start, end, conditions)
-
add_block_dates(events, start, end, employee, company)
add_holidays(events, start, end, employee, company)
+
return events
def add_department_leaves(events, start, end, employee, company):
@@ -697,26 +722,37 @@
filter_conditions = " and employee in (\"%s\")" % '", "'.join(department_employees)
add_leaves(events, start, end, filter_conditions=filter_conditions)
+
def add_leaves(events, start, end, filter_conditions=None):
+ from frappe.desk.reportview import build_match_conditions
conditions = []
-
if not cint(frappe.db.get_value("HR Settings", None, "show_leaves_of_all_department_members_in_calendar")):
- from frappe.desk.reportview import build_match_conditions
match_conditions = build_match_conditions("Leave Application")
if match_conditions:
conditions.append(match_conditions)
- query = """select name, from_date, to_date, employee_name, half_day,
- status, employee, docstatus
- from `tabLeave Application` where
- from_date <= %(end)s and to_date >= %(start)s <= to_date
- and docstatus < 2
- and status!='Rejected' """
+ query = """SELECT
+ docstatus,
+ name,
+ employee,
+ employee_name,
+ leave_type,
+ from_date,
+ to_date,
+ half_day,
+ status,
+ color
+ FROM `tabLeave Application`
+ WHERE
+ from_date <= %(end)s AND to_date >= %(start)s <= to_date
+ AND docstatus < 2
+ AND status != 'Rejected'
+ """
if conditions:
- query += ' and ' + ' and '.join(conditions)
+ query += ' AND ' + ' AND '.join(conditions)
if filter_conditions:
query += filter_conditions
@@ -729,11 +765,13 @@
"to_date": d.to_date,
"docstatus": d.docstatus,
"color": d.color,
- "title": cstr(d.employee_name) + (' ' + _('(Half Day)') if d.half_day else ''),
+ "all_day": int(not d.half_day),
+ "title": cstr(d.employee_name) + f' ({cstr(d.leave_type)})' + (' ' + _('(Half Day)') if d.half_day else ''),
}
if e not in events:
events.append(e)
+
def add_block_dates(events, start, end, employee, company):
# block days
from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates
diff --git a/erpnext/hr/doctype/leave_application/leave_application_calendar.js b/erpnext/hr/doctype/leave_application/leave_application_calendar.js
index 31faadb..0ba0285 100644
--- a/erpnext/hr/doctype/leave_application/leave_application_calendar.js
+++ b/erpnext/hr/doctype/leave_application/leave_application_calendar.js
@@ -7,7 +7,9 @@
"end": "to_date",
"id": "name",
"title": "title",
- "docstatus": 1
+ "docstatus": 1,
+ "color": "color",
+ "allDay": "all_day"
},
options: {
header: {
diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.py b/erpnext/hr/doctype/leave_application/test_leave_application.py
index 2832e2f..b9c785a 100644
--- a/erpnext/hr/doctype/leave_application/test_leave_application.py
+++ b/erpnext/hr/doctype/leave_application/test_leave_application.py
@@ -2,16 +2,24 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.hr.doctype.leave_application.leave_application import LeaveDayBlockedError, OverlapError, NotAnOptionalHoliday, get_leave_balance_on
+import frappe
from frappe.permissions import clear_user_permissions_for_doctype
-from frappe.utils import add_days, nowdate, now_datetime, getdate, add_months
-from erpnext.hr.doctype.leave_type.test_leave_type import create_leave_type
-from erpnext.hr.doctype.leave_allocation.test_leave_allocation import create_leave_allocation
-from erpnext.hr.doctype.leave_policy_assignment.leave_policy_assignment import create_assignment_for_multiple_employees
+from frappe.utils import add_days, add_months, getdate, nowdate
+
from erpnext.hr.doctype.employee.test_employee import make_employee
+from erpnext.hr.doctype.leave_allocation.test_leave_allocation import create_leave_allocation
+from erpnext.hr.doctype.leave_application.leave_application import (
+ LeaveDayBlockedError,
+ NotAnOptionalHoliday,
+ OverlapError,
+ get_leave_balance_on,
+)
+from erpnext.hr.doctype.leave_policy_assignment.leave_policy_assignment import (
+ create_assignment_for_multiple_employees,
+)
+from erpnext.hr.doctype.leave_type.test_leave_type import create_leave_type
test_dependencies = ["Leave Allocation", "Leave Block List", "Employee"]
diff --git a/erpnext/hr/doctype/leave_block_list/leave_block_list.py b/erpnext/hr/doctype/leave_block_list/leave_block_list.py
index 9cb9fc0..9ba079c 100644
--- a/erpnext/hr/doctype/leave_block_list/leave_block_list.py
+++ b/erpnext/hr/doctype/leave_block_list/leave_block_list.py
@@ -4,10 +4,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
class LeaveBlockList(Document):
def validate(self):
diff --git a/erpnext/hr/doctype/leave_block_list/leave_block_list_dashboard.py b/erpnext/hr/doctype/leave_block_list/leave_block_list_dashboard.py
index 45aa491..30e7572 100644
--- a/erpnext/hr/doctype/leave_block_list/leave_block_list_dashboard.py
+++ b/erpnext/hr/doctype/leave_block_list/leave_block_list_dashboard.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_data():
return {
'fieldname': 'leave_block_list',
diff --git a/erpnext/hr/doctype/leave_block_list/test_leave_block_list.py b/erpnext/hr/doctype/leave_block_list/test_leave_block_list.py
index 0eb69a5..dd90e4f 100644
--- a/erpnext/hr/doctype/leave_block_list/test_leave_block_list.py
+++ b/erpnext/hr/doctype/leave_block_list/test_leave_block_list.py
@@ -2,12 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
from frappe.utils import getdate
+
from erpnext.hr.doctype.leave_block_list.leave_block_list import get_applicable_block_dates
+
class TestLeaveBlockList(unittest.TestCase):
def tearDown(self):
frappe.set_user("Administrator")
diff --git a/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.py b/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.py
index 8e5a09e..2f64847 100644
--- a/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.py
+++ b/erpnext/hr/doctype/leave_block_list_allow/leave_block_list_allow.py
@@ -4,9 +4,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class LeaveBlockListAllow(Document):
pass
diff --git a/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.py b/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.py
index 54978a1..4a8f45d 100644
--- a/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.py
+++ b/erpnext/hr/doctype/leave_block_list_date/leave_block_list_date.py
@@ -4,9 +4,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class LeaveBlockListDate(Document):
pass
diff --git a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.py b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.py
index 7401402..681a5e2 100644
--- a/erpnext/hr/doctype/leave_control_panel/leave_control_panel.py
+++ b/erpnext/hr/doctype/leave_control_panel/leave_control_panel.py
@@ -2,11 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import cint, cstr, flt, nowdate, comma_and, date_diff
-from frappe import msgprint, _
+import frappe
+from frappe import _, msgprint
from frappe.model.document import Document
+from frappe.utils import cint, comma_and, cstr, flt
+
class LeaveControlPanel(Document):
def get_employees(self):
@@ -51,7 +52,7 @@
la.docstatus = 1
la.save()
leave_allocated_for.append(d[0])
- except:
+ except Exception:
pass
if leave_allocated_for:
msgprint(_("Leaves Allocated Successfully for {0}").format(comma_and(leave_allocated_for)))
diff --git a/erpnext/hr/doctype/leave_control_panel/test_leave_control_panel.py b/erpnext/hr/doctype/leave_control_panel/test_leave_control_panel.py
index 9a907c8..f64b233 100644
--- a/erpnext/hr/doctype/leave_control_panel/test_leave_control_panel.py
+++ b/erpnext/hr/doctype/leave_control_panel/test_leave_control_panel.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestLeaveControlPanel(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/leave_encashment/leave_encashment.py b/erpnext/hr/doctype/leave_encashment/leave_encashment.py
index d136210..7656abf 100644
--- a/erpnext/hr/doctype/leave_encashment/leave_encashment.py
+++ b/erpnext/hr/doctype/leave_encashment/leave_encashment.py
@@ -3,14 +3,19 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import getdate, nowdate, flt
-from erpnext.hr.utils import set_employee_name, validate_active_employee
-from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import get_assigned_salary_structure
-from erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry import create_leave_ledger_entry
+from frappe.utils import getdate, nowdate
+
from erpnext.hr.doctype.leave_allocation.leave_allocation import get_unused_leaves
+from erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry import create_leave_ledger_entry
+from erpnext.hr.utils import set_employee_name, validate_active_employee
+from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import (
+ get_assigned_salary_structure,
+)
+
class LeaveEncashment(Document):
def validate(self):
diff --git a/erpnext/hr/doctype/leave_encashment/test_leave_encashment.py b/erpnext/hr/doctype/leave_encashment/test_leave_encashment.py
index c1da8b4..762745b 100644
--- a/erpnext/hr/doctype/leave_encashment/test_leave_encashment.py
+++ b/erpnext/hr/doctype/leave_encashment/test_leave_encashment.py
@@ -3,14 +3,18 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import today, add_months
+
+import frappe
+from frappe.utils import add_months, today
+
from erpnext.hr.doctype.employee.test_employee import make_employee
-from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
from erpnext.hr.doctype.leave_period.test_leave_period import create_leave_period
-from erpnext.hr.doctype.leave_policy_assignment.leave_policy_assignment import create_assignment_for_multiple_employees
-from erpnext.hr.doctype.leave_policy.test_leave_policy import create_leave_policy\
+from erpnext.hr.doctype.leave_policy.test_leave_policy import create_leave_policy
+from erpnext.hr.doctype.leave_policy_assignment.leave_policy_assignment import (
+ create_assignment_for_multiple_employees,
+)
+from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
test_dependencies = ["Leave Type"]
diff --git a/erpnext/hr/doctype/leave_ledger_entry/leave_ledger_entry.py b/erpnext/hr/doctype/leave_ledger_entry/leave_ledger_entry.py
index 33a6243..6cf9685 100644
--- a/erpnext/hr/doctype/leave_ledger_entry/leave_ledger_entry.py
+++ b/erpnext/hr/doctype/leave_ledger_entry/leave_ledger_entry.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
-from frappe.utils import add_days, today, flt, DATE_FORMAT, getdate
+from frappe.model.document import Document
+from frappe.utils import DATE_FORMAT, flt, getdate, today
+
class LeaveLedgerEntry(Document):
def validate(self):
diff --git a/erpnext/hr/doctype/leave_ledger_entry/test_leave_ledger_entry.py b/erpnext/hr/doctype/leave_ledger_entry/test_leave_ledger_entry.py
index 6f7725c..5fa419d 100644
--- a/erpnext/hr/doctype/leave_ledger_entry/test_leave_ledger_entry.py
+++ b/erpnext/hr/doctype/leave_ledger_entry/test_leave_ledger_entry.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestLeaveLedgerEntry(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/leave_period/leave_period.py b/erpnext/hr/doctype/leave_period/leave_period.py
index 28a33f6..143d23a 100644
--- a/erpnext/hr/doctype/leave_period/leave_period.py
+++ b/erpnext/hr/doctype/leave_period/leave_period.py
@@ -3,12 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import getdate, cstr, add_days, date_diff, getdate, ceil
from frappe.model.document import Document
+from frappe.utils import getdate
+
from erpnext.hr.utils import validate_overlap
-from frappe.utils.background_jobs import enqueue
+
class LeavePeriod(Document):
diff --git a/erpnext/hr/doctype/leave_period/leave_period_dashboard.py b/erpnext/hr/doctype/leave_period/leave_period_dashboard.py
index 7c2c963..a64c63a 100644
--- a/erpnext/hr/doctype/leave_period/leave_period_dashboard.py
+++ b/erpnext/hr/doctype/leave_period/leave_period_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'leave_period',
diff --git a/erpnext/hr/doctype/leave_period/test_leave_period.py b/erpnext/hr/doctype/leave_period/test_leave_period.py
index cbb3437..5c5ae13 100644
--- a/erpnext/hr/doctype/leave_period/test_leave_period.py
+++ b/erpnext/hr/doctype/leave_period/test_leave_period.py
@@ -3,9 +3,12 @@
# See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
import unittest
+import frappe
+
+import erpnext
+
test_dependencies = ["Employee", "Leave Type", "Leave Policy"]
class TestLeavePeriod(unittest.TestCase):
diff --git a/erpnext/hr/doctype/leave_policy/leave_policy.py b/erpnext/hr/doctype/leave_policy/leave_policy.py
index 964a5de..b11459d 100644
--- a/erpnext/hr/doctype/leave_policy/leave_policy.py
+++ b/erpnext/hr/doctype/leave_policy/leave_policy.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
class LeavePolicy(Document):
def validate(self):
if self.leave_policy_details:
diff --git a/erpnext/hr/doctype/leave_policy/leave_policy_dashboard.py b/erpnext/hr/doctype/leave_policy/leave_policy_dashboard.py
index 474f3a7..76f886c 100644
--- a/erpnext/hr/doctype/leave_policy/leave_policy_dashboard.py
+++ b/erpnext/hr/doctype/leave_policy/leave_policy_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'leave_policy',
diff --git a/erpnext/hr/doctype/leave_policy/test_leave_policy.py b/erpnext/hr/doctype/leave_policy/test_leave_policy.py
index af7567b..b0743f5 100644
--- a/erpnext/hr/doctype/leave_policy/test_leave_policy.py
+++ b/erpnext/hr/doctype/leave_policy/test_leave_policy.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestLeavePolicy(unittest.TestCase):
def test_max_leave_allowed(self):
random_leave_type = frappe.get_all("Leave Type", fields=["name", "max_leaves_allowed"])
diff --git a/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment.py b/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment.py
index d7cb1c8..f62b300 100644
--- a/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment.py
+++ b/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment.py
@@ -3,14 +3,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.model.document import Document
-from frappe import _, bold
-from frappe.utils import getdate, date_diff, comma_and, formatdate, get_datetime, flt
-from math import ceil
+
import json
+from math import ceil
+
+import frappe
+from frappe import _, bold
+from frappe.model.document import Document
+from frappe.utils import date_diff, flt, formatdate, get_datetime, getdate
from six import string_types
+
class LeavePolicyAssignment(Document):
def validate(self):
diff --git a/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment_dashboard.py b/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment_dashboard.py
index a2f7f58..79142a6 100644
--- a/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment_dashboard.py
+++ b/erpnext/hr/doctype/leave_policy_assignment/leave_policy_assignment_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'leave_policy_assignment',
diff --git a/erpnext/hr/doctype/leave_policy_assignment/test_leave_policy_assignment.py b/erpnext/hr/doctype/leave_policy_assignment/test_leave_policy_assignment.py
index 0089804..cbb26a1 100644
--- a/erpnext/hr/doctype/leave_policy_assignment/test_leave_policy_assignment.py
+++ b/erpnext/hr/doctype/leave_policy_assignment/test_leave_policy_assignment.py
@@ -3,11 +3,18 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.hr.doctype.leave_application.test_leave_application import get_leave_period, get_employee
-from erpnext.hr.doctype.leave_policy_assignment.leave_policy_assignment import create_assignment_for_multiple_employees
+
+import frappe
+
+from erpnext.hr.doctype.leave_application.test_leave_application import (
+ get_employee,
+ get_leave_period,
+)
from erpnext.hr.doctype.leave_policy.test_leave_policy import create_leave_policy
+from erpnext.hr.doctype.leave_policy_assignment.leave_policy_assignment import (
+ create_assignment_for_multiple_employees,
+)
test_dependencies = ["Employee"]
diff --git a/erpnext/hr/doctype/leave_policy_detail/leave_policy_detail.py b/erpnext/hr/doctype/leave_policy_detail/leave_policy_detail.py
index c103f08..f889424 100644
--- a/erpnext/hr/doctype/leave_policy_detail/leave_policy_detail.py
+++ b/erpnext/hr/doctype/leave_policy_detail/leave_policy_detail.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class LeavePolicyDetail(Document):
pass
diff --git a/erpnext/hr/doctype/leave_policy_detail/test_leave_policy_detail.py b/erpnext/hr/doctype/leave_policy_detail/test_leave_policy_detail.py
index 610b1fa..4cf9db2 100644
--- a/erpnext/hr/doctype/leave_policy_detail/test_leave_policy_detail.py
+++ b/erpnext/hr/doctype/leave_policy_detail/test_leave_policy_detail.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestLeavePolicyDetail(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/leave_type/leave_type.py b/erpnext/hr/doctype/leave_type/leave_type.py
index 21f180b..195c858 100644
--- a/erpnext/hr/doctype/leave_type/leave_type.py
+++ b/erpnext/hr/doctype/leave_type/leave_type.py
@@ -2,13 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import calendar
-import frappe
-from datetime import datetime
-from frappe.utils import today
-from frappe import _
+import frappe
+from frappe import _
from frappe.model.document import Document
+from frappe.utils import today
+
class LeaveType(Document):
def validate(self):
diff --git a/erpnext/hr/doctype/leave_type/leave_type_dashboard.py b/erpnext/hr/doctype/leave_type/leave_type_dashboard.py
index c8944fc..773d4e8 100644
--- a/erpnext/hr/doctype/leave_type/leave_type_dashboard.py
+++ b/erpnext/hr/doctype/leave_type/leave_type_dashboard.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_data():
return {
'fieldname': 'leave_type',
diff --git a/erpnext/hr/doctype/leave_type/test_leave_type.py b/erpnext/hr/doctype/leave_type/test_leave_type.py
index 048dddd..ee8db74 100644
--- a/erpnext/hr/doctype/leave_type/test_leave_type.py
+++ b/erpnext/hr/doctype/leave_type/test_leave_type.py
@@ -3,7 +3,6 @@
from __future__ import unicode_literals
import frappe
-from frappe import _
test_records = frappe.get_test_records('Leave Type')
diff --git a/erpnext/hr/doctype/offer_term/offer_term.py b/erpnext/hr/doctype/offer_term/offer_term.py
index 6a63201..5f8f591 100644
--- a/erpnext/hr/doctype/offer_term/offer_term.py
+++ b/erpnext/hr/doctype/offer_term/offer_term.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class OfferTerm(Document):
pass
diff --git a/erpnext/hr/doctype/offer_term/test_offer_term.py b/erpnext/hr/doctype/offer_term/test_offer_term.py
index d0dd14d..ec7edd4 100644
--- a/erpnext/hr/doctype/offer_term/test_offer_term.py
+++ b/erpnext/hr/doctype/offer_term/test_offer_term.py
@@ -2,7 +2,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Offer Term')
diff --git a/erpnext/hr/doctype/purpose_of_travel/purpose_of_travel.py b/erpnext/hr/doctype/purpose_of_travel/purpose_of_travel.py
index 62f62a5..f66fd27 100644
--- a/erpnext/hr/doctype/purpose_of_travel/purpose_of_travel.py
+++ b/erpnext/hr/doctype/purpose_of_travel/purpose_of_travel.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PurposeofTravel(Document):
pass
diff --git a/erpnext/hr/doctype/purpose_of_travel/test_purpose_of_travel.py b/erpnext/hr/doctype/purpose_of_travel/test_purpose_of_travel.py
index ccd950d..b33f389 100644
--- a/erpnext/hr/doctype/purpose_of_travel/test_purpose_of_travel.py
+++ b/erpnext/hr/doctype/purpose_of_travel/test_purpose_of_travel.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestPurposeofTravel(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/shift_assignment/shift_assignment.py b/erpnext/hr/doctype/shift_assignment/shift_assignment.py
index 89ae4d5..69af5c5 100644
--- a/erpnext/hr/doctype/shift_assignment/shift_assignment.py
+++ b/erpnext/hr/doctype/shift_assignment/shift_assignment.py
@@ -3,14 +3,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+from datetime import datetime, timedelta
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import cint, cstr, date_diff, flt, formatdate, getdate, now_datetime, nowdate
+from frappe.utils import cstr, getdate, now_datetime, nowdate
+
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
from erpnext.hr.doctype.holiday_list.holiday_list import is_holiday
from erpnext.hr.utils import validate_active_employee
-from datetime import timedelta, datetime
+
class ShiftAssignment(Document):
def validate(self):
diff --git a/erpnext/hr/doctype/shift_assignment/test_shift_assignment.py b/erpnext/hr/doctype/shift_assignment/test_shift_assignment.py
index 07d92fe..84003e2 100644
--- a/erpnext/hr/doctype/shift_assignment/test_shift_assignment.py
+++ b/erpnext/hr/doctype/shift_assignment/test_shift_assignment.py
@@ -3,9 +3,10 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import nowdate, add_days
+
+import frappe
+from frappe.utils import add_days, nowdate
test_dependencies = ["Shift Type"]
diff --git a/erpnext/hr/doctype/shift_request/shift_request.py b/erpnext/hr/doctype/shift_request/shift_request.py
index 2731da1..a6ac7c8 100644
--- a/erpnext/hr/doctype/shift_request/shift_request.py
+++ b/erpnext/hr/doctype/shift_request/shift_request.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import formatdate, getdate
+
from erpnext.hr.utils import share_doc_with_approver, validate_active_employee
+
class OverlapError(frappe.ValidationError): pass
class ShiftRequest(Document):
diff --git a/erpnext/hr/doctype/shift_request/shift_request_dashboard.py b/erpnext/hr/doctype/shift_request/shift_request_dashboard.py
index f70b61a..3ceafc0 100644
--- a/erpnext/hr/doctype/shift_request/shift_request_dashboard.py
+++ b/erpnext/hr/doctype/shift_request/shift_request_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/hr/doctype/shift_request/test_shift_request.py b/erpnext/hr/doctype/shift_request/test_shift_request.py
index 60b7676..7b4a3ca 100644
--- a/erpnext/hr/doctype/shift_request/test_shift_request.py
+++ b/erpnext/hr/doctype/shift_request/test_shift_request.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import nowdate, add_days
+
+import frappe
+from frappe.utils import add_days, nowdate
+
from erpnext.hr.doctype.employee.test_employee import make_employee
test_dependencies = ["Shift Type"]
diff --git a/erpnext/hr/doctype/shift_type/shift_type.py b/erpnext/hr/doctype/shift_type/shift_type.py
index d5fdda8..e53373d 100644
--- a/erpnext/hr/doctype/shift_type/shift_type.py
+++ b/erpnext/hr/doctype/shift_type/shift_type.py
@@ -3,16 +3,25 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import itertools
from datetime import timedelta
import frappe
from frappe.model.document import Document
-from frappe.utils import cint, getdate, get_datetime
-from erpnext.hr.doctype.shift_assignment.shift_assignment import get_actual_start_end_datetime_of_shift, get_employee_shift
-from erpnext.hr.doctype.employee_checkin.employee_checkin import mark_attendance_and_link_log, calculate_working_hours
+from frappe.utils import cint, get_datetime, getdate
+
from erpnext.hr.doctype.attendance.attendance import mark_attendance
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
+from erpnext.hr.doctype.employee_checkin.employee_checkin import (
+ calculate_working_hours,
+ mark_attendance_and_link_log,
+)
+from erpnext.hr.doctype.shift_assignment.shift_assignment import (
+ get_actual_start_end_datetime_of_shift,
+ get_employee_shift,
+)
+
class ShiftType(Document):
@frappe.whitelist()
diff --git a/erpnext/hr/doctype/shift_type/shift_type_dashboard.py b/erpnext/hr/doctype/shift_type/shift_type_dashboard.py
index aedd190..b78c69a 100644
--- a/erpnext/hr/doctype/shift_type/shift_type_dashboard.py
+++ b/erpnext/hr/doctype/shift_type/shift_type_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/hr/doctype/shift_type/test_shift_type.py b/erpnext/hr/doctype/shift_type/test_shift_type.py
index bc4f0ea..699030f 100644
--- a/erpnext/hr/doctype/shift_type/test_shift_type.py
+++ b/erpnext/hr/doctype/shift_type/test_shift_type.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestShiftType(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/skill/skill.py b/erpnext/hr/doctype/skill/skill.py
index 8d24212..ebaa410 100644
--- a/erpnext/hr/doctype/skill/skill.py
+++ b/erpnext/hr/doctype/skill/skill.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class Skill(Document):
pass
diff --git a/erpnext/hr/doctype/staffing_plan/staffing_plan.py b/erpnext/hr/doctype/staffing_plan/staffing_plan.py
index e6c783a..57a92b0 100644
--- a/erpnext/hr/doctype/staffing_plan/staffing_plan.py
+++ b/erpnext/hr/doctype/staffing_plan/staffing_plan.py
@@ -3,12 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
-from frappe.utils import getdate, nowdate, cint, flt
+from frappe.model.document import Document
+from frappe.utils import cint, flt, getdate, nowdate
from frappe.utils.nestedset import get_descendants_of
+
class SubsidiaryCompanyError(frappe.ValidationError): pass
class ParentCompanyError(frappe.ValidationError): pass
diff --git a/erpnext/hr/doctype/staffing_plan/staffing_plan_dashboard.py b/erpnext/hr/doctype/staffing_plan/staffing_plan_dashboard.py
index 8e89d53..24ae122 100644
--- a/erpnext/hr/doctype/staffing_plan/staffing_plan_dashboard.py
+++ b/erpnext/hr/doctype/staffing_plan/staffing_plan_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/hr/doctype/staffing_plan/test_staffing_plan.py b/erpnext/hr/doctype/staffing_plan/test_staffing_plan.py
index 1c6218e..4517cba 100644
--- a/erpnext/hr/doctype/staffing_plan/test_staffing_plan.py
+++ b/erpnext/hr/doctype/staffing_plan/test_staffing_plan.py
@@ -3,11 +3,15 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.hr.doctype.staffing_plan.staffing_plan import SubsidiaryCompanyError
-from erpnext.hr.doctype.staffing_plan.staffing_plan import ParentCompanyError
-from frappe.utils import nowdate, add_days
+
+import frappe
+from frappe.utils import add_days, nowdate
+
+from erpnext.hr.doctype.staffing_plan.staffing_plan import (
+ ParentCompanyError,
+ SubsidiaryCompanyError,
+)
test_dependencies = ["Designation"]
diff --git a/erpnext/hr/doctype/staffing_plan_detail/staffing_plan_detail.py b/erpnext/hr/doctype/staffing_plan_detail/staffing_plan_detail.py
index 28a651e..ea89df3 100644
--- a/erpnext/hr/doctype/staffing_plan_detail/staffing_plan_detail.py
+++ b/erpnext/hr/doctype/staffing_plan_detail/staffing_plan_detail.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class StaffingPlanDetail(Document):
pass
diff --git a/erpnext/hr/doctype/training_event/test_training_event.py b/erpnext/hr/doctype/training_event/test_training_event.py
index 6a275b3..ed44fa6 100644
--- a/erpnext/hr/doctype/training_event/test_training_event.py
+++ b/erpnext/hr/doctype/training_event/test_training_event.py
@@ -3,11 +3,14 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import today, add_days
+
+import frappe
+from frappe.utils import add_days, today
+
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_employee
+
class TestTrainingEvent(unittest.TestCase):
def setUp(self):
create_training_program("Basic Training")
diff --git a/erpnext/hr/doctype/training_event/training_event.py b/erpnext/hr/doctype/training_event/training_event.py
index e2c30cb..9b01d3d 100644
--- a/erpnext/hr/doctype/training_event/training_event.py
+++ b/erpnext/hr/doctype/training_event/training_event.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
+from frappe.model.document import Document
from frappe.utils import time_diff_in_seconds
+
from erpnext.hr.doctype.employee.employee import get_employee_emails
+
class TrainingEvent(Document):
def validate(self):
self.set_employee_emails()
diff --git a/erpnext/hr/doctype/training_event/training_event_dashboard.py b/erpnext/hr/doctype/training_event/training_event_dashboard.py
index 19afd8d..a917c87 100644
--- a/erpnext/hr/doctype/training_event/training_event_dashboard.py
+++ b/erpnext/hr/doctype/training_event/training_event_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/hr/doctype/training_event_employee/training_event_employee.py b/erpnext/hr/doctype/training_event_employee/training_event_employee.py
index 234e958..0892355 100644
--- a/erpnext/hr/doctype/training_event_employee/training_event_employee.py
+++ b/erpnext/hr/doctype/training_event_employee/training_event_employee.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class TrainingEventEmployee(Document):
pass
diff --git a/erpnext/hr/doctype/training_feedback/test_training_feedback.py b/erpnext/hr/doctype/training_feedback/test_training_feedback.py
index 4c0c180..a9bf6d6 100644
--- a/erpnext/hr/doctype/training_feedback/test_training_feedback.py
+++ b/erpnext/hr/doctype/training_feedback/test_training_feedback.py
@@ -3,10 +3,17 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
+
+from erpnext.hr.doctype.training_event.test_training_event import (
+ create_training_event,
+ create_training_program,
+)
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_employee
-from erpnext.hr.doctype.training_event.test_training_event import create_training_program, create_training_event
+
+
class TestTrainingFeedback(unittest.TestCase):
def setUp(self):
create_training_program("Basic Training")
diff --git a/erpnext/hr/doctype/training_feedback/training_feedback.py b/erpnext/hr/doctype/training_feedback/training_feedback.py
index 3d4b9b3..6a41a65 100644
--- a/erpnext/hr/doctype/training_feedback/training_feedback.py
+++ b/erpnext/hr/doctype/training_feedback/training_feedback.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
+from frappe.model.document import Document
+
class TrainingFeedback(Document):
def validate(self):
diff --git a/erpnext/hr/doctype/training_program/test_training_program.py b/erpnext/hr/doctype/training_program/test_training_program.py
index 9d5b286..aec319f 100644
--- a/erpnext/hr/doctype/training_program/test_training_program.py
+++ b/erpnext/hr/doctype/training_program/test_training_program.py
@@ -5,5 +5,6 @@
import unittest
+
class TestTrainingProgram(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/training_program/training_program.py b/erpnext/hr/doctype/training_program/training_program.py
index 7a3720b..6f3ab5a 100644
--- a/erpnext/hr/doctype/training_program/training_program.py
+++ b/erpnext/hr/doctype/training_program/training_program.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class TrainingProgram(Document):
pass
diff --git a/erpnext/hr/doctype/training_program/training_program_dashboard.py b/erpnext/hr/doctype/training_program/training_program_dashboard.py
index 0fc18a8..b2eed68 100644
--- a/erpnext/hr/doctype/training_program/training_program_dashboard.py
+++ b/erpnext/hr/doctype/training_program/training_program_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'training_program',
diff --git a/erpnext/hr/doctype/training_result/test_training_result.py b/erpnext/hr/doctype/training_result/test_training_result.py
index 29ed2a0..17ccc4b 100644
--- a/erpnext/hr/doctype/training_result/test_training_result.py
+++ b/erpnext/hr/doctype/training_result/test_training_result.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Training Result')
diff --git a/erpnext/hr/doctype/training_result/training_result.py b/erpnext/hr/doctype/training_result/training_result.py
index 7cdc51f..9cfc570 100644
--- a/erpnext/hr/doctype/training_result/training_result.py
+++ b/erpnext/hr/doctype/training_result/training_result.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
from erpnext.hr.doctype.employee.employee import get_employee_emails
+
class TrainingResult(Document):
def validate(self):
training_event = frappe.get_doc("Training Event", self.training_event)
diff --git a/erpnext/hr/doctype/training_result_employee/training_result_employee.py b/erpnext/hr/doctype/training_result_employee/training_result_employee.py
index 54e2a18..b0d4605 100644
--- a/erpnext/hr/doctype/training_result_employee/training_result_employee.py
+++ b/erpnext/hr/doctype/training_result_employee/training_result_employee.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class TrainingResultEmployee(Document):
pass
diff --git a/erpnext/hr/doctype/travel_itinerary/travel_itinerary.py b/erpnext/hr/doctype/travel_itinerary/travel_itinerary.py
index 0b369be..467ef16 100644
--- a/erpnext/hr/doctype/travel_itinerary/travel_itinerary.py
+++ b/erpnext/hr/doctype/travel_itinerary/travel_itinerary.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class TravelItinerary(Document):
pass
diff --git a/erpnext/hr/doctype/travel_request/test_travel_request.py b/erpnext/hr/doctype/travel_request/test_travel_request.py
index dac5517..95bf8b9 100644
--- a/erpnext/hr/doctype/travel_request/test_travel_request.py
+++ b/erpnext/hr/doctype/travel_request/test_travel_request.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestTravelRequest(unittest.TestCase):
pass
diff --git a/erpnext/hr/doctype/travel_request/travel_request.py b/erpnext/hr/doctype/travel_request/travel_request.py
index 60834d3..b10333f 100644
--- a/erpnext/hr/doctype/travel_request/travel_request.py
+++ b/erpnext/hr/doctype/travel_request/travel_request.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
from erpnext.hr.utils import validate_active_employee
+
class TravelRequest(Document):
def validate(self):
validate_active_employee(self.employee)
diff --git a/erpnext/hr/doctype/travel_request_costing/travel_request_costing.py b/erpnext/hr/doctype/travel_request_costing/travel_request_costing.py
index 9fa85e8..9b38d88 100644
--- a/erpnext/hr/doctype/travel_request_costing/travel_request_costing.py
+++ b/erpnext/hr/doctype/travel_request_costing/travel_request_costing.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class TravelRequestCosting(Document):
pass
diff --git a/erpnext/hr/doctype/upload_attendance/test_upload_attendance.py b/erpnext/hr/doctype/upload_attendance/test_upload_attendance.py
index 03b0cf3..e0a776c 100644
--- a/erpnext/hr/doctype/upload_attendance/test_upload_attendance.py
+++ b/erpnext/hr/doctype/upload_attendance/test_upload_attendance.py
@@ -3,12 +3,14 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-import erpnext
+
+import frappe
from frappe.utils import getdate
-from erpnext.hr.doctype.upload_attendance.upload_attendance import get_data
+
+import erpnext
from erpnext.hr.doctype.employee.test_employee import make_employee
+from erpnext.hr.doctype.upload_attendance.upload_attendance import get_data
test_dependencies = ['Holiday List']
diff --git a/erpnext/hr/doctype/upload_attendance/upload_attendance.py b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
index 9c765d7..030ecec 100644
--- a/erpnext/hr/doctype/upload_attendance/upload_attendance.py
+++ b/erpnext/hr/doctype/upload_attendance/upload_attendance.py
@@ -4,14 +4,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import cstr, add_days, date_diff, getdate
from frappe import _
-from frappe.utils.csvutils import UnicodeWriter
from frappe.model.document import Document
+from frappe.utils import add_days, cstr, date_diff, getdate
+from frappe.utils.csvutils import UnicodeWriter
+
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
from erpnext.hr.utils import get_holiday_dates_for_employee
+
class UploadAttendance(Document):
pass
diff --git a/erpnext/hr/doctype/vehicle/test_vehicle.py b/erpnext/hr/doctype/vehicle/test_vehicle.py
index ff3429d..2bc94c6 100644
--- a/erpnext/hr/doctype/vehicle/test_vehicle.py
+++ b/erpnext/hr/doctype/vehicle/test_vehicle.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import nowdate,flt, cstr,random_string
+
+import frappe
+from frappe.utils import random_string
+
# test_records = frappe.get_test_records('Vehicle')
class TestVehicle(unittest.TestCase):
diff --git a/erpnext/hr/doctype/vehicle/vehicle.py b/erpnext/hr/doctype/vehicle/vehicle.py
index 1df5068..2ff1904 100644
--- a/erpnext/hr/doctype/vehicle/vehicle.py
+++ b/erpnext/hr/doctype/vehicle/vehicle.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import getdate
from frappe.model.document import Document
+from frappe.utils import getdate
+
class Vehicle(Document):
def validate(self):
diff --git a/erpnext/hr/doctype/vehicle/vehicle_dashboard.py b/erpnext/hr/doctype/vehicle/vehicle_dashboard.py
index 628c897..6a01bcf 100644
--- a/erpnext/hr/doctype/vehicle/vehicle_dashboard.py
+++ b/erpnext/hr/doctype/vehicle/vehicle_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'heatmap': True,
diff --git a/erpnext/hr/doctype/vehicle_log/test_vehicle_log.py b/erpnext/hr/doctype/vehicle_log/test_vehicle_log.py
index ed02120..1b0bfcb 100644
--- a/erpnext/hr/doctype/vehicle_log/test_vehicle_log.py
+++ b/erpnext/hr/doctype/vehicle_log/test_vehicle_log.py
@@ -3,12 +3,15 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import nowdate, flt, cstr, random_string
+
+import frappe
+from frappe.utils import cstr, flt, nowdate, random_string
+
from erpnext.hr.doctype.employee.test_employee import make_employee
from erpnext.hr.doctype.vehicle_log.vehicle_log import make_expense_claim
+
class TestVehicleLog(unittest.TestCase):
def setUp(self):
employee_id = frappe.db.sql("""select name from `tabEmployee` where name='testdriver@example.com'""")
diff --git a/erpnext/hr/doctype/vehicle_log/vehicle_log.py b/erpnext/hr/doctype/vehicle_log/vehicle_log.py
index 04c94e3..73c848b 100644
--- a/erpnext/hr/doctype/vehicle_log/vehicle_log.py
+++ b/erpnext/hr/doctype/vehicle_log/vehicle_log.py
@@ -3,11 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt, cstr
-from frappe.model.mapper import get_mapped_doc
from frappe.model.document import Document
+from frappe.utils import flt
+
class VehicleLog(Document):
def validate(self):
diff --git a/erpnext/hr/doctype/vehicle_service/vehicle_service.py b/erpnext/hr/doctype/vehicle_service/vehicle_service.py
index 18ed782..bc93a97 100644
--- a/erpnext/hr/doctype/vehicle_service/vehicle_service.py
+++ b/erpnext/hr/doctype/vehicle_service/vehicle_service.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class VehicleService(Document):
pass
diff --git a/erpnext/hr/notification/training_feedback/training_feedback.py b/erpnext/hr/notification/training_feedback/training_feedback.py
index 2334f8b..f57de91 100644
--- a/erpnext/hr/notification/training_feedback/training_feedback.py
+++ b/erpnext/hr/notification/training_feedback/training_feedback.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals
-import frappe
def get_context(context):
# do your magic here
diff --git a/erpnext/hr/notification/training_scheduled/training_scheduled.py b/erpnext/hr/notification/training_scheduled/training_scheduled.py
index 2334f8b..f57de91 100644
--- a/erpnext/hr/notification/training_scheduled/training_scheduled.py
+++ b/erpnext/hr/notification/training_scheduled/training_scheduled.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals
-import frappe
def get_context(context):
# do your magic here
diff --git a/erpnext/hr/page/organizational_chart/organizational_chart.js b/erpnext/hr/page/organizational_chart/organizational_chart.js
index 81162a4..b0e41e0 100644
--- a/erpnext/hr/page/organizational_chart/organizational_chart.js
+++ b/erpnext/hr/page/organizational_chart/organizational_chart.js
@@ -15,6 +15,8 @@
} else {
organizational_chart = new erpnext.HierarchyChart('Employee', wrapper, method);
}
+
+ frappe.breadcrumbs.add('HR');
organizational_chart.show();
});
});
diff --git a/erpnext/hr/page/organizational_chart/organizational_chart.py b/erpnext/hr/page/organizational_chart/organizational_chart.py
index 4423d29..1baf805 100644
--- a/erpnext/hr/page/organizational_chart/organizational_chart.py
+++ b/erpnext/hr/page/organizational_chart/organizational_chart.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
@frappe.whitelist()
def get_children(parent=None, company=None, exclude_node=None):
filters = [['status', '!=', 'Left']]
diff --git a/erpnext/hr/page/team_updates/team_updates.py b/erpnext/hr/page/team_updates/team_updates.py
index 58cdc4b..a5e7c44 100644
--- a/erpnext/hr/page/team_updates/team_updates.py
+++ b/erpnext/hr/page/team_updates/team_updates.py
@@ -3,6 +3,7 @@
import frappe
from email_reply_parser import EmailReplyParser
+
@frappe.whitelist()
def get_data(start=0):
#frappe.only_for('Employee', 'System Manager')
diff --git a/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.py b/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.py
index d8691b4..62ffb7d 100644
--- a/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.py
+++ b/erpnext/hr/report/daily_work_summary_replies/daily_work_summary_replies.py
@@ -2,10 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe import _
+
import frappe
+from frappe import _
+
from erpnext.hr.doctype.daily_work_summary.daily_work_summary import get_user_emails_from_group
+
def execute(filters=None):
if not filters.group: return [], []
columns, data = get_columns(), get_data(filters)
diff --git a/erpnext/hr/report/employee_advance_summary/employee_advance_summary.py b/erpnext/hr/report/employee_advance_summary/employee_advance_summary.py
index 363e31d..d0c295d 100644
--- a/erpnext/hr/report/employee_advance_summary/employee_advance_summary.py
+++ b/erpnext/hr/report/employee_advance_summary/employee_advance_summary.py
@@ -2,8 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import msgprint, _
+from frappe import _, msgprint
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/hr/report/employee_analytics/employee_analytics.py b/erpnext/hr/report/employee_analytics/employee_analytics.py
index fe77b6a..725c5a1 100644
--- a/erpnext/hr/report/employee_analytics/employee_analytics.py
+++ b/erpnext/hr/report/employee_analytics/employee_analytics.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/hr/report/employee_birthday/employee_birthday.py b/erpnext/hr/report/employee_birthday/employee_birthday.py
index e8d7844..b284e6b 100644
--- a/erpnext/hr/report/employee_birthday/employee_birthday.py
+++ b/erpnext/hr/report/employee_birthday/employee_birthday.py
@@ -2,9 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
index b8953b3..6bca136 100644
--- a/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
+++ b/erpnext/hr/report/employee_leave_balance/employee_leave_balance.py
@@ -2,12 +2,19 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import flt, add_days
-from frappe import _
-from erpnext.hr.doctype.leave_application.leave_application import get_leaves_for_period, get_leave_balance_on
+
from itertools import groupby
+import frappe
+from frappe import _
+from frappe.utils import add_days
+
+from erpnext.hr.doctype.leave_application.leave_application import (
+ get_leave_balance_on,
+ get_leaves_for_period,
+)
+
+
def execute(filters=None):
if filters.to_date <= filters.from_date:
frappe.throw(_('"From Date" can not be greater than or equal to "To Date"'))
diff --git a/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py b/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py
index e86fa2b..bcbb066 100644
--- a/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py
+++ b/erpnext/hr/report/employee_leave_balance_summary/employee_leave_balance_summary.py
@@ -2,14 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt
-from erpnext.hr.doctype.leave_application.leave_application \
- import get_leave_details
-from erpnext.hr.report.employee_leave_balance.employee_leave_balance \
- import get_department_leave_approver_map
+from erpnext.hr.doctype.leave_application.leave_application import get_leave_details
+from erpnext.hr.report.employee_leave_balance.employee_leave_balance import (
+ get_department_leave_approver_map,
+)
+
def execute(filters=None):
leave_types = frappe.db.sql_list("select name from `tabLeave Type` order by name asc")
@@ -65,7 +66,7 @@
for leave_type in leave_types:
remaining = 0
if leave_type in available_leave["leave_allocation"]:
- # opening balance
+ # opening balance
remaining = available_leave["leave_allocation"][leave_type]['remaining_leaves']
row += [remaining]
diff --git a/erpnext/hr/report/employees_working_on_a_holiday/employees_working_on_a_holiday.py b/erpnext/hr/report/employees_working_on_a_holiday/employees_working_on_a_holiday.py
index 59f56d7..3a26882 100644
--- a/erpnext/hr/report/employees_working_on_a_holiday/employees_working_on_a_holiday.py
+++ b/erpnext/hr/report/employees_working_on_a_holiday/employees_working_on_a_holiday.py
@@ -2,6 +2,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
index bcb0ee4..c6e6432 100644
--- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
+++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
@@ -2,11 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import cstr, cint, getdate
-from frappe import msgprint, _
+
from calendar import monthrange
+import frappe
+from frappe import _, msgprint
+from frappe.utils import cint, cstr, getdate
+
status_map = {
"Absent": "A",
"Half Day": "HD",
diff --git a/erpnext/hr/report/recruitment_analytics/recruitment_analytics.py b/erpnext/hr/report/recruitment_analytics/recruitment_analytics.py
index 303c829..c598e9e 100644
--- a/erpnext/hr/report/recruitment_analytics/recruitment_analytics.py
+++ b/erpnext/hr/report/recruitment_analytics/recruitment_analytics.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/hr/report/vehicle_expenses/test_vehicle_expenses.py b/erpnext/hr/report/vehicle_expenses/test_vehicle_expenses.py
index 26e0f26..2ba87ef 100644
--- a/erpnext/hr/report/vehicle_expenses/test_vehicle_expenses.py
+++ b/erpnext/hr/report/vehicle_expenses/test_vehicle_expenses.py
@@ -2,14 +2,18 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import unittest
+
import frappe
from frappe.utils import getdate
-from erpnext.hr.doctype.employee.test_employee import make_employee
-from erpnext.hr.doctype.vehicle_log.vehicle_log import make_expense_claim
-from erpnext.hr.doctype.vehicle_log.test_vehicle_log import get_vehicle, make_vehicle_log
-from erpnext.hr.report.vehicle_expenses.vehicle_expenses import execute
+
from erpnext.accounts.utils import get_fiscal_year
+from erpnext.hr.doctype.employee.test_employee import make_employee
+from erpnext.hr.doctype.vehicle_log.test_vehicle_log import get_vehicle, make_vehicle_log
+from erpnext.hr.doctype.vehicle_log.vehicle_log import make_expense_claim
+from erpnext.hr.report.vehicle_expenses.vehicle_expenses import execute
+
class TestVehicleExpenses(unittest.TestCase):
@classmethod
diff --git a/erpnext/hr/report/vehicle_expenses/vehicle_expenses.py b/erpnext/hr/report/vehicle_expenses/vehicle_expenses.py
index d847cbb..2be3565 100644
--- a/erpnext/hr/report/vehicle_expenses/vehicle_expenses.py
+++ b/erpnext/hr/report/vehicle_expenses/vehicle_expenses.py
@@ -2,12 +2,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-import erpnext
from frappe import _
from frappe.utils import flt
+
from erpnext.accounts.report.financial_statements import get_period_list
+
def execute(filters=None):
filters = frappe._dict(filters or {})
@@ -96,8 +98,6 @@
}
]
- return columns
-
def get_vehicle_log_data(filters):
start_date, end_date = get_period_dates(filters)
diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py
index 15b237d..deec644 100644
--- a/erpnext/hr/utils.py
+++ b/erpnext/hr/utils.py
@@ -1,14 +1,27 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-import erpnext
import frappe
-from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee, InactiveEmployeeStatusError
from frappe import _
-from frappe.desk.form import assign_to
-from frappe.model.document import Document
-from frappe.utils import (add_days, cstr, flt, format_datetime, formatdate,
- get_datetime, getdate, nowdate, today, unique, get_link_to_form)
+from frappe.utils import (
+ add_days,
+ cstr,
+ flt,
+ format_datetime,
+ formatdate,
+ get_datetime,
+ get_link_to_form,
+ getdate,
+ nowdate,
+ today,
+)
+
+import erpnext
+from erpnext.hr.doctype.employee.employee import (
+ InactiveEmployeeStatusError,
+ get_holiday_list_for_employee,
+)
+
class DuplicateDeclarationError(frappe.ValidationError): pass
@@ -272,6 +285,7 @@
def check_effective_date(from_date, to_date, frequency, based_on_date_of_joining_date):
import calendar
+
from dateutil import relativedelta
from_date = get_datetime(from_date)
@@ -337,9 +351,9 @@
def get_holiday_dates_for_employee(employee, start_date, end_date):
"""return a list of holiday dates for the given employee between start_date and end_date"""
- # return only date
- holidays = get_holidays_for_employee(employee, start_date, end_date)
-
+ # return only date
+ holidays = get_holidays_for_employee(employee, start_date, end_date)
+
return [cstr(h.holiday_date) for h in holidays]
@@ -352,7 +366,7 @@
`raise_exception` (bool)
`only_non_weekly` (bool)
- return: list of dicts with `holiday_date` and `description`
+ return: list of dicts with `holiday_date` and `description`
"""
holiday_list = get_holiday_list_for_employee(employee, raise_exception=raise_exception)
@@ -368,11 +382,11 @@
filters['weekly_off'] = False
holidays = frappe.get_all(
- 'Holiday',
+ 'Holiday',
fields=['description', 'holiday_date'],
filters=filters
)
-
+
return holidays
@erpnext.allow_regional
diff --git a/erpnext/hr/web_form/job_application/job_application.py b/erpnext/hr/web_form/job_application/job_application.py
index 2334f8b..f57de91 100644
--- a/erpnext/hr/web_form/job_application/job_application.py
+++ b/erpnext/hr/web_form/job_application/job_application.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals
-import frappe
def get_context(context):
# do your magic here
diff --git a/erpnext/hr/workspace/hr/hr.json b/erpnext/hr/workspace/hr/hr.json
index 575fa7b..9c5d0c1 100644
--- a/erpnext/hr/workspace/hr/hr.json
+++ b/erpnext/hr/workspace/hr/hr.json
@@ -224,6 +224,17 @@
"type": "Link"
},
{
+ "dependencies": "Employee",
+ "hidden": 0,
+ "is_query_report": 0,
+ "label": "Full and Final Statement",
+ "link_count": 0,
+ "link_to": "Full and Final Statement",
+ "link_type": "DocType",
+ "onboard": 0,
+ "type": "Link"
+ },
+ {
"hidden": 0,
"is_query_report": 0,
"label": "Shift Management",
@@ -931,7 +942,7 @@
"type": "Link"
}
],
- "modified": "2021-08-05 12:15:59.842918",
+ "modified": "2021-08-31 12:18:59.842918",
"modified_by": "Administrator",
"module": "HR",
"name": "HR",
diff --git a/erpnext/hub_node/__init__.py b/erpnext/hub_node/__init__.py
index 85ffe29..6ac3255 100644
--- a/erpnext/hub_node/__init__.py
+++ b/erpnext/hub_node/__init__.py
@@ -2,8 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
+
@frappe.whitelist()
def enable_hub():
hub_settings = frappe.get_doc('Marketplace Settings')
diff --git a/erpnext/hub_node/api.py b/erpnext/hub_node/api.py
index 42f9000..5530491 100644
--- a/erpnext/hub_node/api.py
+++ b/erpnext/hub_node/api.py
@@ -1,11 +1,11 @@
from __future__ import unicode_literals
-import frappe
import json
+import frappe
from frappe import _
-from frappe.frappeclient import FrappeClient
from frappe.desk.form.load import get_attachments
+from frappe.frappeclient import FrappeClient
from six import string_types
current_user = frappe.session.user
diff --git a/erpnext/hub_node/doctype/hub_tracked_item/hub_tracked_item.py b/erpnext/hub_node/doctype/hub_tracked_item/hub_tracked_item.py
index be2cd6b..823c79e 100644
--- a/erpnext/hub_node/doctype/hub_tracked_item/hub_tracked_item.py
+++ b/erpnext/hub_node/doctype/hub_tracked_item/hub_tracked_item.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class HubTrackedItem(Document):
pass
diff --git a/erpnext/hub_node/doctype/hub_tracked_item/test_hub_tracked_item.py b/erpnext/hub_node/doctype/hub_tracked_item/test_hub_tracked_item.py
index 92b2940..c403f90 100644
--- a/erpnext/hub_node/doctype/hub_tracked_item/test_hub_tracked_item.py
+++ b/erpnext/hub_node/doctype/hub_tracked_item/test_hub_tracked_item.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestHubTrackedItem(unittest.TestCase):
pass
diff --git a/erpnext/hub_node/doctype/hub_user/hub_user.py b/erpnext/hub_node/doctype/hub_user/hub_user.py
index de43f4e..1f7c8fc 100644
--- a/erpnext/hub_node/doctype/hub_user/hub_user.py
+++ b/erpnext/hub_node/doctype/hub_user/hub_user.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class HubUser(Document):
pass
diff --git a/erpnext/hub_node/doctype/hub_users/hub_users.py b/erpnext/hub_node/doctype/hub_users/hub_users.py
index 440be14..e08ed68 100644
--- a/erpnext/hub_node/doctype/hub_users/hub_users.py
+++ b/erpnext/hub_node/doctype/hub_users/hub_users.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class HubUsers(Document):
pass
diff --git a/erpnext/hub_node/doctype/marketplace_settings/marketplace_settings.py b/erpnext/hub_node/doctype/marketplace_settings/marketplace_settings.py
index 91c7bf5..33d23f6 100644
--- a/erpnext/hub_node/doctype/marketplace_settings/marketplace_settings.py
+++ b/erpnext/hub_node/doctype/marketplace_settings/marketplace_settings.py
@@ -2,14 +2,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, requests, json, time
-from frappe.model.document import Document
-from frappe.utils import add_years, now, get_datetime, get_datetime_str, cint
-from frappe import _
+import json
+
+import frappe
from frappe.frappeclient import FrappeClient
-from erpnext.utilities.product import get_price, get_qty_in_stock
-from six import string_types
+from frappe.model.document import Document
+from frappe.utils import cint
+
class MarketplaceSettings(Document):
@@ -83,7 +83,6 @@
def unregister(self):
"""Disable the User on hubmarket.org"""
- pass
@frappe.whitelist()
def is_marketplace_enabled():
diff --git a/erpnext/hub_node/doctype/marketplace_settings/test_marketplace_settings.py b/erpnext/hub_node/doctype/marketplace_settings/test_marketplace_settings.py
index 549b991..7922f45 100644
--- a/erpnext/hub_node/doctype/marketplace_settings/test_marketplace_settings.py
+++ b/erpnext/hub_node/doctype/marketplace_settings/test_marketplace_settings.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestMarketplaceSettings(unittest.TestCase):
pass
diff --git a/erpnext/hub_node/legacy.py b/erpnext/hub_node/legacy.py
index b61b88b..2e4c266 100644
--- a/erpnext/hub_node/legacy.py
+++ b/erpnext/hub_node/legacy.py
@@ -1,9 +1,13 @@
from __future__ import unicode_literals
-import frappe, json
-from frappe.utils import nowdate
-from frappe.frappeclient import FrappeClient
-from frappe.utils.nestedset import get_root_of
+
+import json
+
+import frappe
from frappe.contacts.doctype.contact.contact import get_default_contact
+from frappe.frappeclient import FrappeClient
+from frappe.utils import nowdate
+from frappe.utils.nestedset import get_root_of
+
def get_list(doctype, start, limit, fields, filters, order_by):
pass
diff --git a/erpnext/loan_management/dashboard_chart_source/top_10_pledged_loan_securities/top_10_pledged_loan_securities.py b/erpnext/loan_management/dashboard_chart_source/top_10_pledged_loan_securities/top_10_pledged_loan_securities.py
index 6ce2a54..0911e8f 100644
--- a/erpnext/loan_management/dashboard_chart_source/top_10_pledged_loan_securities/top_10_pledged_loan_securities.py
+++ b/erpnext/loan_management/dashboard_chart_source/top_10_pledged_loan_securities/top_10_pledged_loan_securities.py
@@ -2,12 +2,16 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.utils.dashboard import cache_source
-from erpnext.loan_management.report.applicant_wise_loan_security_exposure.applicant_wise_loan_security_exposure \
- import get_loan_security_details
from six import iteritems
+from erpnext.loan_management.report.applicant_wise_loan_security_exposure.applicant_wise_loan_security_exposure import (
+ get_loan_security_details,
+)
+
+
@frappe.whitelist()
@cache_source
def get_data(chart_name = None, chart = None, no_cache = None, filters = None, from_date = None,
diff --git a/erpnext/loan_management/doctype/loan/loan.py b/erpnext/loan_management/doctype/loan/loan.py
index ff7fbbd..7dbd422 100644
--- a/erpnext/loan_management/doctype/loan/loan.py
+++ b/erpnext/loan_management/doctype/loan/loan.py
@@ -3,14 +3,22 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, math, json
-import erpnext
+
+import json
+import math
+
+import frappe
from frappe import _
+from frappe.utils import add_months, flt, getdate, now_datetime, nowdate
from six import string_types
-from frappe.utils import flt, rounded, add_months, nowdate, getdate, now_datetime
-from erpnext.loan_management.doctype.loan_security_unpledge.loan_security_unpledge import get_pledged_security_qty
+
+import erpnext
from erpnext.controllers.accounts_controller import AccountsController
from erpnext.loan_management.doctype.loan_repayment.loan_repayment import calculate_amounts
+from erpnext.loan_management.doctype.loan_security_unpledge.loan_security_unpledge import (
+ get_pledged_security_qty,
+)
+
class Loan(AccountsController):
def validate(self):
@@ -361,7 +369,9 @@
return unpledge_request
def validate_employee_currency_with_company_currency(applicant, company):
- from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import get_employee_currency
+ from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import (
+ get_employee_currency,
+ )
if not applicant:
frappe.throw(_("Please select Applicant"))
if not company:
diff --git a/erpnext/loan_management/doctype/loan/loan_dashboard.py b/erpnext/loan_management/doctype/loan/loan_dashboard.py
index 711a782..28ccc03 100644
--- a/erpnext/loan_management/doctype/loan/loan_dashboard.py
+++ b/erpnext/loan_management/doctype/loan/loan_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/loan_management/doctype/loan/test_loan.py b/erpnext/loan_management/doctype/loan/test_loan.py
index 122d723..ec0aebb 100644
--- a/erpnext/loan_management/doctype/loan/test_loan.py
+++ b/erpnext/loan_management/doctype/loan/test_loan.py
@@ -3,23 +3,40 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
-import erpnext
import unittest
-from frappe.utils import (nowdate, add_days, getdate, now_datetime, add_to_date, get_datetime,
- add_months, get_first_day, get_last_day, flt, date_diff)
-from erpnext.selling.doctype.customer.test_customer import get_customer_dict
-from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_employee
-from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (process_loan_interest_accrual_for_demand_loans,
- process_loan_interest_accrual_for_term_loans)
-from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import days_in_year
-from erpnext.loan_management.doctype.process_loan_security_shortfall.process_loan_security_shortfall import create_process_loan_security_shortfall
-from erpnext.loan_management.doctype.loan.loan import unpledge_security, request_loan_closure, make_loan_write_off
-from erpnext.loan_management.doctype.loan_security_unpledge.loan_security_unpledge import get_pledged_security_qty
+
+import frappe
+from frappe.utils import add_days, add_months, add_to_date, date_diff, flt, get_datetime, nowdate
+
+from erpnext.loan_management.doctype.loan.loan import (
+ make_loan_write_off,
+ request_loan_closure,
+ unpledge_security,
+)
from erpnext.loan_management.doctype.loan_application.loan_application import create_pledge
-from erpnext.loan_management.doctype.loan_disbursement.loan_disbursement import get_disbursal_amount
+from erpnext.loan_management.doctype.loan_disbursement.loan_disbursement import (
+ get_disbursal_amount,
+)
+from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import (
+ days_in_year,
+)
from erpnext.loan_management.doctype.loan_repayment.loan_repayment import calculate_amounts
-from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
+from erpnext.loan_management.doctype.loan_security_unpledge.loan_security_unpledge import (
+ get_pledged_security_qty,
+)
+from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
+ process_loan_interest_accrual_for_demand_loans,
+ process_loan_interest_accrual_for_term_loans,
+)
+from erpnext.loan_management.doctype.process_loan_security_shortfall.process_loan_security_shortfall import (
+ create_process_loan_security_shortfall,
+)
+from erpnext.payroll.doctype.salary_structure.test_salary_structure import (
+ make_employee,
+ make_salary_structure,
+)
+from erpnext.selling.doctype.customer.test_customer import get_customer_dict
+
class TestLoan(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/loan_management/doctype/loan_application/loan_application.py b/erpnext/loan_management/doctype/loan_application/loan_application.py
index d8f3577..e492920 100644
--- a/erpnext/loan_management/doctype/loan_application/loan_application.py
+++ b/erpnext/loan_management/doctype/loan_application/loan_application.py
@@ -3,17 +3,28 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, math
-from frappe import _
-from frappe.utils import flt, rounded, cint
-from frappe.model.mapper import get_mapped_doc
-from frappe.model.document import Document
-from erpnext.loan_management.doctype.loan.loan import (get_monthly_repayment_amount, validate_repayment_method,
- get_total_loan_amount, get_sanctioned_amount_limit)
-from erpnext.loan_management.doctype.loan_security_price.loan_security_price import get_loan_security_price
+
import json
+import math
+
+import frappe
+from frappe import _
+from frappe.model.document import Document
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import cint, flt, rounded
from six import string_types
+from erpnext.loan_management.doctype.loan.loan import (
+ get_monthly_repayment_amount,
+ get_sanctioned_amount_limit,
+ get_total_loan_amount,
+ validate_repayment_method,
+)
+from erpnext.loan_management.doctype.loan_security_price.loan_security_price import (
+ get_loan_security_price,
+)
+
+
class LoanApplication(Document):
def validate(self):
self.set_pledge_amount()
diff --git a/erpnext/loan_management/doctype/loan_application/loan_application_dashboard.py b/erpnext/loan_management/doctype/loan_application/loan_application_dashboard.py
index 3975adf..992d669 100644
--- a/erpnext/loan_management/doctype/loan_application/loan_application_dashboard.py
+++ b/erpnext/loan_management/doctype/loan_application/loan_application_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/loan_management/doctype/loan_application/test_loan_application.py b/erpnext/loan_management/doctype/loan_application/test_loan_application.py
index 2a659e9..aefa089 100644
--- a/erpnext/loan_management/doctype/loan_application/test_loan_application.py
+++ b/erpnext/loan_management/doctype/loan_application/test_loan_application.py
@@ -3,10 +3,16 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_employee, make_salary_structure
-from erpnext.loan_management.doctype.loan.test_loan import create_loan_type, create_loan_accounts
+
+import frappe
+
+from erpnext.loan_management.doctype.loan.test_loan import create_loan_accounts, create_loan_type
+from erpnext.payroll.doctype.salary_structure.test_salary_structure import (
+ make_employee,
+ make_salary_structure,
+)
+
class TestLoanApplication(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py b/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py
index f113c10..6d9d4f4 100644
--- a/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py
+++ b/erpnext/loan_management/doctype/loan_disbursement/loan_disbursement.py
@@ -3,15 +3,21 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
-from frappe.model.document import Document
-from frappe.utils import nowdate, getdate, add_days, flt
-from erpnext.controllers.accounts_controller import AccountsController
+from frappe.utils import add_days, flt, get_datetime, nowdate
+
+import erpnext
from erpnext.accounts.general_ledger import make_gl_entries
-from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import process_loan_interest_accrual_for_demand_loans
-from erpnext.loan_management.doctype.loan_security_unpledge.loan_security_unpledge import get_pledged_security_qty
-from frappe.utils import get_datetime
+from erpnext.controllers.accounts_controller import AccountsController
+from erpnext.loan_management.doctype.loan_security_unpledge.loan_security_unpledge import (
+ get_pledged_security_qty,
+)
+from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
+ process_loan_interest_accrual_for_demand_loans,
+)
+
class LoanDisbursement(AccountsController):
diff --git a/erpnext/loan_management/doctype/loan_disbursement/test_loan_disbursement.py b/erpnext/loan_management/doctype/loan_disbursement/test_loan_disbursement.py
index da56710..b17c9a1 100644
--- a/erpnext/loan_management/doctype/loan_disbursement/test_loan_disbursement.py
+++ b/erpnext/loan_management/doctype/loan_disbursement/test_loan_disbursement.py
@@ -2,16 +2,44 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
-import frappe
+
import unittest
-from frappe.utils import (nowdate, add_days, get_datetime, get_first_day, get_last_day, date_diff, flt, add_to_date)
-from erpnext.loan_management.doctype.loan.test_loan import (create_loan_type, create_loan_security_pledge, create_repayment_entry, create_loan_application,
- make_loan_disbursement_entry, create_loan_accounts, create_loan_security_type, create_loan_security, create_demand_loan, create_loan_security_price)
-from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import process_loan_interest_accrual_for_demand_loans
-from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import days_in_year, get_per_day_interest
-from erpnext.selling.doctype.customer.test_customer import get_customer_dict
+
+import frappe
+from frappe.utils import (
+ add_days,
+ add_to_date,
+ date_diff,
+ flt,
+ get_datetime,
+ get_first_day,
+ get_last_day,
+ nowdate,
+)
+
+from erpnext.loan_management.doctype.loan.test_loan import (
+ create_demand_loan,
+ create_loan_accounts,
+ create_loan_application,
+ create_loan_security,
+ create_loan_security_pledge,
+ create_loan_security_price,
+ create_loan_security_type,
+ create_loan_type,
+ create_repayment_entry,
+ make_loan_disbursement_entry,
+)
from erpnext.loan_management.doctype.loan_application.loan_application import create_pledge
+from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import (
+ days_in_year,
+ get_per_day_interest,
+)
from erpnext.loan_management.doctype.loan_repayment.loan_repayment import calculate_amounts
+from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
+ process_loan_interest_accrual_for_demand_loans,
+)
+from erpnext.selling.doctype.customer.test_customer import get_customer_dict
+
class TestLoanDisbursement(unittest.TestCase):
diff --git a/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py b/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py
index d75213c..93513a8 100644
--- a/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py
+++ b/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py
@@ -3,13 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
-from frappe.model.document import Document
-from frappe.utils import (nowdate, getdate, now_datetime, get_datetime, flt, date_diff, get_last_day, cint,
- get_first_day, get_datetime, add_days)
-from erpnext.controllers.accounts_controller import AccountsController
+from frappe.utils import add_days, cint, date_diff, flt, get_datetime, getdate, nowdate
+
+import erpnext
from erpnext.accounts.general_ledger import make_gl_entries
+from erpnext.controllers.accounts_controller import AccountsController
+
class LoanInterestAccrual(AccountsController):
def validate(self):
diff --git a/erpnext/loan_management/doctype/loan_interest_accrual/test_loan_interest_accrual.py b/erpnext/loan_management/doctype/loan_interest_accrual/test_loan_interest_accrual.py
index eb626f3..06b801e 100644
--- a/erpnext/loan_management/doctype/loan_interest_accrual/test_loan_interest_accrual.py
+++ b/erpnext/loan_management/doctype/loan_interest_accrual/test_loan_interest_accrual.py
@@ -2,15 +2,31 @@
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
-import frappe
+
import unittest
-from frappe.utils import (nowdate, add_days, get_datetime, get_first_day, get_last_day, date_diff, flt, add_to_date)
-from erpnext.loan_management.doctype.loan.test_loan import (create_loan_type, create_loan_security_price,
- make_loan_disbursement_entry, create_loan_accounts, create_loan_security_type, create_loan_security, create_demand_loan, create_loan_application)
-from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import process_loan_interest_accrual_for_demand_loans
-from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import days_in_year
-from erpnext.selling.doctype.customer.test_customer import get_customer_dict
+
+import frappe
+from frappe.utils import add_to_date, date_diff, flt, get_datetime, get_first_day, nowdate
+
+from erpnext.loan_management.doctype.loan.test_loan import (
+ create_demand_loan,
+ create_loan_accounts,
+ create_loan_application,
+ create_loan_security,
+ create_loan_security_price,
+ create_loan_security_type,
+ create_loan_type,
+ make_loan_disbursement_entry,
+)
from erpnext.loan_management.doctype.loan_application.loan_application import create_pledge
+from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import (
+ days_in_year,
+)
+from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
+ process_loan_interest_accrual_for_demand_loans,
+)
+from erpnext.selling.doctype.customer.test_customer import get_customer_dict
+
class TestLoanInterestAccrual(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
index b67b4c4..13b7357 100644
--- a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
+++ b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
@@ -3,18 +3,26 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-import json
+
+import frappe
from frappe import _
-from frappe.utils import flt, getdate, cint
+from frappe.utils import add_days, cint, date_diff, flt, get_datetime, getdate
from six import iteritems
-from frappe.model.document import Document
-from frappe.utils import date_diff, add_days, getdate, add_months, get_first_day, get_datetime
-from erpnext.controllers.accounts_controller import AccountsController
+
+import erpnext
from erpnext.accounts.general_ledger import make_gl_entries
-from erpnext.loan_management.doctype.loan_security_shortfall.loan_security_shortfall import update_shortfall_status
-from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import process_loan_interest_accrual_for_demand_loans
-from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import get_per_day_interest, get_last_accrual_date
+from erpnext.controllers.accounts_controller import AccountsController
+from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import (
+ get_last_accrual_date,
+ get_per_day_interest,
+)
+from erpnext.loan_management.doctype.loan_security_shortfall.loan_security_shortfall import (
+ update_shortfall_status,
+)
+from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
+ process_loan_interest_accrual_for_demand_loans,
+)
+
class LoanRepayment(AccountsController):
diff --git a/erpnext/loan_management/doctype/loan_repayment/test_loan_repayment.py b/erpnext/loan_management/doctype/loan_repayment/test_loan_repayment.py
index 73585a5..c6ca630 100644
--- a/erpnext/loan_management/doctype/loan_repayment/test_loan_repayment.py
+++ b/erpnext/loan_management/doctype/loan_repayment/test_loan_repayment.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestLoanRepayment(unittest.TestCase):
pass
diff --git a/erpnext/loan_management/doctype/loan_repayment_detail/loan_repayment_detail.py b/erpnext/loan_management/doctype/loan_repayment_detail/loan_repayment_detail.py
index a83b9b5..495466c 100644
--- a/erpnext/loan_management/doctype/loan_repayment_detail/loan_repayment_detail.py
+++ b/erpnext/loan_management/doctype/loan_repayment_detail/loan_repayment_detail.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class LoanRepaymentDetail(Document):
pass
diff --git a/erpnext/loan_management/doctype/loan_security/loan_security.py b/erpnext/loan_management/doctype/loan_security/loan_security.py
index 8858c81..91cce67 100644
--- a/erpnext/loan_management/doctype/loan_security/loan_security.py
+++ b/erpnext/loan_management/doctype/loan_security/loan_security.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class LoanSecurity(Document):
def autoname(self):
self.name = self.loan_security_name
diff --git a/erpnext/loan_management/doctype/loan_security/loan_security_dashboard.py b/erpnext/loan_management/doctype/loan_security/loan_security_dashboard.py
index 3eec566..35f3ba6 100644
--- a/erpnext/loan_management/doctype/loan_security/loan_security_dashboard.py
+++ b/erpnext/loan_management/doctype/loan_security/loan_security_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/loan_management/doctype/loan_security/test_loan_security.py b/erpnext/loan_management/doctype/loan_security/test_loan_security.py
index 24dbc68..910b658 100644
--- a/erpnext/loan_management/doctype/loan_security/test_loan_security.py
+++ b/erpnext/loan_management/doctype/loan_security/test_loan_security.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestLoanSecurity(unittest.TestCase):
pass
diff --git a/erpnext/loan_management/doctype/loan_security_pledge/loan_security_pledge.py b/erpnext/loan_management/doctype/loan_security_pledge/loan_security_pledge.py
index c390b6c..eb6c79e 100644
--- a/erpnext/loan_management/doctype/loan_security_pledge/loan_security_pledge.py
+++ b/erpnext/loan_management/doctype/loan_security_pledge/loan_security_pledge.py
@@ -3,12 +3,19 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import now_datetime, cint
from frappe.model.document import Document
-from erpnext.loan_management.doctype.loan_security_shortfall.loan_security_shortfall import update_shortfall_status
-from erpnext.loan_management.doctype.loan_security_price.loan_security_price import get_loan_security_price
+from frappe.utils import cint, now_datetime
+
+from erpnext.loan_management.doctype.loan_security_price.loan_security_price import (
+ get_loan_security_price,
+)
+from erpnext.loan_management.doctype.loan_security_shortfall.loan_security_shortfall import (
+ update_shortfall_status,
+)
+
class LoanSecurityPledge(Document):
def validate(self):
diff --git a/erpnext/loan_management/doctype/loan_security_pledge/test_loan_security_pledge.py b/erpnext/loan_management/doctype/loan_security_pledge/test_loan_security_pledge.py
index d2347c0..41bc78e 100644
--- a/erpnext/loan_management/doctype/loan_security_pledge/test_loan_security_pledge.py
+++ b/erpnext/loan_management/doctype/loan_security_pledge/test_loan_security_pledge.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestLoanSecurityPledge(unittest.TestCase):
pass
diff --git a/erpnext/loan_management/doctype/loan_security_price/loan_security_price.py b/erpnext/loan_management/doctype/loan_security_price/loan_security_price.py
index 9fc1fda..6ede6a2 100644
--- a/erpnext/loan_management/doctype/loan_security_price/loan_security_price.py
+++ b/erpnext/loan_management/doctype/loan_security_price/loan_security_price.py
@@ -3,11 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import getdate, now_datetime, add_to_date, get_datetime, get_timestamp, get_datetime_str
-from six import iteritems
+from frappe.utils import get_datetime
+
class LoanSecurityPrice(Document):
def validate(self):
diff --git a/erpnext/loan_management/doctype/loan_security_price/test_loan_security_price.py b/erpnext/loan_management/doctype/loan_security_price/test_loan_security_price.py
index 2fe0bd5..ac63086 100644
--- a/erpnext/loan_management/doctype/loan_security_price/test_loan_security_price.py
+++ b/erpnext/loan_management/doctype/loan_security_price/test_loan_security_price.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestLoanSecurityPrice(unittest.TestCase):
pass
diff --git a/erpnext/loan_management/doctype/loan_security_shortfall/loan_security_shortfall.py b/erpnext/loan_management/doctype/loan_security_shortfall/loan_security_shortfall.py
index 61f1778..5863c03 100644
--- a/erpnext/loan_management/doctype/loan_security_shortfall/loan_security_shortfall.py
+++ b/erpnext/loan_management/doctype/loan_security_shortfall/loan_security_shortfall.py
@@ -3,11 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import get_datetime, flt
from frappe.model.document import Document
-from six import iteritems
-from erpnext.loan_management.doctype.loan_security_unpledge.loan_security_unpledge import get_pledged_security_qty
+from frappe.utils import flt, get_datetime
+
+from erpnext.loan_management.doctype.loan_security_unpledge.loan_security_unpledge import (
+ get_pledged_security_qty,
+)
+
class LoanSecurityShortfall(Document):
pass
diff --git a/erpnext/loan_management/doctype/loan_security_shortfall/test_loan_security_shortfall.py b/erpnext/loan_management/doctype/loan_security_shortfall/test_loan_security_shortfall.py
index b82f3d2..fefec43 100644
--- a/erpnext/loan_management/doctype/loan_security_shortfall/test_loan_security_shortfall.py
+++ b/erpnext/loan_management/doctype/loan_security_shortfall/test_loan_security_shortfall.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestLoanSecurityShortfall(unittest.TestCase):
pass
diff --git a/erpnext/loan_management/doctype/loan_security_type/loan_security_type.py b/erpnext/loan_management/doctype/loan_security_type/loan_security_type.py
index cb8a50a..ca1957f 100644
--- a/erpnext/loan_management/doctype/loan_security_type/loan_security_type.py
+++ b/erpnext/loan_management/doctype/loan_security_type/loan_security_type.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class LoanSecurityType(Document):
pass
diff --git a/erpnext/loan_management/doctype/loan_security_type/loan_security_type_dashboard.py b/erpnext/loan_management/doctype/loan_security_type/loan_security_type_dashboard.py
index 17de8c1..7a2732e 100644
--- a/erpnext/loan_management/doctype/loan_security_type/loan_security_type_dashboard.py
+++ b/erpnext/loan_management/doctype/loan_security_type/loan_security_type_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/loan_management/doctype/loan_security_type/test_loan_security_type.py b/erpnext/loan_management/doctype/loan_security_type/test_loan_security_type.py
index f7d845a..99d7aaf 100644
--- a/erpnext/loan_management/doctype/loan_security_type/test_loan_security_type.py
+++ b/erpnext/loan_management/doctype/loan_security_type/test_loan_security_type.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestLoanSecurityType(unittest.TestCase):
pass
diff --git a/erpnext/loan_management/doctype/loan_security_unpledge/loan_security_unpledge.py b/erpnext/loan_management/doctype/loan_security_unpledge/loan_security_unpledge.py
index 4f936dd..0af0de1 100644
--- a/erpnext/loan_management/doctype/loan_security_unpledge/loan_security_unpledge.py
+++ b/erpnext/loan_management/doctype/loan_security_unpledge/loan_security_unpledge.py
@@ -3,13 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
-from frappe.utils import get_datetime, flt, getdate
-import json
+from frappe.utils import flt, get_datetime, getdate
from six import iteritems
-from erpnext.loan_management.doctype.loan_security_price.loan_security_price import get_loan_security_price
+
class LoanSecurityUnpledge(Document):
def validate(self):
@@ -30,7 +30,9 @@
d.idx, frappe.bold(d.loan_security)))
def validate_unpledge_qty(self):
- from erpnext.loan_management.doctype.loan_security_shortfall.loan_security_shortfall import get_ltv_ratio
+ from erpnext.loan_management.doctype.loan_security_shortfall.loan_security_shortfall import (
+ get_ltv_ratio,
+ )
pledge_qty_map = get_pledged_security_qty(self.loan)
diff --git a/erpnext/loan_management/doctype/loan_security_unpledge/test_loan_security_unpledge.py b/erpnext/loan_management/doctype/loan_security_unpledge/test_loan_security_unpledge.py
index 5b5c205..17eb7c6 100644
--- a/erpnext/loan_management/doctype/loan_security_unpledge/test_loan_security_unpledge.py
+++ b/erpnext/loan_management/doctype/loan_security_unpledge/test_loan_security_unpledge.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestLoanSecurityUnpledge(unittest.TestCase):
pass
diff --git a/erpnext/loan_management/doctype/loan_type/loan_type.py b/erpnext/loan_management/doctype/loan_type/loan_type.py
index 50ef930..5458d35 100644
--- a/erpnext/loan_management/doctype/loan_type/loan_type.py
+++ b/erpnext/loan_management/doctype/loan_type/loan_type.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
class LoanType(Document):
def validate(self):
self.validate_accounts()
diff --git a/erpnext/loan_management/doctype/loan_type/loan_type_dashboard.py b/erpnext/loan_management/doctype/loan_type/loan_type_dashboard.py
index 95d97fd..96b2c4a 100644
--- a/erpnext/loan_management/doctype/loan_type/loan_type_dashboard.py
+++ b/erpnext/loan_management/doctype/loan_type/loan_type_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/loan_management/doctype/loan_type/test_loan_type.py b/erpnext/loan_management/doctype/loan_type/test_loan_type.py
index 5877ab6..9e57fde 100644
--- a/erpnext/loan_management/doctype/loan_type/test_loan_type.py
+++ b/erpnext/loan_management/doctype/loan_type/test_loan_type.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestLoanType(unittest.TestCase):
pass
diff --git a/erpnext/loan_management/doctype/loan_write_off/loan_write_off.py b/erpnext/loan_management/doctype/loan_write_off/loan_write_off.py
index 676df70..4d5e7df 100644
--- a/erpnext/loan_management/doctype/loan_write_off/loan_write_off.py
+++ b/erpnext/loan_management/doctype/loan_write_off/loan_write_off.py
@@ -3,11 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
-from frappe.utils import getdate, flt, cint
-from erpnext.controllers.accounts_controller import AccountsController
+from frappe.utils import cint, flt, getdate
+
+import erpnext
from erpnext.accounts.general_ledger import make_gl_entries
+from erpnext.controllers.accounts_controller import AccountsController
+
class LoanWriteOff(AccountsController):
def validate(self):
diff --git a/erpnext/loan_management/doctype/loan_write_off/test_loan_write_off.py b/erpnext/loan_management/doctype/loan_write_off/test_loan_write_off.py
index 9f6700e..57337c7 100644
--- a/erpnext/loan_management/doctype/loan_write_off/test_loan_write_off.py
+++ b/erpnext/loan_management/doctype/loan_write_off/test_loan_write_off.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestLoanWriteOff(unittest.TestCase):
pass
diff --git a/erpnext/loan_management/doctype/pledge/pledge.py b/erpnext/loan_management/doctype/pledge/pledge.py
index 0457ad7..5a41cde 100644
--- a/erpnext/loan_management/doctype/pledge/pledge.py
+++ b/erpnext/loan_management/doctype/pledge/pledge.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class Pledge(Document):
pass
diff --git a/erpnext/loan_management/doctype/pledge/test_pledge.py b/erpnext/loan_management/doctype/pledge/test_pledge.py
index 2e01dc1..adcbc6e 100644
--- a/erpnext/loan_management/doctype/pledge/test_pledge.py
+++ b/erpnext/loan_management/doctype/pledge/test_pledge.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestPledge(unittest.TestCase):
pass
diff --git a/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py b/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py
index 8c67c0a..efee701 100644
--- a/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py
+++ b/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py
@@ -3,11 +3,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import nowdate
from frappe.model.document import Document
-from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import (make_accrual_interest_entry_for_demand_loans,
- make_accrual_interest_entry_for_term_loans)
+from frappe.utils import nowdate
+
+from erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual import (
+ make_accrual_interest_entry_for_demand_loans,
+ make_accrual_interest_entry_for_term_loans,
+)
+
class ProcessLoanInterestAccrual(Document):
def on_submit(self):
diff --git a/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual_dashboard.py b/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual_dashboard.py
index e104c66..fcd0399 100644
--- a/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual_dashboard.py
+++ b/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/loan_management/doctype/process_loan_interest_accrual/test_process_loan_interest_accrual.py b/erpnext/loan_management/doctype/process_loan_interest_accrual/test_process_loan_interest_accrual.py
index 6bfd3f4..e7d3602 100644
--- a/erpnext/loan_management/doctype/process_loan_interest_accrual/test_process_loan_interest_accrual.py
+++ b/erpnext/loan_management/doctype/process_loan_interest_accrual/test_process_loan_interest_accrual.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestProcessLoanInterestAccrual(unittest.TestCase):
pass
diff --git a/erpnext/loan_management/doctype/process_loan_security_shortfall/process_loan_security_shortfall.py b/erpnext/loan_management/doctype/process_loan_security_shortfall/process_loan_security_shortfall.py
index b4aad25..c3f5954 100644
--- a/erpnext/loan_management/doctype/process_loan_security_shortfall/process_loan_security_shortfall.py
+++ b/erpnext/loan_management/doctype/process_loan_security_shortfall/process_loan_security_shortfall.py
@@ -3,11 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import get_datetime
-from frappe import _
from frappe.model.document import Document
-from erpnext.loan_management.doctype.loan_security_shortfall.loan_security_shortfall import check_for_ltv_shortfall
+from frappe.utils import get_datetime
+
+from erpnext.loan_management.doctype.loan_security_shortfall.loan_security_shortfall import (
+ check_for_ltv_shortfall,
+)
+
class ProcessLoanSecurityShortfall(Document):
def onload(self):
diff --git a/erpnext/loan_management/doctype/process_loan_security_shortfall/process_loan_security_shortfall_dashboard.py b/erpnext/loan_management/doctype/process_loan_security_shortfall/process_loan_security_shortfall_dashboard.py
index e67e4d4..ced3bd7 100644
--- a/erpnext/loan_management/doctype/process_loan_security_shortfall/process_loan_security_shortfall_dashboard.py
+++ b/erpnext/loan_management/doctype/process_loan_security_shortfall/process_loan_security_shortfall_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/loan_management/doctype/process_loan_security_shortfall/test_process_loan_security_shortfall.py b/erpnext/loan_management/doctype/process_loan_security_shortfall/test_process_loan_security_shortfall.py
index cd379a1..50e0a46 100644
--- a/erpnext/loan_management/doctype/process_loan_security_shortfall/test_process_loan_security_shortfall.py
+++ b/erpnext/loan_management/doctype/process_loan_security_shortfall/test_process_loan_security_shortfall.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestProcessLoanSecurityShortfall(unittest.TestCase):
pass
diff --git a/erpnext/loan_management/doctype/proposed_pledge/proposed_pledge.py b/erpnext/loan_management/doctype/proposed_pledge/proposed_pledge.py
index dfa5c79..5c125e1 100644
--- a/erpnext/loan_management/doctype/proposed_pledge/proposed_pledge.py
+++ b/erpnext/loan_management/doctype/proposed_pledge/proposed_pledge.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ProposedPledge(Document):
pass
diff --git a/erpnext/loan_management/doctype/repayment_schedule/repayment_schedule.py b/erpnext/loan_management/doctype/repayment_schedule/repayment_schedule.py
index 2aa27b0..af9c669 100644
--- a/erpnext/loan_management/doctype/repayment_schedule/repayment_schedule.py
+++ b/erpnext/loan_management/doctype/repayment_schedule/repayment_schedule.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class RepaymentSchedule(Document):
pass
diff --git a/erpnext/loan_management/doctype/salary_slip_loan/salary_slip_loan.py b/erpnext/loan_management/doctype/salary_slip_loan/salary_slip_loan.py
index 9ee0b96..64be1b2 100644
--- a/erpnext/loan_management/doctype/salary_slip_loan/salary_slip_loan.py
+++ b/erpnext/loan_management/doctype/salary_slip_loan/salary_slip_loan.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class SalarySlipLoan(Document):
pass
diff --git a/erpnext/loan_management/doctype/sanctioned_loan_amount/sanctioned_loan_amount.py b/erpnext/loan_management/doctype/sanctioned_loan_amount/sanctioned_loan_amount.py
index 74a1310..5660c42 100644
--- a/erpnext/loan_management/doctype/sanctioned_loan_amount/sanctioned_loan_amount.py
+++ b/erpnext/loan_management/doctype/sanctioned_loan_amount/sanctioned_loan_amount.py
@@ -3,9 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
+from frappe import _
from frappe.model.document import Document
+
class SanctionedLoanAmount(Document):
def validate(self):
sanctioned_doc = frappe.db.exists('Sanctioned Loan Amount', {'applicant': self.applicant, 'company': self.company})
diff --git a/erpnext/loan_management/doctype/sanctioned_loan_amount/test_sanctioned_loan_amount.py b/erpnext/loan_management/doctype/sanctioned_loan_amount/test_sanctioned_loan_amount.py
index ba1372f..663f2e7 100644
--- a/erpnext/loan_management/doctype/sanctioned_loan_amount/test_sanctioned_loan_amount.py
+++ b/erpnext/loan_management/doctype/sanctioned_loan_amount/test_sanctioned_loan_amount.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestSanctionedLoanAmount(unittest.TestCase):
pass
diff --git a/erpnext/loan_management/doctype/unpledge/unpledge.py b/erpnext/loan_management/doctype/unpledge/unpledge.py
index 205230a..2e82e23 100644
--- a/erpnext/loan_management/doctype/unpledge/unpledge.py
+++ b/erpnext/loan_management/doctype/unpledge/unpledge.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class Unpledge(Document):
pass
diff --git a/erpnext/loan_management/report/applicant_wise_loan_security_exposure/applicant_wise_loan_security_exposure.py b/erpnext/loan_management/report/applicant_wise_loan_security_exposure/applicant_wise_loan_security_exposure.py
index f2cbbb4..ff52702 100644
--- a/erpnext/loan_management/report/applicant_wise_loan_security_exposure/applicant_wise_loan_security_exposure.py
+++ b/erpnext/loan_management/report/applicant_wise_loan_security_exposure/applicant_wise_loan_security_exposure.py
@@ -2,12 +2,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-import erpnext
from frappe import _
-from frappe.utils import get_datetime, flt
+from frappe.utils import flt
from six import iteritems
+import erpnext
+
+
def execute(filters=None):
columns = get_columns(filters)
data = get_data(filters)
diff --git a/erpnext/loan_management/report/loan_interest_report/loan_interest_report.py b/erpnext/loan_management/report/loan_interest_report/loan_interest_report.py
index a505e72..c4adef1 100644
--- a/erpnext/loan_management/report/loan_interest_report/loan_interest_report.py
+++ b/erpnext/loan_management/report/loan_interest_report/loan_interest_report.py
@@ -2,12 +2,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-import erpnext
from frappe import _
-from frappe.utils import flt, getdate, add_days
-from erpnext.loan_management.report.applicant_wise_loan_security_exposure.applicant_wise_loan_security_exposure \
- import get_loan_security_details
+from frappe.utils import add_days, flt, getdate
+
+import erpnext
+from erpnext.loan_management.report.applicant_wise_loan_security_exposure.applicant_wise_loan_security_exposure import (
+ get_loan_security_details,
+)
def execute(filters=None):
diff --git a/erpnext/loan_management/report/loan_repayment_and_closure/loan_repayment_and_closure.py b/erpnext/loan_management/report/loan_repayment_and_closure/loan_repayment_and_closure.py
index 6591077..9d8a425 100644
--- a/erpnext/loan_management/report/loan_repayment_and_closure/loan_repayment_and_closure.py
+++ b/erpnext/loan_management/report/loan_repayment_and_closure/loan_repayment_and_closure.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
columns = get_columns()
data = get_data(filters)
diff --git a/erpnext/loan_management/report/loan_security_exposure/loan_security_exposure.py b/erpnext/loan_management/report/loan_security_exposure/loan_security_exposure.py
index 34bbe5a..3d6242a 100644
--- a/erpnext/loan_management/report/loan_security_exposure/loan_security_exposure.py
+++ b/erpnext/loan_management/report/loan_security_exposure/loan_security_exposure.py
@@ -2,12 +2,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import erpnext
+
from frappe import _
from frappe.utils import flt
from six import iteritems
-from erpnext.loan_management.report.applicant_wise_loan_security_exposure.applicant_wise_loan_security_exposure \
- import get_loan_security_details, get_applicant_wise_total_loan_security_qty
+
+import erpnext
+from erpnext.loan_management.report.applicant_wise_loan_security_exposure.applicant_wise_loan_security_exposure import (
+ get_applicant_wise_total_loan_security_qty,
+ get_loan_security_details,
+)
+
def execute(filters=None):
columns = get_columns(filters)
diff --git a/erpnext/loan_management/report/loan_security_status/loan_security_status.py b/erpnext/loan_management/report/loan_security_status/loan_security_status.py
index 1951855..a93a381 100644
--- a/erpnext/loan_management/report/loan_security_status/loan_security_status.py
+++ b/erpnext/loan_management/report/loan_security_status/loan_security_status.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
columns = get_columns(filters)
data = get_data(filters)
diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
index 9728903..52e41c5 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
@@ -2,15 +2,16 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+from frappe import _, throw
+from frappe.utils import add_days, cint, cstr, date_diff, formatdate, getdate
-from frappe.utils import add_days, getdate, cint, cstr, date_diff, formatdate
-
-from frappe import throw, _
-from erpnext.utilities.transaction_base import TransactionBase, delete_events
-from erpnext.stock.utils import get_valid_serial_nos
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+from erpnext.stock.utils import get_valid_serial_nos
+from erpnext.utilities.transaction_base import TransactionBase, delete_events
+
class MaintenanceSchedule(TransactionBase):
@frappe.whitelist()
diff --git a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py
index c733dd0..38654de 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py
+++ b/erpnext/maintenance/doctype/maintenance_schedule/test_maintenance_schedule.py
@@ -2,11 +2,15 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
-from frappe.utils.data import add_days, today, formatdate
-from erpnext.maintenance.doctype.maintenance_schedule.maintenance_schedule import make_maintenance_visit
+
+import unittest
import frappe
-import unittest
+from frappe.utils.data import add_days, formatdate, today
+
+from erpnext.maintenance.doctype.maintenance_schedule.maintenance_schedule import (
+ make_maintenance_visit,
+)
# test_records = frappe.get_test_records('Maintenance Schedule')
diff --git a/erpnext/maintenance/doctype/maintenance_schedule_detail/maintenance_schedule_detail.py b/erpnext/maintenance/doctype/maintenance_schedule_detail/maintenance_schedule_detail.py
index e69b4fb..27c95a1 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule_detail/maintenance_schedule_detail.py
+++ b/erpnext/maintenance/doctype/maintenance_schedule_detail/maintenance_schedule_detail.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class MaintenanceScheduleDetail(Document):
pass
diff --git a/erpnext/maintenance/doctype/maintenance_schedule_item/maintenance_schedule_item.py b/erpnext/maintenance/doctype/maintenance_schedule_item/maintenance_schedule_item.py
index 1dd47fe..9c4a690 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule_item/maintenance_schedule_item.py
+++ b/erpnext/maintenance/doctype/maintenance_schedule_item/maintenance_schedule_item.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class MaintenanceScheduleItem(Document):
pass
diff --git a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py
index d63c700..814ec0c 100644
--- a/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py
+++ b/erpnext/maintenance/doctype/maintenance_visit/maintenance_visit.py
@@ -2,12 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import get_datetime
from erpnext.utilities.transaction_base import TransactionBase
+
class MaintenanceVisit(TransactionBase):
def get_feed(self):
return _("To {0}").format(self.customer_name)
diff --git a/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py b/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py
index 2bea8d1..57e728d 100644
--- a/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py
+++ b/erpnext/maintenance/doctype/maintenance_visit/test_maintenance_visit.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Maintenance Visit')
diff --git a/erpnext/maintenance/doctype/maintenance_visit_purpose/maintenance_visit_purpose.py b/erpnext/maintenance/doctype/maintenance_visit_purpose/maintenance_visit_purpose.py
index a7f0f5b..4c59562 100644
--- a/erpnext/maintenance/doctype/maintenance_visit_purpose/maintenance_visit_purpose.py
+++ b/erpnext/maintenance/doctype/maintenance_visit_purpose/maintenance_visit_purpose.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class MaintenanceVisitPurpose(Document):
pass
diff --git a/erpnext/manufacturing/dashboard_fixtures.py b/erpnext/manufacturing/dashboard_fixtures.py
index 7ba43d6..1bc12ff 100644
--- a/erpnext/manufacturing/dashboard_fixtures.py
+++ b/erpnext/manufacturing/dashboard_fixtures.py
@@ -1,9 +1,14 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-import frappe, erpnext, json
+import json
+
+import frappe
from frappe import _
-from frappe.utils import nowdate, get_first_day, get_last_day, add_months
+from frappe.utils import add_months, nowdate
+
+import erpnext
+
def get_data():
return frappe._dict({
diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.py b/erpnext/manufacturing/doctype/blanket_order/blanket_order.py
index 1aedb1e..59eb168 100644
--- a/erpnext/manufacturing/doctype/blanket_order/blanket_order.py
+++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order.py
@@ -3,11 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt, getdate
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
+from frappe.utils import flt, getdate
+
from erpnext.stock.doctype.item.item import get_item_defaults
diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order_dashboard.py b/erpnext/manufacturing/doctype/blanket_order/blanket_order_dashboard.py
index d9aa0ca..83260ec 100644
--- a/erpnext/manufacturing/doctype/blanket_order/blanket_order_dashboard.py
+++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py b/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py
index 9a0a72f..3104ae0 100644
--- a/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py
+++ b/erpnext/manufacturing/doctype/blanket_order/test_blanket_order.py
@@ -3,12 +3,16 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from frappe.utils import add_months, today
+
from erpnext import get_company_currency
+
from .blanket_order import make_order
+
class TestBlanketOrder(unittest.TestCase):
def setUp(self):
frappe.flags.args = frappe._dict()
diff --git a/erpnext/manufacturing/doctype/blanket_order_item/blanket_order_item.py b/erpnext/manufacturing/doctype/blanket_order_item/blanket_order_item.py
index f07f3c8..0825f76 100644
--- a/erpnext/manufacturing/doctype/blanket_order_item/blanket_order_item.py
+++ b/erpnext/manufacturing/doctype/blanket_order_item/blanket_order_item.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class BlanketOrderItem(Document):
pass
diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js
index 05123d5..8a92413 100644
--- a/erpnext/manufacturing/doctype/bom/bom.js
+++ b/erpnext/manufacturing/doctype/bom/bom.js
@@ -714,4 +714,4 @@
__("Set Process Loss Item Quantity"),
__("Set Quantity")
);
-}
\ No newline at end of file
+}
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index 6e1c7dd..28a84b2 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -1,23 +1,22 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-from typing import List
-from collections import deque
-import frappe, erpnext
-from frappe.utils import cint, cstr, flt, today
-from frappe import _
-from erpnext.setup.utils import get_exchange_rate
-from frappe.website.website_generator import WebsiteGenerator
-from erpnext.stock.get_item_details import get_conversion_factor
-from erpnext.stock.get_item_details import get_price_list_rate
-from frappe.core.doctype.version.version import get_diff
-from erpnext.controllers.queries import get_match_cond
-from erpnext.stock.doctype.item.item import get_item_details
-from frappe.model.mapper import get_mapped_doc
-
import functools
-
+from collections import deque
from operator import itemgetter
+from typing import List
+
+import frappe
+from frappe import _
+from frappe.core.doctype.version.version import get_diff
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import cint, cstr, flt, today
+from frappe.website.website_generator import WebsiteGenerator
+
+import erpnext
+from erpnext.setup.utils import get_exchange_rate
+from erpnext.stock.doctype.item.item import get_item_details
+from erpnext.stock.get_item_details import get_conversion_factor, get_price_list_rate
form_grid_templates = {
"items": "templates/form_grid/item_grid.html"
diff --git a/erpnext/manufacturing/doctype/bom/bom_dashboard.py b/erpnext/manufacturing/doctype/bom/bom_dashboard.py
index 361826e..f65df01 100644
--- a/erpnext/manufacturing/doctype/bom/bom_dashboard.py
+++ b/erpnext/manufacturing/doctype/bom/bom_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'bom_no',
diff --git a/erpnext/manufacturing/doctype/bom/test_bom.py b/erpnext/manufacturing/doctype/bom/test_bom.py
index 8408f10..7950dd9 100644
--- a/erpnext/manufacturing/doctype/bom/test_bom.py
+++ b/erpnext/manufacturing/doctype/bom/test_bom.py
@@ -2,16 +2,20 @@
# License: GNU General Public License v3. See license.txt
-from collections import deque
import unittest
+from collections import deque
+
import frappe
-from frappe.utils import cstr, flt
from frappe.test_runner import make_test_records
-from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation
+from frappe.utils import cstr, flt
+
+from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
from erpnext.manufacturing.doctype.bom.bom import make_variant_bom
from erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool import update_cost
from erpnext.stock.doctype.item.test_item import make_item
-from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
+from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import (
+ create_stock_reconciliation,
+)
from erpnext.tests.test_subcontracting import set_backflush_based_on
test_records = frappe.get_test_records('BOM')
diff --git a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.py b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.py
index 39ccbdd..4317d3a 100644
--- a/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.py
+++ b/erpnext/manufacturing/doctype/bom_explosion_item/bom_explosion_item.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class BOMExplosionItem(Document):
pass
diff --git a/erpnext/manufacturing/doctype/bom_item/bom_item.py b/erpnext/manufacturing/doctype/bom_item/bom_item.py
index 220c73e..2954238 100644
--- a/erpnext/manufacturing/doctype/bom_item/bom_item.py
+++ b/erpnext/manufacturing/doctype/bom_item/bom_item.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class BOMItem(Document):
pass
diff --git a/erpnext/manufacturing/doctype/bom_operation/bom_operation.py b/erpnext/manufacturing/doctype/bom_operation/bom_operation.py
index e3501eb..5e46c7e 100644
--- a/erpnext/manufacturing/doctype/bom_operation/bom_operation.py
+++ b/erpnext/manufacturing/doctype/bom_operation/bom_operation.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class BOMOperation(Document):
pass
diff --git a/erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.py b/erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.py
index b6d423f..891fc53 100644
--- a/erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.py
+++ b/erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class BOMScrapItem(Document):
pass
diff --git a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py
index 8fbcd4e..ed71c6d 100644
--- a/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py
+++ b/erpnext/manufacturing/doctype/bom_update_tool/bom_update_tool.py
@@ -3,13 +3,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json
-from frappe.utils import cstr, flt
-from frappe import _
-from six import string_types
-from erpnext.manufacturing.doctype.bom.bom import get_boms_in_bottom_up_order
-from frappe.model.document import Document
+
+import json
+
import click
+import frappe
+from frappe import _
+from frappe.model.document import Document
+from frappe.utils import cstr, flt
+from six import string_types
+
+from erpnext.manufacturing.doctype.bom.bom import get_boms_in_bottom_up_order
+
class BOMUpdateTool(Document):
def replace_bom(self):
diff --git a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py
index 80d1cdf..88c69ce 100644
--- a/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py
+++ b/erpnext/manufacturing/doctype/bom_update_tool/test_bom_update_tool.py
@@ -3,11 +3,14 @@
from __future__ import unicode_literals
+
import unittest
+
import frappe
-from erpnext.stock.doctype.item.test_item import create_item
-from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom
+
from erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool import update_cost
+from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom
+from erpnext.stock.doctype.item.test_item import create_item
test_records = frappe.get_test_records('BOM')
diff --git a/erpnext/manufacturing/doctype/bom_website_item/bom_website_item.py b/erpnext/manufacturing/doctype/bom_website_item/bom_website_item.py
index 4088a7f..f627b4e 100644
--- a/erpnext/manufacturing/doctype/bom_website_item/bom_website_item.py
+++ b/erpnext/manufacturing/doctype/bom_website_item/bom_website_item.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class BOMWebsiteItem(Document):
pass
diff --git a/erpnext/manufacturing/doctype/bom_website_operation/bom_website_operation.py b/erpnext/manufacturing/doctype/bom_website_operation/bom_website_operation.py
index bcc5dda..5bd8cf5 100644
--- a/erpnext/manufacturing/doctype/bom_website_operation/bom_website_operation.py
+++ b/erpnext/manufacturing/doctype/bom_website_operation/bom_website_operation.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class BOMWebsiteOperation(Document):
pass
diff --git a/erpnext/manufacturing/doctype/downtime_entry/downtime_entry.py b/erpnext/manufacturing/doctype/downtime_entry/downtime_entry.py
index 56ec435..62833d7 100644
--- a/erpnext/manufacturing/doctype/downtime_entry/downtime_entry.py
+++ b/erpnext/manufacturing/doctype/downtime_entry/downtime_entry.py
@@ -3,9 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import time_diff_in_hours
+
from frappe.model.document import Document
+from frappe.utils import time_diff_in_hours
+
class DowntimeEntry(Document):
def validate(self):
diff --git a/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py b/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py
index 8b2a8d3..37169f4 100644
--- a/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py
+++ b/erpnext/manufacturing/doctype/downtime_entry/test_downtime_entry.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestDowntimeEntry(unittest.TestCase):
pass
diff --git a/erpnext/manufacturing/doctype/job_card/job_card.py b/erpnext/manufacturing/doctype/job_card/job_card.py
index 3efbe88..3bf9de2 100644
--- a/erpnext/manufacturing/doctype/job_card/job_card.py
+++ b/erpnext/manufacturing/doctype/job_card/job_card.py
@@ -3,16 +3,32 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import datetime
import json
-from frappe import _, bold
-from frappe.model.mapper import get_mapped_doc
-from frappe.model.document import Document
-from frappe.utils import (flt, cint, time_diff_in_hours, get_datetime, getdate,
- get_time, add_to_date, time_diff, add_days, get_datetime_str, get_link_to_form, time_diff_in_seconds)
-from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings import get_mins_between_operations
+import frappe
+from frappe import _, bold
+from frappe.model.document import Document
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import (
+ add_days,
+ add_to_date,
+ cint,
+ flt,
+ get_datetime,
+ get_link_to_form,
+ get_time,
+ getdate,
+ time_diff,
+ time_diff_in_hours,
+ time_diff_in_seconds,
+)
+
+from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings import (
+ get_mins_between_operations,
+)
+
class OverlapError(frappe.ValidationError): pass
diff --git a/erpnext/manufacturing/doctype/job_card/job_card_dashboard.py b/erpnext/manufacturing/doctype/job_card/job_card_dashboard.py
index c2aa2bd..3ec6697 100644
--- a/erpnext/manufacturing/doctype/job_card/job_card_dashboard.py
+++ b/erpnext/manufacturing/doctype/job_card/job_card_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'job_card',
diff --git a/erpnext/manufacturing/doctype/job_card/test_job_card.py b/erpnext/manufacturing/doctype/job_card/test_job_card.py
index 8fa0b27..db0e08f 100644
--- a/erpnext/manufacturing/doctype/job_card/test_job_card.py
+++ b/erpnext/manufacturing/doctype/job_card/test_job_card.py
@@ -4,11 +4,14 @@
from __future__ import unicode_literals
import unittest
+
import frappe
from frappe.utils import random_string
-from erpnext.manufacturing.doctype.workstation.test_workstation import make_workstation
-from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record
+
from erpnext.manufacturing.doctype.job_card.job_card import OperationMismatchError
+from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record
+from erpnext.manufacturing.doctype.workstation.test_workstation import make_workstation
+
class TestJobCard(unittest.TestCase):
def test_job_card(self):
diff --git a/erpnext/manufacturing/doctype/job_card_item/job_card_item.py b/erpnext/manufacturing/doctype/job_card_item/job_card_item.py
index 373cba2..a133836 100644
--- a/erpnext/manufacturing/doctype/job_card_item/job_card_item.py
+++ b/erpnext/manufacturing/doctype/job_card_item/job_card_item.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class JobCardItem(Document):
pass
diff --git a/erpnext/manufacturing/doctype/job_card_operation/job_card_operation.py b/erpnext/manufacturing/doctype/job_card_operation/job_card_operation.py
index 85d7298..43d1422 100644
--- a/erpnext/manufacturing/doctype/job_card_operation/job_card_operation.py
+++ b/erpnext/manufacturing/doctype/job_card_operation/job_card_operation.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class JobCardOperation(Document):
pass
diff --git a/erpnext/manufacturing/doctype/job_card_time_log/job_card_time_log.py b/erpnext/manufacturing/doctype/job_card_time_log/job_card_time_log.py
index 3dc6689..ed27e7f 100644
--- a/erpnext/manufacturing/doctype/job_card_time_log/job_card_time_log.py
+++ b/erpnext/manufacturing/doctype/job_card_time_log/job_card_time_log.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class JobCardTimeLog(Document):
pass
diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py
index 149fe3e..18d78b5 100644
--- a/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py
+++ b/erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
+from dateutil.relativedelta import relativedelta
from frappe.model.document import Document
from frappe.utils import cint
-from dateutil.relativedelta import relativedelta
+
class ManufacturingSettings(Document):
pass
diff --git a/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py b/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py
index 7391f65..fd0ac72 100644
--- a/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py
+++ b/erpnext/manufacturing/doctype/manufacturing_settings/test_manufacturing_settings.py
@@ -5,5 +5,6 @@
import unittest
+
class TestManufacturingSettings(unittest.TestCase):
pass
diff --git a/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json b/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json
index 6c60bbd..27d7c41 100644
--- a/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json
+++ b/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.json
@@ -6,17 +6,17 @@
"engine": "InnoDB",
"field_order": [
"item_code",
- "item_name",
- "material_request_type",
"from_warehouse",
"warehouse",
- "column_break_4",
+ "item_name",
+ "material_request_type",
+ "actual_qty",
+ "ordered_qty",
"required_bom_qty",
+ "column_break_4",
"quantity",
"uom",
"projected_qty",
- "actual_qty",
- "ordered_qty",
"reserved_qty_for_production",
"safety_stock",
"item_details",
@@ -28,6 +28,7 @@
],
"fields": [
{
+ "columns": 2,
"fieldname": "item_code",
"fieldtype": "Link",
"in_list_view": 1,
@@ -41,6 +42,7 @@
"label": "Item Name"
},
{
+ "columns": 2,
"fieldname": "warehouse",
"fieldtype": "Link",
"in_list_view": 1,
@@ -50,10 +52,11 @@
"reqd": 1
},
{
+ "columns": 1,
"fieldname": "material_request_type",
"fieldtype": "Select",
"in_list_view": 1,
- "label": "Material Request Type",
+ "label": "Type",
"options": "\nPurchase\nMaterial Transfer\nMaterial Issue\nManufacture\nCustomer Provided"
},
{
@@ -61,10 +64,11 @@
"fieldtype": "Column Break"
},
{
+ "columns": 1,
"fieldname": "quantity",
"fieldtype": "Float",
"in_list_view": 1,
- "label": "Required Quantity",
+ "label": "Plan to Request Qty",
"no_copy": 1,
"reqd": 1
},
@@ -75,11 +79,12 @@
"read_only": 1
},
{
+ "columns": 2,
"default": "0",
"fieldname": "actual_qty",
"fieldtype": "Float",
"in_list_view": 1,
- "label": "Actual Qty",
+ "label": "Available Qty",
"no_copy": 1,
"read_only": 1
},
@@ -157,16 +162,18 @@
"read_only": 1
},
{
+ "columns": 2,
"fieldname": "required_bom_qty",
"fieldtype": "Float",
- "label": "Required Qty as per BOM",
+ "in_list_view": 1,
+ "label": "Qty As Per BOM",
"no_copy": 1,
"read_only": 1
}
],
"istable": 1,
"links": [],
- "modified": "2021-03-26 12:41:13.013149",
+ "modified": "2021-08-23 18:17:58.400462",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Material Request Plan Item",
diff --git a/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.py b/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.py
index 73e369c..bc26644 100644
--- a/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.py
+++ b/erpnext/manufacturing/doctype/material_request_plan_item/material_request_plan_item.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class MaterialRequestPlanItem(Document):
pass
diff --git a/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py b/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py
index dc43b69..2675af9 100644
--- a/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py
+++ b/erpnext/manufacturing/doctype/material_request_plan_item/test_material_request_plan_item.py
@@ -5,5 +5,6 @@
import unittest
+
class TestMaterialRequestPlanItem(unittest.TestCase):
pass
diff --git a/erpnext/manufacturing/doctype/operation/operation.js b/erpnext/manufacturing/doctype/operation/operation.js
index 95643bf..ea73fd6 100644
--- a/erpnext/manufacturing/doctype/operation/operation.js
+++ b/erpnext/manufacturing/doctype/operation/operation.js
@@ -29,4 +29,4 @@
title: "Sub Operations",
description: __("If an operation is divided into sub operations, they can be added here.")
}
-];
\ No newline at end of file
+];
diff --git a/erpnext/manufacturing/doctype/operation/operation.py b/erpnext/manufacturing/doctype/operation/operation.py
index 374f320..2926f91 100644
--- a/erpnext/manufacturing/doctype/operation/operation.py
+++ b/erpnext/manufacturing/doctype/operation/operation.py
@@ -7,6 +7,7 @@
from frappe import _
from frappe.model.document import Document
+
class Operation(Document):
def validate(self):
if not self.description:
diff --git a/erpnext/manufacturing/doctype/operation/operation_dashboard.py b/erpnext/manufacturing/doctype/operation/operation_dashboard.py
index 8deb9ec..284fd9d 100644
--- a/erpnext/manufacturing/doctype/operation/operation_dashboard.py
+++ b/erpnext/manufacturing/doctype/operation/operation_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'operation',
diff --git a/erpnext/manufacturing/doctype/operation/test_operation.py b/erpnext/manufacturing/doctype/operation/test_operation.py
index 8e7e723..2b24118 100644
--- a/erpnext/manufacturing/doctype/operation/test_operation.py
+++ b/erpnext/manufacturing/doctype/operation/test_operation.py
@@ -2,9 +2,10 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
test_records = frappe.get_test_records('Operation')
class TestOperation(unittest.TestCase):
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.js b/erpnext/manufacturing/doctype/production_plan/production_plan.js
index 847004f..7b4b7c3 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.js
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.js
@@ -254,7 +254,7 @@
get_items_for_mr: function(frm) {
if (!frm.doc.for_warehouse) {
- frappe.throw(__("Select warehouse for material requests"));
+ frappe.throw(__("To make material requests, 'Make Material Request for Warehouse' field is mandatory"));
}
if (frm.doc.ignore_existing_ordered_qty) {
@@ -265,9 +265,18 @@
title: title,
fields: [
{
- "fieldtype": "Table MultiSelect", "label": __("Source Warehouses (Optional)"),
- "fieldname": "warehouses", "options": "Production Plan Material Request Warehouse",
- "description": __("System will pickup the materials from the selected warehouses. If not specified, system will create material request for purchase."),
+ 'label': __('Target Warehouse'),
+ 'fieldtype': 'Link',
+ 'fieldname': 'target_warehouse',
+ 'read_only': true,
+ 'default': frm.doc.for_warehouse
+ },
+ {
+ 'label': __('Source Warehouses (Optional)'),
+ 'fieldtype': 'Table MultiSelect',
+ 'fieldname': 'warehouses',
+ 'options': 'Production Plan Material Request Warehouse',
+ 'description': __('If source warehouse selected then system will create the material request with type Material Transfer from Source to Target warehouse. If not selected then will create the material request with type Purchase for the target warehouse.'),
get_query: function () {
return {
filters: {
@@ -342,7 +351,11 @@
frappe.prompt(fields, (row) => {
let get_template_url = 'erpnext.manufacturing.doctype.production_plan.production_plan.download_raw_materials';
- open_url_post(frappe.request.url, { cmd: get_template_url, doc: frm.doc, warehouses: row.warehouses });
+ open_url_post(frappe.request.url, {
+ cmd: get_template_url,
+ doc: frm.doc,
+ warehouses: row.warehouses
+ });
}, __('Select Warehouses to get Stock for Materials Planning'), __('Get Stock'));
},
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.json b/erpnext/manufacturing/doctype/production_plan/production_plan.json
index 8437895..b5ed288 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.json
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.json
@@ -300,7 +300,7 @@
{
"fieldname": "for_warehouse",
"fieldtype": "Link",
- "label": "Material Request Warehouse",
+ "label": "Make Material Request for Warehouse",
"options": "Warehouse"
},
{
@@ -364,7 +364,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
- "modified": "2021-06-28 20:00:33.905114",
+ "modified": "2021-08-23 17:26:03.799876",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Plan",
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py
index 6b61c6d..91e5748 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py
@@ -3,18 +3,32 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json, copy
-from frappe import msgprint, _
+
+import copy
+import json
+
+import frappe
+from frappe import _, msgprint
+from frappe.model.document import Document
+from frappe.utils import (
+ add_days,
+ ceil,
+ cint,
+ comma_and,
+ flt,
+ get_link_to_form,
+ getdate,
+ now_datetime,
+ nowdate,
+)
+from frappe.utils.csvutils import build_csv_response
from six import iteritems
-from frappe.model.document import Document
-from frappe.utils import (flt, cint, nowdate, add_days, comma_and, now_datetime,
- ceil, get_link_to_form, getdate)
-from frappe.utils.csvutils import build_csv_response
-from erpnext.manufacturing.doctype.bom.bom import validate_bom_no, get_children
+from erpnext.manufacturing.doctype.bom.bom import get_children, validate_bom_no
from erpnext.manufacturing.doctype.work_order.work_order import get_item_details
from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults
+
class ProductionPlan(Document):
def validate(self):
self.calculate_total_planned_qty()
@@ -331,7 +345,7 @@
def get_production_items(self):
item_dict = {}
for d in self.po_items:
- item_details= {
+ item_details = {
"production_item" : d.item_code,
"use_multi_level_bom" : d.include_exploded_items,
"sales_order" : d.sales_order,
@@ -346,8 +360,7 @@
"production_plan" : self.name,
"production_plan_item" : d.name,
"product_bundle_item" : d.product_bundle_item,
- "planned_start_date" : d.planned_start_date,
- "make_work_order_for_sub_assembly_items": d.get("make_work_order_for_sub_assembly_items", 0)
+ "planned_start_date" : d.planned_start_date
}
item_details.update({
@@ -454,10 +467,14 @@
})
def create_work_order(self, item):
- from erpnext.manufacturing.doctype.work_order.work_order import OverProductionError, get_default_warehouse
+ from erpnext.manufacturing.doctype.work_order.work_order import (
+ OverProductionError,
+ get_default_warehouse,
+ )
warehouse = get_default_warehouse()
wo = frappe.new_doc("Work Order")
wo.update(item)
+ wo.planned_start_date = item.get('planned_start_date') or item.get('schedule_date')
if item.get("warehouse"):
wo.fg_warehouse = item.get("warehouse")
@@ -569,7 +586,10 @@
'Reserved Qty for Production', 'Safety Stock', 'Required Qty']]
doc.warehouse = None
- for d in get_items_for_material_requests(doc, warehouses=warehouses, get_parent_warehouse_data=True):
+ frappe.flags.show_qty_in_stock_uom = 1
+ items = get_items_for_material_requests(doc, warehouses=warehouses, get_parent_warehouse_data=True)
+
+ for d in items:
item_list.append([d.get('item_code'), d.get('description'), d.get('stock_uom'), d.get('warehouse'),
d.get('required_bom_qty'), d.get('projected_qty'), d.get('actual_qty'), d.get('ordered_qty'),
d.get('planned_qty'), d.get('reserved_qty_for_production'), d.get('safety_stock'), d.get('quantity')])
@@ -605,9 +625,16 @@
and bom.name=%s and item.is_stock_item in (1, {0})
group by bei.item_code, bei.stock_uom""".format(0 if include_non_stock_items else 1),
(planned_qty, company, bom_no), as_dict=1):
- item_details.setdefault(d.get('item_code'), d)
+ if not d.conversion_factor and d.purchase_uom:
+ d.conversion_factor = get_uom_conversion_factor(d.item_code, d.purchase_uom)
+ item_details.setdefault(d.get('item_code'), d)
+
return item_details
+def get_uom_conversion_factor(item_code, uom):
+ return frappe.db.get_value('UOM Conversion Detail',
+ {'parent': item_code, 'uom': uom}, 'conversion_factor')
+
def get_subitems(doc, data, item_details, bom_no, company, include_non_stock_items,
include_subcontracted_items, parent_qty, planned_qty=1):
items = frappe.db.sql("""
@@ -642,6 +669,9 @@
if d.item_code in item_details:
item_details[d.item_code].qty = item_details[d.item_code].qty + d.qty
else:
+ if not d.conversion_factor and d.purchase_uom:
+ d.conversion_factor = get_uom_conversion_factor(d.item_code, d.purchase_uom)
+
item_details[d.item_code] = d
if data.get('include_exploded_items') and d.default_bom:
@@ -669,10 +699,11 @@
row['purchase_uom'] = row['stock_uom']
if row['purchase_uom'] != row['stock_uom']:
- if not row['conversion_factor']:
+ if not (row['conversion_factor'] or frappe.flags.show_qty_in_stock_uom):
frappe.throw(_("UOM Conversion factor ({0} -> {1}) not found for item: {2}")
.format(row['purchase_uom'], row['stock_uom'], row.item_code))
- required_qty = required_qty / row['conversion_factor']
+
+ required_qty = required_qty / row['conversion_factor']
if frappe.db.get_value("UOM", row['purchase_uom'], "must_be_whole_number"):
required_qty = ceil(required_qty)
@@ -841,10 +872,8 @@
elif data.get('item_code'):
item_master = frappe.get_doc('Item', data['item_code']).as_dict()
purchase_uom = item_master.purchase_uom or item_master.stock_uom
- conversion_factor = 0
- for d in item_master.get("uoms"):
- if d.uom == purchase_uom:
- conversion_factor = d.conversion_factor
+ conversion_factor = (get_uom_conversion_factor(item_master.name, purchase_uom)
+ if item_master.purchase_uom else 1.0)
item_details[item_master.name] = frappe._dict(
{
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan_dashboard.py b/erpnext/manufacturing/doctype/production_plan/production_plan_dashboard.py
index 52a56af..b4bc346 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan_dashboard.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'production_plan',
diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
index 7802803..6a942d5 100644
--- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
@@ -3,15 +3,23 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import nowdate, now_datetime, flt, add_to_date
-from erpnext.stock.doctype.item.test_item import create_item
-from erpnext.manufacturing.doctype.production_plan.production_plan import get_sales_orders
-from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation
-from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
-from erpnext.manufacturing.doctype.production_plan.production_plan import get_items_for_material_requests, get_warehouse_list
+
+import frappe
+from frappe.utils import add_to_date, flt, now_datetime, nowdate
+
from erpnext.controllers.item_variant import create_variant
+from erpnext.manufacturing.doctype.production_plan.production_plan import (
+ get_items_for_material_requests,
+ get_sales_orders,
+ get_warehouse_list,
+)
+from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
+from erpnext.stock.doctype.item.test_item import create_item
+from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import (
+ create_stock_reconciliation,
+)
+
class TestProductionPlan(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.py b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.py
index 37cf5a4..24029d8 100644
--- a/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.py
+++ b/erpnext/manufacturing/doctype/production_plan_item/production_plan_item.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class ProductionPlanItem(Document):
pass
diff --git a/erpnext/manufacturing/doctype/production_plan_item_reference/production_plan_item_reference.py b/erpnext/manufacturing/doctype/production_plan_item_reference/production_plan_item_reference.py
index 51fbc36..9d25d6f 100644
--- a/erpnext/manufacturing/doctype/production_plan_item_reference/production_plan_item_reference.py
+++ b/erpnext/manufacturing/doctype/production_plan_item_reference/production_plan_item_reference.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ProductionPlanItemReference(Document):
pass
diff --git a/erpnext/manufacturing/doctype/production_plan_material_request/production_plan_material_request.py b/erpnext/manufacturing/doctype/production_plan_material_request/production_plan_material_request.py
index 44786f8..d1d935c 100644
--- a/erpnext/manufacturing/doctype/production_plan_material_request/production_plan_material_request.py
+++ b/erpnext/manufacturing/doctype/production_plan_material_request/production_plan_material_request.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ProductionPlanMaterialRequest(Document):
pass
diff --git a/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/production_plan_material_request_warehouse.py b/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/production_plan_material_request_warehouse.py
index f605985..1548bd7 100644
--- a/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/production_plan_material_request_warehouse.py
+++ b/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/production_plan_material_request_warehouse.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ProductionPlanMaterialRequestWarehouse(Document):
pass
diff --git a/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py b/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py
index ecab5fb..905252d 100644
--- a/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py
+++ b/erpnext/manufacturing/doctype/production_plan_material_request_warehouse/test_production_plan_material_request_warehouse.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestProductionPlanMaterialRequestWarehouse(unittest.TestCase):
pass
diff --git a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.py b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.py
index 99c7273..ea53a98 100644
--- a/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.py
+++ b/erpnext/manufacturing/doctype/production_plan_sales_order/production_plan_sales_order.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class ProductionPlanSalesOrder(Document):
pass
diff --git a/erpnext/manufacturing/doctype/production_plan_sub_assembly_item/production_plan_sub_assembly_item.py b/erpnext/manufacturing/doctype/production_plan_sub_assembly_item/production_plan_sub_assembly_item.py
index 6850a2e..be0ed1b 100644
--- a/erpnext/manufacturing/doctype/production_plan_sub_assembly_item/production_plan_sub_assembly_item.py
+++ b/erpnext/manufacturing/doctype/production_plan_sub_assembly_item/production_plan_sub_assembly_item.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ProductionPlanSubAssemblyItem(Document):
pass
diff --git a/erpnext/manufacturing/doctype/routing/routing.js b/erpnext/manufacturing/doctype/routing/routing.js
index c17a8e9..33a313e 100644
--- a/erpnext/manufacturing/doctype/routing/routing.js
+++ b/erpnext/manufacturing/doctype/routing/routing.js
@@ -82,4 +82,3 @@
description: __("Enter the Operation, the table will fetch the Operation details like Hourly Rate, Workstation automatically.\n\n After that, set the Operation Time in minutes and the table will calculate the Operation Costs based on the Hourly Rate and Operation Time.")
}
];
-
diff --git a/erpnext/manufacturing/doctype/routing/routing.py b/erpnext/manufacturing/doctype/routing/routing.py
index ece0db7..20fb370 100644
--- a/erpnext/manufacturing/doctype/routing/routing.py
+++ b/erpnext/manufacturing/doctype/routing/routing.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import cint, flt
from frappe import _
from frappe.model.document import Document
+from frappe.utils import cint, flt
+
class Routing(Document):
def validate(self):
diff --git a/erpnext/manufacturing/doctype/routing/routing_dashboard.py b/erpnext/manufacturing/doctype/routing/routing_dashboard.py
index 50a3fe6..9ef6ee5 100644
--- a/erpnext/manufacturing/doctype/routing/routing_dashboard.py
+++ b/erpnext/manufacturing/doctype/routing/routing_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/manufacturing/doctype/routing/test_routing.py b/erpnext/manufacturing/doctype/routing/test_routing.py
index 92f2694..b84b2ba 100644
--- a/erpnext/manufacturing/doctype/routing/test_routing.py
+++ b/erpnext/manufacturing/doctype/routing/test_routing.py
@@ -4,11 +4,14 @@
from __future__ import unicode_literals
import unittest
+
import frappe
from frappe.test_runner import make_test_records
-from erpnext.stock.doctype.item.test_item import make_item
+
from erpnext.manufacturing.doctype.job_card.job_card import OperationSequenceError
from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record
+from erpnext.stock.doctype.item.test_item import make_item
+
class TestRouting(unittest.TestCase):
@classmethod
@@ -91,8 +94,8 @@
def setup_operations(rows):
- from erpnext.manufacturing.doctype.workstation.test_workstation import make_workstation
from erpnext.manufacturing.doctype.operation.test_operation import make_operation
+ from erpnext.manufacturing.doctype.workstation.test_workstation import make_workstation
for row in rows:
make_workstation(row)
make_operation(row)
diff --git a/erpnext/manufacturing/doctype/sub_operation/sub_operation.py b/erpnext/manufacturing/doctype/sub_operation/sub_operation.py
index f4b2775..37b64f2 100644
--- a/erpnext/manufacturing/doctype/sub_operation/sub_operation.py
+++ b/erpnext/manufacturing/doctype/sub_operation/sub_operation.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class SubOperation(Document):
pass
diff --git a/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py b/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py
index d3410ca..c5749db 100644
--- a/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py
+++ b/erpnext/manufacturing/doctype/sub_operation/test_sub_operation.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestSubOperation(unittest.TestCase):
pass
diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py
index c0ed611..bb43149 100644
--- a/erpnext/manufacturing/doctype/work_order/test_work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py
@@ -3,18 +3,28 @@
from __future__ import unicode_literals
+
import unittest
+
import frappe
-from frappe.utils import flt, now, add_months, cint, today, add_to_date
-from erpnext.manufacturing.doctype.work_order.work_order import (make_stock_entry,
- ItemHasVariantError, stop_unstop, StockOverProductionError, OverProductionError, CapacityError)
-from erpnext.stock.doctype.stock_entry import test_stock_entry
-from erpnext.stock.utils import get_bin
+from frappe.utils import add_months, cint, flt, now, today
+
+from erpnext.manufacturing.doctype.job_card.job_card import JobCardCancelError
+from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom
+from erpnext.manufacturing.doctype.work_order.work_order import (
+ CapacityError,
+ ItemHasVariantError,
+ OverProductionError,
+ StockOverProductionError,
+ make_stock_entry,
+ stop_unstop,
+)
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
from erpnext.stock.doctype.item.test_item import make_item
-from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom
+from erpnext.stock.doctype.stock_entry import test_stock_entry
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
-from erpnext.manufacturing.doctype.job_card.job_card import JobCardCancelError
+from erpnext.stock.utils import get_bin
+
class TestWorkOrder(unittest.TestCase):
def setUp(self):
@@ -696,8 +706,10 @@
self.assertRaises(frappe.ValidationError, make_stock_entry, wo.name, 'Material Transfer for Manufacture')
def test_wo_completion_with_pl_bom(self):
- from erpnext.manufacturing.doctype.bom.test_bom import create_process_loss_bom_items
- from erpnext.manufacturing.doctype.bom.test_bom import create_bom_with_process_loss_item
+ from erpnext.manufacturing.doctype.bom.test_bom import (
+ create_bom_with_process_loss_item,
+ create_process_loss_bom_items,
+ )
qty = 4
scrap_qty = 0.25 # bom item qty = 1, consider as 25% of FG
diff --git a/erpnext/manufacturing/doctype/work_order/work_order.py b/erpnext/manufacturing/doctype/work_order/work_order.py
index 24b33d5..e282dd3 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order.py
@@ -1,25 +1,43 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-import frappe
import json
-import math
-from frappe import _
-from frappe.utils import flt, get_datetime, getdate, date_diff, cint, nowdate, get_link_to_form, time_diff_in_hours
-from frappe.model.document import Document
-from erpnext.manufacturing.doctype.bom.bom import validate_bom_no, get_bom_items_as_dict, get_bom_item_rate
+
+import frappe
from dateutil.relativedelta import relativedelta
-from erpnext.stock.doctype.item.item import validate_end_of_life, get_item_defaults
-from erpnext.manufacturing.doctype.workstation.workstation import WorkstationHolidayError
-from erpnext.projects.doctype.timesheet.timesheet import OverlapError
-from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings import get_mins_between_operations
-from erpnext.stock.stock_balance import get_planned_qty, update_bin_qty
-from frappe.utils.csvutils import getlink
-from erpnext.stock.utils import get_bin, validate_warehouse_company, get_latest_stock_qty
-from erpnext.utilities.transaction_base import validate_uom_is_integer
+from frappe import _
+from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
+from frappe.utils import (
+ cint,
+ date_diff,
+ flt,
+ get_datetime,
+ get_link_to_form,
+ getdate,
+ nowdate,
+ time_diff_in_hours,
+)
+
+from erpnext.manufacturing.doctype.bom.bom import (
+ get_bom_item_rate,
+ get_bom_items_as_dict,
+ validate_bom_no,
+)
+from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings import (
+ get_mins_between_operations,
+)
from erpnext.stock.doctype.batch.batch import make_batch
-from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos, get_auto_serial_nos, auto_make_serial_nos
+from erpnext.stock.doctype.item.item import get_item_defaults, validate_end_of_life
+from erpnext.stock.doctype.serial_no.serial_no import (
+ auto_make_serial_nos,
+ get_auto_serial_nos,
+ get_serial_nos,
+)
+from erpnext.stock.stock_balance import get_planned_qty, update_bin_qty
+from erpnext.stock.utils import get_bin, get_latest_stock_qty, validate_warehouse_company
+from erpnext.utilities.transaction_base import validate_uom_is_integer
+
class OverProductionError(frappe.ValidationError): pass
class CapacityError(frappe.ValidationError): pass
diff --git a/erpnext/manufacturing/doctype/work_order/work_order_dashboard.py b/erpnext/manufacturing/doctype/work_order/work_order_dashboard.py
index 403d46d..f0fc43f 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order_dashboard.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'work_order',
diff --git a/erpnext/manufacturing/doctype/work_order_item/work_order_item.py b/erpnext/manufacturing/doctype/work_order_item/work_order_item.py
index 9aa53b5..3f2664b 100644
--- a/erpnext/manufacturing/doctype/work_order_item/work_order_item.py
+++ b/erpnext/manufacturing/doctype/work_order_item/work_order_item.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class WorkOrderItem(Document):
pass
diff --git a/erpnext/manufacturing/doctype/work_order_operation/work_order_operation.py b/erpnext/manufacturing/doctype/work_order_operation/work_order_operation.py
index 3c20d8e..d25c9f2 100644
--- a/erpnext/manufacturing/doctype/work_order_operation/work_order_operation.py
+++ b/erpnext/manufacturing/doctype/work_order_operation/work_order_operation.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class WorkOrderOperation(Document):
pass
diff --git a/erpnext/manufacturing/doctype/workstation/test_workstation.py b/erpnext/manufacturing/doctype/workstation/test_workstation.py
index 9b73aca..6c6ab77 100644
--- a/erpnext/manufacturing/doctype/workstation/test_workstation.py
+++ b/erpnext/manufacturing/doctype/workstation/test_workstation.py
@@ -1,14 +1,20 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
from __future__ import unicode_literals
-from erpnext.manufacturing.doctype.operation.test_operation import make_operation
+
+import unittest
import frappe
-import unittest
-from erpnext.manufacturing.doctype.workstation.workstation import check_if_within_operating_hours, NotInWorkingHoursError, WorkstationHolidayError
-from erpnext.manufacturing.doctype.routing.test_routing import setup_bom, create_routing
from frappe.test_runner import make_test_records
+from erpnext.manufacturing.doctype.operation.test_operation import make_operation
+from erpnext.manufacturing.doctype.routing.test_routing import create_routing, setup_bom
+from erpnext.manufacturing.doctype.workstation.workstation import (
+ NotInWorkingHoursError,
+ WorkstationHolidayError,
+ check_if_within_operating_hours,
+)
+
test_dependencies = ["Warehouse"]
test_records = frappe.get_test_records('Workstation')
make_test_records('Workstation')
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.js b/erpnext/manufacturing/doctype/workstation/workstation.js
index 4f5231e..5b9cedb 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.js
+++ b/erpnext/manufacturing/doctype/workstation/workstation.js
@@ -41,4 +41,4 @@
},
-];
\ No newline at end of file
+];
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.py b/erpnext/manufacturing/doctype/workstation/workstation.py
index f4483f7..6daf950 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.py
+++ b/erpnext/manufacturing/doctype/workstation/workstation.py
@@ -2,13 +2,23 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from erpnext.support.doctype.issue.issue import get_holidays
-from frappe.utils import (flt, cint, getdate, formatdate,
- comma_and, time_diff_in_seconds, to_timedelta, add_days)
from frappe.model.document import Document
-from dateutil.parser import parse
+from frappe.utils import (
+ add_days,
+ cint,
+ comma_and,
+ flt,
+ formatdate,
+ getdate,
+ time_diff_in_seconds,
+ to_timedelta,
+)
+
+from erpnext.support.doctype.issue.issue import get_holidays
+
class WorkstationHolidayError(frappe.ValidationError): pass
class NotInWorkingHoursError(frappe.ValidationError): pass
diff --git a/erpnext/manufacturing/doctype/workstation/workstation_dashboard.py b/erpnext/manufacturing/doctype/workstation/workstation_dashboard.py
index 3ddbe73..3e4b38a 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation_dashboard.py
+++ b/erpnext/manufacturing/doctype/workstation/workstation_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'workstation',
diff --git a/erpnext/manufacturing/doctype/workstation_working_hour/workstation_working_hour.py b/erpnext/manufacturing/doctype/workstation_working_hour/workstation_working_hour.py
index 215df4c..719d83d 100644
--- a/erpnext/manufacturing/doctype/workstation_working_hour/workstation_working_hour.py
+++ b/erpnext/manufacturing/doctype/workstation_working_hour/workstation_working_hour.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class WorkstationWorkingHour(Document):
pass
diff --git a/erpnext/manufacturing/notification/material_request_receipt_notification/material_request_receipt_notification.py b/erpnext/manufacturing/notification/material_request_receipt_notification/material_request_receipt_notification.py
index 2334f8b..f57de91 100644
--- a/erpnext/manufacturing/notification/material_request_receipt_notification/material_request_receipt_notification.py
+++ b/erpnext/manufacturing/notification/material_request_receipt_notification/material_request_receipt_notification.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals
-import frappe
def get_context(context):
# do your magic here
diff --git a/erpnext/manufacturing/report/bom_explorer/bom_explorer.py b/erpnext/manufacturing/report/bom_explorer/bom_explorer.py
index 858b554..c122fa9 100644
--- a/erpnext/manufacturing/report/bom_explorer/bom_explorer.py
+++ b/erpnext/manufacturing/report/bom_explorer/bom_explorer.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from pprint import pprint
+
def execute(filters=None):
data = []
diff --git a/erpnext/manufacturing/report/bom_operations_time/bom_operations_time.py b/erpnext/manufacturing/report/bom_operations_time/bom_operations_time.py
index 8778d9b..3c2d215 100644
--- a/erpnext/manufacturing/report/bom_operations_time/bom_operations_time.py
+++ b/erpnext/manufacturing/report/bom_operations_time/bom_operations_time.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
data = get_data(filters)
columns = get_columns(filters)
diff --git a/erpnext/manufacturing/report/bom_stock_calculated/bom_stock_calculated.py b/erpnext/manufacturing/report/bom_stock_calculated/bom_stock_calculated.py
index ffd9242..c085990 100644
--- a/erpnext/manufacturing/report/bom_stock_calculated/bom_stock_calculated.py
+++ b/erpnext/manufacturing/report/bom_stock_calculated/bom_stock_calculated.py
@@ -2,12 +2,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils.data import comma_and
+
def execute(filters=None):
-# if not filters: filters = {}
+ # if not filters: filters = {}
columns = get_columns()
summ_data = []
diff --git a/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.py b/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.py
index ed8b939..b8ef68d 100644
--- a/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.py
+++ b/erpnext/manufacturing/report/bom_stock_report/bom_stock_report.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.py b/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.py
index dc424b7..bbf5037 100644
--- a/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.py
+++ b/erpnext/manufacturing/report/bom_variance_report/bom_variance_report.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
columns, data = [], []
columns = get_columns(filters)
diff --git a/erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py b/erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py
index b4db98c..0dcad44 100644
--- a/erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py
+++ b/erpnext/manufacturing/report/cost_of_poor_quality_report/cost_of_poor_quality_report.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt
+
def execute(filters=None):
columns, data = [], []
diff --git a/erpnext/manufacturing/report/downtime_analysis/downtime_analysis.py b/erpnext/manufacturing/report/downtime_analysis/downtime_analysis.py
index 74c794b..a1c6fd1 100644
--- a/erpnext/manufacturing/report/downtime_analysis/downtime_analysis.py
+++ b/erpnext/manufacturing/report/downtime_analysis/downtime_analysis.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import flt
from frappe import _
+from frappe.utils import flt
+
def execute(filters=None):
columns, data = [], []
diff --git a/erpnext/manufacturing/report/exponential_smoothing_forecasting/exponential_smoothing_forecasting.py b/erpnext/manufacturing/report/exponential_smoothing_forecasting/exponential_smoothing_forecasting.py
index 9a6c764..f014e7f 100644
--- a/erpnext/manufacturing/report/exponential_smoothing_forecasting/exponential_smoothing_forecasting.py
+++ b/erpnext/manufacturing/report/exponential_smoothing_forecasting/exponential_smoothing_forecasting.py
@@ -2,12 +2,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
-from frappe.utils import flt, nowdate, add_years, cint, getdate
+from frappe.utils import add_years, cint, flt, getdate
+
+import erpnext
from erpnext.accounts.report.financial_statements import get_period_list
from erpnext.stock.doctype.warehouse.warehouse import get_child_warehouses
+
def execute(filters=None):
return ForecastingReport(filters).execute_report()
diff --git a/erpnext/manufacturing/report/job_card_summary/job_card_summary.py b/erpnext/manufacturing/report/job_card_summary/job_card_summary.py
index a893905..a7aec31 100644
--- a/erpnext/manufacturing/report/job_card_summary/job_card_summary.py
+++ b/erpnext/manufacturing/report/job_card_summary/job_card_summary.py
@@ -2,10 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import getdate, flt
-from erpnext.stock.report.stock_analytics.stock_analytics import (get_period_date_ranges, get_period)
+from frappe.utils import getdate
+
+from erpnext.stock.report.stock_analytics.stock_analytics import get_period, get_period_date_ranges
+
def execute(filters=None):
columns, data = [], []
diff --git a/erpnext/manufacturing/report/production_analytics/production_analytics.py b/erpnext/manufacturing/report/production_analytics/production_analytics.py
index 42c9d97..9e0978a 100644
--- a/erpnext/manufacturing/report/production_analytics/production_analytics.py
+++ b/erpnext/manufacturing/report/production_analytics/production_analytics.py
@@ -2,10 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _, scrub
from frappe.utils import getdate
-from erpnext.stock.report.stock_analytics.stock_analytics import (get_period_date_ranges, get_period)
+
+from erpnext.stock.report.stock_analytics.stock_analytics import get_period, get_period_date_ranges
+
def execute(filters=None):
columns = get_columns(filters)
diff --git a/erpnext/manufacturing/report/production_plan_summary/production_plan_summary.py b/erpnext/manufacturing/report/production_plan_summary/production_plan_summary.py
index 81b1791..9a4d0c4 100644
--- a/erpnext/manufacturing/report/production_plan_summary/production_plan_summary.py
+++ b/erpnext/manufacturing/report/production_plan_summary/production_plan_summary.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.utils import flt
+
def execute(filters=None):
columns, data = [], []
data = get_data(filters)
diff --git a/erpnext/manufacturing/report/production_planning_report/production_planning_report.py b/erpnext/manufacturing/report/production_planning_report/production_planning_report.py
index 806d268..e27270a 100644
--- a/erpnext/manufacturing/report/production_planning_report/production_planning_report.py
+++ b/erpnext/manufacturing/report/production_planning_report/production_planning_report.py
@@ -2,8 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
from erpnext.stock.doctype.warehouse.warehouse import get_child_warehouses
# and bom_no is not null and bom_no !=''
diff --git a/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py b/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py
index a12ac7f..54df208 100644
--- a/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py
+++ b/erpnext/manufacturing/report/quality_inspection_summary/quality_inspection_summary.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
columns, data = [], []
data = get_data(filters)
diff --git a/erpnext/manufacturing/report/work_order_stock_report/work_order_stock_report.py b/erpnext/manufacturing/report/work_order_stock_report/work_order_stock_report.py
index 599a738..5b2e262 100644
--- a/erpnext/manufacturing/report/work_order_stock_report/work_order_stock_report.py
+++ b/erpnext/manufacturing/report/work_order_stock_report/work_order_stock_report.py
@@ -2,8 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe.utils import cint
+
import frappe
+from frappe.utils import cint
+
def execute(filters=None):
wo_list = get_work_orders()
diff --git a/erpnext/manufacturing/report/work_order_summary/work_order_summary.py b/erpnext/manufacturing/report/work_order_summary/work_order_summary.py
index d0766f9..b65af33 100644
--- a/erpnext/manufacturing/report/work_order_summary/work_order_summary.py
+++ b/erpnext/manufacturing/report/work_order_summary/work_order_summary.py
@@ -2,10 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import date_diff, today, getdate, flt
from frappe import _
-from erpnext.stock.report.stock_analytics.stock_analytics import (get_period_date_ranges, get_period)
+from frappe.utils import date_diff, flt, getdate, today
+
+from erpnext.stock.report.stock_analytics.stock_analytics import get_period, get_period_date_ranges
+
def execute(filters=None):
columns, data = [], []
diff --git a/erpnext/non_profit/doctype/certification_application/certification_application.py b/erpnext/non_profit/doctype/certification_application/certification_application.py
index d4fc76b..ff400c8 100644
--- a/erpnext/non_profit/doctype/certification_application/certification_application.py
+++ b/erpnext/non_profit/doctype/certification_application/certification_application.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class CertificationApplication(Document):
pass
diff --git a/erpnext/non_profit/doctype/certification_application/test_certification_application.py b/erpnext/non_profit/doctype/certification_application/test_certification_application.py
index 30cb8c0..5e1cbf8 100644
--- a/erpnext/non_profit/doctype/certification_application/test_certification_application.py
+++ b/erpnext/non_profit/doctype/certification_application/test_certification_application.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestCertificationApplication(unittest.TestCase):
pass
diff --git a/erpnext/non_profit/doctype/certified_consultant/certified_consultant.py b/erpnext/non_profit/doctype/certified_consultant/certified_consultant.py
index 3bc6ed7..0cbc208 100644
--- a/erpnext/non_profit/doctype/certified_consultant/certified_consultant.py
+++ b/erpnext/non_profit/doctype/certified_consultant/certified_consultant.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class CertifiedConsultant(Document):
pass
diff --git a/erpnext/non_profit/doctype/certified_consultant/test_certified_consultant.py b/erpnext/non_profit/doctype/certified_consultant/test_certified_consultant.py
index 19b485d..29a7388 100644
--- a/erpnext/non_profit/doctype/certified_consultant/test_certified_consultant.py
+++ b/erpnext/non_profit/doctype/certified_consultant/test_certified_consultant.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestCertifiedConsultant(unittest.TestCase):
pass
diff --git a/erpnext/non_profit/doctype/chapter/chapter.py b/erpnext/non_profit/doctype/chapter/chapter.py
index e9554b1..c5c9569 100644
--- a/erpnext/non_profit/doctype/chapter/chapter.py
+++ b/erpnext/non_profit/doctype/chapter/chapter.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.website.website_generator import WebsiteGenerator
+
class Chapter(WebsiteGenerator):
_website = frappe._dict(
condition_field = "published",
diff --git a/erpnext/non_profit/doctype/chapter/test_chapter.py b/erpnext/non_profit/doctype/chapter/test_chapter.py
index d757a1f..04cdc27 100644
--- a/erpnext/non_profit/doctype/chapter/test_chapter.py
+++ b/erpnext/non_profit/doctype/chapter/test_chapter.py
@@ -5,5 +5,6 @@
import unittest
+
class TestChapter(unittest.TestCase):
pass
diff --git a/erpnext/non_profit/doctype/chapter_member/chapter_member.py b/erpnext/non_profit/doctype/chapter_member/chapter_member.py
index a1b25f2..1638294 100644
--- a/erpnext/non_profit/doctype/chapter_member/chapter_member.py
+++ b/erpnext/non_profit/doctype/chapter_member/chapter_member.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class ChapterMember(Document):
pass
diff --git a/erpnext/non_profit/doctype/donation/donation.py b/erpnext/non_profit/doctype/donation/donation.py
index 9aa7e13..e4e2b4e 100644
--- a/erpnext/non_profit/doctype/donation/donation.py
+++ b/erpnext/non_profit/doctype/donation/donation.py
@@ -3,15 +3,19 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+import json
+
import frappe
import six
-import json
-from frappe.model.document import Document
from frappe import _
-from frappe.utils import getdate, flt, get_link_to_form
from frappe.email import sendmail_to_system_managers
+from frappe.model.document import Document
+from frappe.utils import flt, get_link_to_form, getdate
+
from erpnext.non_profit.doctype.membership.membership import verify_signature
+
class Donation(Document):
def validate(self):
if not self.donor or not frappe.db.exists('Donor', self.donor):
diff --git a/erpnext/non_profit/doctype/donation/donation_dashboard.py b/erpnext/non_profit/doctype/donation/donation_dashboard.py
index 3da8942..4a16077 100644
--- a/erpnext/non_profit/doctype/donation/donation_dashboard.py
+++ b/erpnext/non_profit/doctype/donation/donation_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'donation',
diff --git a/erpnext/non_profit/doctype/donation/test_donation.py b/erpnext/non_profit/doctype/donation/test_donation.py
index b206f54..6b9ade9 100644
--- a/erpnext/non_profit/doctype/donation/test_donation.py
+++ b/erpnext/non_profit/doctype/donation/test_donation.py
@@ -3,10 +3,13 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
+
from erpnext.non_profit.doctype.donation.donation import create_donation
+
class TestDonation(unittest.TestCase):
def setUp(self):
create_donor_type()
diff --git a/erpnext/non_profit/doctype/donor/donor.py b/erpnext/non_profit/doctype/donor/donor.py
index ab6a197..a46163a 100644
--- a/erpnext/non_profit/doctype/donor/donor.py
+++ b/erpnext/non_profit/doctype/donor/donor.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe.model.document import Document
+
from frappe.contacts.address_and_contact import load_address_and_contact
+from frappe.model.document import Document
+
class Donor(Document):
def onload(self):
diff --git a/erpnext/non_profit/doctype/donor/test_donor.py b/erpnext/non_profit/doctype/donor/test_donor.py
index 3b6724e..5ce0199 100644
--- a/erpnext/non_profit/doctype/donor/test_donor.py
+++ b/erpnext/non_profit/doctype/donor/test_donor.py
@@ -5,5 +5,6 @@
import unittest
+
class TestDonor(unittest.TestCase):
pass
diff --git a/erpnext/non_profit/doctype/donor_type/donor_type.py b/erpnext/non_profit/doctype/donor_type/donor_type.py
index e9262ac..4d34725 100644
--- a/erpnext/non_profit/doctype/donor_type/donor_type.py
+++ b/erpnext/non_profit/doctype/donor_type/donor_type.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class DonorType(Document):
pass
diff --git a/erpnext/non_profit/doctype/donor_type/test_donor_type.py b/erpnext/non_profit/doctype/donor_type/test_donor_type.py
index e793913..7857ec5 100644
--- a/erpnext/non_profit/doctype/donor_type/test_donor_type.py
+++ b/erpnext/non_profit/doctype/donor_type/test_donor_type.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-
import unittest
+
class TestDonorType(unittest.TestCase):
pass
diff --git a/erpnext/non_profit/doctype/grant_application/grant_application.py b/erpnext/non_profit/doctype/grant_application/grant_application.py
index b810fd0..92a6256 100644
--- a/erpnext/non_profit/doctype/grant_application/grant_application.py
+++ b/erpnext/non_profit/doctype/grant_application/grant_application.py
@@ -3,11 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.website.website_generator import WebsiteGenerator
from frappe.contacts.address_and_contact import load_address_and_contact
from frappe.utils import get_url
+from frappe.website.website_generator import WebsiteGenerator
+
class GrantApplication(WebsiteGenerator):
_website = frappe._dict(
diff --git a/erpnext/non_profit/doctype/grant_application/test_grant_application.py b/erpnext/non_profit/doctype/grant_application/test_grant_application.py
index da16acf..d158091 100644
--- a/erpnext/non_profit/doctype/grant_application/test_grant_application.py
+++ b/erpnext/non_profit/doctype/grant_application/test_grant_application.py
@@ -5,5 +5,6 @@
import unittest
+
class TestGrantApplication(unittest.TestCase):
pass
diff --git a/erpnext/non_profit/doctype/member/member.py b/erpnext/non_profit/doctype/member/member.py
index 67828d6..f7e7f10 100644
--- a/erpnext/non_profit/doctype/member/member.py
+++ b/erpnext/non_profit/doctype/member/member.py
@@ -3,14 +3,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.model.document import Document
from frappe.contacts.address_and_contact import load_address_and_contact
-from frappe.utils import cint, get_link_to_form
from frappe.integrations.utils import get_payment_gateway_controller
+from frappe.model.document import Document
+from frappe.utils import cint, get_link_to_form
+
from erpnext.non_profit.doctype.membership_type.membership_type import get_membership_type
+
class Member(Document):
def onload(self):
"""Load address and contacts in `__onload`"""
diff --git a/erpnext/non_profit/doctype/member/member_dashboard.py b/erpnext/non_profit/doctype/member/member_dashboard.py
index 743db25..ff929a5 100644
--- a/erpnext/non_profit/doctype/member/member_dashboard.py
+++ b/erpnext/non_profit/doctype/member/member_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'heatmap': True,
diff --git a/erpnext/non_profit/doctype/member/test_member.py b/erpnext/non_profit/doctype/member/test_member.py
index 748a500..38ad87f 100644
--- a/erpnext/non_profit/doctype/member/test_member.py
+++ b/erpnext/non_profit/doctype/member/test_member.py
@@ -5,5 +5,6 @@
import unittest
+
class TestMember(unittest.TestCase):
pass
diff --git a/erpnext/non_profit/doctype/membership/membership.py b/erpnext/non_profit/doctype/membership/membership.py
index b584116..b65dc8e 100644
--- a/erpnext/non_profit/doctype/membership/membership.py
+++ b/erpnext/non_profit/doctype/membership/membership.py
@@ -3,17 +3,20 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import json
+from datetime import datetime
+
import frappe
import six
-import os
-from datetime import datetime
-from frappe.model.document import Document
-from frappe.email import sendmail_to_system_managers
-from frappe.utils import add_days, add_years, nowdate, getdate, add_months, get_link_to_form
-from erpnext.non_profit.doctype.member.member import create_member
from frappe import _
+from frappe.email import sendmail_to_system_managers
+from frappe.model.document import Document
+from frappe.utils import add_days, add_months, add_years, get_link_to_form, getdate, nowdate
+
import erpnext
+from erpnext.non_profit.doctype.member.member import create_member
+
class Membership(Document):
def validate(self):
@@ -207,7 +210,7 @@
try:
return frappe.get_doc("Member", members[0]["name"])
- except:
+ except Exception:
return None
@@ -393,7 +396,7 @@
""".format(get_link_to_form("Error Log", log.name))
sendmail_to_system_managers("[Important] [ERPNext] Razorpay membership webhook failed , please check.", content)
- except:
+ except Exception:
pass
@@ -402,7 +405,7 @@
try:
return plan[0]["name"]
- except:
+ except Exception:
return None
diff --git a/erpnext/non_profit/doctype/membership/test_membership.py b/erpnext/non_profit/doctype/membership/test_membership.py
index 5ad2088..5f52cda 100644
--- a/erpnext/non_profit/doctype/membership/test_membership.py
+++ b/erpnext/non_profit/doctype/membership/test_membership.py
@@ -2,12 +2,16 @@
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
import frappe
+from frappe.utils import add_months, nowdate
+
import erpnext
from erpnext.non_profit.doctype.member.member import create_member
from erpnext.non_profit.doctype.membership.membership import update_halted_razorpay_subscription
-from frappe.utils import nowdate, add_months
+
class TestMembership(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/non_profit/doctype/membership_type/membership_type.py b/erpnext/non_profit/doctype/membership_type/membership_type.py
index c712b99..1b847d9 100644
--- a/erpnext/non_profit/doctype/membership_type/membership_type.py
+++ b/erpnext/non_profit/doctype/membership_type/membership_type.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe.model.document import Document
+
import frappe
from frappe import _
+from frappe.model.document import Document
+
class MembershipType(Document):
def validate(self):
diff --git a/erpnext/non_profit/doctype/membership_type/test_membership_type.py b/erpnext/non_profit/doctype/membership_type/test_membership_type.py
index d2c9bee..2503ba1 100644
--- a/erpnext/non_profit/doctype/membership_type/test_membership_type.py
+++ b/erpnext/non_profit/doctype/membership_type/test_membership_type.py
@@ -5,5 +5,6 @@
import unittest
+
class TestMembershipType(unittest.TestCase):
pass
diff --git a/erpnext/non_profit/doctype/non_profit_settings/non_profit_settings.py b/erpnext/non_profit/doctype/non_profit_settings/non_profit_settings.py
index 50c9351..cb365cb 100644
--- a/erpnext/non_profit/doctype/non_profit_settings/non_profit_settings.py
+++ b/erpnext/non_profit/doctype/non_profit_settings/non_profit_settings.py
@@ -3,11 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.integrations.utils import get_payment_gateway_controller
from frappe.model.document import Document
+
class NonProfitSettings(Document):
@frappe.whitelist()
def generate_webhook_secret(self, field="membership_webhook_secret"):
diff --git a/erpnext/non_profit/doctype/non_profit_settings/test_non_profit_settings.py b/erpnext/non_profit/doctype/non_profit_settings/test_non_profit_settings.py
index 3f0ede3..a0a5403 100644
--- a/erpnext/non_profit/doctype/non_profit_settings/test_non_profit_settings.py
+++ b/erpnext/non_profit/doctype/non_profit_settings/test_non_profit_settings.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestNonProfitSettings(unittest.TestCase):
pass
diff --git a/erpnext/non_profit/doctype/volunteer/test_volunteer.py b/erpnext/non_profit/doctype/volunteer/test_volunteer.py
index 6f3bee0..346eac5 100644
--- a/erpnext/non_profit/doctype/volunteer/test_volunteer.py
+++ b/erpnext/non_profit/doctype/volunteer/test_volunteer.py
@@ -5,5 +5,6 @@
import unittest
+
class TestVolunteer(unittest.TestCase):
pass
diff --git a/erpnext/non_profit/doctype/volunteer/volunteer.py b/erpnext/non_profit/doctype/volunteer/volunteer.py
index 699868a..6c9232b 100644
--- a/erpnext/non_profit/doctype/volunteer/volunteer.py
+++ b/erpnext/non_profit/doctype/volunteer/volunteer.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe.model.document import Document
+
from frappe.contacts.address_and_contact import load_address_and_contact
+from frappe.model.document import Document
+
class Volunteer(Document):
def onload(self):
diff --git a/erpnext/non_profit/doctype/volunteer_skill/volunteer_skill.py b/erpnext/non_profit/doctype/volunteer_skill/volunteer_skill.py
index dc9f823..3422ec2 100644
--- a/erpnext/non_profit/doctype/volunteer_skill/volunteer_skill.py
+++ b/erpnext/non_profit/doctype/volunteer_skill/volunteer_skill.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class VolunteerSkill(Document):
pass
diff --git a/erpnext/non_profit/doctype/volunteer_type/test_volunteer_type.py b/erpnext/non_profit/doctype/volunteer_type/test_volunteer_type.py
index 78f65c7..2c64d21 100644
--- a/erpnext/non_profit/doctype/volunteer_type/test_volunteer_type.py
+++ b/erpnext/non_profit/doctype/volunteer_type/test_volunteer_type.py
@@ -5,5 +5,6 @@
import unittest
+
class TestVolunteerType(unittest.TestCase):
pass
diff --git a/erpnext/non_profit/doctype/volunteer_type/volunteer_type.py b/erpnext/non_profit/doctype/volunteer_type/volunteer_type.py
index 9776402..116f5d8 100644
--- a/erpnext/non_profit/doctype/volunteer_type/volunteer_type.py
+++ b/erpnext/non_profit/doctype/volunteer_type/volunteer_type.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class VolunteerType(Document):
pass
diff --git a/erpnext/non_profit/report/expiring_memberships/expiring_memberships.py b/erpnext/non_profit/report/expiring_memberships/expiring_memberships.py
index 122db45..2167b65 100644
--- a/erpnext/non_profit/report/expiring_memberships/expiring_memberships.py
+++ b/erpnext/non_profit/report/expiring_memberships/expiring_memberships.py
@@ -2,8 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import _,msgprint
+from frappe import _
+
def execute(filters=None):
columns = get_columns(filters)
diff --git a/erpnext/non_profit/web_form/certification_application/certification_application.py b/erpnext/non_profit/web_form/certification_application/certification_application.py
index 2334f8b..f57de91 100644
--- a/erpnext/non_profit/web_form/certification_application/certification_application.py
+++ b/erpnext/non_profit/web_form/certification_application/certification_application.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals
-import frappe
def get_context(context):
# do your magic here
diff --git a/erpnext/non_profit/web_form/certification_application_usd/certification_application_usd.py b/erpnext/non_profit/web_form/certification_application_usd/certification_application_usd.py
index 2334f8b..f57de91 100644
--- a/erpnext/non_profit/web_form/certification_application_usd/certification_application_usd.py
+++ b/erpnext/non_profit/web_form/certification_application_usd/certification_application_usd.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals
-import frappe
def get_context(context):
# do your magic here
diff --git a/erpnext/non_profit/web_form/grant_application/grant_application.py b/erpnext/non_profit/web_form/grant_application/grant_application.py
index 186722a..dab0e9f 100644
--- a/erpnext/non_profit/web_form/grant_application/grant_application.py
+++ b/erpnext/non_profit/web_form/grant_application/grant_application.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_context(context):
context.no_cache = True
context.parents = [dict(label='View All ',
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index ae83d5e..c82579a 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -298,7 +298,10 @@
erpnext.patches.v13_0.migrate_stripe_api
erpnext.patches.v13_0.reset_clearance_date_for_intracompany_payment_entries
erpnext.patches.v13_0.einvoicing_deprecation_warning
+erpnext.patches.v13_0.custom_fields_for_taxjar_integration
erpnext.patches.v14_0.delete_einvoicing_doctypes
erpnext.patches.v13_0.set_operation_time_based_on_operating_cost
erpnext.patches.v13_0.validate_options_for_data_field
-erpnext.patches.v13_0.update_dates_in_tax_withholding_category
\ No newline at end of file
+erpnext.patches.v13_0.create_gst_payment_entry_fields
+erpnext.patches.v14_0.delete_shopify_doctypes
+erpnext.patches.v13_0.update_dates_in_tax_withholding_category
diff --git a/erpnext/patches/v10_0/add_default_cash_flow_mappers.py b/erpnext/patches/v10_0/add_default_cash_flow_mappers.py
index d607b2f..5c28597 100644
--- a/erpnext/patches/v10_0/add_default_cash_flow_mappers.py
+++ b/erpnext/patches/v10_0/add_default_cash_flow_mappers.py
@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
+
from erpnext.setup.install import create_default_cash_flow_mapper_templates
diff --git a/erpnext/patches/v10_0/delete_hub_documents.py b/erpnext/patches/v10_0/delete_hub_documents.py
index f6a1499..16c7abf 100644
--- a/erpnext/patches/v10_0/delete_hub_documents.py
+++ b/erpnext/patches/v10_0/delete_hub_documents.py
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
import frappe
-from frappe.model.utils.rename_field import rename_field
+
def execute():
for dt, dn in (("Page", "Hub"), ("DocType", "Hub Settings"), ("DocType", "Hub Category")):
diff --git a/erpnext/patches/v10_0/fichier_des_ecritures_comptables_for_france.py b/erpnext/patches/v10_0/fichier_des_ecritures_comptables_for_france.py
index 0315ae7..a3e4957 100644
--- a/erpnext/patches/v10_0/fichier_des_ecritures_comptables_for_france.py
+++ b/erpnext/patches/v10_0/fichier_des_ecritures_comptables_for_france.py
@@ -2,9 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
from erpnext.setup.doctype.company.company import install_country_fixtures
+
def execute():
frappe.reload_doc('regional', 'report', 'fichier_des_ecritures_comptables_[fec]')
for d in frappe.get_all('Company', filters = {'country': 'France'}):
diff --git a/erpnext/patches/v10_0/migrate_daily_work_summary_settings_to_daily_work_summary_group.py b/erpnext/patches/v10_0/migrate_daily_work_summary_settings_to_daily_work_summary_group.py
index daa258e..a3c61a5 100644
--- a/erpnext/patches/v10_0/migrate_daily_work_summary_settings_to_daily_work_summary_group.py
+++ b/erpnext/patches/v10_0/migrate_daily_work_summary_settings_to_daily_work_summary_group.py
@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
diff --git a/erpnext/patches/v10_0/rename_offer_letter_to_job_offer.py b/erpnext/patches/v10_0/rename_offer_letter_to_job_offer.py
index f832936..4fc419e 100644
--- a/erpnext/patches/v10_0/rename_offer_letter_to_job_offer.py
+++ b/erpnext/patches/v10_0/rename_offer_letter_to_job_offer.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
if frappe.db.table_exists("Offer Letter") and not frappe.db.table_exists("Job Offer"):
frappe.rename_doc("DocType", "Offer Letter", "Job Offer", force=True)
diff --git a/erpnext/patches/v10_0/rename_price_to_rate_in_pricing_rule.py b/erpnext/patches/v10_0/rename_price_to_rate_in_pricing_rule.py
index a9dd310..1b8c6fb 100644
--- a/erpnext/patches/v10_0/rename_price_to_rate_in_pricing_rule.py
+++ b/erpnext/patches/v10_0/rename_price_to_rate_in_pricing_rule.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
frappe.reload_doc("accounts", "doctype", "pricing_rule")
diff --git a/erpnext/patches/v10_0/set_currency_in_pricing_rule.py b/erpnext/patches/v10_0/set_currency_in_pricing_rule.py
index c413931..2a3f1c0 100644
--- a/erpnext/patches/v10_0/set_currency_in_pricing_rule.py
+++ b/erpnext/patches/v10_0/set_currency_in_pricing_rule.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doctype("Pricing Rule")
diff --git a/erpnext/patches/v10_0/update_translatable_fields.py b/erpnext/patches/v10_0/update_translatable_fields.py
index 9d6bda7..2c55a052 100644
--- a/erpnext/patches/v10_0/update_translatable_fields.py
+++ b/erpnext/patches/v10_0/update_translatable_fields.py
@@ -4,6 +4,7 @@
import frappe
+
def execute():
'''
Enable translatable in these fields
diff --git a/erpnext/patches/v10_1/transfer_subscription_to_auto_repeat.py b/erpnext/patches/v10_1/transfer_subscription_to_auto_repeat.py
index 3d1a88e..2d5b0c5 100644
--- a/erpnext/patches/v10_1/transfer_subscription_to_auto_repeat.py
+++ b/erpnext/patches/v10_1/transfer_subscription_to_auto_repeat.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
diff --git a/erpnext/patches/v11_0/add_default_dispatch_notification_template.py b/erpnext/patches/v11_0/add_default_dispatch_notification_template.py
index f4c1895..197b3b7 100644
--- a/erpnext/patches/v11_0/add_default_dispatch_notification_template.py
+++ b/erpnext/patches/v11_0/add_default_dispatch_notification_template.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
import os
import frappe
diff --git a/erpnext/patches/v11_0/add_default_email_template_for_leave.py b/erpnext/patches/v11_0/add_default_email_template_for_leave.py
index 0f1e496..f8538df 100644
--- a/erpnext/patches/v11_0/add_default_email_template_for_leave.py
+++ b/erpnext/patches/v11_0/add_default_email_template_for_leave.py
@@ -1,7 +1,11 @@
from __future__ import unicode_literals
-import frappe, os
+
+import os
+
+import frappe
from frappe import _
+
def execute():
frappe.reload_doc("email", "doctype", "email_template")
diff --git a/erpnext/patches/v11_0/add_expense_claim_default_account.py b/erpnext/patches/v11_0/add_expense_claim_default_account.py
index a613bd8..74b93ef 100644
--- a/erpnext/patches/v11_0/add_expense_claim_default_account.py
+++ b/erpnext/patches/v11_0/add_expense_claim_default_account.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("setup", "doctype", "company")
diff --git a/erpnext/patches/v11_0/add_healthcare_service_unit_tree_root.py b/erpnext/patches/v11_0/add_healthcare_service_unit_tree_root.py
index a45f39d..9bb91dc 100644
--- a/erpnext/patches/v11_0/add_healthcare_service_unit_tree_root.py
+++ b/erpnext/patches/v11_0/add_healthcare_service_unit_tree_root.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute():
""" assign lft and rgt appropriately """
if "Healthcare" not in frappe.get_active_domains():
diff --git a/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py b/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py
index 0243dfb..08ad855 100644
--- a/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py
+++ b/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("assets", "doctype", "Location")
for dt in ("Account", "Cost Center", "File", "Employee", "Location", "Task", "Customer Group", "Sales Person", "Territory"):
diff --git a/erpnext/patches/v11_0/add_item_group_defaults.py b/erpnext/patches/v11_0/add_item_group_defaults.py
index 2a15ad1..6849b27 100644
--- a/erpnext/patches/v11_0/add_item_group_defaults.py
+++ b/erpnext/patches/v11_0/add_item_group_defaults.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
'''
diff --git a/erpnext/patches/v11_0/add_market_segments.py b/erpnext/patches/v11_0/add_market_segments.py
index a8841ef..e7cc7d1 100644
--- a/erpnext/patches/v11_0/add_market_segments.py
+++ b/erpnext/patches/v11_0/add_market_segments.py
@@ -1,9 +1,10 @@
from __future__ import unicode_literals
import frappe
-from frappe import _
+
from erpnext.setup.setup_wizard.operations.install_fixtures import add_market_segments
+
def execute():
frappe.reload_doc('crm', 'doctype', 'market_segment')
diff --git a/erpnext/patches/v11_0/add_permissions_in_gst_settings.py b/erpnext/patches/v11_0/add_permissions_in_gst_settings.py
index 83b2a4c..9df1b58 100644
--- a/erpnext/patches/v11_0/add_permissions_in_gst_settings.py
+++ b/erpnext/patches/v11_0/add_permissions_in_gst_settings.py
@@ -1,6 +1,8 @@
import frappe
+
from erpnext.regional.india.setup import add_permissions
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
diff --git a/erpnext/patches/v11_0/add_sales_stages.py b/erpnext/patches/v11_0/add_sales_stages.py
index d06c688..23e4874 100644
--- a/erpnext/patches/v11_0/add_sales_stages.py
+++ b/erpnext/patches/v11_0/add_sales_stages.py
@@ -1,8 +1,10 @@
from __future__ import unicode_literals
+
import frappe
-from frappe import _
+
from erpnext.setup.setup_wizard.operations.install_fixtures import add_sale_stages
+
def execute():
frappe.reload_doc('crm', 'doctype', 'sales_stage')
diff --git a/erpnext/patches/v11_0/check_buying_selling_in_currency_exchange.py b/erpnext/patches/v11_0/check_buying_selling_in_currency_exchange.py
index 0a1a360..5eaf212 100644
--- a/erpnext/patches/v11_0/check_buying_selling_in_currency_exchange.py
+++ b/erpnext/patches/v11_0/check_buying_selling_in_currency_exchange.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('setup', 'doctype', 'currency_exchange')
frappe.db.sql("""update `tabCurrency Exchange` set for_buying = 1, for_selling = 1""")
diff --git a/erpnext/patches/v11_0/create_default_success_action.py b/erpnext/patches/v11_0/create_default_success_action.py
index 31feff2..4a59837 100644
--- a/erpnext/patches/v11_0/create_default_success_action.py
+++ b/erpnext/patches/v11_0/create_default_success_action.py
@@ -1,7 +1,10 @@
from __future__ import unicode_literals
+
import frappe
+
from erpnext.setup.install import create_default_success_action
+
def execute():
frappe.reload_doc("core", "doctype", "success_action")
create_default_success_action()
diff --git a/erpnext/patches/v11_0/create_department_records_for_each_company.py b/erpnext/patches/v11_0/create_department_records_for_each_company.py
index e9b5950..7799a65 100644
--- a/erpnext/patches/v11_0/create_department_records_for_each_company.py
+++ b/erpnext/patches/v11_0/create_department_records_for_each_company.py
@@ -1,8 +1,10 @@
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils.nestedset import rebuild_tree
+
def execute():
frappe.local.lang = frappe.db.get_default("lang") or 'en'
diff --git a/erpnext/patches/v11_0/create_salary_structure_assignments.py b/erpnext/patches/v11_0/create_salary_structure_assignments.py
index d3ea7a3..c3cc9b6 100644
--- a/erpnext/patches/v11_0/create_salary_structure_assignments.py
+++ b/erpnext/patches/v11_0/create_salary_structure_assignments.py
@@ -2,10 +2,16 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
from datetime import datetime
+
+import frappe
from frappe.utils import getdate
-from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import DuplicateAssignment
+
+from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import (
+ DuplicateAssignment,
+)
+
def execute():
frappe.reload_doc('Payroll', 'doctype', 'Salary Structure')
diff --git a/erpnext/patches/v11_0/drop_column_max_days_allowed.py b/erpnext/patches/v11_0/drop_column_max_days_allowed.py
index 029f75a..e45d01c 100644
--- a/erpnext/patches/v11_0/drop_column_max_days_allowed.py
+++ b/erpnext/patches/v11_0/drop_column_max_days_allowed.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
if frappe.db.exists("DocType", "Leave Type"):
if 'max_days_allowed' in frappe.db.get_table_columns("Leave Type"):
diff --git a/erpnext/patches/v11_0/ewaybill_fields_gst_india.py b/erpnext/patches/v11_0/ewaybill_fields_gst_india.py
index 4247c78..a59291c 100644
--- a/erpnext/patches/v11_0/ewaybill_fields_gst_india.py
+++ b/erpnext/patches/v11_0/ewaybill_fields_gst_india.py
@@ -1,7 +1,10 @@
from __future__ import unicode_literals
+
import frappe
+
from erpnext.regional.india.setup import make_custom_fields
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
diff --git a/erpnext/patches/v11_0/hr_ux_cleanups.py b/erpnext/patches/v11_0/hr_ux_cleanups.py
index 8d18796..b09f4a7 100644
--- a/erpnext/patches/v11_0/hr_ux_cleanups.py
+++ b/erpnext/patches/v11_0/hr_ux_cleanups.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doctype('Employee')
frappe.db.sql('update tabEmployee set first_name = employee_name')
diff --git a/erpnext/patches/v11_0/inter_state_field_for_gst.py b/erpnext/patches/v11_0/inter_state_field_for_gst.py
index 730eebc..fa83af0 100644
--- a/erpnext/patches/v11_0/inter_state_field_for_gst.py
+++ b/erpnext/patches/v11_0/inter_state_field_for_gst.py
@@ -1,6 +1,9 @@
from __future__ import unicode_literals
+
import frappe
-from erpnext.regional.india.setup import make_custom_fields
+
+from erpnext.regional.india.setup import make_custom_fields
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
diff --git a/erpnext/patches/v11_0/make_asset_finance_book_against_old_entries.py b/erpnext/patches/v11_0/make_asset_finance_book_against_old_entries.py
index dfcf5ab..1d3f8c1 100644
--- a/erpnext/patches/v11_0/make_asset_finance_book_against_old_entries.py
+++ b/erpnext/patches/v11_0/make_asset_finance_book_against_old_entries.py
@@ -2,8 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils.nestedset import rebuild_tree
+
def execute():
frappe.reload_doc('assets', 'doctype', 'asset_finance_book')
diff --git a/erpnext/patches/v11_0/make_italian_localization_fields.py b/erpnext/patches/v11_0/make_italian_localization_fields.py
index 29d25c9..994df72 100644
--- a/erpnext/patches/v11_0/make_italian_localization_fields.py
+++ b/erpnext/patches/v11_0/make_italian_localization_fields.py
@@ -2,10 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-from erpnext.regional.italy.setup import make_custom_fields, setup_report
-from erpnext.regional.italy import state_codes
+
import frappe
+from erpnext.regional.italy import state_codes
+from erpnext.regional.italy.setup import make_custom_fields, setup_report
+
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'Italy'})
if not company:
diff --git a/erpnext/patches/v11_0/make_job_card.py b/erpnext/patches/v11_0/make_job_card.py
index 9c41c0b..e361d5a 100644
--- a/erpnext/patches/v11_0/make_job_card.py
+++ b/erpnext/patches/v11_0/make_job_card.py
@@ -2,9 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
from erpnext.manufacturing.doctype.work_order.work_order import create_job_card
+
def execute():
frappe.reload_doc('manufacturing', 'doctype', 'work_order')
frappe.reload_doc('manufacturing', 'doctype', 'work_order_item')
diff --git a/erpnext/patches/v11_0/make_location_from_warehouse.py b/erpnext/patches/v11_0/make_location_from_warehouse.py
index 8c92b51..e855b3e 100644
--- a/erpnext/patches/v11_0/make_location_from_warehouse.py
+++ b/erpnext/patches/v11_0/make_location_from_warehouse.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.utils.nestedset import rebuild_tree
+
def execute():
if not frappe.db.get_value('Asset', {'docstatus': ('<', 2) }, 'name'): return
frappe.reload_doc('assets', 'doctype', 'location')
diff --git a/erpnext/patches/v11_0/make_quality_inspection_template.py b/erpnext/patches/v11_0/make_quality_inspection_template.py
index 9720af4..1c3d34e 100644
--- a/erpnext/patches/v11_0/make_quality_inspection_template.py
+++ b/erpnext/patches/v11_0/make_quality_inspection_template.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('stock', 'doctype', 'quality_inspection_template')
frappe.reload_doc('stock', 'doctype', 'item')
diff --git a/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py b/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py
index 6da70b4..42fdf13 100644
--- a/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py
+++ b/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
'''
@@ -30,7 +32,7 @@
buying_cost_center, selling_cost_center, expense_account, income_account, default_supplier
FROM `tabItem`;
''', companies[0].name)
- except:
+ except Exception:
pass
else:
item_details = frappe.db.sql(""" SELECT name, default_warehouse,
diff --git a/erpnext/patches/v11_0/move_leave_approvers_from_employee.py b/erpnext/patches/v11_0/move_leave_approvers_from_employee.py
index ef703d0..accfa5e 100644
--- a/erpnext/patches/v11_0/move_leave_approvers_from_employee.py
+++ b/erpnext/patches/v11_0/move_leave_approvers_from_employee.py
@@ -1,8 +1,9 @@
from __future__ import unicode_literals
+
import frappe
-from frappe import _
from frappe.model.utils.rename_field import rename_field
+
def execute():
frappe.reload_doc("hr", "doctype", "department_approver")
frappe.reload_doc("hr", "doctype", "employee")
diff --git a/erpnext/patches/v11_0/rebuild_tree_for_company.py b/erpnext/patches/v11_0/rebuild_tree_for_company.py
index 4cb74c7..6caca47 100644
--- a/erpnext/patches/v11_0/rebuild_tree_for_company.py
+++ b/erpnext/patches/v11_0/rebuild_tree_for_company.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.utils.nestedset import rebuild_tree
+
def execute():
frappe.reload_doc("setup", "doctype", "company")
rebuild_tree('Company', 'parent_company')
diff --git a/erpnext/patches/v11_0/redesign_healthcare_billing_work_flow.py b/erpnext/patches/v11_0/redesign_healthcare_billing_work_flow.py
index 7c8a822..b1ed0f5 100644
--- a/erpnext/patches/v11_0/redesign_healthcare_billing_work_flow.py
+++ b/erpnext/patches/v11_0/redesign_healthcare_billing_work_flow.py
@@ -1,8 +1,10 @@
from __future__ import unicode_literals
+
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+from frappe.modules import get_doctype_module, scrub
+
from erpnext.domains.healthcare import data
-from frappe.modules import scrub, get_doctype_module
sales_invoice_referenced_doc = {
"Patient Appointment": "sales_invoice",
diff --git a/erpnext/patches/v11_0/remove_barcodes_field_from_copy_fields_to_variants.py b/erpnext/patches/v11_0/remove_barcodes_field_from_copy_fields_to_variants.py
index 97ddd41..caf74f5 100644
--- a/erpnext/patches/v11_0/remove_barcodes_field_from_copy_fields_to_variants.py
+++ b/erpnext/patches/v11_0/remove_barcodes_field_from_copy_fields_to_variants.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
'''Remove barcodes field from "Copy Fields to Variants" table because barcodes must be unique'''
diff --git a/erpnext/patches/v11_0/remove_modules_setup_page.py b/erpnext/patches/v11_0/remove_modules_setup_page.py
index bb0bdf5..eab3237 100644
--- a/erpnext/patches/v11_0/remove_modules_setup_page.py
+++ b/erpnext/patches/v11_0/remove_modules_setup_page.py
@@ -2,7 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.delete_doc("Page", "modules_setup")
diff --git a/erpnext/patches/v11_0/rename_additional_salary_component_additional_salary.py b/erpnext/patches/v11_0/rename_additional_salary_component_additional_salary.py
index 8eb7016..5b2c286 100644
--- a/erpnext/patches/v11_0/rename_additional_salary_component_additional_salary.py
+++ b/erpnext/patches/v11_0/rename_additional_salary_component_additional_salary.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
import frappe
# this patch should have been included with this PR https://github.com/frappe/erpnext/pull/14302
diff --git a/erpnext/patches/v11_0/rename_asset_adjustment_doctype.py b/erpnext/patches/v11_0/rename_asset_adjustment_doctype.py
index 923b230..707dff7 100644
--- a/erpnext/patches/v11_0/rename_asset_adjustment_doctype.py
+++ b/erpnext/patches/v11_0/rename_asset_adjustment_doctype.py
@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
diff --git a/erpnext/patches/v11_0/rename_bom_wo_fields.py b/erpnext/patches/v11_0/rename_bom_wo_fields.py
index 0e6036b..4ad6ea9 100644
--- a/erpnext/patches/v11_0/rename_bom_wo_fields.py
+++ b/erpnext/patches/v11_0/rename_bom_wo_fields.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
# updating column value to handle field change from Data to Currency
changed_field = "base_scrap_material_cost"
diff --git a/erpnext/patches/v11_0/rename_duplicate_item_code_values.py b/erpnext/patches/v11_0/rename_duplicate_item_code_values.py
index 00ab562..61f3856 100644
--- a/erpnext/patches/v11_0/rename_duplicate_item_code_values.py
+++ b/erpnext/patches/v11_0/rename_duplicate_item_code_values.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
items = []
items = frappe.db.sql("""select item_code from `tabItem` group by item_code having count(*) > 1""", as_dict=True)
diff --git a/erpnext/patches/v11_0/rename_field_max_days_allowed.py b/erpnext/patches/v11_0/rename_field_max_days_allowed.py
index 4e99fac..48f73fb 100644
--- a/erpnext/patches/v11_0/rename_field_max_days_allowed.py
+++ b/erpnext/patches/v11_0/rename_field_max_days_allowed.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
frappe.db.sql("""
UPDATE `tabLeave Type`
diff --git a/erpnext/patches/v11_0/rename_health_insurance.py b/erpnext/patches/v11_0/rename_health_insurance.py
index 06fc615..a4f53b0 100644
--- a/erpnext/patches/v11_0/rename_health_insurance.py
+++ b/erpnext/patches/v11_0/rename_health_insurance.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.rename_doc('DocType', 'Health Insurance', 'Employee Health Insurance', force=True)
frappe.reload_doc('hr', 'doctype', 'employee_health_insurance')
diff --git a/erpnext/patches/v11_0/rename_healthcare_doctype_and_fields.py b/erpnext/patches/v11_0/rename_healthcare_doctype_and_fields.py
index 9705681..7a8c52f 100644
--- a/erpnext/patches/v11_0/rename_healthcare_doctype_and_fields.py
+++ b/erpnext/patches/v11_0/rename_healthcare_doctype_and_fields.py
@@ -1,7 +1,8 @@
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
-from frappe.modules import scrub, get_doctype_module
+from frappe.modules import get_doctype_module, scrub
field_rename_map = {
"Patient Encounter": [
diff --git a/erpnext/patches/v11_0/rename_healthcare_fields.py b/erpnext/patches/v11_0/rename_healthcare_fields.py
index 9aeb433..5c96367 100644
--- a/erpnext/patches/v11_0/rename_healthcare_fields.py
+++ b/erpnext/patches/v11_0/rename_healthcare_fields.py
@@ -1,7 +1,8 @@
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
-from frappe.modules import scrub, get_doctype_module
+from frappe.modules import get_doctype_module, scrub
lab_test_name = ["test_name", "lab_test_name"]
lab_test_code = ["test_code", "lab_test_code"]
diff --git a/erpnext/patches/v11_0/rename_members_with_naming_series.py b/erpnext/patches/v11_0/rename_members_with_naming_series.py
index 84f5518..a3d7970 100644
--- a/erpnext/patches/v11_0/rename_members_with_naming_series.py
+++ b/erpnext/patches/v11_0/rename_members_with_naming_series.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("non_profit", "doctype", "member")
old_named_members = frappe.get_all("Member", filters = {"name": ("not like", "MEM-%")})
diff --git a/erpnext/patches/v11_0/rename_overproduction_percent_field.py b/erpnext/patches/v11_0/rename_overproduction_percent_field.py
index fbf925d..c7124af 100644
--- a/erpnext/patches/v11_0/rename_overproduction_percent_field.py
+++ b/erpnext/patches/v11_0/rename_overproduction_percent_field.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-from frappe.model.utils.rename_field import rename_field
+
import frappe
+from frappe.model.utils.rename_field import rename_field
+
def execute():
frappe.reload_doc('manufacturing', 'doctype', 'manufacturing_settings')
diff --git a/erpnext/patches/v11_0/rename_production_order_to_work_order.py b/erpnext/patches/v11_0/rename_production_order_to_work_order.py
index 2f620f4..995f1af 100644
--- a/erpnext/patches/v11_0/rename_production_order_to_work_order.py
+++ b/erpnext/patches/v11_0/rename_production_order_to_work_order.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
frappe.rename_doc('DocType', 'Production Order', 'Work Order', force=True)
frappe.reload_doc('manufacturing', 'doctype', 'work_order')
diff --git a/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py
index c4b3838..2e53fb8 100644
--- a/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py
+++ b/erpnext/patches/v11_0/rename_supplier_type_to_supplier_group.py
@@ -1,9 +1,11 @@
from __future__ import unicode_literals
+
import frappe
-from frappe.model.utils.rename_field import rename_field
from frappe import _
+from frappe.model.utils.rename_field import rename_field
from frappe.utils.nestedset import rebuild_tree
+
def execute():
if frappe.db.table_exists("Supplier Group"):
frappe.reload_doc('setup', 'doctype', 'supplier_group')
diff --git a/erpnext/patches/v11_0/renamed_from_to_fields_in_project.py b/erpnext/patches/v11_0/renamed_from_to_fields_in_project.py
index d5ca4cc..894aaee 100644
--- a/erpnext/patches/v11_0/renamed_from_to_fields_in_project.py
+++ b/erpnext/patches/v11_0/renamed_from_to_fields_in_project.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
frappe.reload_doc('projects', 'doctype', 'project')
diff --git a/erpnext/patches/v11_0/reset_publish_in_hub_for_all_items.py b/erpnext/patches/v11_0/reset_publish_in_hub_for_all_items.py
index 56e95e0..a664baf 100644
--- a/erpnext/patches/v11_0/reset_publish_in_hub_for_all_items.py
+++ b/erpnext/patches/v11_0/reset_publish_in_hub_for_all_items.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('stock', 'doctype', 'item')
frappe.db.sql("""update `tabItem` set publish_in_hub = 0""")
diff --git a/erpnext/patches/v11_0/set_default_email_template_in_hr.py b/erpnext/patches/v11_0/set_default_email_template_in_hr.py
index 4622376..ff75424 100644
--- a/erpnext/patches/v11_0/set_default_email_template_in_hr.py
+++ b/erpnext/patches/v11_0/set_default_email_template_in_hr.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
-from frappe import _
+
import frappe
+from frappe import _
+
def execute():
hr_settings = frappe.get_single("HR Settings")
diff --git a/erpnext/patches/v11_0/set_department_for_doctypes.py b/erpnext/patches/v11_0/set_department_for_doctypes.py
index 175d2a1..c969965 100644
--- a/erpnext/patches/v11_0/set_department_for_doctypes.py
+++ b/erpnext/patches/v11_0/set_department_for_doctypes.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
import frappe
# Set department value based on employee value
diff --git a/erpnext/patches/v11_0/set_missing_gst_hsn_code.py b/erpnext/patches/v11_0/set_missing_gst_hsn_code.py
index 8f8a545..7a0a989 100644
--- a/erpnext/patches/v11_0/set_missing_gst_hsn_code.py
+++ b/erpnext/patches/v11_0/set_missing_gst_hsn_code.py
@@ -1,7 +1,10 @@
from __future__ import unicode_literals
+
import frappe
+
from erpnext.controllers.taxes_and_totals import get_itemised_tax_breakup_html
+
def execute():
company = frappe.db.sql_list("select name from tabCompany where country = 'India'")
if not company:
diff --git a/erpnext/patches/v11_0/set_salary_component_properties.py b/erpnext/patches/v11_0/set_salary_component_properties.py
index d8ce31f..b70dc35 100644
--- a/erpnext/patches/v11_0/set_salary_component_properties.py
+++ b/erpnext/patches/v11_0/set_salary_component_properties.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('Payroll', 'doctype', 'salary_detail')
frappe.reload_doc('Payroll', 'doctype', 'salary_component')
diff --git a/erpnext/patches/v11_0/set_update_field_and_value_in_workflow_state.py b/erpnext/patches/v11_0/set_update_field_and_value_in_workflow_state.py
index d0cabb3..da4d4bd 100644
--- a/erpnext/patches/v11_0/set_update_field_and_value_in_workflow_state.py
+++ b/erpnext/patches/v11_0/set_update_field_and_value_in_workflow_state.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.model.workflow import get_workflow_name
+
def execute():
for doctype in ['Expense Claim', 'Leave Application']:
diff --git a/erpnext/patches/v11_0/set_user_permissions_for_department.py b/erpnext/patches/v11_0/set_user_permissions_for_department.py
index 2f90f14..7840d5e 100644
--- a/erpnext/patches/v11_0/set_user_permissions_for_department.py
+++ b/erpnext/patches/v11_0/set_user_permissions_for_department.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
user_permissions = frappe.db.sql("""select name, for_value from `tabUser Permission`
where allow='Department'""", as_dict=1)
diff --git a/erpnext/patches/v11_0/skip_user_permission_check_for_department.py b/erpnext/patches/v11_0/skip_user_permission_check_for_department.py
index 4e72917..66d1b6b 100644
--- a/erpnext/patches/v11_0/skip_user_permission_check_for_department.py
+++ b/erpnext/patches/v11_0/skip_user_permission_check_for_department.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
import frappe
from frappe.desk.form.linked_with import get_linked_doctypes
diff --git a/erpnext/patches/v11_0/uom_conversion_data.py b/erpnext/patches/v11_0/uom_conversion_data.py
index 91470b3..a408d86 100644
--- a/erpnext/patches/v11_0/uom_conversion_data.py
+++ b/erpnext/patches/v11_0/uom_conversion_data.py
@@ -1,5 +1,7 @@
from __future__ import unicode_literals
-import frappe, json
+
+import frappe
+
def execute():
from erpnext.setup.setup_wizard.operations.install_fixtures import add_uom_data
diff --git a/erpnext/patches/v11_0/update_account_type_in_party_type.py b/erpnext/patches/v11_0/update_account_type_in_party_type.py
index dabaeff..e51874f 100644
--- a/erpnext/patches/v11_0/update_account_type_in_party_type.py
+++ b/erpnext/patches/v11_0/update_account_type_in_party_type.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('setup', 'doctype', 'party_type')
party_types = {'Customer': 'Receivable', 'Supplier': 'Payable',
diff --git a/erpnext/patches/v11_0/update_allow_transfer_for_manufacture.py b/erpnext/patches/v11_0/update_allow_transfer_for_manufacture.py
index 799e91a..bfcfc9f 100644
--- a/erpnext/patches/v11_0/update_allow_transfer_for_manufacture.py
+++ b/erpnext/patches/v11_0/update_allow_transfer_for_manufacture.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('stock', 'doctype', 'item')
frappe.db.sql(""" update `tabItem` set include_item_in_manufacturing = 1
diff --git a/erpnext/patches/v11_0/update_backflush_subcontract_rm_based_on_bom.py b/erpnext/patches/v11_0/update_backflush_subcontract_rm_based_on_bom.py
index 37a616c..c3b18bd 100644
--- a/erpnext/patches/v11_0/update_backflush_subcontract_rm_based_on_bom.py
+++ b/erpnext/patches/v11_0/update_backflush_subcontract_rm_based_on_bom.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('buying', 'doctype', 'buying_settings')
frappe.db.set_value('Buying Settings', None, 'backflush_raw_materials_of_subcontract_based_on', 'BOM')
diff --git a/erpnext/patches/v11_0/update_brand_in_item_price.py b/erpnext/patches/v11_0/update_brand_in_item_price.py
index 977d84f..a489378 100644
--- a/erpnext/patches/v11_0/update_brand_in_item_price.py
+++ b/erpnext/patches/v11_0/update_brand_in_item_price.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('stock', 'doctype', 'item_price')
diff --git a/erpnext/patches/v11_0/update_delivery_trip_status.py b/erpnext/patches/v11_0/update_delivery_trip_status.py
index 42f017e..da25958 100755
--- a/erpnext/patches/v11_0/update_delivery_trip_status.py
+++ b/erpnext/patches/v11_0/update_delivery_trip_status.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('setup', 'doctype', 'global_defaults', force=True)
frappe.reload_doc('stock', 'doctype', 'delivery_trip')
diff --git a/erpnext/patches/v11_0/update_department_lft_rgt.py b/erpnext/patches/v11_0/update_department_lft_rgt.py
index 2b38203..f7ecf6e 100644
--- a/erpnext/patches/v11_0/update_department_lft_rgt.py
+++ b/erpnext/patches/v11_0/update_department_lft_rgt.py
@@ -4,6 +4,7 @@
from frappe import _
from frappe.utils.nestedset import rebuild_tree
+
def execute():
""" assign lft and rgt appropriately """
frappe.reload_doc("hr", "doctype", "department")
diff --git a/erpnext/patches/v11_0/update_hub_url.py b/erpnext/patches/v11_0/update_hub_url.py
index 6c6ca3c..c89b9b5 100644
--- a/erpnext/patches/v11_0/update_hub_url.py
+++ b/erpnext/patches/v11_0/update_hub_url.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('hub_node', 'doctype', 'Marketplace Settings')
frappe.db.set_value('Marketplace Settings', 'Marketplace Settings', 'marketplace_url', 'https://hubmarket.org')
diff --git a/erpnext/patches/v11_0/update_sales_partner_type.py b/erpnext/patches/v11_0/update_sales_partner_type.py
index b393926..1369805 100644
--- a/erpnext/patches/v11_0/update_sales_partner_type.py
+++ b/erpnext/patches/v11_0/update_sales_partner_type.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute():
from erpnext.setup.setup_wizard.operations.install_fixtures import default_sales_partner_type
diff --git a/erpnext/patches/v11_0/update_total_qty_field.py b/erpnext/patches/v11_0/update_total_qty_field.py
index 9407256..e79a5f9 100644
--- a/erpnext/patches/v11_0/update_total_qty_field.py
+++ b/erpnext/patches/v11_0/update_total_qty_field.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('buying', 'doctype', 'purchase_order')
frappe.reload_doc('buying', 'doctype', 'supplier_quotation')
diff --git a/erpnext/patches/v11_1/delete_bom_browser.py b/erpnext/patches/v11_1/delete_bom_browser.py
index 2892674..aad3df2 100644
--- a/erpnext/patches/v11_1/delete_bom_browser.py
+++ b/erpnext/patches/v11_1/delete_bom_browser.py
@@ -2,7 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.delete_doc_if_exists('Page', 'bom-browser')
diff --git a/erpnext/patches/v11_1/delete_scheduling_tool.py b/erpnext/patches/v11_1/delete_scheduling_tool.py
index b7ad28a..56d0dbf 100644
--- a/erpnext/patches/v11_1/delete_scheduling_tool.py
+++ b/erpnext/patches/v11_1/delete_scheduling_tool.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
if frappe.db.exists("DocType", "Scheduling Tool"):
frappe.delete_doc("DocType", "Scheduling Tool", ignore_permissions=True)
diff --git a/erpnext/patches/v11_1/make_job_card_time_logs.py b/erpnext/patches/v11_1/make_job_card_time_logs.py
index b706e5c..db0c345 100644
--- a/erpnext/patches/v11_1/make_job_card_time_logs.py
+++ b/erpnext/patches/v11_1/make_job_card_time_logs.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('manufacturing', 'doctype', 'job_card_time_log')
diff --git a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py
index fc3ec74..9ea6cd8 100644
--- a/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py
+++ b/erpnext/patches/v11_1/move_customer_lead_to_dynamic_column.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doctype("Quotation")
frappe.db.sql(""" UPDATE `tabQuotation` set party_name = lead WHERE quotation_to = 'Lead' """)
diff --git a/erpnext/patches/v11_1/rename_depends_on_lwp.py b/erpnext/patches/v11_1/rename_depends_on_lwp.py
index 4c4b14f..95a8225 100644
--- a/erpnext/patches/v11_1/rename_depends_on_lwp.py
+++ b/erpnext/patches/v11_1/rename_depends_on_lwp.py
@@ -2,10 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import scrub
from frappe.model.utils.rename_field import rename_field
+
def execute():
for doctype in ("Salary Component", "Salary Detail"):
if "depends_on_lwp" in frappe.db.get_table_columns(doctype):
diff --git a/erpnext/patches/v11_1/renamed_delayed_item_report.py b/erpnext/patches/v11_1/renamed_delayed_item_report.py
index 8e8725c..2128563 100644
--- a/erpnext/patches/v11_1/renamed_delayed_item_report.py
+++ b/erpnext/patches/v11_1/renamed_delayed_item_report.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
for report in ["Delayed Order Item Summary", "Delayed Order Summary"]:
if frappe.db.exists("Report", report):
diff --git a/erpnext/patches/v11_1/set_default_action_for_quality_inspection.py b/erpnext/patches/v11_1/set_default_action_for_quality_inspection.py
index b13239f..4325490 100644
--- a/erpnext/patches/v11_1/set_default_action_for_quality_inspection.py
+++ b/erpnext/patches/v11_1/set_default_action_for_quality_inspection.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
stock_settings = frappe.get_doc('Stock Settings')
if stock_settings.default_warehouse and not frappe.db.exists("Warehouse", stock_settings.default_warehouse):
diff --git a/erpnext/patches/v11_1/set_missing_opportunity_from.py b/erpnext/patches/v11_1/set_missing_opportunity_from.py
index cb444b2..6569200 100644
--- a/erpnext/patches/v11_1/set_missing_opportunity_from.py
+++ b/erpnext/patches/v11_1/set_missing_opportunity_from.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doctype("Opportunity")
diff --git a/erpnext/patches/v11_1/set_missing_title_for_quotation.py b/erpnext/patches/v11_1/set_missing_title_for_quotation.py
index e2ef343..93d9f0e 100644
--- a/erpnext/patches/v11_1/set_missing_title_for_quotation.py
+++ b/erpnext/patches/v11_1/set_missing_title_for_quotation.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
frappe.reload_doctype("Quotation")
# update customer_name from Customer document if quotation_to is set to Customer
diff --git a/erpnext/patches/v11_1/set_salary_details_submittable.py b/erpnext/patches/v11_1/set_salary_details_submittable.py
index 6d847ec..4a4cf30 100644
--- a/erpnext/patches/v11_1/set_salary_details_submittable.py
+++ b/erpnext/patches/v11_1/set_salary_details_submittable.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.db.sql("""
update `tabSalary Structure` ss, `tabSalary Detail` sd
diff --git a/erpnext/patches/v11_1/set_status_for_material_request_type_manufacture.py b/erpnext/patches/v11_1/set_status_for_material_request_type_manufacture.py
index ec01fbb..64db97e 100644
--- a/erpnext/patches/v11_1/set_status_for_material_request_type_manufacture.py
+++ b/erpnext/patches/v11_1/set_status_for_material_request_type_manufacture.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.db.sql("""
update `tabMaterial Request`
diff --git a/erpnext/patches/v11_1/set_variant_based_on.py b/erpnext/patches/v11_1/set_variant_based_on.py
index 49a9a17..b69767d 100644
--- a/erpnext/patches/v11_1/set_variant_based_on.py
+++ b/erpnext/patches/v11_1/set_variant_based_on.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.db.sql("""update tabItem set variant_based_on = 'Item Attribute'
where ifnull(variant_based_on, '') = ''
diff --git a/erpnext/patches/v11_1/setup_guardian_role.py b/erpnext/patches/v11_1/setup_guardian_role.py
index 6ccfed9..bb33f19 100644
--- a/erpnext/patches/v11_1/setup_guardian_role.py
+++ b/erpnext/patches/v11_1/setup_guardian_role.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
if 'Education' in frappe.get_active_domains() and not frappe.db.exists("Role", "Guardian"):
doc = frappe.new_doc("Role")
diff --git a/erpnext/patches/v11_1/update_bank_transaction_status.py b/erpnext/patches/v11_1/update_bank_transaction_status.py
index 354e636..33007af 100644
--- a/erpnext/patches/v11_1/update_bank_transaction_status.py
+++ b/erpnext/patches/v11_1/update_bank_transaction_status.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("accounts", "doctype", "bank_transaction")
diff --git a/erpnext/patches/v11_1/update_default_supplier_in_item_defaults.py b/erpnext/patches/v11_1/update_default_supplier_in_item_defaults.py
index 8c360ad..22dabae 100644
--- a/erpnext/patches/v11_1/update_default_supplier_in_item_defaults.py
+++ b/erpnext/patches/v11_1/update_default_supplier_in_item_defaults.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
'''
default supplier was not set in the item defaults for multi company instance,
diff --git a/erpnext/patches/v11_1/woocommerce_set_creation_user.py b/erpnext/patches/v11_1/woocommerce_set_creation_user.py
index 074b904..e7218b1 100644
--- a/erpnext/patches/v11_1/woocommerce_set_creation_user.py
+++ b/erpnext/patches/v11_1/woocommerce_set_creation_user.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.utils import cint
+
def execute():
frappe.reload_doc("erpnext_integrations", "doctype","woocommerce_settings")
doc = frappe.get_doc("Woocommerce Settings")
diff --git a/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py b/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py
index 855d21d..384a1f5 100644
--- a/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py
+++ b/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py
@@ -6,6 +6,7 @@
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
frappe.reload_doc("setup", "doctype", "company")
if frappe.db.has_column('Company', 'default_terms'):
diff --git a/erpnext/patches/v12_0/add_document_type_field_for_italy_einvoicing.py b/erpnext/patches/v12_0/add_document_type_field_for_italy_einvoicing.py
index 6fe578d..7f39dfe 100644
--- a/erpnext/patches/v12_0/add_document_type_field_for_italy_einvoicing.py
+++ b/erpnext/patches/v12_0/add_document_type_field_for_italy_einvoicing.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
-from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+
import frappe
+from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'Italy'})
diff --git a/erpnext/patches/v12_0/add_eway_bill_in_delivery_note.py b/erpnext/patches/v12_0/add_eway_bill_in_delivery_note.py
index cf1ed36..973da89 100644
--- a/erpnext/patches/v12_0/add_eway_bill_in_delivery_note.py
+++ b/erpnext/patches/v12_0/add_eway_bill_in_delivery_note.py
@@ -1,6 +1,7 @@
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
diff --git a/erpnext/patches/v12_0/add_export_type_field_in_party_master.py b/erpnext/patches/v12_0/add_export_type_field_in_party_master.py
index a0b1f87..e05c821 100644
--- a/erpnext/patches/v12_0/add_export_type_field_in_party_master.py
+++ b/erpnext/patches/v12_0/add_export_type_field_in_party_master.py
@@ -1,7 +1,10 @@
from __future__ import unicode_literals
+
import frappe
+
from erpnext.regional.india.setup import make_custom_fields
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
diff --git a/erpnext/patches/v12_0/add_gst_category_in_delivery_note.py b/erpnext/patches/v12_0/add_gst_category_in_delivery_note.py
index c908192..30e47cb 100644
--- a/erpnext/patches/v12_0/add_gst_category_in_delivery_note.py
+++ b/erpnext/patches/v12_0/add_gst_category_in_delivery_note.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
diff --git a/erpnext/patches/v12_0/add_permission_in_lower_deduction.py b/erpnext/patches/v12_0/add_permission_in_lower_deduction.py
index 2e42368..1d77e5a 100644
--- a/erpnext/patches/v12_0/add_permission_in_lower_deduction.py
+++ b/erpnext/patches/v12_0/add_permission_in_lower_deduction.py
@@ -1,6 +1,7 @@
import frappe
from frappe.permissions import add_permission, update_permission_property
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
diff --git a/erpnext/patches/v12_0/add_state_code_for_ladakh.py b/erpnext/patches/v12_0/add_state_code_for_ladakh.py
index 29a7b4b..6722b7b 100644
--- a/erpnext/patches/v12_0/add_state_code_for_ladakh.py
+++ b/erpnext/patches/v12_0/add_state_code_for_ladakh.py
@@ -1,6 +1,8 @@
import frappe
+
from erpnext.regional.india import states
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
diff --git a/erpnext/patches/v12_0/add_taxjar_integration_field.py b/erpnext/patches/v12_0/add_taxjar_integration_field.py
index 4c823e1..d10a6d7 100644
--- a/erpnext/patches/v12_0/add_taxjar_integration_field.py
+++ b/erpnext/patches/v12_0/add_taxjar_integration_field.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals
import frappe
+
from erpnext.regional.united_states.setup import make_custom_fields
diff --git a/erpnext/patches/v12_0/add_variant_of_in_item_attribute_table.py b/erpnext/patches/v12_0/add_variant_of_in_item_attribute_table.py
index 893f7a4..c3a422c 100644
--- a/erpnext/patches/v12_0/add_variant_of_in_item_attribute_table.py
+++ b/erpnext/patches/v12_0/add_variant_of_in_item_attribute_table.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
frappe.reload_doc('stock', 'doctype', 'item_variant_attribute')
frappe.db.sql('''
diff --git a/erpnext/patches/v12_0/create_accounting_dimensions_in_missing_doctypes.py b/erpnext/patches/v12_0/create_accounting_dimensions_in_missing_doctypes.py
index f171542..02fbe62 100644
--- a/erpnext/patches/v12_0/create_accounting_dimensions_in_missing_doctypes.py
+++ b/erpnext/patches/v12_0/create_accounting_dimensions_in_missing_doctypes.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
+
def execute():
frappe.reload_doc('accounts', 'doctype', 'accounting_dimension')
diff --git a/erpnext/patches/v12_0/create_default_energy_point_rules.py b/erpnext/patches/v12_0/create_default_energy_point_rules.py
index 93d2576..35eaca7 100644
--- a/erpnext/patches/v12_0/create_default_energy_point_rules.py
+++ b/erpnext/patches/v12_0/create_default_energy_point_rules.py
@@ -1,6 +1,8 @@
import frappe
+
from erpnext.setup.install import create_default_energy_point_rules
+
def execute():
frappe.reload_doc('social', 'doctype', 'energy_point_rule')
create_default_energy_point_rules()
diff --git a/erpnext/patches/v12_0/create_irs_1099_field_united_states.py b/erpnext/patches/v12_0/create_irs_1099_field_united_states.py
index 23a8f24..65265c4 100644
--- a/erpnext/patches/v12_0/create_irs_1099_field_united_states.py
+++ b/erpnext/patches/v12_0/create_irs_1099_field_united_states.py
@@ -1,7 +1,10 @@
from __future__ import unicode_literals
+
import frappe
+
from erpnext.regional.united_states.setup import make_custom_fields
+
def execute():
frappe.reload_doc('accounts', 'doctype', 'allowed_to_transact_with', force=True)
diff --git a/erpnext/patches/v12_0/create_itc_reversal_custom_fields.py b/erpnext/patches/v12_0/create_itc_reversal_custom_fields.py
index a6230f4..9267ebf 100644
--- a/erpnext/patches/v12_0/create_itc_reversal_custom_fields.py
+++ b/erpnext/patches/v12_0/create_itc_reversal_custom_fields.py
@@ -1,9 +1,12 @@
from __future__ import unicode_literals
+
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
+
from erpnext.regional.india.utils import get_gst_accounts
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'}, fields=['name'])
if not company:
diff --git a/erpnext/patches/v12_0/create_taxable_value_field.py b/erpnext/patches/v12_0/create_taxable_value_field.py
index b9ee81d..40de8d8 100644
--- a/erpnext/patches/v12_0/create_taxable_value_field.py
+++ b/erpnext/patches/v12_0/create_taxable_value_field.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
diff --git a/erpnext/patches/v12_0/delete_priority_property_setter.py b/erpnext/patches/v12_0/delete_priority_property_setter.py
index 1638557..cacc463 100644
--- a/erpnext/patches/v12_0/delete_priority_property_setter.py
+++ b/erpnext/patches/v12_0/delete_priority_property_setter.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
frappe.db.sql("""
DELETE FROM `tabProperty Setter`
diff --git a/erpnext/patches/v12_0/fix_percent_complete_for_projects.py b/erpnext/patches/v12_0/fix_percent_complete_for_projects.py
index 3622df6..36f51bc 100644
--- a/erpnext/patches/v12_0/fix_percent_complete_for_projects.py
+++ b/erpnext/patches/v12_0/fix_percent_complete_for_projects.py
@@ -1,6 +1,7 @@
import frappe
from frappe.utils import flt
+
def execute():
for project in frappe.get_all("Project", fields=["name", "percent_complete_method"]):
total = frappe.db.count('Task', dict(project=project.name))
diff --git a/erpnext/patches/v12_0/fix_quotation_expired_status.py b/erpnext/patches/v12_0/fix_quotation_expired_status.py
index ac7e82d..e5c4b8c 100644
--- a/erpnext/patches/v12_0/fix_quotation_expired_status.py
+++ b/erpnext/patches/v12_0/fix_quotation_expired_status.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
# fixes status of quotations which have status 'Expired' despite having valid sales order created
diff --git a/erpnext/patches/v12_0/generate_leave_ledger_entries.py b/erpnext/patches/v12_0/generate_leave_ledger_entries.py
index fe072d7..aed56d6 100644
--- a/erpnext/patches/v12_0/generate_leave_ledger_entries.py
+++ b/erpnext/patches/v12_0/generate_leave_ledger_entries.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.utils import getdate, today
+
def execute():
""" Generates leave ledger entries for leave allocation/application/encashment
for last allocation """
diff --git a/erpnext/patches/v12_0/make_item_manufacturer.py b/erpnext/patches/v12_0/make_item_manufacturer.py
index ebc2832..cfc2472 100644
--- a/erpnext/patches/v12_0/make_item_manufacturer.py
+++ b/erpnext/patches/v12_0/make_item_manufacturer.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("stock", "doctype", "item_manufacturer")
diff --git a/erpnext/patches/v12_0/move_bank_account_swift_number_to_bank.py b/erpnext/patches/v12_0/move_bank_account_swift_number_to_bank.py
index a670ade..3e9d429 100644
--- a/erpnext/patches/v12_0/move_bank_account_swift_number_to_bank.py
+++ b/erpnext/patches/v12_0/move_bank_account_swift_number_to_bank.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('accounts', 'doctype', 'bank', force=1)
diff --git a/erpnext/patches/v12_0/move_credit_limit_to_customer_credit_limit.py b/erpnext/patches/v12_0/move_credit_limit_to_customer_credit_limit.py
index c9293b9..2662632 100644
--- a/erpnext/patches/v12_0/move_credit_limit_to_customer_credit_limit.py
+++ b/erpnext/patches/v12_0/move_credit_limit_to_customer_credit_limit.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
''' Move credit limit and bypass credit limit to the child table of customer credit limit '''
frappe.reload_doc("Selling", "doctype", "Customer Credit Limit")
diff --git a/erpnext/patches/v12_0/move_due_advance_amount_to_pending_amount.py b/erpnext/patches/v12_0/move_due_advance_amount_to_pending_amount.py
index 6013eaa..55f5cd5 100644
--- a/erpnext/patches/v12_0/move_due_advance_amount_to_pending_amount.py
+++ b/erpnext/patches/v12_0/move_due_advance_amount_to_pending_amount.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
''' Move from due_advance_amount to pending_amount '''
diff --git a/erpnext/patches/v12_0/move_item_tax_to_item_tax_template.py b/erpnext/patches/v12_0/move_item_tax_to_item_tax_template.py
index 5c3fa59..677a564 100644
--- a/erpnext/patches/v12_0/move_item_tax_to_item_tax_template.py
+++ b/erpnext/patches/v12_0/move_item_tax_to_item_tax_template.py
@@ -1,7 +1,9 @@
-import frappe
import json
-from six import iteritems
+
+import frappe
from frappe.model.naming import make_autoname
+from six import iteritems
+
def execute():
if "tax_type" not in frappe.db.get_table_columns("Item Tax"):
diff --git a/erpnext/patches/v12_0/move_plaid_settings_to_doctype.py b/erpnext/patches/v12_0/move_plaid_settings_to_doctype.py
index d2bcb12..dafea28 100644
--- a/erpnext/patches/v12_0/move_plaid_settings_to_doctype.py
+++ b/erpnext/patches/v12_0/move_plaid_settings_to_doctype.py
@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
diff --git a/erpnext/patches/v12_0/move_target_distribution_from_parent_to_child.py b/erpnext/patches/v12_0/move_target_distribution_from_parent_to_child.py
index 97badf3..72f4df5 100644
--- a/erpnext/patches/v12_0/move_target_distribution_from_parent_to_child.py
+++ b/erpnext/patches/v12_0/move_target_distribution_from_parent_to_child.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("setup", "doctype", "target_detail")
diff --git a/erpnext/patches/v12_0/recalculate_requested_qty_in_bin.py b/erpnext/patches/v12_0/recalculate_requested_qty_in_bin.py
index 46794be..a19e9a9 100644
--- a/erpnext/patches/v12_0/recalculate_requested_qty_in_bin.py
+++ b/erpnext/patches/v12_0/recalculate_requested_qty_in_bin.py
@@ -1,6 +1,9 @@
from __future__ import unicode_literals
+
import frappe
-from erpnext.stock.stock_balance import update_bin_qty, get_indented_qty
+
+from erpnext.stock.stock_balance import get_indented_qty, update_bin_qty
+
def execute():
bin_details = frappe.db.sql("""
diff --git a/erpnext/patches/v12_0/remove_bank_remittance_custom_fields.py b/erpnext/patches/v12_0/remove_bank_remittance_custom_fields.py
index be884f9..fba4118 100644
--- a/erpnext/patches/v12_0/remove_bank_remittance_custom_fields.py
+++ b/erpnext/patches/v12_0/remove_bank_remittance_custom_fields.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals
+
import frappe
-from erpnext.regional.india.setup import make_custom_fields
+
def execute():
frappe.reload_doc("accounts", "doctype", "tax_category")
diff --git a/erpnext/patches/v12_0/remove_denied_leaves_from_leave_ledger.py b/erpnext/patches/v12_0/remove_denied_leaves_from_leave_ledger.py
index 4fcffb7..f6a1984 100644
--- a/erpnext/patches/v12_0/remove_denied_leaves_from_leave_ledger.py
+++ b/erpnext/patches/v12_0/remove_denied_leaves_from_leave_ledger.py
@@ -2,8 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import getdate, today
+
def execute():
''' Delete leave ledger entry created
diff --git a/erpnext/patches/v12_0/remove_duplicate_leave_ledger_entries.py b/erpnext/patches/v12_0/remove_duplicate_leave_ledger_entries.py
index 6b1b601..6fa1c04 100644
--- a/erpnext/patches/v12_0/remove_duplicate_leave_ledger_entries.py
+++ b/erpnext/patches/v12_0/remove_duplicate_leave_ledger_entries.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
"""Delete duplicate leave ledger entries of type allocation created."""
frappe.reload_doc('hr', 'doctype', 'leave_ledger_entry')
diff --git a/erpnext/patches/v12_0/remove_patient_medical_record_page.py b/erpnext/patches/v12_0/remove_patient_medical_record_page.py
index 904bfe4..bf71c48 100644
--- a/erpnext/patches/v12_0/remove_patient_medical_record_page.py
+++ b/erpnext/patches/v12_0/remove_patient_medical_record_page.py
@@ -1,7 +1,9 @@
# Copyright (c) 2019
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.delete_doc("Page", "medical_record")
diff --git a/erpnext/patches/v12_0/rename_account_type_doctype.py b/erpnext/patches/v12_0/rename_account_type_doctype.py
index 9a08ad4..27357a8 100644
--- a/erpnext/patches/v12_0/rename_account_type_doctype.py
+++ b/erpnext/patches/v12_0/rename_account_type_doctype.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.rename_doc('DocType', 'Account Type', 'Bank Account Type', force=True)
frappe.rename_doc('DocType', 'Account Subtype', 'Bank Account Subtype', force=True)
diff --git a/erpnext/patches/v12_0/rename_bank_account_field_in_journal_entry_account.py b/erpnext/patches/v12_0/rename_bank_account_field_in_journal_entry_account.py
index 7489ea3..7e02fff 100644
--- a/erpnext/patches/v12_0/rename_bank_account_field_in_journal_entry_account.py
+++ b/erpnext/patches/v12_0/rename_bank_account_field_in_journal_entry_account.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
''' Change the fieldname from bank_account_no to bank_account '''
if not frappe.get_meta("Journal Entry Account").has_field("bank_account"):
diff --git a/erpnext/patches/v12_0/rename_bank_reconciliation.py b/erpnext/patches/v12_0/rename_bank_reconciliation.py
index 2efa854..5c79ce2 100644
--- a/erpnext/patches/v12_0/rename_bank_reconciliation.py
+++ b/erpnext/patches/v12_0/rename_bank_reconciliation.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
if frappe.db.table_exists("Bank Reconciliation"):
frappe.rename_doc('DocType', 'Bank Reconciliation', 'Bank Clearance', force=True)
diff --git a/erpnext/patches/v12_0/rename_bank_reconciliation_fields.py b/erpnext/patches/v12_0/rename_bank_reconciliation_fields.py
index 978b1c9..629cd5b 100644
--- a/erpnext/patches/v12_0/rename_bank_reconciliation_fields.py
+++ b/erpnext/patches/v12_0/rename_bank_reconciliation_fields.py
@@ -3,6 +3,7 @@
import frappe
+
def _rename_single_field(**kwargs):
count = frappe.db.sql("SELECT COUNT(*) FROM tabSingles WHERE doctype='{doctype}' AND field='{new_name}';".format(**kwargs))[0][0] #nosec
if count == 0:
diff --git a/erpnext/patches/v12_0/rename_lost_reason_detail.py b/erpnext/patches/v12_0/rename_lost_reason_detail.py
index c71b91c..337302a 100644
--- a/erpnext/patches/v12_0/rename_lost_reason_detail.py
+++ b/erpnext/patches/v12_0/rename_lost_reason_detail.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
if frappe.db.exists("DocType", "Lost Reason Detail"):
frappe.reload_doc("crm", "doctype", "opportunity_lost_reason")
diff --git a/erpnext/patches/v12_0/rename_mws_settings_fields.py b/erpnext/patches/v12_0/rename_mws_settings_fields.py
index e08e376..d5bf38d 100644
--- a/erpnext/patches/v12_0/rename_mws_settings_fields.py
+++ b/erpnext/patches/v12_0/rename_mws_settings_fields.py
@@ -3,6 +3,7 @@
import frappe
+
def execute():
count = frappe.db.sql("SELECT COUNT(*) FROM `tabSingles` WHERE doctype='Amazon MWS Settings' AND field='enable_sync';")[0][0]
if count == 0:
diff --git a/erpnext/patches/v12_0/rename_pos_closing_doctype.py b/erpnext/patches/v12_0/rename_pos_closing_doctype.py
index 9d8626b..e6fb1f3 100644
--- a/erpnext/patches/v12_0/rename_pos_closing_doctype.py
+++ b/erpnext/patches/v12_0/rename_pos_closing_doctype.py
@@ -1,8 +1,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
if frappe.db.table_exists("POS Closing Voucher"):
if not frappe.db.exists("DocType", "POS Closing Entry"):
diff --git a/erpnext/patches/v12_0/rename_pricing_rule_child_doctypes.py b/erpnext/patches/v12_0/rename_pricing_rule_child_doctypes.py
index b9ad622..4bf3840 100644
--- a/erpnext/patches/v12_0/rename_pricing_rule_child_doctypes.py
+++ b/erpnext/patches/v12_0/rename_pricing_rule_child_doctypes.py
@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
doctypes = {
diff --git a/erpnext/patches/v12_0/rename_tolerance_fields.py b/erpnext/patches/v12_0/rename_tolerance_fields.py
index 20b0963..ca2427b 100644
--- a/erpnext/patches/v12_0/rename_tolerance_fields.py
+++ b/erpnext/patches/v12_0/rename_tolerance_fields.py
@@ -1,6 +1,7 @@
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
frappe.reload_doc("stock", "doctype", "item")
frappe.reload_doc("stock", "doctype", "stock_settings")
diff --git a/erpnext/patches/v12_0/replace_accounting_with_accounts_in_home_settings.py b/erpnext/patches/v12_0/replace_accounting_with_accounts_in_home_settings.py
index f88a22f..ff332f7 100644
--- a/erpnext/patches/v12_0/replace_accounting_with_accounts_in_home_settings.py
+++ b/erpnext/patches/v12_0/replace_accounting_with_accounts_in_home_settings.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
frappe.db.sql("""UPDATE `tabUser` SET `home_settings` = REPLACE(`home_settings`, 'Accounting', 'Accounts')""")
frappe.cache().delete_key('home_settings')
diff --git a/erpnext/patches/v12_0/repost_stock_ledger_entries_for_target_warehouse.py b/erpnext/patches/v12_0/repost_stock_ledger_entries_for_target_warehouse.py
index c52f380..5150430 100644
--- a/erpnext/patches/v12_0/repost_stock_ledger_entries_for_target_warehouse.py
+++ b/erpnext/patches/v12_0/repost_stock_ledger_entries_for_target_warehouse.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
warehouse_perm = frappe.get_all("User Permission",
fields=["count(*) as p_count", "is_default", "user"], filters={"allow": "Warehouse"}, group_by="user")
diff --git a/erpnext/patches/v12_0/set_against_blanket_order_in_sales_and_purchase_order.py b/erpnext/patches/v12_0/set_against_blanket_order_in_sales_and_purchase_order.py
index 85202bf..b76e34a 100644
--- a/erpnext/patches/v12_0/set_against_blanket_order_in_sales_and_purchase_order.py
+++ b/erpnext/patches/v12_0/set_against_blanket_order_in_sales_and_purchase_order.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
frappe.reload_doc('selling', 'doctype', 'sales_order_item', force=True)
diff --git a/erpnext/patches/v12_0/set_automatically_process_deferred_accounting_in_accounts_settings.py b/erpnext/patches/v12_0/set_automatically_process_deferred_accounting_in_accounts_settings.py
index b5d7e3d..849e96e 100644
--- a/erpnext/patches/v12_0/set_automatically_process_deferred_accounting_in_accounts_settings.py
+++ b/erpnext/patches/v12_0/set_automatically_process_deferred_accounting_in_accounts_settings.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("accounts", "doctype", "accounts_settings")
diff --git a/erpnext/patches/v12_0/set_cost_center_in_child_table_of_expense_claim.py b/erpnext/patches/v12_0/set_cost_center_in_child_table_of_expense_claim.py
index 4415cfe..d3045a1 100644
--- a/erpnext/patches/v12_0/set_cost_center_in_child_table_of_expense_claim.py
+++ b/erpnext/patches/v12_0/set_cost_center_in_child_table_of_expense_claim.py
@@ -1,4 +1,6 @@
import frappe
+
+
def execute():
frappe.reload_doc('hr', 'doctype', 'expense_claim_detail')
frappe.db.sql("""
diff --git a/erpnext/patches/v12_0/set_cwip_and_delete_asset_settings.py b/erpnext/patches/v12_0/set_cwip_and_delete_asset_settings.py
index 13110df..e363c26 100644
--- a/erpnext/patches/v12_0/set_cwip_and_delete_asset_settings.py
+++ b/erpnext/patches/v12_0/set_cwip_and_delete_asset_settings.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
import frappe
from frappe.utils import cint
diff --git a/erpnext/patches/v12_0/set_default_homepage_type.py b/erpnext/patches/v12_0/set_default_homepage_type.py
index a290e31..1e4333a 100644
--- a/erpnext/patches/v12_0/set_default_homepage_type.py
+++ b/erpnext/patches/v12_0/set_default_homepage_type.py
@@ -1,4 +1,5 @@
import frappe
+
def execute():
frappe.db.set_value('Homepage', 'Homepage', 'hero_section_based_on', 'Default')
diff --git a/erpnext/patches/v12_0/set_default_payroll_based_on.py b/erpnext/patches/v12_0/set_default_payroll_based_on.py
index 038bd6d..85112f2 100644
--- a/erpnext/patches/v12_0/set_default_payroll_based_on.py
+++ b/erpnext/patches/v12_0/set_default_payroll_based_on.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("hr", "doctype", "hr_settings")
frappe.db.set_value("HR Settings", None, "payroll_based_on", "Leave")
diff --git a/erpnext/patches/v12_0/set_expense_account_in_landed_cost_voucher_taxes.py b/erpnext/patches/v12_0/set_expense_account_in_landed_cost_voucher_taxes.py
index a27c7b2..49b3bff 100644
--- a/erpnext/patches/v12_0/set_expense_account_in_landed_cost_voucher_taxes.py
+++ b/erpnext/patches/v12_0/set_expense_account_in_landed_cost_voucher_taxes.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from six import iteritems
+
def execute():
frappe.reload_doctype('Landed Cost Taxes and Charges')
diff --git a/erpnext/patches/v12_0/set_gst_category.py b/erpnext/patches/v12_0/set_gst_category.py
index cc09395..094e2a3 100644
--- a/erpnext/patches/v12_0/set_gst_category.py
+++ b/erpnext/patches/v12_0/set_gst_category.py
@@ -1,6 +1,8 @@
import frappe
+
from erpnext.regional.india.setup import make_custom_fields
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
diff --git a/erpnext/patches/v12_0/set_italian_import_supplier_invoice_permissions.py b/erpnext/patches/v12_0/set_italian_import_supplier_invoice_permissions.py
index 8fdc73b..a991b3c 100644
--- a/erpnext/patches/v12_0/set_italian_import_supplier_invoice_permissions.py
+++ b/erpnext/patches/v12_0/set_italian_import_supplier_invoice_permissions.py
@@ -2,9 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
from erpnext.regional.italy.setup import add_permissions
+
def execute():
countries = frappe.get_all("Company", fields="country")
countries = [country["country"] for country in countries]
diff --git a/erpnext/patches/v12_0/set_multi_uom_in_rfq.py b/erpnext/patches/v12_0/set_multi_uom_in_rfq.py
index a5c8f75..fada5f0 100644
--- a/erpnext/patches/v12_0/set_multi_uom_in_rfq.py
+++ b/erpnext/patches/v12_0/set_multi_uom_in_rfq.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import flt
-from erpnext.stock.get_item_details import get_conversion_factor
+
def execute():
frappe.reload_doc('buying', 'doctype', 'request_for_quotation_item')
diff --git a/erpnext/patches/v12_0/set_payment_entry_status.py b/erpnext/patches/v12_0/set_payment_entry_status.py
index 84645a3..f879295 100644
--- a/erpnext/patches/v12_0/set_payment_entry_status.py
+++ b/erpnext/patches/v12_0/set_payment_entry_status.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
frappe.reload_doctype("Payment Entry")
frappe.db.sql("""update `tabPayment Entry` set status = CASE
diff --git a/erpnext/patches/v12_0/set_permission_einvoicing.py b/erpnext/patches/v12_0/set_permission_einvoicing.py
index e223510..01cab14 100644
--- a/erpnext/patches/v12_0/set_permission_einvoicing.py
+++ b/erpnext/patches/v12_0/set_permission_einvoicing.py
@@ -1,7 +1,9 @@
import frappe
-from erpnext.regional.italy.setup import make_custom_fields
from frappe.permissions import add_permission, update_permission_property
+from erpnext.regional.italy.setup import make_custom_fields
+
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'Italy'})
diff --git a/erpnext/patches/v12_0/set_priority_for_support.py b/erpnext/patches/v12_0/set_priority_for_support.py
index 66696be..6d7d099 100644
--- a/erpnext/patches/v12_0/set_priority_for_support.py
+++ b/erpnext/patches/v12_0/set_priority_for_support.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
frappe.reload_doc("support", "doctype", "issue_priority")
frappe.reload_doc("support", "doctype", "service_level_priority")
diff --git a/erpnext/patches/v12_0/set_produced_qty_field_in_sales_order_for_work_order.py b/erpnext/patches/v12_0/set_produced_qty_field_in_sales_order_for_work_order.py
index 6c11cb4..9c851dd 100644
--- a/erpnext/patches/v12_0/set_produced_qty_field_in_sales_order_for_work_order.py
+++ b/erpnext/patches/v12_0/set_produced_qty_field_in_sales_order_for_work_order.py
@@ -1,7 +1,8 @@
import frappe
-from frappe.utils import flt
+
from erpnext.selling.doctype.sales_order.sales_order import update_produced_qty_in_so_item
+
def execute():
frappe.reload_doctype('Sales Order Item')
frappe.reload_doctype('Sales Order')
diff --git a/erpnext/patches/v12_0/set_production_capacity_in_workstation.py b/erpnext/patches/v12_0/set_production_capacity_in_workstation.py
index babaebe..248d335 100644
--- a/erpnext/patches/v12_0/set_production_capacity_in_workstation.py
+++ b/erpnext/patches/v12_0/set_production_capacity_in_workstation.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("manufacturing", "doctype", "workstation")
diff --git a/erpnext/patches/v12_0/set_published_in_hub_tracked_item.py b/erpnext/patches/v12_0/set_published_in_hub_tracked_item.py
index e54c7f3..73c6ce8 100644
--- a/erpnext/patches/v12_0/set_published_in_hub_tracked_item.py
+++ b/erpnext/patches/v12_0/set_published_in_hub_tracked_item.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("Hub Node", "doctype", "Hub Tracked Item")
if not frappe.db.a_row_exists("Hub Tracked Item"):
diff --git a/erpnext/patches/v12_0/set_purchase_receipt_delivery_note_detail.py b/erpnext/patches/v12_0/set_purchase_receipt_delivery_note_detail.py
index 52c9a2d..cad947f 100644
--- a/erpnext/patches/v12_0/set_purchase_receipt_delivery_note_detail.py
+++ b/erpnext/patches/v12_0/set_purchase_receipt_delivery_note_detail.py
@@ -1,7 +1,10 @@
from __future__ import unicode_literals
-import frappe
+
from collections import defaultdict
+import frappe
+
+
def execute():
frappe.reload_doc('stock', 'doctype', 'delivery_note_item', force=True)
diff --git a/erpnext/patches/v12_0/set_quotation_status.py b/erpnext/patches/v12_0/set_quotation_status.py
index 87643a2..bb17276 100644
--- a/erpnext/patches/v12_0/set_quotation_status.py
+++ b/erpnext/patches/v12_0/set_quotation_status.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.db.sql(""" UPDATE `tabQuotation` set status = 'Open'
diff --git a/erpnext/patches/v12_0/set_received_qty_in_material_request_as_per_stock_uom.py b/erpnext/patches/v12_0/set_received_qty_in_material_request_as_per_stock_uom.py
index 88c3e2e..f8b510e 100644
--- a/erpnext/patches/v12_0/set_received_qty_in_material_request_as_per_stock_uom.py
+++ b/erpnext/patches/v12_0/set_received_qty_in_material_request_as_per_stock_uom.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
purchase_receipts = frappe.db.sql("""
SELECT
diff --git a/erpnext/patches/v12_0/set_serial_no_status.py b/erpnext/patches/v12_0/set_serial_no_status.py
index 3b5f5ef..9a05e70 100644
--- a/erpnext/patches/v12_0/set_serial_no_status.py
+++ b/erpnext/patches/v12_0/set_serial_no_status.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.utils import getdate, nowdate
+
def execute():
frappe.reload_doc('stock', 'doctype', 'serial_no')
diff --git a/erpnext/patches/v12_0/set_task_status.py b/erpnext/patches/v12_0/set_task_status.py
index dbd7e5a..1b4955a 100644
--- a/erpnext/patches/v12_0/set_task_status.py
+++ b/erpnext/patches/v12_0/set_task_status.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
frappe.reload_doctype('Task')
diff --git a/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py b/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py
index 1cc37ca..21ee23b 100644
--- a/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py
+++ b/erpnext/patches/v12_0/set_updated_purpose_in_pick_list.py
@@ -5,6 +5,7 @@
import frappe
+
def execute():
frappe.reload_doc("stock", "doctype", "pick_list")
frappe.db.sql("""UPDATE `tabPick List` set purpose = 'Delivery'
diff --git a/erpnext/patches/v12_0/set_valid_till_date_in_supplier_quotation.py b/erpnext/patches/v12_0/set_valid_till_date_in_supplier_quotation.py
index 4a6e228..72d5521 100644
--- a/erpnext/patches/v12_0/set_valid_till_date_in_supplier_quotation.py
+++ b/erpnext/patches/v12_0/set_valid_till_date_in_supplier_quotation.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("buying", "doctype", "supplier_quotation")
frappe.db.sql("""UPDATE `tabSupplier Quotation`
diff --git a/erpnext/patches/v12_0/stock_entry_enhancements.py b/erpnext/patches/v12_0/stock_entry_enhancements.py
index 17fdcd9..b99501d 100644
--- a/erpnext/patches/v12_0/stock_entry_enhancements.py
+++ b/erpnext/patches/v12_0/stock_entry_enhancements.py
@@ -3,9 +3,11 @@
from __future__ import unicode_literals
+
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+
def execute():
create_stock_entry_types()
diff --git a/erpnext/patches/v12_0/unhide_cost_center_field.py b/erpnext/patches/v12_0/unhide_cost_center_field.py
index 3474a34..823dd22 100644
--- a/erpnext/patches/v12_0/unhide_cost_center_field.py
+++ b/erpnext/patches/v12_0/unhide_cost_center_field.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.db.sql("""
DELETE FROM `tabProperty Setter`
diff --git a/erpnext/patches/v12_0/unset_customer_supplier_based_on_type_of_item_price.py b/erpnext/patches/v12_0/unset_customer_supplier_based_on_type_of_item_price.py
index b8efb21..61c4c60 100644
--- a/erpnext/patches/v12_0/unset_customer_supplier_based_on_type_of_item_price.py
+++ b/erpnext/patches/v12_0/unset_customer_supplier_based_on_type_of_item_price.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
import frappe
diff --git a/erpnext/patches/v12_0/update_address_template_for_india.py b/erpnext/patches/v12_0/update_address_template_for_india.py
index 0d582da..d41aae2 100644
--- a/erpnext/patches/v12_0/update_address_template_for_india.py
+++ b/erpnext/patches/v12_0/update_address_template_for_india.py
@@ -2,9 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
from erpnext.regional.address_template.setup import set_up_address_templates
+
def execute():
if frappe.db.get_value('Company', {'country': 'India'}, 'name'):
address_template = frappe.db.get_value('Address Template', 'India', 'template')
diff --git a/erpnext/patches/v12_0/update_appointment_reminder_scheduler_entry.py b/erpnext/patches/v12_0/update_appointment_reminder_scheduler_entry.py
index f451664..024cb2b 100644
--- a/erpnext/patches/v12_0/update_appointment_reminder_scheduler_entry.py
+++ b/erpnext/patches/v12_0/update_appointment_reminder_scheduler_entry.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
job = frappe.db.exists('Scheduled Job Type', 'patient_appointment.send_appointment_reminder')
if job:
diff --git a/erpnext/patches/v12_0/update_bom_in_so_mr.py b/erpnext/patches/v12_0/update_bom_in_so_mr.py
index 8a87171..2834075 100644
--- a/erpnext/patches/v12_0/update_bom_in_so_mr.py
+++ b/erpnext/patches/v12_0/update_bom_in_so_mr.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("stock", "doctype", "material_request_item")
frappe.reload_doc("selling", "doctype", "sales_order_item")
diff --git a/erpnext/patches/v12_0/update_due_date_in_gle.py b/erpnext/patches/v12_0/update_due_date_in_gle.py
index 3484872..60ad325 100644
--- a/erpnext/patches/v12_0/update_due_date_in_gle.py
+++ b/erpnext/patches/v12_0/update_due_date_in_gle.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("accounts", "doctype", "gl_entry")
diff --git a/erpnext/patches/v12_0/update_end_date_and_status_in_email_campaign.py b/erpnext/patches/v12_0/update_end_date_and_status_in_email_campaign.py
index c45f622..208076b 100644
--- a/erpnext/patches/v12_0/update_end_date_and_status_in_email_campaign.py
+++ b/erpnext/patches/v12_0/update_end_date_and_status_in_email_campaign.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.utils import add_days, getdate, today
+
def execute():
if frappe.db.exists('DocType', 'Email Campaign'):
email_campaign = frappe.get_all('Email Campaign')
diff --git a/erpnext/patches/v12_0/update_ewaybill_field_position.py b/erpnext/patches/v12_0/update_ewaybill_field_position.py
index 9e5f599..520b5d0 100644
--- a/erpnext/patches/v12_0/update_ewaybill_field_position.py
+++ b/erpnext/patches/v12_0/update_ewaybill_field_position.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals
+
import frappe
-from erpnext.regional.india.setup import make_custom_fields
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
diff --git a/erpnext/patches/v12_0/update_gst_category.py b/erpnext/patches/v12_0/update_gst_category.py
index 1a54216..bee8919 100644
--- a/erpnext/patches/v12_0/update_gst_category.py
+++ b/erpnext/patches/v12_0/update_gst_category.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
diff --git a/erpnext/patches/v12_0/update_healthcare_refactored_changes.py b/erpnext/patches/v12_0/update_healthcare_refactored_changes.py
index d0b0443..bfad3dd 100644
--- a/erpnext/patches/v12_0/update_healthcare_refactored_changes.py
+++ b/erpnext/patches/v12_0/update_healthcare_refactored_changes.py
@@ -1,7 +1,8 @@
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
-from frappe.modules import scrub, get_doctype_module
+from frappe.modules import get_doctype_module, scrub
field_rename_map = {
'Healthcare Settings': [
diff --git a/erpnext/patches/v12_0/update_is_cancelled_field.py b/erpnext/patches/v12_0/update_is_cancelled_field.py
index 4bbec44..3e7c37f 100644
--- a/erpnext/patches/v12_0/update_is_cancelled_field.py
+++ b/erpnext/patches/v12_0/update_is_cancelled_field.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
try:
frappe.db.sql("UPDATE `tabStock Ledger Entry` SET is_cancelled = 0 where is_cancelled in ('', NULL, 'No')")
@@ -11,5 +13,5 @@
frappe.reload_doc("stock", "doctype", "stock_ledger_entry")
frappe.reload_doc("stock", "doctype", "serial_no")
- except:
+ except Exception:
pass
diff --git a/erpnext/patches/v12_0/update_item_tax_template_company.py b/erpnext/patches/v12_0/update_item_tax_template_company.py
index e15894d..3ad983d 100644
--- a/erpnext/patches/v12_0/update_item_tax_template_company.py
+++ b/erpnext/patches/v12_0/update_item_tax_template_company.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('accounts', 'doctype', 'item_tax_template')
diff --git a/erpnext/patches/v12_0/update_owner_fields_in_acc_dimension_custom_fields.py b/erpnext/patches/v12_0/update_owner_fields_in_acc_dimension_custom_fields.py
index 6ebaf48..09e2319 100644
--- a/erpnext/patches/v12_0/update_owner_fields_in_acc_dimension_custom_fields.py
+++ b/erpnext/patches/v12_0/update_owner_fields_in_acc_dimension_custom_fields.py
@@ -1,6 +1,11 @@
from __future__ import unicode_literals
+
import frappe
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_doctypes_with_dimensions
+
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_doctypes_with_dimensions,
+)
+
def execute():
accounting_dimensions = frappe.db.sql("""select fieldname from
diff --git a/erpnext/patches/v12_0/update_price_list_currency_in_bom.py b/erpnext/patches/v12_0/update_price_list_currency_in_bom.py
index 09f0707..e4c1008 100644
--- a/erpnext/patches/v12_0/update_price_list_currency_in_bom.py
+++ b/erpnext/patches/v12_0/update_price_list_currency_in_bom.py
@@ -1,8 +1,11 @@
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import getdate, flt
+from frappe.utils import getdate
+
from erpnext.setup.utils import get_exchange_rate
+
def execute():
frappe.reload_doc("manufacturing", "doctype", "bom")
frappe.reload_doc("manufacturing", "doctype", "bom_item")
diff --git a/erpnext/patches/v12_0/update_price_or_product_discount.py b/erpnext/patches/v12_0/update_price_or_product_discount.py
index 3a8cd43..4ff3925 100644
--- a/erpnext/patches/v12_0/update_price_or_product_discount.py
+++ b/erpnext/patches/v12_0/update_price_or_product_discount.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("accounts", "doctype", "pricing_rule")
diff --git a/erpnext/patches/v12_0/update_pricing_rule_fields.py b/erpnext/patches/v12_0/update_pricing_rule_fields.py
index 985613a..6f102e9 100644
--- a/erpnext/patches/v12_0/update_pricing_rule_fields.py
+++ b/erpnext/patches/v12_0/update_pricing_rule_fields.py
@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
parentfield = {
diff --git a/erpnext/patches/v12_0/update_state_code_for_daman_and_diu.py b/erpnext/patches/v12_0/update_state_code_for_daman_and_diu.py
index 8dbfa18..25cf6b9 100644
--- a/erpnext/patches/v12_0/update_state_code_for_daman_and_diu.py
+++ b/erpnext/patches/v12_0/update_state_code_for_daman_and_diu.py
@@ -1,6 +1,8 @@
import frappe
+
from erpnext.regional.india import states
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
diff --git a/erpnext/patches/v12_0/update_uom_conversion_factor.py b/erpnext/patches/v12_0/update_uom_conversion_factor.py
index 24914fd..7c7477a 100644
--- a/erpnext/patches/v12_0/update_uom_conversion_factor.py
+++ b/erpnext/patches/v12_0/update_uom_conversion_factor.py
@@ -1,5 +1,7 @@
from __future__ import unicode_literals
-import frappe, json
+
+import frappe
+
def execute():
from erpnext.setup.setup_wizard.operations.install_fixtures import add_uom_data
diff --git a/erpnext/patches/v12_0/update_vehicle_no_reqd_condition.py b/erpnext/patches/v12_0/update_vehicle_no_reqd_condition.py
index 01a4ae0..69bfaaa 100644
--- a/erpnext/patches/v12_0/update_vehicle_no_reqd_condition.py
+++ b/erpnext/patches/v12_0/update_vehicle_no_reqd_condition.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
frappe.reload_doc('custom', 'doctype', 'custom_field')
company = frappe.get_all('Company', filters = {'country': 'India'})
diff --git a/erpnext/patches/v13_0/add_custom_field_for_south_africa.py b/erpnext/patches/v13_0/add_custom_field_for_south_africa.py
index 73ff1ca..96aa547 100644
--- a/erpnext/patches/v13_0/add_custom_field_for_south_africa.py
+++ b/erpnext/patches/v13_0/add_custom_field_for_south_africa.py
@@ -1,14 +1,18 @@
# Copyright (c) 2020, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
import frappe
-from erpnext.regional.south_africa.setup import make_custom_fields, add_permissions
+
+from erpnext.regional.south_africa.setup import add_permissions, make_custom_fields
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'South Africa'})
if not company:
return
+ frappe.reload_doc('regional', 'doctype', 'south_africa_vat_settings')
+ frappe.reload_doc('accounts', 'doctype', 'south_africa_vat_account')
+
make_custom_fields()
add_permissions()
diff --git a/erpnext/patches/v13_0/add_doctype_to_sla.py b/erpnext/patches/v13_0/add_doctype_to_sla.py
index cdc5a1e..7252b3e 100644
--- a/erpnext/patches/v13_0/add_doctype_to_sla.py
+++ b/erpnext/patches/v13_0/add_doctype_to_sla.py
@@ -6,6 +6,7 @@
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
frappe.reload_doc('support', 'doctype', 'sla_fulfilled_on_status')
frappe.reload_doc('support', 'doctype', 'service_level_agreement')
diff --git a/erpnext/patches/v13_0/add_missing_fg_item_for_stock_entry.py b/erpnext/patches/v13_0/add_missing_fg_item_for_stock_entry.py
index 0d8109c..bd18b9b 100644
--- a/erpnext/patches/v13_0/add_missing_fg_item_for_stock_entry.py
+++ b/erpnext/patches/v13_0/add_missing_fg_item_for_stock_entry.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
import frappe
-from frappe.utils import cstr, flt, cint
-from erpnext.stock.stock_ledger import make_sl_entries
+from frappe.utils import cint, cstr, flt
+
from erpnext.controllers.stock_controller import create_repost_item_valuation_entry
+from erpnext.stock.stock_ledger import make_sl_entries
+
def execute():
if not frappe.db.has_column('Work Order', 'has_batch_no'):
diff --git a/erpnext/patches/v13_0/add_naming_series_to_old_projects.py b/erpnext/patches/v13_0/add_naming_series_to_old_projects.py
index a7b66f0..f029f75 100644
--- a/erpnext/patches/v13_0/add_naming_series_to_old_projects.py
+++ b/erpnext/patches/v13_0/add_naming_series_to_old_projects.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals
+
import frappe
-from frappe.custom.doctype.property_setter.property_setter import make_property_setter, delete_property_setter
+
def execute():
frappe.reload_doc("projects", "doctype", "project")
diff --git a/erpnext/patches/v13_0/add_po_to_global_search.py b/erpnext/patches/v13_0/add_po_to_global_search.py
index 1c60b18..15b7c71 100644
--- a/erpnext/patches/v13_0/add_po_to_global_search.py
+++ b/erpnext/patches/v13_0/add_po_to_global_search.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
import frappe
diff --git a/erpnext/patches/v13_0/add_standard_navbar_items.py b/erpnext/patches/v13_0/add_standard_navbar_items.py
index d05b258..699c480 100644
--- a/erpnext/patches/v13_0/add_standard_navbar_items.py
+++ b/erpnext/patches/v13_0/add_standard_navbar_items.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
# import frappe
from erpnext.setup.install import add_standard_navbar_items
+
def execute():
# Add standard navbar items for ERPNext in Navbar Settings
add_standard_navbar_items()
diff --git a/erpnext/patches/v13_0/bill_for_rejected_quantity_in_purchase_invoice.py b/erpnext/patches/v13_0/bill_for_rejected_quantity_in_purchase_invoice.py
index 7de9fa1..07d1cee 100644
--- a/erpnext/patches/v13_0/bill_for_rejected_quantity_in_purchase_invoice.py
+++ b/erpnext/patches/v13_0/bill_for_rejected_quantity_in_purchase_invoice.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doctype("Buying Settings")
buying_settings = frappe.get_single("Buying Settings")
diff --git a/erpnext/patches/v13_0/change_default_pos_print_format.py b/erpnext/patches/v13_0/change_default_pos_print_format.py
index 1e4f383..5a0320a 100644
--- a/erpnext/patches/v13_0/change_default_pos_print_format.py
+++ b/erpnext/patches/v13_0/change_default_pos_print_format.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.db.sql(
"""UPDATE `tabPOS Profile` profile
diff --git a/erpnext/patches/v13_0/check_is_income_tax_component.py b/erpnext/patches/v13_0/check_is_income_tax_component.py
index 7a52dc8..aac87ba 100644
--- a/erpnext/patches/v13_0/check_is_income_tax_component.py
+++ b/erpnext/patches/v13_0/check_is_income_tax_component.py
@@ -3,9 +3,12 @@
from __future__ import unicode_literals
-import frappe, erpnext
+import frappe
+
+import erpnext
from erpnext.regional.india.setup import setup
+
def execute():
doctypes = ['salary_component',
diff --git a/erpnext/patches/v13_0/convert_qi_parameter_to_link_field.py b/erpnext/patches/v13_0/convert_qi_parameter_to_link_field.py
index 341955a..66ac62f 100644
--- a/erpnext/patches/v13_0/convert_qi_parameter_to_link_field.py
+++ b/erpnext/patches/v13_0/convert_qi_parameter_to_link_field.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('stock', 'doctype', 'quality_inspection_parameter')
diff --git a/erpnext/patches/v13_0/create_gst_payment_entry_fields.py b/erpnext/patches/v13_0/create_gst_payment_entry_fields.py
new file mode 100644
index 0000000..334c9d2
--- /dev/null
+++ b/erpnext/patches/v13_0/create_gst_payment_entry_fields.py
@@ -0,0 +1,31 @@
+# Copyright (c) 2021, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+import frappe
+from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+
+def execute():
+ frappe.reload_doc('accounts', 'doctype', 'advance_taxes_and_charges')
+ frappe.reload_doc('accounts', 'doctype', 'payment_entry')
+
+ custom_fields = {
+ 'Payment Entry': [
+ dict(fieldname='gst_section', label='GST Details', fieldtype='Section Break', insert_after='deductions',
+ print_hide=1, collapsible=1),
+ dict(fieldname='company_address', label='Company Address', fieldtype='Link', insert_after='gst_section',
+ print_hide=1, options='Address'),
+ dict(fieldname='company_gstin', label='Company GSTIN',
+ fieldtype='Data', insert_after='company_address',
+ fetch_from='company_address.gstin', print_hide=1, read_only=1),
+ dict(fieldname='place_of_supply', label='Place of Supply',
+ fieldtype='Data', insert_after='company_gstin',
+ print_hide=1, read_only=1),
+ dict(fieldname='customer_address', label='Customer Address', fieldtype='Link', insert_after='place_of_supply',
+ print_hide=1, options='Address', depends_on = 'eval:doc.party_type == "Customer"'),
+ dict(fieldname='customer_gstin', label='Customer GSTIN',
+ fieldtype='Data', insert_after='customer_address',
+ fetch_from='customer_address.gstin', print_hide=1, read_only=1)
+ ]
+ }
+
+ create_custom_fields(custom_fields, update=True)
\ No newline at end of file
diff --git a/erpnext/patches/v13_0/create_healthcare_custom_fields_in_stock_entry_detail.py b/erpnext/patches/v13_0/create_healthcare_custom_fields_in_stock_entry_detail.py
index 08d4876..543faeb 100644
--- a/erpnext/patches/v13_0/create_healthcare_custom_fields_in_stock_entry_detail.py
+++ b/erpnext/patches/v13_0/create_healthcare_custom_fields_in_stock_entry_detail.py
@@ -1,7 +1,9 @@
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+
from erpnext.domains.healthcare import data
+
def execute():
if 'Healthcare' not in frappe.get_active_domains():
return
diff --git a/erpnext/patches/v13_0/create_leave_policy_assignment_based_on_employee_current_leave_policy.py b/erpnext/patches/v13_0/create_leave_policy_assignment_based_on_employee_current_leave_policy.py
index 9a35453..b1b5c24 100644
--- a/erpnext/patches/v13_0/create_leave_policy_assignment_based_on_employee_current_leave_policy.py
+++ b/erpnext/patches/v13_0/create_leave_policy_assignment_based_on_employee_current_leave_policy.py
@@ -5,6 +5,7 @@
import frappe
+
def execute():
if "leave_policy" in frappe.db.get_table_columns("Employee"):
employees_with_leave_policy = frappe.db.sql("SELECT name, leave_policy FROM `tabEmployee` WHERE leave_policy IS NOT NULL and leave_policy != ''", as_dict = 1)
diff --git a/erpnext/patches/v13_0/create_uae_pos_invoice_fields.py b/erpnext/patches/v13_0/create_uae_pos_invoice_fields.py
index 6ad3402..3bfa78f 100644
--- a/erpnext/patches/v13_0/create_uae_pos_invoice_fields.py
+++ b/erpnext/patches/v13_0/create_uae_pos_invoice_fields.py
@@ -4,8 +4,10 @@
from __future__ import unicode_literals
import frappe
+
from erpnext.regional.united_arab_emirates.setup import make_custom_fields
+
def execute():
company = frappe.get_all('Company', filters = {'country': ['in', ['Saudi Arabia', 'United Arab Emirates']]})
if not company:
diff --git a/erpnext/patches/v13_0/custom_fields_for_taxjar_integration.py b/erpnext/patches/v13_0/custom_fields_for_taxjar_integration.py
new file mode 100644
index 0000000..eee9f11
--- /dev/null
+++ b/erpnext/patches/v13_0/custom_fields_for_taxjar_integration.py
@@ -0,0 +1,32 @@
+from __future__ import unicode_literals
+
+import frappe
+from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
+
+from erpnext.regional.united_states.setup import add_permissions
+
+
+def execute():
+ company = frappe.get_all('Company', filters = {'country': 'United States'}, fields=['name'])
+ if not company:
+ return
+
+ frappe.reload_doc("regional", "doctype", "product_tax_category")
+
+ custom_fields = {
+ 'Sales Invoice Item': [
+ dict(fieldname='product_tax_category', fieldtype='Link', insert_after='description', options='Product Tax Category',
+ label='Product Tax Category', fetch_from='item_code.product_tax_category'),
+ dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount',
+ label='Tax Collectable', read_only=1),
+ dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable',
+ label='Taxable Amount', read_only=1)
+ ],
+ 'Item': [
+ dict(fieldname='product_tax_category', fieldtype='Link', insert_after='item_group', options='Product Tax Category',
+ label='Product Tax Category')
+ ]
+ }
+ create_custom_fields(custom_fields, update=True)
+ add_permissions()
+ frappe.enqueue('erpnext.regional.united_states.setup.add_product_tax_categories', now=True)
diff --git a/erpnext/patches/v13_0/delete_old_bank_reconciliation_doctypes.py b/erpnext/patches/v13_0/delete_old_bank_reconciliation_doctypes.py
index 77a23cf..089bbe3 100644
--- a/erpnext/patches/v13_0/delete_old_bank_reconciliation_doctypes.py
+++ b/erpnext/patches/v13_0/delete_old_bank_reconciliation_doctypes.py
@@ -6,6 +6,7 @@
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
doctypes = [
"Bank Statement Settings",
diff --git a/erpnext/patches/v13_0/delete_old_purchase_reports.py b/erpnext/patches/v13_0/delete_old_purchase_reports.py
index 57620d3..3cb7e12 100644
--- a/erpnext/patches/v13_0/delete_old_purchase_reports.py
+++ b/erpnext/patches/v13_0/delete_old_purchase_reports.py
@@ -4,8 +4,10 @@
from __future__ import unicode_literals
import frappe
+
from erpnext.accounts.utils import check_and_delete_linked_reports
+
def execute():
reports_to_delete = ["Requested Items To Be Ordered",
"Purchase Order Items To Be Received or Billed","Purchase Order Items To Be Received",
diff --git a/erpnext/patches/v13_0/delete_old_sales_reports.py b/erpnext/patches/v13_0/delete_old_sales_reports.py
index 905a42c..c9a3666 100644
--- a/erpnext/patches/v13_0/delete_old_sales_reports.py
+++ b/erpnext/patches/v13_0/delete_old_sales_reports.py
@@ -4,8 +4,10 @@
from __future__ import unicode_literals
import frappe
+
from erpnext.accounts.utils import check_and_delete_linked_reports
+
def execute():
reports_to_delete = ["Ordered Items To Be Delivered", "Ordered Items To Be Billed"]
diff --git a/erpnext/patches/v13_0/delete_orphaned_tables.py b/erpnext/patches/v13_0/delete_orphaned_tables.py
index 50a4a0e..1ea22d6 100644
--- a/erpnext/patches/v13_0/delete_orphaned_tables.py
+++ b/erpnext/patches/v13_0/delete_orphaned_tables.py
@@ -6,6 +6,7 @@
import frappe
from frappe.utils import getdate
+
def execute():
frappe.reload_doc('setup', 'doctype', 'transaction_deletion_record')
diff --git a/erpnext/patches/v13_0/delete_report_requested_items_to_order.py b/erpnext/patches/v13_0/delete_report_requested_items_to_order.py
index 8d6340d..87565f0 100644
--- a/erpnext/patches/v13_0/delete_report_requested_items_to_order.py
+++ b/erpnext/patches/v13_0/delete_report_requested_items_to_order.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
""" Check for one or multiple Auto Email Reports and delete """
auto_email_reports = frappe.db.get_values("Auto Email Report", {"report": "Requested Items to Order"}, ["name"])
diff --git a/erpnext/patches/v13_0/drop_razorpay_payload_column.py b/erpnext/patches/v13_0/drop_razorpay_payload_column.py
index 76b8041..a7aee52 100644
--- a/erpnext/patches/v13_0/drop_razorpay_payload_column.py
+++ b/erpnext/patches/v13_0/drop_razorpay_payload_column.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
if frappe.db.exists("DocType", "Membership"):
if 'webhook_payload' in frappe.db.get_table_columns("Membership"):
diff --git a/erpnext/patches/v13_0/fix_non_unique_represents_company.py b/erpnext/patches/v13_0/fix_non_unique_represents_company.py
index f20c73a..e91c1db 100644
--- a/erpnext/patches/v13_0/fix_non_unique_represents_company.py
+++ b/erpnext/patches/v13_0/fix_non_unique_represents_company.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
frappe.db.sql("""
update tabCustomer
diff --git a/erpnext/patches/v13_0/germany_make_custom_fields.py b/erpnext/patches/v13_0/germany_make_custom_fields.py
index 41ab945..86ad188 100644
--- a/erpnext/patches/v13_0/germany_make_custom_fields.py
+++ b/erpnext/patches/v13_0/germany_make_custom_fields.py
@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import frappe
+
from erpnext.regional.germany.setup import make_custom_fields
diff --git a/erpnext/patches/v13_0/healthcare_lab_module_rename_doctypes.py b/erpnext/patches/v13_0/healthcare_lab_module_rename_doctypes.py
index 2549a1e..f297654 100644
--- a/erpnext/patches/v13_0/healthcare_lab_module_rename_doctypes.py
+++ b/erpnext/patches/v13_0/healthcare_lab_module_rename_doctypes.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
diff --git a/erpnext/patches/v13_0/item_reposting_for_incorrect_sl_and_gl.py b/erpnext/patches/v13_0/item_reposting_for_incorrect_sl_and_gl.py
index c4ad1b7..e4cb9ae 100644
--- a/erpnext/patches/v13_0/item_reposting_for_incorrect_sl_and_gl.py
+++ b/erpnext/patches/v13_0/item_reposting_for_incorrect_sl_and_gl.py
@@ -1,8 +1,9 @@
import frappe
-from frappe import _
-from frappe.utils import getdate, get_time, today
-from erpnext.stock.stock_ledger import update_entries_after
+from frappe.utils import get_time, getdate, today
+
from erpnext.accounts.utils import update_gl_entries_after
+from erpnext.stock.stock_ledger import update_entries_after
+
def execute():
for doctype in ('repost_item_valuation', 'stock_entry_detail', 'purchase_receipt_item',
diff --git a/erpnext/patches/v13_0/loyalty_points_entry_for_pos_invoice.py b/erpnext/patches/v13_0/loyalty_points_entry_for_pos_invoice.py
index d2228c3..43c6c49 100644
--- a/erpnext/patches/v13_0/loyalty_points_entry_for_pos_invoice.py
+++ b/erpnext/patches/v13_0/loyalty_points_entry_for_pos_invoice.py
@@ -5,6 +5,7 @@
import frappe
+
def execute():
'''`sales_invoice` field from loyalty point entry is splitted into `invoice_type` & `invoice` fields'''
diff --git a/erpnext/patches/v13_0/make_non_standard_user_type.py b/erpnext/patches/v13_0/make_non_standard_user_type.py
index 73361f0..746e408 100644
--- a/erpnext/patches/v13_0/make_non_standard_user_type.py
+++ b/erpnext/patches/v13_0/make_non_standard_user_type.py
@@ -2,10 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from six import iteritems
+
from erpnext.setup.install import add_non_standard_user_types
+
def execute():
doctype_dict = {
'projects': ['Timesheet'],
diff --git a/erpnext/patches/v13_0/move_branch_code_to_bank_account.py b/erpnext/patches/v13_0/move_branch_code_to_bank_account.py
index 24d9196..9116f58 100644
--- a/erpnext/patches/v13_0/move_branch_code_to_bank_account.py
+++ b/erpnext/patches/v13_0/move_branch_code_to_bank_account.py
@@ -5,6 +5,7 @@
import frappe
+
def execute():
frappe.reload_doc('accounts', 'doctype', 'bank_account')
diff --git a/erpnext/patches/v13_0/move_doctype_reports_and_notification_from_hr_to_payroll.py b/erpnext/patches/v13_0/move_doctype_reports_and_notification_from_hr_to_payroll.py
index 4d7c85c..064e8d7 100644
--- a/erpnext/patches/v13_0/move_doctype_reports_and_notification_from_hr_to_payroll.py
+++ b/erpnext/patches/v13_0/move_doctype_reports_and_notification_from_hr_to_payroll.py
@@ -5,6 +5,7 @@
import frappe
+
def execute():
frappe.db.sql("""UPDATE `tabPrint Format`
SET module = 'Payroll'
diff --git a/erpnext/patches/v13_0/move_payroll_setting_separately_from_hr_settings.py b/erpnext/patches/v13_0/move_payroll_setting_separately_from_hr_settings.py
index a901064..85d5109 100644
--- a/erpnext/patches/v13_0/move_payroll_setting_separately_from_hr_settings.py
+++ b/erpnext/patches/v13_0/move_payroll_setting_separately_from_hr_settings.py
@@ -5,6 +5,7 @@
import frappe
+
def execute():
data = frappe.db.sql('''SELECT *
FROM `tabSingles`
diff --git a/erpnext/patches/v13_0/move_tax_slabs_from_payroll_period_to_income_tax_slab.py b/erpnext/patches/v13_0/move_tax_slabs_from_payroll_period_to_income_tax_slab.py
index 1a91d21..e73fa7b 100644
--- a/erpnext/patches/v13_0/move_tax_slabs_from_payroll_period_to_income_tax_slab.py
+++ b/erpnext/patches/v13_0/move_tax_slabs_from_payroll_period_to_income_tax_slab.py
@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
-from frappe.model.utils.rename_field import rename_field
+
def execute():
if not (frappe.db.table_exists("Payroll Period") and frappe.db.table_exists("Taxable Salary Slab")):
@@ -86,7 +86,7 @@
try:
employee_other_income.submit()
migrated.append([proof.employee, proof.payroll_period])
- except:
+ except Exception:
pass
if not frappe.db.table_exists("Employee Tax Exemption Declaration"):
@@ -108,5 +108,5 @@
try:
employee_other_income.submit()
- except:
+ except Exception:
pass
diff --git a/erpnext/patches/v13_0/patch_to_fix_reverse_linking_in_additional_salary_encashment_and_incentive.py b/erpnext/patches/v13_0/patch_to_fix_reverse_linking_in_additional_salary_encashment_and_incentive.py
index 15aeb76..bb539a7 100644
--- a/erpnext/patches/v13_0/patch_to_fix_reverse_linking_in_additional_salary_encashment_and_incentive.py
+++ b/erpnext/patches/v13_0/patch_to_fix_reverse_linking_in_additional_salary_encashment_and_incentive.py
@@ -2,6 +2,7 @@
import frappe
+
def execute():
if not frappe.db.table_exists("Additional Salary"):
return
diff --git a/erpnext/patches/v13_0/print_uom_after_quantity_patch.py b/erpnext/patches/v13_0/print_uom_after_quantity_patch.py
index 0de3728..f2022b2 100644
--- a/erpnext/patches/v13_0/print_uom_after_quantity_patch.py
+++ b/erpnext/patches/v13_0/print_uom_after_quantity_patch.py
@@ -3,8 +3,8 @@
from __future__ import unicode_literals
-import frappe
from erpnext.setup.install import create_print_uom_after_qty_custom_field
+
def execute():
create_print_uom_after_qty_custom_field()
diff --git a/erpnext/patches/v13_0/remove_attribute_field_from_item_variant_setting.py b/erpnext/patches/v13_0/remove_attribute_field_from_item_variant_setting.py
index 53da700..bbe3eb5 100644
--- a/erpnext/patches/v13_0/remove_attribute_field_from_item_variant_setting.py
+++ b/erpnext/patches/v13_0/remove_attribute_field_from_item_variant_setting.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
"""Remove has_variants and attribute fields from item variant settings."""
frappe.reload_doc("stock", "doctype", "Item Variant Settings")
diff --git a/erpnext/patches/v13_0/rename_discharge_date_in_ip_record.py b/erpnext/patches/v13_0/rename_discharge_date_in_ip_record.py
index 491dc82..2a04211 100644
--- a/erpnext/patches/v13_0/rename_discharge_date_in_ip_record.py
+++ b/erpnext/patches/v13_0/rename_discharge_date_in_ip_record.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
frappe.reload_doc("Healthcare", "doctype", "Inpatient Record")
if frappe.db.has_column("Inpatient Record", "discharge_date"):
diff --git a/erpnext/patches/v13_0/rename_issue_doctype_fields.py b/erpnext/patches/v13_0/rename_issue_doctype_fields.py
index 4885c0b..4aeafea 100644
--- a/erpnext/patches/v13_0/rename_issue_doctype_fields.py
+++ b/erpnext/patches/v13_0/rename_issue_doctype_fields.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
if frappe.db.exists('DocType', 'Issue'):
issues = frappe.db.get_all('Issue', fields=['name', 'response_by_variance', 'resolution_by_variance', 'mins_to_first_response'],
diff --git a/erpnext/patches/v13_0/rename_issue_status_hold_to_on_hold.py b/erpnext/patches/v13_0/rename_issue_status_hold_to_on_hold.py
index 4ef04ad..1d245db 100644
--- a/erpnext/patches/v13_0/rename_issue_status_hold_to_on_hold.py
+++ b/erpnext/patches/v13_0/rename_issue_status_hold_to_on_hold.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
if frappe.db.exists('DocType', 'Issue'):
frappe.reload_doc("support", "doctype", "issue")
diff --git a/erpnext/patches/v13_0/rename_membership_settings_to_non_profit_settings.py b/erpnext/patches/v13_0/rename_membership_settings_to_non_profit_settings.py
index f60567b..23a782a 100644
--- a/erpnext/patches/v13_0/rename_membership_settings_to_non_profit_settings.py
+++ b/erpnext/patches/v13_0/rename_membership_settings_to_non_profit_settings.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
if frappe.db.table_exists("Membership Settings"):
frappe.rename_doc("DocType", "Membership Settings", "Non Profit Settings")
diff --git a/erpnext/patches/v13_0/rename_stop_to_send_birthday_reminders.py b/erpnext/patches/v13_0/rename_stop_to_send_birthday_reminders.py
index 1787a56..813fbd2 100644
--- a/erpnext/patches/v13_0/rename_stop_to_send_birthday_reminders.py
+++ b/erpnext/patches/v13_0/rename_stop_to_send_birthday_reminders.py
@@ -1,23 +1,24 @@
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
frappe.reload_doc('hr', 'doctype', 'hr_settings')
try:
# Rename the field
rename_field('HR Settings', 'stop_birthday_reminders', 'send_birthday_reminders')
-
+
# Reverse the value
old_value = frappe.db.get_single_value('HR Settings', 'send_birthday_reminders')
frappe.db.set_value(
- 'HR Settings',
- 'HR Settings',
- 'send_birthday_reminders',
+ 'HR Settings',
+ 'HR Settings',
+ 'send_birthday_reminders',
1 if old_value == 0 else 0
)
-
+
except Exception as e:
if e.args[0] != 1054:
- raise
\ No newline at end of file
+ raise
diff --git a/erpnext/patches/v13_0/replace_pos_page_with_point_of_sale_page.py b/erpnext/patches/v13_0/replace_pos_page_with_point_of_sale_page.py
index d8bcd7f..989f1a0 100644
--- a/erpnext/patches/v13_0/replace_pos_page_with_point_of_sale_page.py
+++ b/erpnext/patches/v13_0/replace_pos_page_with_point_of_sale_page.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
if frappe.db.exists("Page", "point-of-sale"):
frappe.rename_doc("Page", "pos", "point-of-sale", 1, 1)
diff --git a/erpnext/patches/v13_0/replace_pos_payment_mode_table.py b/erpnext/patches/v13_0/replace_pos_payment_mode_table.py
index bc1fc98..103c791 100644
--- a/erpnext/patches/v13_0/replace_pos_payment_mode_table.py
+++ b/erpnext/patches/v13_0/replace_pos_payment_mode_table.py
@@ -5,6 +5,7 @@
import frappe
+
def execute():
frappe.reload_doc("accounts", "doctype", "pos_payment_method")
pos_profiles = frappe.get_all("POS Profile")
diff --git a/erpnext/patches/v13_0/reset_clearance_date_for_intracompany_payment_entries.py b/erpnext/patches/v13_0/reset_clearance_date_for_intracompany_payment_entries.py
index 1da5275..29343b7 100644
--- a/erpnext/patches/v13_0/reset_clearance_date_for_intracompany_payment_entries.py
+++ b/erpnext/patches/v13_0/reset_clearance_date_for_intracompany_payment_entries.py
@@ -5,6 +5,7 @@
import frappe
+
def execute():
"""
Reset Clearance Date for Payment Entries of type Internal Transfer that have only been reconciled with one Bank Transaction.
@@ -35,11 +36,11 @@
for payment_entry in intra_company_pe:
reconciled_bank_transactions[payment_entry] = frappe.get_all(
- 'Bank Transaction Payments',
+ 'Bank Transaction Payments',
filters = {
'payment_entry': payment_entry
- },
+ },
pluck='parent'
)
- return reconciled_bank_transactions
\ No newline at end of file
+ return reconciled_bank_transactions
diff --git a/erpnext/patches/v13_0/set_app_name.py b/erpnext/patches/v13_0/set_app_name.py
index 3f886f1..4a88442 100644
--- a/erpnext/patches/v13_0/set_app_name.py
+++ b/erpnext/patches/v13_0/set_app_name.py
@@ -1,5 +1,5 @@
import frappe
-from frappe import _
+
def execute():
frappe.reload_doctype("System Settings")
diff --git a/erpnext/patches/v13_0/set_company_field_in_healthcare_doctypes.py b/erpnext/patches/v13_0/set_company_field_in_healthcare_doctypes.py
index a5b93f6..e9396c2 100644
--- a/erpnext/patches/v13_0/set_company_field_in_healthcare_doctypes.py
+++ b/erpnext/patches/v13_0/set_company_field_in_healthcare_doctypes.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
company = frappe.db.get_single_value('Global Defaults', 'default_company')
doctypes = ['Clinical Procedure', 'Inpatient Record', 'Lab Test', 'Sample Collection', 'Patient Appointment', 'Patient Encounter', 'Vital Signs', 'Therapy Session', 'Therapy Plan', 'Patient Assessment']
diff --git a/erpnext/patches/v13_0/set_company_in_leave_ledger_entry.py b/erpnext/patches/v13_0/set_company_in_leave_ledger_entry.py
index 13ec41e..c744f35 100644
--- a/erpnext/patches/v13_0/set_company_in_leave_ledger_entry.py
+++ b/erpnext/patches/v13_0/set_company_in_leave_ledger_entry.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
frappe.reload_doc('HR', 'doctype', 'Leave Allocation')
frappe.reload_doc('HR', 'doctype', 'Leave Ledger Entry')
diff --git a/erpnext/patches/v13_0/set_operation_time_based_on_operating_cost.py b/erpnext/patches/v13_0/set_operation_time_based_on_operating_cost.py
index 4acbdd6..e26285e 100644
--- a/erpnext/patches/v13_0/set_operation_time_based_on_operating_cost.py
+++ b/erpnext/patches/v13_0/set_operation_time_based_on_operating_cost.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
frappe.reload_doc('manufacturing', 'doctype', 'bom')
frappe.reload_doc('manufacturing', 'doctype', 'bom_operation')
@@ -12,4 +13,4 @@
WHERE
time_in_mins = 0 AND operating_cost > 0
AND hour_rate > 0 AND docstatus = 1 AND parenttype = "BOM"
- ''')
\ No newline at end of file
+ ''')
diff --git a/erpnext/patches/v13_0/set_payment_channel_in_payment_gateway_account.py b/erpnext/patches/v13_0/set_payment_channel_in_payment_gateway_account.py
index 7f75946..da889e6 100644
--- a/erpnext/patches/v13_0/set_payment_channel_in_payment_gateway_account.py
+++ b/erpnext/patches/v13_0/set_payment_channel_in_payment_gateway_account.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
"""Set the payment gateway account as Email for all the existing payment channel."""
doc_meta = frappe.get_meta("Payment Gateway Account")
diff --git a/erpnext/patches/v13_0/set_pos_closing_as_failed.py b/erpnext/patches/v13_0/set_pos_closing_as_failed.py
index 7968e74..8c7f508 100644
--- a/erpnext/patches/v13_0/set_pos_closing_as_failed.py
+++ b/erpnext/patches/v13_0/set_pos_closing_as_failed.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('accounts', 'doctype', 'pos_closing_entry')
diff --git a/erpnext/patches/v13_0/set_training_event_attendance.py b/erpnext/patches/v13_0/set_training_event_attendance.py
index 3db183f..4e3d8f5 100644
--- a/erpnext/patches/v13_0/set_training_event_attendance.py
+++ b/erpnext/patches/v13_0/set_training_event_attendance.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('hr', 'doctype', 'training_event')
frappe.reload_doc('hr', 'doctype', 'training_event_employee')
diff --git a/erpnext/patches/v13_0/set_youtube_video_id.py b/erpnext/patches/v13_0/set_youtube_video_id.py
index f6104d1..1594e52 100644
--- a/erpnext/patches/v13_0/set_youtube_video_id.py
+++ b/erpnext/patches/v13_0/set_youtube_video_id.py
@@ -1,7 +1,10 @@
from __future__ import unicode_literals
+
import frappe
+
from erpnext.utilities.doctype.video.video import get_id_from_url
+
def execute():
frappe.reload_doc("utilities", "doctype","video")
diff --git a/erpnext/patches/v13_0/setting_custom_roles_for_some_regional_reports.py b/erpnext/patches/v13_0/setting_custom_roles_for_some_regional_reports.py
index c8c160f..a6a3ff3 100644
--- a/erpnext/patches/v13_0/setting_custom_roles_for_some_regional_reports.py
+++ b/erpnext/patches/v13_0/setting_custom_roles_for_some_regional_reports.py
@@ -1,7 +1,10 @@
from __future__ import unicode_literals
+
import frappe
+
from erpnext.regional.india.setup import add_custom_roles_for_reports
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
diff --git a/erpnext/patches/v13_0/setup_fields_for_80g_certificate_and_donation.py b/erpnext/patches/v13_0/setup_fields_for_80g_certificate_and_donation.py
index 833c355..7a2a253 100644
--- a/erpnext/patches/v13_0/setup_fields_for_80g_certificate_and_donation.py
+++ b/erpnext/patches/v13_0/setup_fields_for_80g_certificate_and_donation.py
@@ -1,6 +1,8 @@
import frappe
+
from erpnext.regional.india.setup import make_custom_fields
+
def execute():
if frappe.get_all('Company', filters = {'country': 'India'}):
make_custom_fields()
diff --git a/erpnext/patches/v13_0/setup_gratuity_rule_for_india_and_uae.py b/erpnext/patches/v13_0/setup_gratuity_rule_for_india_and_uae.py
index 01fd6a1..01e75a6 100644
--- a/erpnext/patches/v13_0/setup_gratuity_rule_for_india_and_uae.py
+++ b/erpnext/patches/v13_0/setup_gratuity_rule_for_india_and_uae.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('payroll', 'doctype', 'gratuity_rule')
frappe.reload_doc('payroll', 'doctype', 'gratuity_rule_slab')
diff --git a/erpnext/patches/v13_0/setup_patient_history_settings_for_standard_doctypes.py b/erpnext/patches/v13_0/setup_patient_history_settings_for_standard_doctypes.py
index 83581dd..80622d4 100644
--- a/erpnext/patches/v13_0/setup_patient_history_settings_for_standard_doctypes.py
+++ b/erpnext/patches/v13_0/setup_patient_history_settings_for_standard_doctypes.py
@@ -1,7 +1,10 @@
from __future__ import unicode_literals
+
import frappe
+
from erpnext.healthcare.setup import setup_patient_history_settings
+
def execute():
if "Healthcare" not in frappe.get_active_domains():
return
diff --git a/erpnext/patches/v13_0/setup_uae_vat_fields.py b/erpnext/patches/v13_0/setup_uae_vat_fields.py
index 1830bab..d89e052 100644
--- a/erpnext/patches/v13_0/setup_uae_vat_fields.py
+++ b/erpnext/patches/v13_0/setup_uae_vat_fields.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
import frappe
+
from erpnext.regional.united_arab_emirates.setup import setup
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'United Arab Emirates'})
if not company:
diff --git a/erpnext/patches/v13_0/shopify_deprecation_warning.py b/erpnext/patches/v13_0/shopify_deprecation_warning.py
index 6f199c8..245d1a9 100644
--- a/erpnext/patches/v13_0/shopify_deprecation_warning.py
+++ b/erpnext/patches/v13_0/shopify_deprecation_warning.py
@@ -1,5 +1,4 @@
import click
-import frappe
def execute():
diff --git a/erpnext/patches/v13_0/stock_entry_enhancements.py b/erpnext/patches/v13_0/stock_entry_enhancements.py
index 7b93ce3..5fcd6a3 100644
--- a/erpnext/patches/v13_0/stock_entry_enhancements.py
+++ b/erpnext/patches/v13_0/stock_entry_enhancements.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3.See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("stock", "doctype", "stock_entry")
if frappe.db.has_column("Stock Entry", "add_to_transit"):
diff --git a/erpnext/patches/v13_0/update_actual_start_and_end_date_in_wo.py b/erpnext/patches/v13_0/update_actual_start_and_end_date_in_wo.py
index 50f233d..dd87a53 100644
--- a/erpnext/patches/v13_0/update_actual_start_and_end_date_in_wo.py
+++ b/erpnext/patches/v13_0/update_actual_start_and_end_date_in_wo.py
@@ -7,6 +7,7 @@
import frappe
from frappe.utils import add_to_date
+
def execute():
frappe.reload_doc("manufacturing", "doctype", "work_order")
frappe.reload_doc("manufacturing", "doctype", "work_order_item")
diff --git a/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py b/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py
index dc9ed18..dc973a9 100644
--- a/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py
+++ b/erpnext/patches/v13_0/update_amt_in_work_order_required_items.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
""" Correct amount in child table of required items table."""
diff --git a/erpnext/patches/v13_0/update_deferred_settings.py b/erpnext/patches/v13_0/update_deferred_settings.py
index bcc0952..5405931 100644
--- a/erpnext/patches/v13_0/update_deferred_settings.py
+++ b/erpnext/patches/v13_0/update_deferred_settings.py
@@ -1,8 +1,10 @@
# Copyright (c) 2019, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
accounts_settings = frappe.get_doc('Accounts Settings', 'Accounts Settings')
accounts_settings.book_deferred_entries_based_on = 'Days'
diff --git a/erpnext/patches/v13_0/update_export_type_for_gst.py b/erpnext/patches/v13_0/update_export_type_for_gst.py
index ef70b55..de57861 100644
--- a/erpnext/patches/v13_0/update_export_type_for_gst.py
+++ b/erpnext/patches/v13_0/update_export_type_for_gst.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
diff --git a/erpnext/patches/v13_0/update_job_card_details.py b/erpnext/patches/v13_0/update_job_card_details.py
index 733b3a9..a0405e5 100644
--- a/erpnext/patches/v13_0/update_job_card_details.py
+++ b/erpnext/patches/v13_0/update_job_card_details.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("manufacturing", "doctype", "job_card")
frappe.reload_doc("manufacturing", "doctype", "job_card_item")
diff --git a/erpnext/patches/v13_0/update_level_in_bom.py b/erpnext/patches/v13_0/update_level_in_bom.py
index 0d03c42..6223500 100644
--- a/erpnext/patches/v13_0/update_level_in_bom.py
+++ b/erpnext/patches/v13_0/update_level_in_bom.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
for document in ["bom", "bom_item", "bom_explosion_item"]:
frappe.reload_doc('manufacturing', 'doctype', document)
diff --git a/erpnext/patches/v13_0/update_member_email_address.py b/erpnext/patches/v13_0/update_member_email_address.py
index 4056f84..769658e 100644
--- a/erpnext/patches/v13_0/update_member_email_address.py
+++ b/erpnext/patches/v13_0/update_member_email_address.py
@@ -2,9 +2,11 @@
# MIT License. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
"""add value to email_id column from email"""
diff --git a/erpnext/patches/v13_0/update_old_loans.py b/erpnext/patches/v13_0/update_old_loans.py
index 8cf09aa..b01a877 100644
--- a/erpnext/patches/v13_0/update_old_loans.py
+++ b/erpnext/patches/v13_0/update_old_loans.py
@@ -1,12 +1,18 @@
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import nowdate, flt
-from erpnext.accounts.doctype.account.test_account import create_account
-from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import process_loan_interest_accrual_for_term_loans
-from erpnext.loan_management.doctype.loan.loan import make_repayment_entry
-from erpnext.loan_management.doctype.loan_repayment.loan_repayment import get_accrued_interest_entries
from frappe.model.naming import make_autoname
+from frappe.utils import flt, nowdate
+
+from erpnext.accounts.doctype.account.test_account import create_account
+from erpnext.loan_management.doctype.loan_repayment.loan_repayment import (
+ get_accrued_interest_entries,
+)
+from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
+ process_loan_interest_accrual_for_term_loans,
+)
+
def execute():
diff --git a/erpnext/patches/v13_0/update_payment_terms_outstanding.py b/erpnext/patches/v13_0/update_payment_terms_outstanding.py
index 4816b40..c9e920b 100644
--- a/erpnext/patches/v13_0/update_payment_terms_outstanding.py
+++ b/erpnext/patches/v13_0/update_payment_terms_outstanding.py
@@ -2,8 +2,10 @@
# MIT License. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("accounts", "doctype", "Payment Schedule")
if frappe.db.count('Payment Schedule'):
diff --git a/erpnext/patches/v13_0/update_pos_closing_entry_in_merge_log.py b/erpnext/patches/v13_0/update_pos_closing_entry_in_merge_log.py
index 262e38d..71fe9ed 100644
--- a/erpnext/patches/v13_0/update_pos_closing_entry_in_merge_log.py
+++ b/erpnext/patches/v13_0/update_pos_closing_entry_in_merge_log.py
@@ -2,8 +2,10 @@
# MIT License. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("accounts", "doctype", "POS Invoice Merge Log")
frappe.reload_doc("accounts", "doctype", "POS Closing Entry")
diff --git a/erpnext/patches/v13_0/update_project_template_tasks.py b/erpnext/patches/v13_0/update_project_template_tasks.py
index b41b742..f0d0a5a 100644
--- a/erpnext/patches/v13_0/update_project_template_tasks.py
+++ b/erpnext/patches/v13_0/update_project_template_tasks.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("projects", "doctype", "project_template")
frappe.reload_doc("projects", "doctype", "project_template_task")
diff --git a/erpnext/patches/v13_0/update_reason_for_resignation_in_employee.py b/erpnext/patches/v13_0/update_reason_for_resignation_in_employee.py
index ccdc334..8407502 100644
--- a/erpnext/patches/v13_0/update_reason_for_resignation_in_employee.py
+++ b/erpnext/patches/v13_0/update_reason_for_resignation_in_employee.py
@@ -2,8 +2,10 @@
# MIT License. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("hr", "doctype", "employee")
diff --git a/erpnext/patches/v13_0/update_recipient_email_digest.py b/erpnext/patches/v13_0/update_recipient_email_digest.py
index d9aa03f..f4a4810 100644
--- a/erpnext/patches/v13_0/update_recipient_email_digest.py
+++ b/erpnext/patches/v13_0/update_recipient_email_digest.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc("setup", "doctype", "Email Digest")
frappe.reload_doc("setup", "doctype", "Email Digest Recipient")
diff --git a/erpnext/patches/v13_0/update_response_by_variance.py b/erpnext/patches/v13_0/update_response_by_variance.py
index ef4d976..444ec9e 100644
--- a/erpnext/patches/v13_0/update_response_by_variance.py
+++ b/erpnext/patches/v13_0/update_response_by_variance.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
if frappe.db.exists('DocType', 'Issue') and frappe.db.count('Issue'):
invalid_issues = frappe.get_all('Issue', {
diff --git a/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py b/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py
index a5769d2..efb3a59 100644
--- a/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py
+++ b/erpnext/patches/v13_0/update_returned_qty_in_pr_dn.py
@@ -1,8 +1,10 @@
# Copyright (c) 2021, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
+
from erpnext.controllers.status_updater import OverAllowanceError
+
def execute():
frappe.reload_doc('stock', 'doctype', 'purchase_receipt')
frappe.reload_doc('stock', 'doctype', 'purchase_receipt_item')
diff --git a/erpnext/patches/v13_0/update_shipment_status.py b/erpnext/patches/v13_0/update_shipment_status.py
index c425599..f2d7d1d 100644
--- a/erpnext/patches/v13_0/update_shipment_status.py
+++ b/erpnext/patches/v13_0/update_shipment_status.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
frappe.reload_doc("stock", "doctype", "shipment")
diff --git a/erpnext/patches/v13_0/update_sla_enhancements.py b/erpnext/patches/v13_0/update_sla_enhancements.py
index c156ba9..bcfbf8b 100644
--- a/erpnext/patches/v13_0/update_sla_enhancements.py
+++ b/erpnext/patches/v13_0/update_sla_enhancements.py
@@ -5,6 +5,7 @@
import frappe
+
def execute():
# add holiday list and employee group fields in SLA
# change response and resolution time in priorities child table
diff --git a/erpnext/patches/v13_0/update_start_end_date_for_old_shift_assignment.py b/erpnext/patches/v13_0/update_start_end_date_for_old_shift_assignment.py
index 0f521cb..bcdf72e 100644
--- a/erpnext/patches/v13_0/update_start_end_date_for_old_shift_assignment.py
+++ b/erpnext/patches/v13_0/update_start_end_date_for_old_shift_assignment.py
@@ -5,6 +5,7 @@
import frappe
+
def execute():
frappe.reload_doc('hr', 'doctype', 'shift_assignment')
if frappe.db.has_column('Shift Assignment', 'date'):
diff --git a/erpnext/patches/v13_0/update_subscription.py b/erpnext/patches/v13_0/update_subscription.py
index d25e9c8..e0ea78f 100644
--- a/erpnext/patches/v13_0/update_subscription.py
+++ b/erpnext/patches/v13_0/update_subscription.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from six import iteritems
+
def execute():
frappe.reload_doc('accounts', 'doctype', 'subscription')
diff --git a/erpnext/patches/v13_0/update_subscription_status_in_memberships.py b/erpnext/patches/v13_0/update_subscription_status_in_memberships.py
index d9c3e45..e21fe57 100644
--- a/erpnext/patches/v13_0/update_subscription_status_in_memberships.py
+++ b/erpnext/patches/v13_0/update_subscription_status_in_memberships.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
if frappe.db.exists('DocType', 'Member'):
frappe.reload_doc('Non Profit', 'doctype', 'Member')
diff --git a/erpnext/patches/v13_0/update_tds_check_field.py b/erpnext/patches/v13_0/update_tds_check_field.py
index 341b0e8..436d2e6 100644
--- a/erpnext/patches/v13_0/update_tds_check_field.py
+++ b/erpnext/patches/v13_0/update_tds_check_field.py
@@ -1,5 +1,6 @@
import frappe
+
def execute():
if frappe.db.has_table("Tax Withholding Category") \
and frappe.db.has_column("Tax Withholding Category", "round_off_tax_amount"):
diff --git a/erpnext/patches/v13_0/update_timesheet_changes.py b/erpnext/patches/v13_0/update_timesheet_changes.py
index a36c84e..d993d54 100644
--- a/erpnext/patches/v13_0/update_timesheet_changes.py
+++ b/erpnext/patches/v13_0/update_timesheet_changes.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.model.utils.rename_field import rename_field
+
def execute():
frappe.reload_doc("projects", "doctype", "timesheet")
frappe.reload_doc("projects", "doctype", "timesheet_detail")
diff --git a/erpnext/patches/v13_0/updates_for_multi_currency_payroll.py b/erpnext/patches/v13_0/updates_for_multi_currency_payroll.py
index 7d344f9..c760a6a 100644
--- a/erpnext/patches/v13_0/updates_for_multi_currency_payroll.py
+++ b/erpnext/patches/v13_0/updates_for_multi_currency_payroll.py
@@ -5,6 +5,7 @@
from frappe import _
from frappe.model.utils.rename_field import rename_field
+
def execute():
frappe.reload_doc('Accounts', 'doctype', 'Salary Component Account')
diff --git a/erpnext/patches/v13_0/validate_options_for_data_field.py b/erpnext/patches/v13_0/validate_options_for_data_field.py
index 568d1a4..41a38fe 100644
--- a/erpnext/patches/v13_0/validate_options_for_data_field.py
+++ b/erpnext/patches/v13_0/validate_options_for_data_field.py
@@ -2,12 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model import data_field_options
+from frappe.model import data_field_options
+
def execute():
- for field in frappe.get_all('Custom Field',
+ for field in frappe.get_all('Custom Field',
fields = ['name'],
filters = {
'fieldtype': 'Data',
@@ -16,7 +18,7 @@
if field not in data_field_options:
frappe.db.sql("""
- UPDATE
+ UPDATE
`tabCustom Field`
SET
options=NULL
diff --git a/erpnext/patches/v14_0/delete_einvoicing_doctypes.py b/erpnext/patches/v14_0/delete_einvoicing_doctypes.py
index b77d244..a3a8149 100644
--- a/erpnext/patches/v14_0/delete_einvoicing_doctypes.py
+++ b/erpnext/patches/v14_0/delete_einvoicing_doctypes.py
@@ -1,9 +1,10 @@
import frappe
+
def execute():
frappe.delete_doc('DocType', 'E Invoice Settings', ignore_missing=True)
frappe.delete_doc('DocType', 'E Invoice User', ignore_missing=True)
frappe.delete_doc('Report', 'E-Invoice Summary', ignore_missing=True)
frappe.delete_doc('Print Format', 'GST E-Invoice', ignore_missing=True)
frappe.delete_doc('Custom Field', 'Sales Invoice-eway_bill_cancelled', ignore_missing=True)
- frappe.delete_doc('Custom Field', 'Sales Invoice-irn_cancelled', ignore_missing=True)
\ No newline at end of file
+ frappe.delete_doc('Custom Field', 'Sales Invoice-irn_cancelled', ignore_missing=True)
diff --git a/erpnext/patches/v14_0/delete_shopify_doctypes.py b/erpnext/patches/v14_0/delete_shopify_doctypes.py
new file mode 100644
index 0000000..96bee39
--- /dev/null
+++ b/erpnext/patches/v14_0/delete_shopify_doctypes.py
@@ -0,0 +1,6 @@
+import frappe
+
+
+def execute():
+ frappe.delete_doc("DocType", "Shopify Settings", ignore_missing=True)
+ frappe.delete_doc("DocType", "Shopify Log", ignore_missing=True)
diff --git a/erpnext/patches/v4_2/repost_reserved_qty.py b/erpnext/patches/v4_2/repost_reserved_qty.py
index 36117aa..4fa3b46 100644
--- a/erpnext/patches/v4_2/repost_reserved_qty.py
+++ b/erpnext/patches/v4_2/repost_reserved_qty.py
@@ -2,8 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty
+
+from erpnext.stock.stock_balance import get_reserved_qty, update_bin_qty
+
def execute():
for doctype in ("Sales Order Item", "Bin"):
diff --git a/erpnext/patches/v4_2/update_requested_and_ordered_qty.py b/erpnext/patches/v4_2/update_requested_and_ordered_qty.py
index 7bb49e6..9330a44 100644
--- a/erpnext/patches/v4_2/update_requested_and_ordered_qty.py
+++ b/erpnext/patches/v4_2/update_requested_and_ordered_qty.py
@@ -2,10 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
- from erpnext.stock.stock_balance import update_bin_qty, get_indented_qty, get_ordered_qty
+ from erpnext.stock.stock_balance import get_indented_qty, get_ordered_qty, update_bin_qty
count=0
for item_code, warehouse in frappe.db.sql("""select distinct item_code, warehouse from
@@ -20,5 +22,5 @@
})
if count % 200 == 0:
frappe.db.commit()
- except:
+ except Exception:
frappe.db.rollback()
diff --git a/erpnext/patches/v5_7/update_item_description_based_on_item_master.py b/erpnext/patches/v5_7/update_item_description_based_on_item_master.py
index 2045358..82b5b1c 100644
--- a/erpnext/patches/v5_7/update_item_description_based_on_item_master.py
+++ b/erpnext/patches/v5_7/update_item_description_based_on_item_master.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def execute():
name = frappe.db.sql(""" select name from `tabPatch Log` \
where \
diff --git a/erpnext/patches/v8_1/removed_roles_from_gst_report_non_indian_account.py b/erpnext/patches/v8_1/removed_roles_from_gst_report_non_indian_account.py
index 55f5f82..ecfdc41 100644
--- a/erpnext/patches/v8_1/removed_roles_from_gst_report_non_indian_account.py
+++ b/erpnext/patches/v8_1/removed_roles_from_gst_report_non_indian_account.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute():
frappe.reload_doc('core', 'doctype', 'has_role')
company = frappe.get_all('Company', filters = {'country': 'India'})
diff --git a/erpnext/patches/v8_1/setup_gst_india.py b/erpnext/patches/v8_1/setup_gst_india.py
index c214990..140b226 100644
--- a/erpnext/patches/v8_1/setup_gst_india.py
+++ b/erpnext/patches/v8_1/setup_gst_india.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
+
import frappe
from frappe.email import sendmail_to_system_managers
+
def execute():
frappe.reload_doc('stock', 'doctype', 'item')
frappe.reload_doc("stock", "doctype", "customs_tariff_number")
diff --git a/erpnext/patches/v8_7/sync_india_custom_fields.py b/erpnext/patches/v8_7/sync_india_custom_fields.py
index eb24a90..65ec14e 100644
--- a/erpnext/patches/v8_7/sync_india_custom_fields.py
+++ b/erpnext/patches/v8_7/sync_india_custom_fields.py
@@ -1,6 +1,9 @@
from __future__ import unicode_literals
+
import frappe
-from erpnext.regional.india.setup import make_custom_fields
+
+from erpnext.regional.india.setup import make_custom_fields
+
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})
diff --git a/erpnext/payroll/doctype/additional_salary/additional_salary.py b/erpnext/payroll/doctype/additional_salary/additional_salary.py
index 381f399..ed10f2b 100644
--- a/erpnext/payroll/doctype/additional_salary/additional_salary.py
+++ b/erpnext/payroll/doctype/additional_salary/additional_salary.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _, bold
-from frappe.utils import getdate, date_diff, comma_and, formatdate
+from frappe.model.document import Document
+from frappe.utils import comma_and, date_diff, formatdate, getdate
+
from erpnext.hr.utils import validate_active_employee
+
class AdditionalSalary(Document):
def on_submit(self):
if self.ref_doctype == "Employee Advance" and self.ref_docname:
diff --git a/erpnext/payroll/doctype/additional_salary/test_additional_salary.py b/erpnext/payroll/doctype/additional_salary/test_additional_salary.py
index 2a9c561..2ad4afe 100644
--- a/erpnext/payroll/doctype/additional_salary/test_additional_salary.py
+++ b/erpnext/payroll/doctype/additional_salary/test_additional_salary.py
@@ -2,12 +2,19 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
-import frappe, erpnext
-from frappe.utils import nowdate, add_days
+
+import frappe
+from frappe.utils import add_days, nowdate
+
+import erpnext
from erpnext.hr.doctype.employee.test_employee import make_employee
from erpnext.payroll.doctype.salary_component.test_salary_component import create_salary_component
-from erpnext.payroll.doctype.salary_slip.test_salary_slip import make_employee_salary_slip, setup_test
+from erpnext.payroll.doctype.salary_slip.test_salary_slip import (
+ make_employee_salary_slip,
+ setup_test,
+)
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
diff --git a/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.py b/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.py
index a1cde08..9983f01 100644
--- a/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.py
+++ b/erpnext/payroll/doctype/employee_benefit_application/employee_benefit_application.py
@@ -3,13 +3,26 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import date_diff, getdate, rounded, add_days, cstr, cint, flt
from frappe.model.document import Document
-from erpnext.payroll.doctype.payroll_period.payroll_period import get_payroll_period_days, get_period_factor
-from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import get_assigned_salary_structure
-from erpnext.hr.utils import get_sal_slip_total_benefit_given, get_holiday_dates_for_employee, get_previous_claimed_amount, validate_active_employee
+from frappe.utils import add_days, cint, cstr, date_diff, getdate, rounded
+
+from erpnext.hr.utils import (
+ get_holiday_dates_for_employee,
+ get_previous_claimed_amount,
+ get_sal_slip_total_benefit_given,
+ validate_active_employee,
+)
+from erpnext.payroll.doctype.payroll_period.payroll_period import (
+ get_payroll_period_days,
+ get_period_factor,
+)
+from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import (
+ get_assigned_salary_structure,
+)
+
class EmployeeBenefitApplication(Document):
def validate(self):
diff --git a/erpnext/payroll/doctype/employee_benefit_application/test_employee_benefit_application.py b/erpnext/payroll/doctype/employee_benefit_application/test_employee_benefit_application.py
index 34e1a8f..ea05e0e 100644
--- a/erpnext/payroll/doctype/employee_benefit_application/test_employee_benefit_application.py
+++ b/erpnext/payroll/doctype/employee_benefit_application/test_employee_benefit_application.py
@@ -2,7 +2,9 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestEmployeeBenefitApplication(unittest.TestCase):
pass
diff --git a/erpnext/payroll/doctype/employee_benefit_application_detail/employee_benefit_application_detail.py b/erpnext/payroll/doctype/employee_benefit_application_detail/employee_benefit_application_detail.py
index 65405fe..ddcbaa2 100644
--- a/erpnext/payroll/doctype/employee_benefit_application_detail/employee_benefit_application_detail.py
+++ b/erpnext/payroll/doctype/employee_benefit_application_detail/employee_benefit_application_detail.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class EmployeeBenefitApplicationDetail(Document):
pass
diff --git a/erpnext/payroll/doctype/employee_benefit_claim/employee_benefit_claim.py b/erpnext/payroll/doctype/employee_benefit_claim/employee_benefit_claim.py
index c6713f3..7898e04 100644
--- a/erpnext/payroll/doctype/employee_benefit_claim/employee_benefit_claim.py
+++ b/erpnext/payroll/doctype/employee_benefit_claim/employee_benefit_claim.py
@@ -3,14 +3,21 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt
from frappe.model.document import Document
-from erpnext.payroll.doctype.employee_benefit_application.employee_benefit_application import get_max_benefits
+from frappe.utils import flt
+
from erpnext.hr.utils import get_previous_claimed_amount, validate_active_employee
+from erpnext.payroll.doctype.employee_benefit_application.employee_benefit_application import (
+ get_max_benefits,
+)
from erpnext.payroll.doctype.payroll_period.payroll_period import get_payroll_period
-from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import get_assigned_salary_structure
+from erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment import (
+ get_assigned_salary_structure,
+)
+
class EmployeeBenefitClaim(Document):
def validate(self):
diff --git a/erpnext/payroll/doctype/employee_benefit_claim/test_employee_benefit_claim.py b/erpnext/payroll/doctype/employee_benefit_claim/test_employee_benefit_claim.py
index aff73e5..f3f2229 100644
--- a/erpnext/payroll/doctype/employee_benefit_claim/test_employee_benefit_claim.py
+++ b/erpnext/payroll/doctype/employee_benefit_claim/test_employee_benefit_claim.py
@@ -2,7 +2,9 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
import unittest
+
class TestEmployeeBenefitClaim(unittest.TestCase):
pass
diff --git a/erpnext/payroll/doctype/employee_incentive/employee_incentive.py b/erpnext/payroll/doctype/employee_incentive/employee_incentive.py
index 6b918ba..74d0736 100644
--- a/erpnext/payroll/doctype/employee_incentive/employee_incentive.py
+++ b/erpnext/payroll/doctype/employee_incentive/employee_incentive.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
from erpnext.hr.utils import validate_active_employee
+
class EmployeeIncentive(Document):
def validate(self):
validate_active_employee(self.employee)
diff --git a/erpnext/payroll/doctype/employee_incentive/test_employee_incentive.py b/erpnext/payroll/doctype/employee_incentive/test_employee_incentive.py
index f7597ad..3c95fa8 100644
--- a/erpnext/payroll/doctype/employee_incentive/test_employee_incentive.py
+++ b/erpnext/payroll/doctype/employee_incentive/test_employee_incentive.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestEmployeeIncentive(unittest.TestCase):
pass
diff --git a/erpnext/payroll/doctype/employee_other_income/employee_other_income.py b/erpnext/payroll/doctype/employee_other_income/employee_other_income.py
index ab63c0d..73a0321 100644
--- a/erpnext/payroll/doctype/employee_other_income/employee_other_income.py
+++ b/erpnext/payroll/doctype/employee_other_income/employee_other_income.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class EmployeeOtherIncome(Document):
pass
diff --git a/erpnext/payroll/doctype/employee_other_income/test_employee_other_income.py b/erpnext/payroll/doctype/employee_other_income/test_employee_other_income.py
index 2eeca7a..5b735b3 100644
--- a/erpnext/payroll/doctype/employee_other_income/test_employee_other_income.py
+++ b/erpnext/payroll/doctype/employee_other_income/test_employee_other_income.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestEmployeeOtherIncome(unittest.TestCase):
pass
diff --git a/erpnext/payroll/doctype/employee_tax_exemption_category/employee_tax_exemption_category.py b/erpnext/payroll/doctype/employee_tax_exemption_category/employee_tax_exemption_category.py
index 4f705db..f88f551 100644
--- a/erpnext/payroll/doctype/employee_tax_exemption_category/employee_tax_exemption_category.py
+++ b/erpnext/payroll/doctype/employee_tax_exemption_category/employee_tax_exemption_category.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class EmployeeTaxExemptionCategory(Document):
pass
diff --git a/erpnext/payroll/doctype/employee_tax_exemption_category/test_employee_tax_exemption_category.py b/erpnext/payroll/doctype/employee_tax_exemption_category/test_employee_tax_exemption_category.py
index 669fb71..e6bc3ab 100644
--- a/erpnext/payroll/doctype/employee_tax_exemption_category/test_employee_tax_exemption_category.py
+++ b/erpnext/payroll/doctype/employee_tax_exemption_category/test_employee_tax_exemption_category.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestEmployeeTaxExemptionCategory(unittest.TestCase):
pass
diff --git a/erpnext/payroll/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py b/erpnext/payroll/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py
index e11d60a..099ab0d 100644
--- a/erpnext/payroll/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py
+++ b/erpnext/payroll/doctype/employee_tax_exemption_declaration/employee_tax_exemption_declaration.py
@@ -3,13 +3,20 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
-from frappe import _
-from frappe.utils import flt
from frappe.model.mapper import get_mapped_doc
-from erpnext.hr.utils import validate_tax_declaration, get_total_exemption_amount, validate_active_employee, \
- calculate_annual_eligible_hra_exemption, validate_duplicate_exemption_for_payroll_period
+from frappe.utils import flt
+
+from erpnext.hr.utils import (
+ calculate_annual_eligible_hra_exemption,
+ get_total_exemption_amount,
+ validate_active_employee,
+ validate_duplicate_exemption_for_payroll_period,
+ validate_tax_declaration,
+)
+
class EmployeeTaxExemptionDeclaration(Document):
def validate(self):
diff --git a/erpnext/payroll/doctype/employee_tax_exemption_declaration/test_employee_tax_exemption_declaration.py b/erpnext/payroll/doctype/employee_tax_exemption_declaration/test_employee_tax_exemption_declaration.py
index 311f352..b7154a4 100644
--- a/erpnext/payroll/doctype/employee_tax_exemption_declaration/test_employee_tax_exemption_declaration.py
+++ b/erpnext/payroll/doctype/employee_tax_exemption_declaration/test_employee_tax_exemption_declaration.py
@@ -3,11 +3,15 @@
# See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
import unittest
+
+import frappe
+
+import erpnext
from erpnext.hr.doctype.employee.test_employee import make_employee
from erpnext.hr.utils import DuplicateDeclarationError
+
class TestEmployeeTaxExemptionDeclaration(unittest.TestCase):
def setUp(self):
make_employee("employee@taxexepmtion.com")
diff --git a/erpnext/payroll/doctype/employee_tax_exemption_declaration_category/employee_tax_exemption_declaration_category.py b/erpnext/payroll/doctype/employee_tax_exemption_declaration_category/employee_tax_exemption_declaration_category.py
index bff747f..2923e57 100644
--- a/erpnext/payroll/doctype/employee_tax_exemption_declaration_category/employee_tax_exemption_declaration_category.py
+++ b/erpnext/payroll/doctype/employee_tax_exemption_declaration_category/employee_tax_exemption_declaration_category.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class EmployeeTaxExemptionDeclarationCategory(Document):
pass
diff --git a/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py b/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py
index 8131ae0..f35fd3c 100644
--- a/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py
+++ b/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/employee_tax_exemption_proof_submission.py
@@ -3,12 +3,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
-from frappe import _
from frappe.utils import flt
-from erpnext.hr.utils import validate_tax_declaration, get_total_exemption_amount, validate_active_employee, \
- calculate_hra_exemption_for_period, validate_duplicate_exemption_for_payroll_period
+
+from erpnext.hr.utils import (
+ calculate_hra_exemption_for_period,
+ get_total_exemption_amount,
+ validate_active_employee,
+ validate_duplicate_exemption_for_payroll_period,
+ validate_tax_declaration,
+)
+
class EmployeeTaxExemptionProofSubmission(Document):
def validate(self):
diff --git a/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/test_employee_tax_exemption_proof_submission.py b/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/test_employee_tax_exemption_proof_submission.py
index cb9ed5f..aafc0a1 100644
--- a/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/test_employee_tax_exemption_proof_submission.py
+++ b/erpnext/payroll/doctype/employee_tax_exemption_proof_submission/test_employee_tax_exemption_proof_submission.py
@@ -3,9 +3,15 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.payroll.doctype.employee_tax_exemption_declaration.test_employee_tax_exemption_declaration import create_exemption_category, create_payroll_period
+
+import frappe
+
+from erpnext.payroll.doctype.employee_tax_exemption_declaration.test_employee_tax_exemption_declaration import (
+ create_exemption_category,
+ create_payroll_period,
+)
+
class TestEmployeeTaxExemptionProofSubmission(unittest.TestCase):
def setup(self):
diff --git a/erpnext/payroll/doctype/employee_tax_exemption_proof_submission_detail/employee_tax_exemption_proof_submission_detail.py b/erpnext/payroll/doctype/employee_tax_exemption_proof_submission_detail/employee_tax_exemption_proof_submission_detail.py
index 0244ae6..e0a11ae 100644
--- a/erpnext/payroll/doctype/employee_tax_exemption_proof_submission_detail/employee_tax_exemption_proof_submission_detail.py
+++ b/erpnext/payroll/doctype/employee_tax_exemption_proof_submission_detail/employee_tax_exemption_proof_submission_detail.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class EmployeeTaxExemptionProofSubmissionDetail(Document):
pass
diff --git a/erpnext/payroll/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.py b/erpnext/payroll/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.py
index d3f24c9..5948ef2 100644
--- a/erpnext/payroll/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.py
+++ b/erpnext/payroll/doctype/employee_tax_exemption_sub_category/employee_tax_exemption_sub_category.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt
from frappe.model.document import Document
+from frappe.utils import flt
+
class EmployeeTaxExemptionSubCategory(Document):
def validate(self):
diff --git a/erpnext/payroll/doctype/employee_tax_exemption_sub_category/test_employee_tax_exemption_sub_category.py b/erpnext/payroll/doctype/employee_tax_exemption_sub_category/test_employee_tax_exemption_sub_category.py
index 5d705567..0086086 100644
--- a/erpnext/payroll/doctype/employee_tax_exemption_sub_category/test_employee_tax_exemption_sub_category.py
+++ b/erpnext/payroll/doctype/employee_tax_exemption_sub_category/test_employee_tax_exemption_sub_category.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestEmployeeTaxExemptionSubCategory(unittest.TestCase):
pass
diff --git a/erpnext/payroll/doctype/gratuity/gratuity.js b/erpnext/payroll/doctype/gratuity/gratuity.js
index 377f3c6..d4f7c9c 100644
--- a/erpnext/payroll/doctype/gratuity/gratuity.js
+++ b/erpnext/payroll/doctype/gratuity/gratuity.js
@@ -3,13 +3,6 @@
frappe.ui.form.on('Gratuity', {
setup: function (frm) {
- frm.set_query('salary_component', function () {
- return {
- filters: {
- type: "Earning"
- }
- };
- });
frm.set_query("expense_account", function () {
return {
filters: {
@@ -31,7 +24,7 @@
});
},
refresh: function (frm) {
- if (frm.doc.docstatus === 1 && frm.doc.pay_via_salary_slip === 0 && frm.doc.status === "Unpaid") {
+ if (frm.doc.docstatus == 1 && frm.doc.status == "Unpaid") {
frm.add_custom_button(__("Create Payment Entry"), function () {
return frappe.call({
method: 'erpnext.accounts.doctype.payment_entry.payment_entry.get_payment_entry',
diff --git a/erpnext/payroll/doctype/gratuity/gratuity.json b/erpnext/payroll/doctype/gratuity/gratuity.json
index 5cffd7e..48a9ce4 100644
--- a/erpnext/payroll/doctype/gratuity/gratuity.json
+++ b/erpnext/payroll/doctype/gratuity/gratuity.json
@@ -16,9 +16,6 @@
"company",
"gratuity_rule",
"section_break_5",
- "pay_via_salary_slip",
- "payroll_date",
- "salary_component",
"payable_account",
"expense_account",
"mode_of_payment",
@@ -50,26 +47,12 @@
"reqd": 1
},
{
- "default": "1",
- "fieldname": "pay_via_salary_slip",
- "fieldtype": "Check",
- "label": "Pay via Salary Slip"
- },
- {
"fieldname": "posting_date",
"fieldtype": "Date",
"label": "Posting date",
"reqd": 1
},
{
- "depends_on": "eval: doc.pay_via_salary_slip == 1",
- "fieldname": "salary_component",
- "fieldtype": "Link",
- "label": "Salary Component",
- "mandatory_depends_on": "eval: doc.pay_via_salary_slip == 1",
- "options": "Salary Component"
- },
- {
"default": "0",
"fieldname": "current_work_experience",
"fieldtype": "Int",
@@ -95,20 +78,18 @@
"reqd": 1
},
{
- "depends_on": "eval: doc.pay_via_salary_slip == 0",
"fieldname": "expense_account",
"fieldtype": "Link",
"label": "Expense Account",
- "mandatory_depends_on": "eval: doc.pay_via_salary_slip == 0",
- "options": "Account"
+ "options": "Account",
+ "reqd": 1
},
{
- "depends_on": "eval: doc.pay_via_salary_slip == 0",
"fieldname": "mode_of_payment",
"fieldtype": "Link",
"label": "Mode of Payment",
- "mandatory_depends_on": "eval: doc.pay_via_salary_slip == 0",
- "options": "Mode of Payment"
+ "options": "Mode of Payment",
+ "reqd": 1
},
{
"fieldname": "gratuity_rule",
@@ -162,13 +143,6 @@
"fieldtype": "Column Break"
},
{
- "depends_on": "eval: doc.pay_via_salary_slip == 1",
- "fieldname": "payroll_date",
- "fieldtype": "Date",
- "label": "Payroll Date",
- "mandatory_depends_on": "eval: doc.pay_via_salary_slip == 1"
- },
- {
"default": "0",
"depends_on": "eval:doc.pay_via_salary_slip == 0",
"fieldname": "paid_amount",
@@ -177,26 +151,23 @@
"read_only": 1
},
{
- "depends_on": "eval: doc.pay_via_salary_slip == 0",
"fieldname": "payable_account",
"fieldtype": "Link",
"label": "Payable Account",
- "mandatory_depends_on": "eval: doc.pay_via_salary_slip == 0",
- "options": "Account"
+ "options": "Account",
+ "reqd": 1
},
{
- "depends_on": "eval: doc.pay_via_salary_slip == 0",
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
- "mandatory_depends_on": "eval: doc.pay_via_salary_slip == 0",
"options": "Cost Center"
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
- "modified": "2020-11-02 18:21:11.971488",
+ "modified": "2021-07-02 15:05:57.396398",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Gratuity",
diff --git a/erpnext/payroll/doctype/gratuity/gratuity.py b/erpnext/payroll/doctype/gratuity/gratuity.py
index 8cb804d..cc28dc4 100644
--- a/erpnext/payroll/doctype/gratuity/gratuity.py
+++ b/erpnext/payroll/doctype/gratuity/gratuity.py
@@ -3,12 +3,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+from math import floor
+
import frappe
from frappe import _, bold
from frappe.utils import flt, get_datetime, get_link_to_form
+
from erpnext.accounts.general_ledger import make_gl_entries
from erpnext.controllers.accounts_controller import AccountsController
-from math import floor
+
class Gratuity(AccountsController):
def validate(self):
@@ -19,10 +23,7 @@
self.status = "Unpaid"
def on_submit(self):
- if self.pay_via_salary_slip:
- self.create_additional_salary()
- else:
- self.create_gl_entries()
+ self.create_gl_entries()
def on_cancel(self):
self.ignore_linked_doctypes = ['GL Entry']
@@ -65,19 +66,6 @@
return gl_entry
- def create_additional_salary(self):
- if self.pay_via_salary_slip:
- additional_salary = frappe.new_doc('Additional Salary')
- additional_salary.employee = self.employee
- additional_salary.salary_component = self.salary_component
- additional_salary.overwrite_salary_structure_amount = 0
- additional_salary.amount = self.amount
- additional_salary.payroll_date = self.payroll_date
- additional_salary.company = self.company
- additional_salary.ref_doctype = self.doctype
- additional_salary.ref_docname = self.name
- additional_salary.submit()
-
def set_total_advance_paid(self):
paid_amount = frappe.db.sql("""
select ifnull(sum(debit_in_account_currency), 0) as paid_amount
@@ -242,7 +230,11 @@
order_by = "from_date desc")[0].salary_structure
def get_last_salary_slip(employee):
- return frappe.get_list("Salary Slip", filters = {
+ salary_slips = frappe.get_list("Salary Slip", filters = {
"employee": employee, 'docstatus': 1
},
- order_by = "start_date desc")[0].name
+ order_by = "start_date desc"
+ )
+ if not salary_slips:
+ return
+ return salary_slips[0].name
diff --git a/erpnext/payroll/doctype/gratuity/gratuity_dashboard.py b/erpnext/payroll/doctype/gratuity/gratuity_dashboard.py
index 483e346..1599fc2 100644
--- a/erpnext/payroll/doctype/gratuity/gratuity_dashboard.py
+++ b/erpnext/payroll/doctype/gratuity/gratuity_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'reference_name',
@@ -11,10 +13,6 @@
{
'label': _('Payment'),
'items': ['Payment Entry']
- },
- {
- 'label': _('Additional Salary'),
- 'items': ['Additional Salary']
}
]
}
diff --git a/erpnext/payroll/doctype/gratuity/test_gratuity.py b/erpnext/payroll/doctype/gratuity/test_gratuity.py
index 7daea2d..1403e9b 100644
--- a/erpnext/payroll/doctype/gratuity/test_gratuity.py
+++ b/erpnext/payroll/doctype/gratuity/test_gratuity.py
@@ -3,15 +3,20 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
+from frappe.utils import add_days, flt, get_datetime, getdate
+
from erpnext.hr.doctype.employee.test_employee import make_employee
-from erpnext.payroll.doctype.salary_slip.test_salary_slip import make_employee_salary_slip, make_earning_salary_component, \
- make_deduction_salary_component
-from erpnext.payroll.doctype.gratuity.gratuity import get_last_salary_slip
-from erpnext.regional.united_arab_emirates.setup import create_gratuity_rule
from erpnext.hr.doctype.expense_claim.test_expense_claim import get_payable_account
-from frappe.utils import getdate, add_days, get_datetime, flt
+from erpnext.payroll.doctype.gratuity.gratuity import get_last_salary_slip
+from erpnext.payroll.doctype.salary_slip.test_salary_slip import (
+ make_deduction_salary_component,
+ make_earning_salary_component,
+ make_employee_salary_slip,
+)
+from erpnext.regional.united_arab_emirates.setup import create_gratuity_rule
test_dependencies = ["Salary Component", "Salary Slip", "Account"]
class TestGratuity(unittest.TestCase):
@@ -22,14 +27,18 @@
def setUp(self):
frappe.db.sql("DELETE FROM `tabGratuity`")
- frappe.db.sql("DELETE FROM `tabAdditional Salary` WHERE ref_doctype = 'Gratuity'")
- def test_check_gratuity_amount_based_on_current_slab_and_additional_salary_creation(self):
+ def test_get_last_salary_slip_should_return_none_for_new_employee(self):
+ new_employee = make_employee("new_employee@salary.com", company='_Test Company')
+ salary_slip = get_last_salary_slip(new_employee)
+ assert salary_slip is None
+
+ def test_check_gratuity_amount_based_on_current_slab(self):
employee, sal_slip = create_employee_and_get_last_salary_slip()
rule = get_gratuity_rule("Rule Under Unlimited Contract on termination (UAE)")
- gratuity = create_gratuity(pay_via_salary_slip = 1, employee=employee, rule=rule.name)
+ gratuity = create_gratuity(employee=employee, rule=rule.name)
#work experience calculation
date_of_joining, relieving_date = frappe.db.get_value('Employee', employee, ['date_of_joining', 'relieving_date'])
@@ -57,9 +66,6 @@
self.assertEqual(flt(gratuity_amount, 2), flt(gratuity.amount, 2))
- #additional salary creation (Pay via salary slip)
- self.assertTrue(frappe.db.exists("Additional Salary", {"ref_docname": gratuity.name}))
-
def test_check_gratuity_amount_based_on_all_previous_slabs(self):
employee, sal_slip = create_employee_and_get_last_salary_slip()
rule = get_gratuity_rule("Rule Under Limited Contract (UAE)")
@@ -137,14 +143,9 @@
gratuity.employee = args.employee
gratuity.posting_date = getdate()
gratuity.gratuity_rule = args.rule or "Rule Under Limited Contract (UAE)"
- gratuity.pay_via_salary_slip = args.pay_via_salary_slip or 0
- if gratuity.pay_via_salary_slip:
- gratuity.payroll_date = getdate()
- gratuity.salary_component = "Performance Bonus"
- else:
- gratuity.expense_account = args.expense_account or 'Payment Account - _TC'
- gratuity.payable_account = args.payable_account or get_payable_account("_Test Company")
- gratuity.mode_of_payment = args.mode_of_payment or 'Cash'
+ gratuity.expense_account = args.expense_account or 'Payment Account - _TC'
+ gratuity.payable_account = args.payable_account or get_payable_account("_Test Company")
+ gratuity.mode_of_payment = args.mode_of_payment or 'Cash'
gratuity.save()
gratuity.submit()
diff --git a/erpnext/payroll/doctype/gratuity_applicable_component/gratuity_applicable_component.py b/erpnext/payroll/doctype/gratuity_applicable_component/gratuity_applicable_component.py
index 23e4340..d76b26d 100644
--- a/erpnext/payroll/doctype/gratuity_applicable_component/gratuity_applicable_component.py
+++ b/erpnext/payroll/doctype/gratuity_applicable_component/gratuity_applicable_component.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class GratuityApplicableComponent(Document):
pass
diff --git a/erpnext/payroll/doctype/gratuity_rule/gratuity_rule.py b/erpnext/payroll/doctype/gratuity_rule/gratuity_rule.py
index 29a6ebe..95d2929 100644
--- a/erpnext/payroll/doctype/gratuity_rule/gratuity_rule.py
+++ b/erpnext/payroll/doctype/gratuity_rule/gratuity_rule.py
@@ -3,16 +3,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
+from frappe.model.document import Document
+
class GratuityRule(Document):
def validate(self):
for current_slab in self.gratuity_rule_slabs:
if (current_slab.from_year > current_slab.to_year) and current_slab.to_year != 0:
- frappe(_("Row {0}: From (Year) can not be greater than To (Year)").format(current_slab.idx))
+ frappe.throw(_("Row {0}: From (Year) can not be greater than To (Year)").format(current_slab.idx))
if current_slab.to_year == 0 and current_slab.from_year == 0 and len(self.gratuity_rule_slabs) > 1:
frappe.throw(_("You can not define multiple slabs if you have a slab with no lower and upper limits."))
diff --git a/erpnext/payroll/doctype/gratuity_rule/gratuity_rule_dashboard.py b/erpnext/payroll/doctype/gratuity_rule/gratuity_rule_dashboard.py
index 0f27315..60dcfa4 100644
--- a/erpnext/payroll/doctype/gratuity_rule/gratuity_rule_dashboard.py
+++ b/erpnext/payroll/doctype/gratuity_rule/gratuity_rule_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'gratuity_rule',
diff --git a/erpnext/payroll/doctype/gratuity_rule/test_gratuity_rule.py b/erpnext/payroll/doctype/gratuity_rule/test_gratuity_rule.py
index 1f5dc4e..c81d7b7 100644
--- a/erpnext/payroll/doctype/gratuity_rule/test_gratuity_rule.py
+++ b/erpnext/payroll/doctype/gratuity_rule/test_gratuity_rule.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestGratuityRule(unittest.TestCase):
pass
diff --git a/erpnext/payroll/doctype/gratuity_rule_slab/gratuity_rule_slab.py b/erpnext/payroll/doctype/gratuity_rule_slab/gratuity_rule_slab.py
index fa468e7..dcd7e46 100644
--- a/erpnext/payroll/doctype/gratuity_rule_slab/gratuity_rule_slab.py
+++ b/erpnext/payroll/doctype/gratuity_rule_slab/gratuity_rule_slab.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class GratuityRuleSlab(Document):
pass
diff --git a/erpnext/payroll/doctype/income_tax_slab/income_tax_slab.py b/erpnext/payroll/doctype/income_tax_slab/income_tax_slab.py
index 81e3647..f778fd9 100644
--- a/erpnext/payroll/doctype/income_tax_slab/income_tax_slab.py
+++ b/erpnext/payroll/doctype/income_tax_slab/income_tax_slab.py
@@ -3,9 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
+from frappe.model.document import Document
+
#import frappe
import erpnext
-from frappe.model.document import Document
+
class IncomeTaxSlab(Document):
def validate(self):
diff --git a/erpnext/payroll/doctype/income_tax_slab/test_income_tax_slab.py b/erpnext/payroll/doctype/income_tax_slab/test_income_tax_slab.py
index deaaf65..d762990 100644
--- a/erpnext/payroll/doctype/income_tax_slab/test_income_tax_slab.py
+++ b/erpnext/payroll/doctype/income_tax_slab/test_income_tax_slab.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestIncomeTaxSlab(unittest.TestCase):
pass
diff --git a/erpnext/payroll/doctype/income_tax_slab_other_charges/income_tax_slab_other_charges.py b/erpnext/payroll/doctype/income_tax_slab_other_charges/income_tax_slab_other_charges.py
index b4098ec..3314677 100644
--- a/erpnext/payroll/doctype/income_tax_slab_other_charges/income_tax_slab_other_charges.py
+++ b/erpnext/payroll/doctype/income_tax_slab_other_charges/income_tax_slab_other_charges.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class IncomeTaxSlabOtherCharges(Document):
pass
diff --git a/erpnext/payroll/doctype/payroll_employee_detail/payroll_employee_detail.py b/erpnext/payroll/doctype/payroll_employee_detail/payroll_employee_detail.py
index aeb11fd..074d223 100644
--- a/erpnext/payroll/doctype/payroll_employee_detail/payroll_employee_detail.py
+++ b/erpnext/payroll/doctype/payroll_employee_detail/payroll_employee_detail.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class PayrollEmployeeDetail(Document):
pass
diff --git a/erpnext/payroll/doctype/payroll_entry/payroll_entry.py b/erpnext/payroll/doctype/payroll_entry/payroll_entry.py
index 13cc423..f1557c7 100644
--- a/erpnext/payroll/doctype/payroll_entry/payroll_entry.py
+++ b/erpnext/payroll/doctype/payroll_entry/payroll_entry.py
@@ -3,15 +3,30 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe.model.document import Document
+
+import frappe
from dateutil.relativedelta import relativedelta
-from frappe.utils import cint, flt, add_days, getdate, add_to_date, DATE_FORMAT, date_diff, comma_and
from frappe import _
+from frappe.desk.reportview import get_filters_cond, get_match_cond
+from frappe.model.document import Document
+from frappe.utils import (
+ DATE_FORMAT,
+ add_days,
+ add_to_date,
+ cint,
+ comma_and,
+ date_diff,
+ flt,
+ getdate,
+)
+
+import erpnext
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
+ get_accounting_dimensions,
+)
from erpnext.accounts.utils import get_fiscal_year
from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
-from frappe.desk.reportview import get_match_cond, get_filters_cond
-from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
+
class PayrollEntry(Document):
def onload(self):
@@ -529,7 +544,8 @@
def get_month_details(year, month):
ysd = frappe.db.get_value("Fiscal Year", year, "year_start_date")
if ysd:
- import calendar, datetime
+ import calendar
+ import datetime
diff_mnt = cint(month)-cint(ysd.month)
if diff_mnt<0:
diff_mnt = 12-int(ysd.month)+cint(month)
diff --git a/erpnext/payroll/doctype/payroll_entry/payroll_entry_dashboard.py b/erpnext/payroll/doctype/payroll_entry/payroll_entry_dashboard.py
index 0346a7c..16e44d0 100644
--- a/erpnext/payroll/doctype/payroll_entry/payroll_entry_dashboard.py
+++ b/erpnext/payroll/doctype/payroll_entry/payroll_entry_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/payroll/doctype/payroll_entry/test_payroll_entry.py b/erpnext/payroll/doctype/payroll_entry/test_payroll_entry.py
index b80b320..dd0e127 100644
--- a/erpnext/payroll/doctype/payroll_entry/test_payroll_entry.py
+++ b/erpnext/payroll/doctype/payroll_entry/test_payroll_entry.py
@@ -1,19 +1,37 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import unittest
-import erpnext
+
import frappe
from dateutil.relativedelta import relativedelta
-from erpnext.accounts.utils import get_fiscal_year, getdate, nowdate
from frappe.utils import add_months
-from erpnext.payroll.doctype.payroll_entry.payroll_entry import get_start_end_dates, get_end_date
+
+import erpnext
+from erpnext.accounts.utils import get_fiscal_year, getdate, nowdate
from erpnext.hr.doctype.employee.test_employee import make_employee
-from erpnext.payroll.doctype.salary_slip.test_salary_slip import get_salary_component_account, \
- make_earning_salary_component, make_deduction_salary_component, create_account, make_employee_salary_slip
-from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure, create_salary_structure_assignment
-from erpnext.loan_management.doctype.loan.test_loan import create_loan, make_loan_disbursement_entry, create_loan_type, create_loan_accounts
-from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import process_loan_interest_accrual_for_term_loans
+from erpnext.loan_management.doctype.loan.test_loan import (
+ create_loan,
+ create_loan_accounts,
+ create_loan_type,
+ make_loan_disbursement_entry,
+)
+from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
+ process_loan_interest_accrual_for_term_loans,
+)
+from erpnext.payroll.doctype.payroll_entry.payroll_entry import get_end_date, get_start_end_dates
+from erpnext.payroll.doctype.salary_slip.test_salary_slip import (
+ create_account,
+ get_salary_component_account,
+ make_deduction_salary_component,
+ make_earning_salary_component,
+ make_employee_salary_slip,
+)
+from erpnext.payroll.doctype.salary_structure.test_salary_structure import (
+ create_salary_structure_assignment,
+ make_salary_structure,
+)
test_dependencies = ['Holiday List']
diff --git a/erpnext/payroll/doctype/payroll_period/payroll_period.py b/erpnext/payroll/doctype/payroll_period/payroll_period.py
index 66dec07..0de8d63 100644
--- a/erpnext/payroll/doctype/payroll_period/payroll_period.py
+++ b/erpnext/payroll/doctype/payroll_period/payroll_period.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import date_diff, getdate, formatdate, cint, month_diff, flt, add_months
from frappe.model.document import Document
+from frappe.utils import add_months, cint, date_diff, flt, formatdate, getdate, month_diff
+
from erpnext.hr.utils import get_holiday_dates_for_employee
+
class PayrollPeriod(Document):
def validate(self):
self.validate_dates()
diff --git a/erpnext/payroll/doctype/payroll_period/payroll_period_dashboard.py b/erpnext/payroll/doctype/payroll_period/payroll_period_dashboard.py
index e332995..4105d8e 100644
--- a/erpnext/payroll/doctype/payroll_period/payroll_period_dashboard.py
+++ b/erpnext/payroll/doctype/payroll_period/payroll_period_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/payroll/doctype/payroll_period/test_payroll_period.py b/erpnext/payroll/doctype/payroll_period/test_payroll_period.py
index d06dc73..e93c0e5 100644
--- a/erpnext/payroll/doctype/payroll_period/test_payroll_period.py
+++ b/erpnext/payroll/doctype/payroll_period/test_payroll_period.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestPayrollPeriod(unittest.TestCase):
pass
diff --git a/erpnext/payroll/doctype/payroll_period_date/payroll_period_date.py b/erpnext/payroll/doctype/payroll_period_date/payroll_period_date.py
index a3ee269..fa6835d 100644
--- a/erpnext/payroll/doctype/payroll_period_date/payroll_period_date.py
+++ b/erpnext/payroll/doctype/payroll_period_date/payroll_period_date.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class PayrollPeriodDate(Document):
pass
diff --git a/erpnext/payroll/doctype/payroll_settings/payroll_settings.py b/erpnext/payroll/doctype/payroll_settings/payroll_settings.py
index 459b7ea..b85d554 100644
--- a/erpnext/payroll/doctype/payroll_settings/payroll_settings.py
+++ b/erpnext/payroll/doctype/payroll_settings/payroll_settings.py
@@ -3,11 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
+from frappe import _
+from frappe.custom.doctype.property_setter.property_setter import make_property_setter
from frappe.model.document import Document
from frappe.utils import cint
-from frappe.custom.doctype.property_setter.property_setter import make_property_setter
-from frappe import _
+
class PayrollSettings(Document):
def validate(self):
diff --git a/erpnext/payroll/doctype/payroll_settings/test_payroll_settings.py b/erpnext/payroll/doctype/payroll_settings/test_payroll_settings.py
index 314866e..30a6a33 100644
--- a/erpnext/payroll/doctype/payroll_settings/test_payroll_settings.py
+++ b/erpnext/payroll/doctype/payroll_settings/test_payroll_settings.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestPayrollSettings(unittest.TestCase):
pass
diff --git a/erpnext/payroll/doctype/retention_bonus/retention_bonus.py b/erpnext/payroll/doctype/retention_bonus/retention_bonus.py
index 055bea7..7e731e7 100644
--- a/erpnext/payroll/doctype/retention_bonus/retention_bonus.py
+++ b/erpnext/payroll/doctype/retention_bonus/retention_bonus.py
@@ -3,11 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
+from frappe.model.document import Document
from frappe.utils import getdate
+
from erpnext.hr.utils import validate_active_employee
+
+
class RetentionBonus(Document):
def validate(self):
validate_active_employee(self.employee)
diff --git a/erpnext/payroll/doctype/retention_bonus/test_retention_bonus.py b/erpnext/payroll/doctype/retention_bonus/test_retention_bonus.py
index eef4f14..a380d9f 100644
--- a/erpnext/payroll/doctype/retention_bonus/test_retention_bonus.py
+++ b/erpnext/payroll/doctype/retention_bonus/test_retention_bonus.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestRetentionBonus(unittest.TestCase):
pass
diff --git a/erpnext/payroll/doctype/salary_component/salary_component.py b/erpnext/payroll/doctype/salary_component/salary_component.py
index 7c92631..761d443 100644
--- a/erpnext/payroll/doctype/salary_component/salary_component.py
+++ b/erpnext/payroll/doctype/salary_component/salary_component.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
from frappe.model.naming import append_number_if_name_exists
+
class SalaryComponent(Document):
def validate(self):
self.validate_abbr()
diff --git a/erpnext/payroll/doctype/salary_component/test_salary_component.py b/erpnext/payroll/doctype/salary_component/test_salary_component.py
index 4f7db0c..939fa4a 100644
--- a/erpnext/payroll/doctype/salary_component/test_salary_component.py
+++ b/erpnext/payroll/doctype/salary_component/test_salary_component.py
@@ -3,9 +3,10 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
# test_records = frappe.get_test_records('Salary Component')
class TestSalaryComponent(unittest.TestCase):
diff --git a/erpnext/payroll/doctype/salary_detail/salary_detail.py b/erpnext/payroll/doctype/salary_detail/salary_detail.py
index 0b18754..50d1958 100644
--- a/erpnext/payroll/doctype/salary_detail/salary_detail.py
+++ b/erpnext/payroll/doctype/salary_detail/salary_detail.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class SalaryDetail(Document):
pass
diff --git a/erpnext/payroll/doctype/salary_slip/salary_slip.js b/erpnext/payroll/doctype/salary_slip/salary_slip.js
index 5258f3a..3ef9762 100644
--- a/erpnext/payroll/doctype/salary_slip/salary_slip.js
+++ b/erpnext/payroll/doctype/salary_slip/salary_slip.js
@@ -135,15 +135,15 @@
change_form_labels: function(frm, company_currency) {
frm.set_currency_labels(["base_hour_rate", "base_gross_pay", "base_total_deduction",
- "base_net_pay", "base_rounded_total", "base_total_in_words", "base_year_to_date", "base_month_to_date"],
+ "base_net_pay", "base_rounded_total", "base_total_in_words", "base_year_to_date", "base_month_to_date", "gross_base_year_to_date"],
company_currency);
- frm.set_currency_labels(["hour_rate", "gross_pay", "total_deduction", "net_pay", "rounded_total", "total_in_words", "year_to_date", "month_to_date"],
+ frm.set_currency_labels(["hour_rate", "gross_pay", "total_deduction", "net_pay", "rounded_total", "total_in_words", "year_to_date", "month_to_date", "gross_year_to_date"],
frm.doc.currency);
// toggle fields
frm.toggle_display(["exchange_rate", "base_hour_rate", "base_gross_pay", "base_total_deduction",
- "base_net_pay", "base_rounded_total", "base_total_in_words", "base_year_to_date", "base_month_to_date"],
+ "base_net_pay", "base_rounded_total", "base_total_in_words", "base_year_to_date", "base_month_to_date", "base_gross_year_to_date"],
frm.doc.currency != company_currency);
},
diff --git a/erpnext/payroll/doctype/salary_slip/salary_slip.json b/erpnext/payroll/doctype/salary_slip/salary_slip.json
index 42a0f29..1974403 100644
--- a/erpnext/payroll/doctype/salary_slip/salary_slip.json
+++ b/erpnext/payroll/doctype/salary_slip/salary_slip.json
@@ -56,6 +56,8 @@
"totals",
"gross_pay",
"base_gross_pay",
+ "gross_year_to_date",
+ "base_gross_year_to_date",
"column_break_25",
"total_deduction",
"base_total_deduction",
@@ -625,13 +627,27 @@
"label": "Leave Details",
"options": "Salary Slip Leave",
"read_only": 1
+ },
+ {
+ "fieldname": "gross_year_to_date",
+ "fieldtype": "Currency",
+ "label": "Gross Year To Date",
+ "options": "currency",
+ "read_only": 1
+ },
+ {
+ "fieldname": "base_gross_year_to_date",
+ "fieldtype": "Currency",
+ "label": "Gross Year To Date(Company Currency)",
+ "options": "Company:company:default_currency",
+ "read_only": 1
}
],
"icon": "fa fa-file-text",
"idx": 9,
"is_submittable": 1,
"links": [],
- "modified": "2021-03-31 22:44:09.772331",
+ "modified": "2021-09-01 10:35:52.374549",
"modified_by": "Administrator",
"module": "Payroll",
"name": "Salary Slip",
@@ -672,4 +688,4 @@
"sort_order": "DESC",
"timeline_field": "employee",
"title_field": "employee_name"
-}
\ No newline at end of file
+}
diff --git a/erpnext/payroll/doctype/salary_slip/salary_slip.py b/erpnext/payroll/doctype/salary_slip/salary_slip.py
index 6325351..8c48345 100644
--- a/erpnext/payroll/doctype/salary_slip/salary_slip.py
+++ b/erpnext/payroll/doctype/salary_slip/salary_slip.py
@@ -2,27 +2,51 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-import datetime, math
-from frappe.utils import add_days, cint, cstr, flt, getdate, rounded, date_diff, money_in_words, formatdate, get_first_day
+import datetime
+import math
+
+import frappe
+from frappe import _, msgprint
from frappe.model.naming import make_autoname
-
-from frappe import msgprint, _
-from erpnext.payroll.doctype.payroll_entry.payroll_entry import get_start_end_dates
-from erpnext.hr.doctype.employee.employee import get_holiday_list_for_employee
-from erpnext.hr.utils import get_holiday_dates_for_employee
-from erpnext.utilities.transaction_base import TransactionBase
+from frappe.utils import (
+ add_days,
+ cint,
+ cstr,
+ date_diff,
+ flt,
+ formatdate,
+ get_first_day,
+ getdate,
+ money_in_words,
+ rounded,
+)
from frappe.utils.background_jobs import enqueue
-from erpnext.payroll.doctype.additional_salary.additional_salary import get_additional_salaries
-from erpnext.payroll.doctype.payroll_period.payroll_period import get_period_factor, get_payroll_period
-from erpnext.payroll.doctype.employee_benefit_application.employee_benefit_application import get_benefit_component_amount
-from erpnext.payroll.doctype.employee_benefit_claim.employee_benefit_claim import get_benefit_claim_amount, get_last_payroll_period_benefits
-from erpnext.loan_management.doctype.loan_repayment.loan_repayment import calculate_amounts, create_repayment_entry
-from erpnext.accounts.utils import get_fiscal_year
-from erpnext.hr.utils import validate_active_employee
from six import iteritems
+import erpnext
+from erpnext.accounts.utils import get_fiscal_year
+from erpnext.hr.utils import get_holiday_dates_for_employee, validate_active_employee
+from erpnext.loan_management.doctype.loan_repayment.loan_repayment import (
+ calculate_amounts,
+ create_repayment_entry,
+)
+from erpnext.payroll.doctype.additional_salary.additional_salary import get_additional_salaries
+from erpnext.payroll.doctype.employee_benefit_application.employee_benefit_application import (
+ get_benefit_component_amount,
+)
+from erpnext.payroll.doctype.employee_benefit_claim.employee_benefit_claim import (
+ get_benefit_claim_amount,
+ get_last_payroll_period_benefits,
+)
+from erpnext.payroll.doctype.payroll_entry.payroll_entry import get_start_end_dates
+from erpnext.payroll.doctype.payroll_period.payroll_period import (
+ get_payroll_period,
+ get_period_factor,
+)
+from erpnext.utilities.transaction_base import TransactionBase
+
+
class SalarySlip(TransactionBase):
def __init__(self, *args, **kwargs):
super(SalarySlip, self).__init__(*args, **kwargs)
@@ -1214,7 +1238,7 @@
period_start_date, period_end_date = self.get_year_to_date_period()
salary_slip_sum = frappe.get_list('Salary Slip',
- fields = ['sum(net_pay) as sum'],
+ fields = ['sum(net_pay) as net_sum', 'sum(gross_pay) as gross_sum'],
filters = {'employee_name' : self.employee_name,
'start_date' : ['>=', period_start_date],
'end_date' : ['<', period_end_date],
@@ -1222,10 +1246,13 @@
'docstatus': 1
})
- year_to_date = flt(salary_slip_sum[0].sum) if salary_slip_sum else 0.0
+ year_to_date = flt(salary_slip_sum[0].net_sum) if salary_slip_sum else 0.0
+ gross_year_to_date = flt(salary_slip_sum[0].gross_sum) if salary_slip_sum else 0.0
year_to_date += self.net_pay
+ gross_year_to_date += self.gross_pay
self.year_to_date = year_to_date
+ self.gross_year_to_date = gross_year_to_date
def compute_month_to_date(self):
month_to_date = 0
diff --git a/erpnext/payroll/doctype/salary_slip/test_salary_slip.py b/erpnext/payroll/doctype/salary_slip/test_salary_slip.py
index 636ec0b..480daa2 100644
--- a/erpnext/payroll/doctype/salary_slip/test_salary_slip.py
+++ b/erpnext/payroll/doctype/salary_slip/test_salary_slip.py
@@ -2,20 +2,34 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import unittest
-import frappe
-import erpnext
import calendar
import random
+import unittest
+
+import frappe
+from frappe.utils import (
+ add_days,
+ add_months,
+ cstr,
+ flt,
+ get_first_day,
+ get_last_day,
+ getdate,
+ nowdate,
+)
+
+import erpnext
from erpnext.accounts.utils import get_fiscal_year
-from frappe.utils import getdate, nowdate, add_days, add_months, flt, get_first_day, get_last_day, cstr
-from erpnext.payroll.doctype.salary_structure.salary_structure import make_salary_slip
-from erpnext.payroll.doctype.payroll_entry.payroll_entry import get_month_details
from erpnext.hr.doctype.employee.test_employee import make_employee
from erpnext.hr.doctype.leave_allocation.test_leave_allocation import create_leave_allocation
from erpnext.hr.doctype.leave_type.test_leave_type import create_leave_type
-from erpnext.payroll.doctype.employee_tax_exemption_declaration.test_employee_tax_exemption_declaration \
- import create_payroll_period, create_exemption_category
+from erpnext.payroll.doctype.employee_tax_exemption_declaration.test_employee_tax_exemption_declaration import (
+ create_exemption_category,
+ create_payroll_period,
+)
+from erpnext.payroll.doctype.payroll_entry.payroll_entry import get_month_details
+from erpnext.payroll.doctype.salary_structure.salary_structure import make_salary_slip
+
class TestSalarySlip(unittest.TestCase):
def setUp(self):
@@ -154,7 +168,9 @@
self.assertEqual(ss.gross_pay, 78000)
def test_payment_days(self):
- from erpnext.payroll.doctype.salary_structure.test_salary_structure import create_salary_structure_assignment
+ from erpnext.payroll.doctype.salary_structure.test_salary_structure import (
+ create_salary_structure_assignment,
+ )
no_of_days = self.get_no_of_days()
# Holidays not included in working days
@@ -231,8 +247,15 @@
self.assertTrue(email_queue)
def test_loan_repayment_salary_slip(self):
- from erpnext.loan_management.doctype.loan.test_loan import create_loan_type, create_loan, make_loan_disbursement_entry, create_loan_accounts
- from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import process_loan_interest_accrual_for_term_loans
+ from erpnext.loan_management.doctype.loan.test_loan import (
+ create_loan,
+ create_loan_accounts,
+ create_loan_type,
+ make_loan_disbursement_entry,
+ )
+ from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import (
+ process_loan_interest_accrual_for_term_loans,
+ )
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
applicant = make_employee("test_loan_repayment_salary_slip@salary.com", company="_Test Company")
@@ -386,8 +409,7 @@
for doc in delete_docs:
frappe.db.sql("delete from `tab%s` where employee='%s'" % (doc, employee))
- from erpnext.payroll.doctype.salary_structure.test_salary_structure import \
- make_salary_structure, create_salary_structure_assignment
+ from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_salary_structure
salary_structure = make_salary_structure("Stucture to test tax", "Monthly",
other_details={"max_benefits": 100000}, test_tax=True,
diff --git a/erpnext/payroll/doctype/salary_slip_leave/salary_slip_leave.py b/erpnext/payroll/doctype/salary_slip_leave/salary_slip_leave.py
index 7a92bf1..fc8282b 100644
--- a/erpnext/payroll/doctype/salary_slip_leave/salary_slip_leave.py
+++ b/erpnext/payroll/doctype/salary_slip_leave/salary_slip_leave.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class SalarySlipLeave(Document):
pass
diff --git a/erpnext/payroll/doctype/salary_slip_timesheet/salary_slip_timesheet.py b/erpnext/payroll/doctype/salary_slip_timesheet/salary_slip_timesheet.py
index 7adb12e..79c4c6e 100644
--- a/erpnext/payroll/doctype/salary_slip_timesheet/salary_slip_timesheet.py
+++ b/erpnext/payroll/doctype/salary_slip_timesheet/salary_slip_timesheet.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class SalarySlipTimesheet(Document):
pass
diff --git a/erpnext/payroll/doctype/salary_structure/salary_structure.py b/erpnext/payroll/doctype/salary_structure/salary_structure.py
index 6dfb3a5..ef401b2 100644
--- a/erpnext/payroll/doctype/salary_structure/salary_structure.py
+++ b/erpnext/payroll/doctype/salary_structure/salary_structure.py
@@ -2,13 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe.utils import flt, cint, cstr
+import frappe
from frappe import _
-from frappe.model.mapper import get_mapped_doc
from frappe.model.document import Document
-from six import iteritems
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import cint, cstr, flt
+
+import erpnext
+
class SalaryStructure(Document):
def validate(self):
diff --git a/erpnext/payroll/doctype/salary_structure/salary_structure_dashboard.py b/erpnext/payroll/doctype/salary_structure/salary_structure_dashboard.py
index 0159e35..11d9a94 100644
--- a/erpnext/payroll/doctype/salary_structure/salary_structure_dashboard.py
+++ b/erpnext/payroll/doctype/salary_structure/salary_structure_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/payroll/doctype/salary_structure/test_salary_structure.py b/erpnext/payroll/doctype/salary_structure/test_salary_structure.py
index 3957d83..ff4a55e 100644
--- a/erpnext/payroll/doctype/salary_structure/test_salary_structure.py
+++ b/erpnext/payroll/doctype/salary_structure/test_salary_structure.py
@@ -2,17 +2,24 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-import erpnext
-from frappe.utils.make_random import get_random
-from frappe.utils import nowdate, add_years, get_first_day, date_diff
-from erpnext.payroll.doctype.salary_structure.salary_structure import make_salary_slip
-from erpnext.payroll.doctype.salary_slip.test_salary_slip import make_earning_salary_component,\
- make_deduction_salary_component, make_employee_salary_slip, create_tax_slab
-from erpnext.hr.doctype.employee.test_employee import make_employee
-from erpnext.payroll.doctype.employee_tax_exemption_declaration.test_employee_tax_exemption_declaration import create_payroll_period
+import frappe
+from frappe.utils import add_years, date_diff, get_first_day, nowdate
+from frappe.utils.make_random import get_random
+
+import erpnext
+from erpnext.hr.doctype.employee.test_employee import make_employee
+from erpnext.payroll.doctype.employee_tax_exemption_declaration.test_employee_tax_exemption_declaration import (
+ create_payroll_period,
+)
+from erpnext.payroll.doctype.salary_slip.test_salary_slip import (
+ create_tax_slab,
+ make_deduction_salary_component,
+ make_earning_salary_component,
+ make_employee_salary_slip,
+)
+from erpnext.payroll.doctype.salary_structure.salary_structure import make_salary_slip
test_dependencies = ["Fiscal Year"]
diff --git a/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.py b/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.py
index 5fb3ce2..385cf36 100644
--- a/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.py
+++ b/erpnext/payroll/doctype/salary_structure_assignment/salary_structure_assignment.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import getdate
from frappe.model.document import Document
+from frappe.utils import getdate
+
class DuplicateAssignment(frappe.ValidationError): pass
diff --git a/erpnext/payroll/doctype/salary_structure_assignment/test_salary_structure_assignment.py b/erpnext/payroll/doctype/salary_structure_assignment/test_salary_structure_assignment.py
index a9833bf..fbb894c 100644
--- a/erpnext/payroll/doctype/salary_structure_assignment/test_salary_structure_assignment.py
+++ b/erpnext/payroll/doctype/salary_structure_assignment/test_salary_structure_assignment.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestSalaryStructureAssignment(unittest.TestCase):
pass
diff --git a/erpnext/payroll/doctype/taxable_salary_slab/taxable_salary_slab.py b/erpnext/payroll/doctype/taxable_salary_slab/taxable_salary_slab.py
index 49c5255..c0827c4 100644
--- a/erpnext/payroll/doctype/taxable_salary_slab/taxable_salary_slab.py
+++ b/erpnext/payroll/doctype/taxable_salary_slab/taxable_salary_slab.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class TaxableSalarySlab(Document):
pass
diff --git a/erpnext/payroll/notification/retention_bonus/retention_bonus.py b/erpnext/payroll/notification/retention_bonus/retention_bonus.py
index 2334f8b..f57de91 100644
--- a/erpnext/payroll/notification/retention_bonus/retention_bonus.py
+++ b/erpnext/payroll/notification/retention_bonus/retention_bonus.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals
-import frappe
def get_context(context):
# do your magic here
diff --git a/erpnext/payroll/report/bank_remittance/bank_remittance.py b/erpnext/payroll/report/bank_remittance/bank_remittance.py
index 05a5366..d55317e 100644
--- a/erpnext/payroll/report/bank_remittance/bank_remittance.py
+++ b/erpnext/payroll/report/bank_remittance/bank_remittance.py
@@ -2,11 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import formatdate
-import itertools
from frappe import _, get_all
+
def execute(filters=None):
columns = [
{
diff --git a/erpnext/payroll/report/income_tax_deductions/income_tax_deductions.py b/erpnext/payroll/report/income_tax_deductions/income_tax_deductions.py
index 8a79416..296a7c2 100644
--- a/erpnext/payroll/report/income_tax_deductions/income_tax_deductions.py
+++ b/erpnext/payroll/report/income_tax_deductions/income_tax_deductions.py
@@ -2,9 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
+import erpnext
+
+
def execute(filters=None):
data = get_data(filters)
columns = get_columns(filters) if len(data) else []
diff --git a/erpnext/payroll/report/salary_payments_based_on_payment_mode/salary_payments_based_on_payment_mode.py b/erpnext/payroll/report/salary_payments_based_on_payment_mode/salary_payments_based_on_payment_mode.py
index a0dab63..57ea1b3 100644
--- a/erpnext/payroll/report/salary_payments_based_on_payment_mode/salary_payments_based_on_payment_mode.py
+++ b/erpnext/payroll/report/salary_payments_based_on_payment_mode/salary_payments_based_on_payment_mode.py
@@ -2,9 +2,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
-from erpnext.regional.report.provident_fund_deductions.provident_fund_deductions import get_conditions
+
+import erpnext
+from erpnext.regional.report.provident_fund_deductions.provident_fund_deductions import (
+ get_conditions,
+)
+
def execute(filters=None):
mode_of_payments = get_payment_modes()
diff --git a/erpnext/payroll/report/salary_payments_via_ecs/salary_payments_via_ecs.py b/erpnext/payroll/report/salary_payments_via_ecs/salary_payments_via_ecs.py
index d09745c..bc8fd9d 100644
--- a/erpnext/payroll/report/salary_payments_via_ecs/salary_payments_via_ecs.py
+++ b/erpnext/payroll/report/salary_payments_via_ecs/salary_payments_via_ecs.py
@@ -2,9 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
+import erpnext
+
+
def execute(filters=None):
columns = get_columns(filters)
data = get_data(filters)
diff --git a/erpnext/payroll/report/salary_register/salary_register.py b/erpnext/payroll/report/salary_register/salary_register.py
index a1b1a8c..2a9dad6 100644
--- a/erpnext/payroll/report/salary_register/salary_register.py
+++ b/erpnext/payroll/report/salary_register/salary_register.py
@@ -2,9 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe.utils import flt
+
+import frappe
from frappe import _
+from frappe.utils import flt
+
+import erpnext
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/portal/doctype/homepage/homepage.py b/erpnext/portal/doctype/homepage/homepage.py
index 54ea7c6..7eeaf4b 100644
--- a/erpnext/portal/doctype/homepage/homepage.py
+++ b/erpnext/portal/doctype/homepage/homepage.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
from frappe.website.utils import delete_page_cache
+
class Homepage(Document):
def validate(self):
if not self.description:
diff --git a/erpnext/portal/doctype/homepage/test_homepage.py b/erpnext/portal/doctype/homepage/test_homepage.py
index e646775..bc8a828 100644
--- a/erpnext/portal/doctype/homepage/test_homepage.py
+++ b/erpnext/portal/doctype/homepage/test_homepage.py
@@ -3,11 +3,13 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from frappe.utils import set_request
from frappe.website.serve import get_response
+
class TestHomepage(unittest.TestCase):
def test_homepage_load(self):
set_request(method='GET', path='home')
diff --git a/erpnext/portal/doctype/homepage_featured_product/homepage_featured_product.py b/erpnext/portal/doctype/homepage_featured_product/homepage_featured_product.py
index 936e07d..8e8f776 100644
--- a/erpnext/portal/doctype/homepage_featured_product/homepage_featured_product.py
+++ b/erpnext/portal/doctype/homepage_featured_product/homepage_featured_product.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class HomepageFeaturedProduct(Document):
pass
diff --git a/erpnext/portal/doctype/homepage_section/homepage_section.py b/erpnext/portal/doctype/homepage_section/homepage_section.py
index 1ed7030..0817861 100644
--- a/erpnext/portal/doctype/homepage_section/homepage_section.py
+++ b/erpnext/portal/doctype/homepage_section/homepage_section.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
from frappe.utils import cint
+
class HomepageSection(Document):
@property
def column_value(self):
diff --git a/erpnext/portal/doctype/homepage_section/test_homepage_section.py b/erpnext/portal/doctype/homepage_section/test_homepage_section.py
index 5bb9682..6fb7d0a 100644
--- a/erpnext/portal/doctype/homepage_section/test_homepage_section.py
+++ b/erpnext/portal/doctype/homepage_section/test_homepage_section.py
@@ -3,12 +3,14 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from bs4 import BeautifulSoup
from frappe.utils import set_request
from frappe.website.serve import get_response
+
class TestHomepageSection(unittest.TestCase):
def test_homepage_section_card(self):
try:
diff --git a/erpnext/portal/doctype/homepage_section_card/homepage_section_card.py b/erpnext/portal/doctype/homepage_section_card/homepage_section_card.py
index bd17279..b710452 100644
--- a/erpnext/portal/doctype/homepage_section_card/homepage_section_card.py
+++ b/erpnext/portal/doctype/homepage_section_card/homepage_section_card.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class HomepageSectionCard(Document):
pass
diff --git a/erpnext/portal/doctype/products_settings/products_settings.py b/erpnext/portal/doctype/products_settings/products_settings.py
index 9a70892..d4f09b9 100644
--- a/erpnext/portal/doctype/products_settings/products_settings.py
+++ b/erpnext/portal/doctype/products_settings/products_settings.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import cint
from frappe import _
from frappe.model.document import Document
+from frappe.utils import cint
+
class ProductsSettings(Document):
def validate(self):
diff --git a/erpnext/portal/doctype/products_settings/test_products_settings.py b/erpnext/portal/doctype/products_settings/test_products_settings.py
index d04a009..5495cc9 100644
--- a/erpnext/portal/doctype/products_settings/test_products_settings.py
+++ b/erpnext/portal/doctype/products_settings/test_products_settings.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestProductsSettings(unittest.TestCase):
pass
diff --git a/erpnext/portal/doctype/website_attribute/website_attribute.py b/erpnext/portal/doctype/website_attribute/website_attribute.py
index b8b667a..f9ba733 100644
--- a/erpnext/portal/doctype/website_attribute/website_attribute.py
+++ b/erpnext/portal/doctype/website_attribute/website_attribute.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class WebsiteAttribute(Document):
pass
diff --git a/erpnext/portal/doctype/website_filter_field/website_filter_field.py b/erpnext/portal/doctype/website_filter_field/website_filter_field.py
index 2aa8a6f..335d457 100644
--- a/erpnext/portal/doctype/website_filter_field/website_filter_field.py
+++ b/erpnext/portal/doctype/website_filter_field/website_filter_field.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class WebsiteFilterField(Document):
pass
diff --git a/erpnext/portal/product_configurator/item_variants_cache.py b/erpnext/portal/product_configurator/item_variants_cache.py
index fc294ce..636ae8d 100644
--- a/erpnext/portal/product_configurator/item_variants_cache.py
+++ b/erpnext/portal/product_configurator/item_variants_cache.py
@@ -1,5 +1,6 @@
import frappe
+
class ItemVariantsCacheManager:
def __init__(self, item_code):
self.item_code = item_code
diff --git a/erpnext/portal/product_configurator/test_product_configurator.py b/erpnext/portal/product_configurator/test_product_configurator.py
index ec7c83a..5db74f2 100644
--- a/erpnext/portal/product_configurator/test_product_configurator.py
+++ b/erpnext/portal/product_configurator/test_product_configurator.py
@@ -1,8 +1,11 @@
from __future__ import unicode_literals
+import unittest
+
+import frappe
from bs4 import BeautifulSoup
-import frappe, unittest
from frappe.utils import get_html_for_route
+
from erpnext.portal.product_configurator.utils import get_products_for_website
test_dependencies = ["Item"]
diff --git a/erpnext/portal/product_configurator/utils.py b/erpnext/portal/product_configurator/utils.py
index d60b1a2..cf623c8 100644
--- a/erpnext/portal/product_configurator/utils.py
+++ b/erpnext/portal/product_configurator/utils.py
@@ -1,8 +1,10 @@
import frappe
from frappe.utils import cint
+
from erpnext.portal.product_configurator.item_variants_cache import ItemVariantsCacheManager
-from erpnext.shopping_cart.product_info import get_product_info_for_website
from erpnext.setup.doctype.item_group.item_group import get_child_groups
+from erpnext.shopping_cart.product_info import get_product_info_for_website
+
def get_field_filter_data():
product_settings = get_product_settings()
diff --git a/erpnext/portal/utils.py b/erpnext/portal/utils.py
index d6d4469..bae8f35 100644
--- a/erpnext/portal/utils.py
+++ b/erpnext/portal/utils.py
@@ -1,9 +1,14 @@
from __future__ import unicode_literals
+
import frappe
-from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import get_shopping_cart_settings
-from erpnext.shopping_cart.cart import get_debtors_account
from frappe.utils.nestedset import get_root_of
+from erpnext.shopping_cart.cart import get_debtors_account
+from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import (
+ get_shopping_cart_settings,
+)
+
+
def set_default_role(doc, method):
'''Set customer, supplier, student, guardian based on email'''
if frappe.flags.setting_role or frappe.flags.in_migrate:
diff --git a/erpnext/projects/doctype/activity_cost/activity_cost.py b/erpnext/projects/doctype/activity_cost/activity_cost.py
index 99226ea..e210324 100644
--- a/erpnext/projects/doctype/activity_cost/activity_cost.py
+++ b/erpnext/projects/doctype/activity_cost/activity_cost.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
class DuplicationError(frappe.ValidationError): pass
class ActivityCost(Document):
diff --git a/erpnext/projects/doctype/activity_cost/test_activity_cost.py b/erpnext/projects/doctype/activity_cost/test_activity_cost.py
index 5f35f29..c031f3c 100644
--- a/erpnext/projects/doctype/activity_cost/test_activity_cost.py
+++ b/erpnext/projects/doctype/activity_cost/test_activity_cost.py
@@ -3,11 +3,13 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
from erpnext.projects.doctype.activity_cost.activity_cost import DuplicationError
+
class TestActivityCost(unittest.TestCase):
def test_duplication(self):
frappe.db.sql("delete from `tabActivity Cost`")
diff --git a/erpnext/projects/doctype/activity_type/activity_type.py b/erpnext/projects/doctype/activity_type/activity_type.py
index 50e18ef..4c94fe4 100644
--- a/erpnext/projects/doctype/activity_type/activity_type.py
+++ b/erpnext/projects/doctype/activity_type/activity_type.py
@@ -2,7 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class ActivityType(Document):
pass
diff --git a/erpnext/projects/doctype/activity_type/test_activity_type.py b/erpnext/projects/doctype/activity_type/test_activity_type.py
index dcb0101..02619af 100644
--- a/erpnext/projects/doctype/activity_type/test_activity_type.py
+++ b/erpnext/projects/doctype/activity_type/test_activity_type.py
@@ -2,6 +2,6 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
import frappe
+
test_records = frappe.get_test_records('Activity Type')
diff --git a/erpnext/projects/doctype/dependent_task/dependent_task.py b/erpnext/projects/doctype/dependent_task/dependent_task.py
index 90a96ac..3f62cef 100644
--- a/erpnext/projects/doctype/dependent_task/dependent_task.py
+++ b/erpnext/projects/doctype/dependent_task/dependent_task.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class DependentTask(Document):
pass
diff --git a/erpnext/projects/doctype/project/project.py b/erpnext/projects/doctype/project/project.py
index 1e4b2b0..2a8870b 100644
--- a/erpnext/projects/doctype/project/project.py
+++ b/erpnext/projects/doctype/project/project.py
@@ -2,19 +2,20 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import _
-from six import iteritems
from email_reply_parser import EmailReplyParser
-from frappe.utils import (flt, getdate, get_url, now,
- nowtime, get_time, today, get_datetime, add_days)
-from erpnext.controllers.queries import get_filters_cond
+from frappe import _
from frappe.desk.reportview import get_match_cond
+from frappe.model.document import Document
+from frappe.utils import add_days, flt, get_datetime, get_time, get_url, nowtime, today
+
+from erpnext.controllers.employee_boarding_controller import update_employee_boarding_status
+from erpnext.controllers.queries import get_filters_cond
+from erpnext.education.doctype.student_attendance.student_attendance import get_holiday_list
from erpnext.hr.doctype.daily_work_summary.daily_work_summary import get_users_email
from erpnext.hr.doctype.holiday_list.holiday_list import is_holiday
-from frappe.model.document import Document
-from erpnext.education.doctype.student_attendance.student_attendance import get_holiday_list
-from erpnext.controllers.employee_boarding_controller import update_employee_boarding_status
+
class Project(Document):
def get_feed(self):
diff --git a/erpnext/projects/doctype/project/project_dashboard.py b/erpnext/projects/doctype/project/project_dashboard.py
index 39cf016..64fbbf5 100644
--- a/erpnext/projects/doctype/project/project_dashboard.py
+++ b/erpnext/projects/doctype/project/project_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'heatmap': True,
diff --git a/erpnext/projects/doctype/project/test_project.py b/erpnext/projects/doctype/project/test_project.py
index 70139c6..ebc1326 100644
--- a/erpnext/projects/doctype/project/test_project.py
+++ b/erpnext/projects/doctype/project/test_project.py
@@ -2,9 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+import unittest
-import frappe, unittest
-from frappe.utils import getdate, nowdate, add_days
+import frappe
+from frappe.utils import add_days, getdate, nowdate
from erpnext.projects.doctype.project_template.test_project_template import make_project_template
from erpnext.projects.doctype.task.test_task import create_task
diff --git a/erpnext/projects/doctype/project_template/project_template.py b/erpnext/projects/doctype/project_template/project_template.py
index 2426fd2..493ce5b 100644
--- a/erpnext/projects/doctype/project_template/project_template.py
+++ b/erpnext/projects/doctype/project_template/project_template.py
@@ -3,11 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
+from frappe.model.document import Document
from frappe.utils import get_link_to_form
+
class ProjectTemplate(Document):
def validate(self):
diff --git a/erpnext/projects/doctype/project_template/project_template_dashboard.py b/erpnext/projects/doctype/project_template/project_template_dashboard.py
index 67f74f5..8eeaa8d 100644
--- a/erpnext/projects/doctype/project_template/project_template_dashboard.py
+++ b/erpnext/projects/doctype/project_template/project_template_dashboard.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+
def get_data():
return {
'fieldname': 'project_template',
diff --git a/erpnext/projects/doctype/project_template/test_project_template.py b/erpnext/projects/doctype/project_template/test_project_template.py
index d546fd0..f71984f 100644
--- a/erpnext/projects/doctype/project_template/test_project_template.py
+++ b/erpnext/projects/doctype/project_template/test_project_template.py
@@ -3,10 +3,13 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
+
from erpnext.projects.doctype.task.test_task import create_task
+
class TestProjectTemplate(unittest.TestCase):
pass
diff --git a/erpnext/projects/doctype/project_template_task/project_template_task.py b/erpnext/projects/doctype/project_template_task/project_template_task.py
index 57bc4f1..e086141 100644
--- a/erpnext/projects/doctype/project_template_task/project_template_task.py
+++ b/erpnext/projects/doctype/project_template_task/project_template_task.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ProjectTemplateTask(Document):
pass
diff --git a/erpnext/projects/doctype/project_type/project_type.py b/erpnext/projects/doctype/project_type/project_type.py
index 36137ca..1089483 100644
--- a/erpnext/projects/doctype/project_type/project_type.py
+++ b/erpnext/projects/doctype/project_type/project_type.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe.model.document import Document
+
import frappe
from frappe import _
+from frappe.model.document import Document
+
class ProjectType(Document):
def on_trash(self):
diff --git a/erpnext/projects/doctype/project_type/test_project_type.py b/erpnext/projects/doctype/project_type/test_project_type.py
index ee23390..a79020f 100644
--- a/erpnext/projects/doctype/project_type/test_project_type.py
+++ b/erpnext/projects/doctype/project_type/test_project_type.py
@@ -5,5 +5,6 @@
import unittest
+
class TestProjectType(unittest.TestCase):
pass
diff --git a/erpnext/projects/doctype/project_update/project_update.py b/erpnext/projects/doctype/project_update/project_update.py
index 2e1ec74..147e591 100644
--- a/erpnext/projects/doctype/project_update/project_update.py
+++ b/erpnext/projects/doctype/project_update/project_update.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class ProjectUpdate(Document):
pass
diff --git a/erpnext/projects/doctype/project_update/test_project_update.py b/erpnext/projects/doctype/project_update/test_project_update.py
index 2edd2f8..1596603 100644
--- a/erpnext/projects/doctype/project_update/test_project_update.py
+++ b/erpnext/projects/doctype/project_update/test_project_update.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestProjectUpdate(unittest.TestCase):
pass
diff --git a/erpnext/projects/doctype/project_user/project_user.py b/erpnext/projects/doctype/project_user/project_user.py
index 3198f3b..7abe945 100644
--- a/erpnext/projects/doctype/project_user/project_user.py
+++ b/erpnext/projects/doctype/project_user/project_user.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ProjectUser(Document):
pass
diff --git a/erpnext/projects/doctype/projects_settings/projects_settings.py b/erpnext/projects/doctype/projects_settings/projects_settings.py
index 9dcac14..88bb247 100644
--- a/erpnext/projects/doctype/projects_settings/projects_settings.py
+++ b/erpnext/projects/doctype/projects_settings/projects_settings.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ProjectsSettings(Document):
pass
diff --git a/erpnext/projects/doctype/projects_settings/test_projects_settings.py b/erpnext/projects/doctype/projects_settings/test_projects_settings.py
index d671da7..3266246 100644
--- a/erpnext/projects/doctype/projects_settings/test_projects_settings.py
+++ b/erpnext/projects/doctype/projects_settings/test_projects_settings.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestProjectsSettings(unittest.TestCase):
pass
diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py
index 5976e01..6b90622 100755
--- a/erpnext/projects/doctype/task/task.py
+++ b/erpnext/projects/doctype/task/task.py
@@ -9,7 +9,7 @@
from frappe import _, throw
from frappe.desk.form.assign_to import clear, close_all_assignments
from frappe.model.mapper import get_mapped_doc
-from frappe.utils import add_days, cstr, date_diff, get_link_to_form, getdate, today, flt
+from frappe.utils import add_days, cstr, date_diff, flt, get_link_to_form, getdate, today
from frappe.utils.nestedset import NestedSet
diff --git a/erpnext/projects/doctype/task/test_task.py b/erpnext/projects/doctype/task/test_task.py
index 0fad5e8..41a9c16 100644
--- a/erpnext/projects/doctype/task/test_task.py
+++ b/erpnext/projects/doctype/task/test_task.py
@@ -1,12 +1,15 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
import unittest
-from frappe.utils import getdate, nowdate, add_days
+
+import frappe
+from frappe.utils import add_days, getdate, nowdate
from erpnext.projects.doctype.task.task import CircularReferenceError
+
class TestTask(unittest.TestCase):
def test_circular_reference(self):
task1 = create_task("_Test Task 1", add_days(nowdate(), -15), add_days(nowdate(), -10))
diff --git a/erpnext/projects/doctype/task_depends_on/task_depends_on.py b/erpnext/projects/doctype/task_depends_on/task_depends_on.py
index 723a0fc..ddb67ee 100644
--- a/erpnext/projects/doctype/task_depends_on/task_depends_on.py
+++ b/erpnext/projects/doctype/task_depends_on/task_depends_on.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class TaskDependsOn(Document):
pass
diff --git a/erpnext/projects/doctype/task_type/task_type.py b/erpnext/projects/doctype/task_type/task_type.py
index 9c0b532..5aacf8a 100644
--- a/erpnext/projects/doctype/task_type/task_type.py
+++ b/erpnext/projects/doctype/task_type/task_type.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class TaskType(Document):
pass
diff --git a/erpnext/projects/doctype/task_type/test_task_type.py b/erpnext/projects/doctype/task_type/test_task_type.py
index 1db6e27..7690c37 100644
--- a/erpnext/projects/doctype/task_type/test_task_type.py
+++ b/erpnext/projects/doctype/task_type/test_task_type.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestTaskType(unittest.TestCase):
pass
diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py
index 2b0c3ab..6b32c66 100644
--- a/erpnext/projects/doctype/timesheet/test_timesheet.py
+++ b/erpnext/projects/doctype/timesheet/test_timesheet.py
@@ -3,21 +3,28 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
-import unittest
import datetime
-from frappe.utils.make_random import get_random
-from frappe.utils import now_datetime, nowdate, add_days, add_months
-from erpnext.projects.doctype.timesheet.timesheet import OverlapError
-from erpnext.projects.doctype.timesheet.timesheet import make_salary_slip, make_sales_invoice
+import unittest
+
+import frappe
+from frappe.utils import add_months, now_datetime, nowdate
+
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
-from erpnext.payroll.doctype.salary_structure.test_salary_structure \
- import make_salary_structure, create_salary_structure_assignment
-from erpnext.payroll.doctype.salary_slip.test_salary_slip import (
- make_earning_salary_component,
- make_deduction_salary_component
-)
from erpnext.hr.doctype.employee.test_employee import make_employee
+from erpnext.payroll.doctype.salary_slip.test_salary_slip import (
+ make_deduction_salary_component,
+ make_earning_salary_component,
+)
+from erpnext.payroll.doctype.salary_structure.test_salary_structure import (
+ create_salary_structure_assignment,
+ make_salary_structure,
+)
+from erpnext.projects.doctype.timesheet.timesheet import (
+ OverlapError,
+ make_salary_slip,
+ make_sales_invoice,
+)
+
class TestTimesheet(unittest.TestCase):
@classmethod
diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py
index 5f569d6..e144e82 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.py
+++ b/erpnext/projects/doctype/timesheet/timesheet.py
@@ -3,19 +3,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe import _
import json
-from datetime import timedelta
-from erpnext.controllers.queries import get_match_cond
-from frappe.utils import flt, time_diff_in_hours, get_datetime, getdate, cint, date_diff, add_to_date
+
+import frappe
+from frappe import _
from frappe.model.document import Document
-from erpnext.manufacturing.doctype.workstation.workstation import (check_if_within_operating_hours,
- WorkstationHolidayError)
-from erpnext.manufacturing.doctype.manufacturing_settings.manufacturing_settings import get_mins_between_operations
-from erpnext.setup.utils import get_exchange_rate
+from frappe.utils import flt, getdate, time_diff_in_hours
+
+from erpnext.controllers.queries import get_match_cond
from erpnext.hr.utils import validate_active_employee
+from erpnext.setup.utils import get_exchange_rate
+
class OverlapError(frappe.ValidationError): pass
class OverWorkLoggedError(frappe.ValidationError): pass
diff --git a/erpnext/projects/doctype/timesheet/timesheet_dashboard.py b/erpnext/projects/doctype/timesheet/timesheet_dashboard.py
index 088d98c..3ef1d92 100644
--- a/erpnext/projects/doctype/timesheet/timesheet_dashboard.py
+++ b/erpnext/projects/doctype/timesheet/timesheet_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'time_sheet',
diff --git a/erpnext/projects/doctype/timesheet_detail/timesheet_detail.py b/erpnext/projects/doctype/timesheet_detail/timesheet_detail.py
index 7da94b7..4fd233e 100644
--- a/erpnext/projects/doctype/timesheet_detail/timesheet_detail.py
+++ b/erpnext/projects/doctype/timesheet_detail/timesheet_detail.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class TimesheetDetail(Document):
pass
diff --git a/erpnext/projects/report/billing_summary.py b/erpnext/projects/report/billing_summary.py
index a22ed7b..dec2824 100644
--- a/erpnext/projects/report/billing_summary.py
+++ b/erpnext/projects/report/billing_summary.py
@@ -3,9 +3,11 @@
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import time_diff_in_hours, flt
+from frappe.utils import flt, time_diff_in_hours
+
def get_columns():
return [
diff --git a/erpnext/projects/report/daily_timesheet_summary/daily_timesheet_summary.py b/erpnext/projects/report/daily_timesheet_summary/daily_timesheet_summary.py
index 3dcae5b..3a33b4b 100644
--- a/erpnext/projects/report/daily_timesheet_summary/daily_timesheet_summary.py
+++ b/erpnext/projects/report/daily_timesheet_summary/daily_timesheet_summary.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.desk.reportview import build_match_conditions
+
def execute(filters=None):
if not filters:
filters = {}
diff --git a/erpnext/projects/report/delayed_tasks_summary/delayed_tasks_summary.py b/erpnext/projects/report/delayed_tasks_summary/delayed_tasks_summary.py
index cdabe64..3016390 100644
--- a/erpnext/projects/report/delayed_tasks_summary/delayed_tasks_summary.py
+++ b/erpnext/projects/report/delayed_tasks_summary/delayed_tasks_summary.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.utils import date_diff, nowdate
+
def execute(filters=None):
columns, data = [], []
data = get_data(filters)
diff --git a/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py b/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py
index 78291b2..88c77c8 100644
--- a/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py
+++ b/erpnext/projects/report/delayed_tasks_summary/test_delayed_tasks_summary.py
@@ -1,10 +1,14 @@
from __future__ import unicode_literals
+
import unittest
+
import frappe
-from frappe.utils import nowdate, add_days, add_months
+from frappe.utils import add_days, add_months, nowdate
+
from erpnext.projects.doctype.task.test_task import create_task
from erpnext.projects.report.delayed_tasks_summary.delayed_tasks_summary import execute
+
class TestDelayedTasksSummary(unittest.TestCase):
@classmethod
def setUp(self):
diff --git a/erpnext/projects/report/employee_billing_summary/employee_billing_summary.py b/erpnext/projects/report/employee_billing_summary/employee_billing_summary.py
index 17c92c2..30bd9f0 100644
--- a/erpnext/projects/report/employee_billing_summary/employee_billing_summary.py
+++ b/erpnext/projects/report/employee_billing_summary/employee_billing_summary.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import _
+
from erpnext.projects.report.billing_summary import get_columns, get_data
+
def execute(filters=None):
filters = frappe._dict(filters or {})
columns = get_columns()
diff --git a/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.py b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.py
index 4d22f46..d59a2ac 100644
--- a/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.py
+++ b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/employee_hours_utilization_based_on_timesheet.py
@@ -2,11 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt, getdate
from six import iteritems
+
def execute(filters=None):
return EmployeeHoursReport(filters).run()
diff --git a/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/test_employee_util.py b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/test_employee_util.py
index 969fc55..f456c84 100644
--- a/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/test_employee_util.py
+++ b/erpnext/projects/report/employee_hours_utilization_based_on_timesheet/test_employee_util.py
@@ -1,11 +1,16 @@
from __future__ import unicode_literals
-import unittest
-import frappe
+import unittest
+
+import frappe
from frappe.utils.make_random import get_random
-from erpnext.projects.report.employee_hours_utilization_based_on_timesheet.employee_hours_utilization_based_on_timesheet import execute
+
from erpnext.hr.doctype.employee.test_employee import make_employee
from erpnext.projects.doctype.project.test_project import make_project
+from erpnext.projects.report.employee_hours_utilization_based_on_timesheet.employee_hours_utilization_based_on_timesheet import (
+ execute,
+)
+
class TestEmployeeUtilization(unittest.TestCase):
@classmethod
diff --git a/erpnext/projects/report/project_billing_summary/project_billing_summary.py b/erpnext/projects/report/project_billing_summary/project_billing_summary.py
index 17c92c2..30bd9f0 100644
--- a/erpnext/projects/report/project_billing_summary/project_billing_summary.py
+++ b/erpnext/projects/report/project_billing_summary/project_billing_summary.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import _
+
from erpnext.projects.report.billing_summary import get_columns, get_data
+
def execute(filters=None):
filters = frappe._dict(filters or {})
columns = get_columns()
diff --git a/erpnext/projects/report/project_profitability/project_profitability.py b/erpnext/projects/report/project_profitability/project_profitability.py
index 0a52f7b..13e02c8 100644
--- a/erpnext/projects/report/project_profitability/project_profitability.py
+++ b/erpnext/projects/report/project_profitability/project_profitability.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt
+
def execute(filters=None):
columns, data = [], []
data = get_data(filters)
diff --git a/erpnext/projects/report/project_profitability/test_project_profitability.py b/erpnext/projects/report/project_profitability/test_project_profitability.py
index 180926f..8cf169b 100644
--- a/erpnext/projects/report/project_profitability/test_project_profitability.py
+++ b/erpnext/projects/report/project_profitability/test_project_profitability.py
@@ -1,12 +1,19 @@
from __future__ import unicode_literals
+
import unittest
+
import frappe
-from frappe.utils import getdate, nowdate, add_days
+from frappe.utils import add_days, getdate, nowdate
+
from erpnext.hr.doctype.employee.test_employee import make_employee
-from erpnext.projects.doctype.timesheet.test_timesheet import make_salary_structure_for_timesheet, make_timesheet
+from erpnext.projects.doctype.timesheet.test_timesheet import (
+ make_salary_structure_for_timesheet,
+ make_timesheet,
+)
from erpnext.projects.doctype.timesheet.timesheet import make_salary_slip, make_sales_invoice
from erpnext.projects.report.project_profitability.project_profitability import execute
+
class TestProjectProfitability(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/projects/report/project_summary/project_summary.py b/erpnext/projects/report/project_summary/project_summary.py
index 98dd617..dbb4e84 100644
--- a/erpnext/projects/report/project_summary/project_summary.py
+++ b/erpnext/projects/report/project_summary/project_summary.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
columns = get_columns()
data = []
diff --git a/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py b/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
index c13d7cf..5d2b7db 100644
--- a/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
+++ b/erpnext/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
@@ -5,6 +5,7 @@
import frappe
from frappe import _
+
def execute(filters=None):
columns = get_columns()
proj_details = get_project_details()
diff --git a/erpnext/projects/utils.py b/erpnext/projects/utils.py
index c39f908..6926470 100644
--- a/erpnext/projects/utils.py
+++ b/erpnext/projects/utils.py
@@ -4,8 +4,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
+
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def query_task(doctype, txt, searchfield, start, page_len, filters):
diff --git a/erpnext/projects/web_form/tasks/tasks.py b/erpnext/projects/web_form/tasks/tasks.py
index e5a9404..aed7942 100644
--- a/erpnext/projects/web_form/tasks/tasks.py
+++ b/erpnext/projects/web_form/tasks/tasks.py
@@ -2,6 +2,7 @@
import frappe
+
def get_context(context):
if frappe.form_dict.project:
context.parents = [{'title': frappe.form_dict.project, 'route': '/projects?project='+ frappe.form_dict.project}]
diff --git a/erpnext/public/build.json b/erpnext/public/build.json
index 3c60e3e..6b70dab 100644
--- a/erpnext/public/build.json
+++ b/erpnext/public/build.json
@@ -38,6 +38,7 @@
"public/js/templates/item_quick_entry.html",
"public/js/utils/item_quick_entry.js",
"public/js/utils/customer_quick_entry.js",
+ "public/js/utils/supplier_quick_entry.js",
"public/js/education/student_button.html",
"public/js/education/assessment_result_tool.html",
"public/js/hub/hub_factory.js",
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 2538852..5f8966f 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -866,21 +866,25 @@
if (frappe.meta.get_docfield(this.frm.doctype, "shipping_address") &&
in_list(['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'], this.frm.doctype)) {
- erpnext.utils.get_shipping_address(this.frm, function(){
+ erpnext.utils.get_shipping_address(this.frm, function() {
set_party_account(set_pricing);
});
// Get default company billing address in Purchase Invoice, Order and Receipt
- frappe.call({
- 'method': 'frappe.contacts.doctype.address.address.get_default_address',
- 'args': {
- 'doctype': 'Company',
- 'name': this.frm.doc.company
- },
- 'callback': function(r) {
- me.frm.set_value('billing_address', r.message);
- }
- });
+ if (this.frm.doc.company && frappe.meta.get_docfield(this.frm.doctype, "billing_address")) {
+ frappe.call({
+ method: "erpnext.setup.doctype.company.company.get_default_company_address",
+ args: {name: this.frm.doc.company, existing_address: this.frm.doc.billing_address || ""},
+ debounce: 2000,
+ callback: function(r) {
+ if (r.message) {
+ me.frm.set_value("billing_address", r.message);
+ } else {
+ me.frm.set_value("company_address", "");
+ }
+ }
+ });
+ }
} else {
set_party_account(set_pricing);
diff --git a/erpnext/public/js/erpnext.bundle.js b/erpnext/public/js/erpnext.bundle.js
index 9f7f29a..febdb24 100644
--- a/erpnext/public/js/erpnext.bundle.js
+++ b/erpnext/public/js/erpnext.bundle.js
@@ -15,6 +15,7 @@
import "./templates/item_quick_entry.html";
import "./utils/item_quick_entry";
import "./utils/customer_quick_entry";
+import "./utils/supplier_quick_entry";
import "./education/student_button.html";
import "./education/assessment_result_tool.html";
import "./hub/hub_factory";
diff --git a/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js b/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js
index 23ec2fd..6286732 100644
--- a/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js
+++ b/erpnext/public/js/hierarchy_chart/hierarchy_chart_desktop.js
@@ -67,8 +67,6 @@
}
show() {
- frappe.breadcrumbs.add('HR');
-
this.setup_actions();
if ($(`[data-fieldname="company"]`).length) return;
let me = this;
@@ -83,8 +81,9 @@
reqd: 1,
change: () => {
me.company = undefined;
+ $('#hierarchy-chart-wrapper').remove();
- if (company.get_value() && me.company != company.get_value()) {
+ if (company.get_value()) {
me.company = company.get_value();
// svg for connectors
@@ -92,6 +91,8 @@
me.setup_hierarchy();
me.render_root_nodes();
me.all_nodes_expanded = false;
+ } else {
+ frappe.throw(__('Please select a company first.'));
}
}
});
@@ -172,11 +173,11 @@
</ul>`);
this.page.main
- .find('#hierarchy-chart-wrapper')
+ .find('#hierarchy-chart')
+ .empty()
.append(this.$hierarchy);
this.nodes = {};
- this.all_nodes_expanded = false;
}
make_svg_markers() {
@@ -203,6 +204,8 @@
<g id="connectors" fill="none">
</g>
</svg>
+ <div id="hierarchy-chart">
+ </div>
</div>`);
}
@@ -219,7 +222,10 @@
let expand_node = undefined;
let node = undefined;
- $.each(r.message, (i, data) => {
+ $.each(r.message, (_i, data) => {
+ if ($(`#${data.id}`).length)
+ return;
+
node = new me.Node({
id: data.id,
parent: $('<li class="child-node"></li>').appendTo(me.$hierarchy.find('.node-children')),
@@ -290,7 +296,7 @@
() => frappe.dom.freeze(),
() => this.setup_hierarchy(),
() => this.render_root_nodes(true),
- () => this.get_all_nodes(node.id, node.name),
+ () => this.get_all_nodes(),
(data_list) => this.render_children_of_all_nodes(data_list),
() => frappe.dom.unfreeze()
]);
@@ -341,15 +347,13 @@
node.expanded = true;
}
- get_all_nodes(node_id, node_name) {
+ get_all_nodes() {
return new Promise(resolve => {
frappe.call({
method: 'erpnext.utilities.hierarchy_chart.get_all_nodes',
args: {
method: this.method,
- company: this.company,
- parent: node_id,
- parent_name: node_name
+ company: this.company
},
callback: (r) => {
resolve(r.message);
diff --git a/erpnext/public/js/hierarchy_chart/hierarchy_chart_mobile.js b/erpnext/public/js/hierarchy_chart/hierarchy_chart_mobile.js
index b1b78c0..b1a8879 100644
--- a/erpnext/public/js/hierarchy_chart/hierarchy_chart_mobile.js
+++ b/erpnext/public/js/hierarchy_chart/hierarchy_chart_mobile.js
@@ -59,8 +59,6 @@
}
show() {
- frappe.breadcrumbs.add('HR');
-
let me = this;
if ($(`[data-fieldname="company"]`).length) return;
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 9caf1de..e0610eb 100755
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -86,9 +86,9 @@
proceed_save_with_reminders_frequency_change: () => {
frappe.ui.hide_open_dialog();
-
+
frappe.call({
- method: 'erpnext.hr.doctype.hr_settings.hr_settings.set_proceed_with_frequency_change',
+ method: 'erpnext.hr.doctype.hr_settings.hr_settings.set_proceed_with_frequency_change',
callback: () => {
cur_frm.save();
}
diff --git a/erpnext/public/js/utils/party.js b/erpnext/public/js/utils/party.js
index 4d432e3..a492b32 100644
--- a/erpnext/public/js/utils/party.js
+++ b/erpnext/public/js/utils/party.js
@@ -289,8 +289,8 @@
company: frm.doc.company,
address: frm.doc.shipping_address
},
- callback: function(r){
- if (r.message){
+ callback: function(r) {
+ if (r.message) {
frm.set_value("shipping_address", r.message[0]) //Address title or name
frm.set_value("shipping_address_display", r.message[1]) //Address to be displayed on the page
}
diff --git a/erpnext/public/js/utils/supplier_quick_entry.js b/erpnext/public/js/utils/supplier_quick_entry.js
new file mode 100644
index 0000000..8d591a9
--- /dev/null
+++ b/erpnext/public/js/utils/supplier_quick_entry.js
@@ -0,0 +1,77 @@
+frappe.provide('frappe.ui.form');
+
+frappe.ui.form.SupplierQuickEntryForm = class SupplierQuickEntryForm extends frappe.ui.form.QuickEntryForm {
+ constructor(doctype, after_insert, init_callback, doc, force) {
+ super(doctype, after_insert, init_callback, doc, force);
+ this.skip_redirect_on_error = true;
+ }
+
+ render_dialog() {
+ this.mandatory = this.mandatory.concat(this.get_variant_fields());
+ super.render_dialog();
+ }
+
+ get_variant_fields() {
+ var variant_fields = [
+ {
+ fieldtype: "Section Break",
+ label: __("Primary Contact Details"),
+ collapsible: 1
+ },
+ {
+ label: __("Email Id"),
+ fieldname: "email_id",
+ fieldtype: "Data"
+ },
+ {
+ fieldtype: "Column Break"
+ },
+ {
+ label: __("Mobile Number"),
+ fieldname: "mobile_no",
+ fieldtype: "Data"
+ },
+ {
+ fieldtype: "Section Break",
+ label: __("Primary Address Details"),
+ collapsible: 1
+ },
+ {
+ label: __("Address Line 1"),
+ fieldname: "address_line1",
+ fieldtype: "Data"
+ },
+ {
+ label: __("Address Line 2"),
+ fieldname: "address_line2",
+ fieldtype: "Data"
+ },
+ {
+ label: __("ZIP Code"),
+ fieldname: "pincode",
+ fieldtype: "Data"
+ },
+ {
+ fieldtype: "Column Break"
+ },
+ {
+ label: __("City"),
+ fieldname: "city",
+ fieldtype: "Data"
+ },
+ {
+ label: __("State"),
+ fieldname: "state",
+ fieldtype: "Data"
+ },
+ {
+ label: __("Country"),
+ fieldname: "country",
+ fieldtype: "Link",
+ options: "Country"
+ }
+ ];
+
+ return variant_fields;
+ }
+};
diff --git a/erpnext/quality_management/doctype/non_conformance/non_conformance.py b/erpnext/quality_management/doctype/non_conformance/non_conformance.py
index d4e8cc7..a4613fd 100644
--- a/erpnext/quality_management/doctype/non_conformance/non_conformance.py
+++ b/erpnext/quality_management/doctype/non_conformance/non_conformance.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class NonConformance(Document):
pass
diff --git a/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py b/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py
index 54f8b58..759b117 100644
--- a/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py
+++ b/erpnext/quality_management/doctype/non_conformance/test_non_conformance.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestNonConformance(unittest.TestCase):
pass
diff --git a/erpnext/quality_management/doctype/quality_action/quality_action.py b/erpnext/quality_management/doctype/quality_action/quality_action.py
index 02401ba..646a0df 100644
--- a/erpnext/quality_management/doctype/quality_action/quality_action.py
+++ b/erpnext/quality_management/doctype/quality_action/quality_action.py
@@ -3,9 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class QualityAction(Document):
def validate(self):
self.status = 'Open' if any([d.status=='Open' for d in self.resolutions]) else 'Completed'
diff --git a/erpnext/quality_management/doctype/quality_action/test_quality_action.py b/erpnext/quality_management/doctype/quality_action/test_quality_action.py
index 98d665f..33229d4 100644
--- a/erpnext/quality_management/doctype/quality_action/test_quality_action.py
+++ b/erpnext/quality_management/doctype/quality_action/test_quality_action.py
@@ -3,9 +3,9 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestQualityAction(unittest.TestCase):
# quality action has no code
pass
diff --git a/erpnext/quality_management/doctype/quality_action_resolution/quality_action_resolution.py b/erpnext/quality_management/doctype/quality_action_resolution/quality_action_resolution.py
index de8873f..b456fb7 100644
--- a/erpnext/quality_management/doctype/quality_action_resolution/quality_action_resolution.py
+++ b/erpnext/quality_management/doctype/quality_action_resolution/quality_action_resolution.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class QualityActionResolution(Document):
pass
diff --git a/erpnext/quality_management/doctype/quality_feedback/quality_feedback.py b/erpnext/quality_management/doctype/quality_feedback/quality_feedback.py
index d3e96cf..9189c28 100644
--- a/erpnext/quality_management/doctype/quality_feedback/quality_feedback.py
+++ b/erpnext/quality_management/doctype/quality_feedback/quality_feedback.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class QualityFeedback(Document):
@frappe.whitelist()
def set_parameters(self):
diff --git a/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py b/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py
index 5a8bd5c..7a87c36 100644
--- a/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py
+++ b/erpnext/quality_management/doctype/quality_feedback/test_quality_feedback.py
@@ -3,9 +3,10 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
class TestQualityFeedback(unittest.TestCase):
def test_quality_feedback(self):
diff --git a/erpnext/quality_management/doctype/quality_feedback_parameter/quality_feedback_parameter.py b/erpnext/quality_management/doctype/quality_feedback_parameter/quality_feedback_parameter.py
index d652e8a..9a21b26 100644
--- a/erpnext/quality_management/doctype/quality_feedback_parameter/quality_feedback_parameter.py
+++ b/erpnext/quality_management/doctype/quality_feedback_parameter/quality_feedback_parameter.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class QualityFeedbackParameter(Document):
pass
diff --git a/erpnext/quality_management/doctype/quality_feedback_template/quality_feedback_template.py b/erpnext/quality_management/doctype/quality_feedback_template/quality_feedback_template.py
index 0c6dfc0..c6a520a 100644
--- a/erpnext/quality_management/doctype/quality_feedback_template/quality_feedback_template.py
+++ b/erpnext/quality_management/doctype/quality_feedback_template/quality_feedback_template.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class QualityFeedbackTemplate(Document):
pass
diff --git a/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py b/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py
index afed14b..1de58aa 100644
--- a/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py
+++ b/erpnext/quality_management/doctype/quality_feedback_template/test_quality_feedback_template.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestQualityFeedbackTemplate(unittest.TestCase):
pass
diff --git a/erpnext/quality_management/doctype/quality_feedback_template_parameter/quality_feedback_template_parameter.py b/erpnext/quality_management/doctype/quality_feedback_template_parameter/quality_feedback_template_parameter.py
index 3f3348f..44a6b01 100644
--- a/erpnext/quality_management/doctype/quality_feedback_template_parameter/quality_feedback_template_parameter.py
+++ b/erpnext/quality_management/doctype/quality_feedback_template_parameter/quality_feedback_template_parameter.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class QualityFeedbackTemplateParameter(Document):
pass
diff --git a/erpnext/quality_management/doctype/quality_goal/quality_goal.py b/erpnext/quality_management/doctype/quality_goal/quality_goal.py
index 3e616b7..2888401 100644
--- a/erpnext/quality_management/doctype/quality_goal/quality_goal.py
+++ b/erpnext/quality_management/doctype/quality_goal/quality_goal.py
@@ -3,10 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class QualityGoal(Document):
def validate(self):
pass
diff --git a/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py b/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py
index 0e135b5..84240d2 100644
--- a/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py
+++ b/erpnext/quality_management/doctype/quality_goal/test_quality_goal.py
@@ -3,9 +3,10 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.quality_management.doctype.quality_procedure.test_quality_procedure import create_procedure
+
+import frappe
+
class TestQualityGoal(unittest.TestCase):
def test_quality_goal(self):
diff --git a/erpnext/quality_management/doctype/quality_goal_objective/quality_goal_objective.py b/erpnext/quality_management/doctype/quality_goal_objective/quality_goal_objective.py
index f4bd357..c9c2c6e 100644
--- a/erpnext/quality_management/doctype/quality_goal_objective/quality_goal_objective.py
+++ b/erpnext/quality_management/doctype/quality_goal_objective/quality_goal_objective.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class QualityGoalObjective(Document):
pass
diff --git a/erpnext/quality_management/doctype/quality_meeting/quality_meeting.py b/erpnext/quality_management/doctype/quality_meeting/quality_meeting.py
index 9e453eb..0ac0484 100644
--- a/erpnext/quality_management/doctype/quality_meeting/quality_meeting.py
+++ b/erpnext/quality_management/doctype/quality_meeting/quality_meeting.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class QualityMeeting(Document):
pass
diff --git a/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py b/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py
index 6bf4c17..e57256d 100644
--- a/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py
+++ b/erpnext/quality_management/doctype/quality_meeting/test_quality_meeting.py
@@ -3,9 +3,9 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestQualityMeeting(unittest.TestCase):
# nothing to test
pass
diff --git a/erpnext/quality_management/doctype/quality_meeting_agenda/quality_meeting_agenda.py b/erpnext/quality_management/doctype/quality_meeting_agenda/quality_meeting_agenda.py
index 5d77975..5e4d9ff 100644
--- a/erpnext/quality_management/doctype/quality_meeting_agenda/quality_meeting_agenda.py
+++ b/erpnext/quality_management/doctype/quality_meeting_agenda/quality_meeting_agenda.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class QualityMeetingAgenda(Document):
pass
diff --git a/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py b/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py
index 4750cc1..8744d27 100644
--- a/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py
+++ b/erpnext/quality_management/doctype/quality_meeting_agenda/test_quality_meeting_agenda.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestQualityMeetingAgenda(unittest.TestCase):
pass
diff --git a/erpnext/quality_management/doctype/quality_meeting_minutes/quality_meeting_minutes.py b/erpnext/quality_management/doctype/quality_meeting_minutes/quality_meeting_minutes.py
index 47b2c95..e3d061b 100644
--- a/erpnext/quality_management/doctype/quality_meeting_minutes/quality_meeting_minutes.py
+++ b/erpnext/quality_management/doctype/quality_meeting_minutes/quality_meeting_minutes.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class QualityMeetingMinutes(Document):
pass
diff --git a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py
index 117db00..56293c9 100644
--- a/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py
+++ b/erpnext/quality_management/doctype/quality_procedure/quality_procedure.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils.nestedset import NestedSet, rebuild_tree
from frappe import _
+from frappe.utils.nestedset import NestedSet
+
class QualityProcedure(NestedSet):
nsm_parent_field = 'parent_quality_procedure'
diff --git a/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py b/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py
index 4fa7734..b064011 100644
--- a/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py
+++ b/erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py
@@ -3,11 +3,13 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
from .quality_procedure import add_node
+
class TestQualityProcedure(unittest.TestCase):
def test_add_node(self):
try:
diff --git a/erpnext/quality_management/doctype/quality_procedure_process/quality_procedure_process.py b/erpnext/quality_management/doctype/quality_procedure_process/quality_procedure_process.py
index 0d9a286..e281294 100644
--- a/erpnext/quality_management/doctype/quality_procedure_process/quality_procedure_process.py
+++ b/erpnext/quality_management/doctype/quality_procedure_process/quality_procedure_process.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class QualityProcedureProcess(Document):
pass
diff --git a/erpnext/quality_management/doctype/quality_review/quality_review.py b/erpnext/quality_management/doctype/quality_review/quality_review.py
index 34cc890..b766623 100644
--- a/erpnext/quality_management/doctype/quality_review/quality_review.py
+++ b/erpnext/quality_management/doctype/quality_review/quality_review.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class QualityReview(Document):
def validate(self):
# fetch targets from goal
diff --git a/erpnext/quality_management/doctype/quality_review/test_quality_review.py b/erpnext/quality_management/doctype/quality_review/test_quality_review.py
index 161ecd0..2f28dda 100644
--- a/erpnext/quality_management/doctype/quality_review/test_quality_review.py
+++ b/erpnext/quality_management/doctype/quality_review/test_quality_review.py
@@ -3,12 +3,14 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
from ..quality_goal.test_quality_goal import get_quality_goal
from .quality_review import review
+
class TestQualityReview(unittest.TestCase):
def test_review_creation(self):
quality_goal = get_quality_goal()
diff --git a/erpnext/quality_management/doctype/quality_review_objective/quality_review_objective.py b/erpnext/quality_management/doctype/quality_review_objective/quality_review_objective.py
index 3092a1e..23b11e8 100644
--- a/erpnext/quality_management/doctype/quality_review_objective/quality_review_objective.py
+++ b/erpnext/quality_management/doctype/quality_review_objective/quality_review_objective.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class QualityReviewObjective(Document):
pass
diff --git a/erpnext/regional/__init__.py b/erpnext/regional/__init__.py
index faa5912..45a689e 100644
--- a/erpnext/regional/__init__.py
+++ b/erpnext/regional/__init__.py
@@ -2,10 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
from erpnext import get_region
+
def check_deletion_permission(doc, method):
region = get_region(doc.company)
if region in ["Nepal", "France"] and doc.docstatus != 0:
diff --git a/erpnext/regional/address_template/test_regional_address_template.py b/erpnext/regional/address_template/test_regional_address_template.py
index 8a05ea2..2880d62 100644
--- a/erpnext/regional/address_template/test_regional_address_template.py
+++ b/erpnext/regional/address_template/test_regional_address_template.py
@@ -1,9 +1,11 @@
from __future__ import unicode_literals
+
from unittest import TestCase
import frappe
-from erpnext.regional.address_template.setup import get_address_templates
-from erpnext.regional.address_template.setup import update_address_template
+
+from erpnext.regional.address_template.setup import get_address_templates, update_address_template
+
def ensure_country(country):
if frappe.db.exists("Country", country):
diff --git a/erpnext/regional/doctype/datev_settings/datev_settings.py b/erpnext/regional/doctype/datev_settings/datev_settings.py
index cff5bba..0d2d9eb 100644
--- a/erpnext/regional/doctype/datev_settings/datev_settings.py
+++ b/erpnext/regional/doctype/datev_settings/datev_settings.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class DATEVSettings(Document):
pass
diff --git a/erpnext/regional/doctype/datev_settings/test_datev_settings.py b/erpnext/regional/doctype/datev_settings/test_datev_settings.py
index 0271329..73412f7 100644
--- a/erpnext/regional/doctype/datev_settings/test_datev_settings.py
+++ b/erpnext/regional/doctype/datev_settings/test_datev_settings.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestDATEVSettings(unittest.TestCase):
pass
diff --git a/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.py b/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.py
index 4791dc2..0704de8 100644
--- a/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.py
+++ b/erpnext/regional/doctype/gst_hsn_code/gst_hsn_code.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class GSTHSNCode(Document):
pass
diff --git a/erpnext/regional/doctype/gst_hsn_code/test_gst_hsn_code.py b/erpnext/regional/doctype/gst_hsn_code/test_gst_hsn_code.py
index ed54f20..1a90e6d 100644
--- a/erpnext/regional/doctype/gst_hsn_code/test_gst_hsn_code.py
+++ b/erpnext/regional/doctype/gst_hsn_code/test_gst_hsn_code.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestGSTHSNCode(unittest.TestCase):
pass
diff --git a/erpnext/regional/doctype/gst_settings/gst_settings.py b/erpnext/regional/doctype/gst_settings/gst_settings.py
index af3d92e..7b27fb6 100644
--- a/erpnext/regional/doctype/gst_settings/gst_settings.py
+++ b/erpnext/regional/doctype/gst_settings/gst_settings.py
@@ -3,11 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, os
+
+import os
+
+import frappe
from frappe import _
-from frappe.utils import get_url, nowdate, date_diff
-from frappe.model.document import Document
from frappe.contacts.doctype.contact.contact import get_default_contact
+from frappe.model.document import Document
+from frappe.utils import date_diff, get_url, nowdate
+
class EmailMissing(frappe.ValidationError): pass
diff --git a/erpnext/regional/doctype/gst_settings/test_gst_settings.py b/erpnext/regional/doctype/gst_settings/test_gst_settings.py
index d118dee..836d3a8 100644
--- a/erpnext/regional/doctype/gst_settings/test_gst_settings.py
+++ b/erpnext/regional/doctype/gst_settings/test_gst_settings.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestGSTSettings(unittest.TestCase):
pass
diff --git a/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py b/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py
index 0ee5b09..d8ce319 100644
--- a/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py
+++ b/erpnext/regional/doctype/gstr_3b_report/gstr_3b_report.py
@@ -3,15 +3,19 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import os
+
import json
+import os
+
import frappe
-from six import iteritems
from frappe import _
from frappe.model.document import Document
-from frappe.utils import flt, cstr
+from frappe.utils import cstr, flt
+from six import iteritems
+
from erpnext.regional.india import state_numbers
+
class GSTR3BReport(Document):
def validate(self):
self.get_data()
diff --git a/erpnext/regional/doctype/gstr_3b_report/test_gstr_3b_report.py b/erpnext/regional/doctype/gstr_3b_report/test_gstr_3b_report.py
index 065f80d..115f9b8 100644
--- a/erpnext/regional/doctype/gstr_3b_report/test_gstr_3b_report.py
+++ b/erpnext/regional/doctype/gstr_3b_report/test_gstr_3b_report.py
@@ -3,13 +3,15 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
-import unittest
-from frappe.utils import getdate
-from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
-from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
-from erpnext.stock.doctype.item.test_item import make_item
import json
+import unittest
+
+import frappe
+from frappe.utils import getdate
+
+from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
+from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+from erpnext.stock.doctype.item.test_item import make_item
test_dependencies = ["Territory", "Customer Group", "Supplier Group", "Item"]
diff --git a/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.py b/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.py
index 0030053..76cb621 100644
--- a/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.py
+++ b/erpnext/regional/doctype/import_supplier_invoice/import_supplier_invoice.py
@@ -3,21 +3,21 @@
from __future__ import unicode_literals
-from decimal import Decimal
-import json
import re
-import traceback
import zipfile
-import frappe, erpnext
+
+import dateutil
+import frappe
+from bs4 import BeautifulSoup as bs
from frappe import _
from frappe.model.document import Document
-from frappe.custom.doctype.custom_field.custom_field import create_custom_field
+from frappe.utils import flt, get_datetime_str, today
from frappe.utils.data import format_datetime
-from bs4 import BeautifulSoup as bs
-from frappe.utils import cint, flt, today, nowdate, add_days, get_files_path, get_datetime_str
-import dateutil
from frappe.utils.file_manager import save_file
+import erpnext
+
+
class ImportSupplierInvoice(Document):
def validate(self):
if not frappe.db.get_value("Stock Settings", fieldname="stock_uom"):
diff --git a/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py b/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py
index d1caf77..4be4c3a 100644
--- a/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py
+++ b/erpnext/regional/doctype/import_supplier_invoice/test_import_supplier_invoice.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestImportSupplierInvoice(unittest.TestCase):
pass
diff --git a/erpnext/regional/doctype/lower_deduction_certificate/lower_deduction_certificate.py b/erpnext/regional/doctype/lower_deduction_certificate/lower_deduction_certificate.py
index 656c329..d8553f1 100644
--- a/erpnext/regional/doctype/lower_deduction_certificate/lower_deduction_certificate.py
+++ b/erpnext/regional/doctype/lower_deduction_certificate/lower_deduction_certificate.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import getdate, get_link_to_form
from frappe.model.document import Document
+from frappe.utils import get_link_to_form, getdate
+
from erpnext.accounts.utils import get_fiscal_year
+
class LowerDeductionCertificate(Document):
def validate(self):
self.validate_dates()
diff --git a/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py b/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py
index 7e95020..54443c0 100644
--- a/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py
+++ b/erpnext/regional/doctype/lower_deduction_certificate/test_lower_deduction_certificate.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestLowerDeductionCertificate(unittest.TestCase):
pass
diff --git a/erpnext/regional/doctype/product_tax_category/__init__.py b/erpnext/regional/doctype/product_tax_category/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/regional/doctype/product_tax_category/__init__.py
diff --git a/erpnext/regional/doctype/product_tax_category/product_tax_category.js b/erpnext/regional/doctype/product_tax_category/product_tax_category.js
new file mode 100644
index 0000000..9f8e795
--- /dev/null
+++ b/erpnext/regional/doctype/product_tax_category/product_tax_category.js
@@ -0,0 +1,8 @@
+// Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Product Tax Category', {
+ // refresh: function(frm) {
+
+ // }
+});
diff --git a/erpnext/regional/doctype/product_tax_category/product_tax_category.json b/erpnext/regional/doctype/product_tax_category/product_tax_category.json
new file mode 100644
index 0000000..147cb34
--- /dev/null
+++ b/erpnext/regional/doctype/product_tax_category/product_tax_category.json
@@ -0,0 +1,70 @@
+{
+ "actions": [],
+ "autoname": "field:product_tax_code",
+ "creation": "2021-08-23 12:33:37.910225",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "product_tax_code",
+ "column_break_2",
+ "category_name",
+ "section_break_4",
+ "description"
+ ],
+ "fields": [
+ {
+ "fieldname": "product_tax_code",
+ "fieldtype": "Data",
+ "in_list_view": 1,
+ "label": "Product Tax Code",
+ "reqd": 1,
+ "unique": 1
+ },
+ {
+ "fieldname": "description",
+ "fieldtype": "Small Text",
+ "label": "Description"
+ },
+ {
+ "fieldname": "category_name",
+ "fieldtype": "Data",
+ "label": "Category Name",
+ "length": 255
+ },
+ {
+ "fieldname": "column_break_2",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "section_break_4",
+ "fieldtype": "Section Break"
+ }
+ ],
+ "index_web_pages_for_search": 1,
+ "links": [],
+ "modified": "2021-08-24 09:10:25.313642",
+ "modified_by": "Administrator",
+ "module": "Regional",
+ "name": "Product Tax Category",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "System Manager",
+ "share": 1,
+ "write": 1
+ }
+ ],
+ "quick_entry": 1,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "title_field": "category_name",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/regional/doctype/product_tax_category/product_tax_category.py b/erpnext/regional/doctype/product_tax_category/product_tax_category.py
new file mode 100644
index 0000000..b6be9e0
--- /dev/null
+++ b/erpnext/regional/doctype/product_tax_category/product_tax_category.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+# import frappe
+from frappe.model.document import Document
+
+
+class ProductTaxCategory(Document):
+ pass
diff --git a/erpnext/regional/doctype/product_tax_category/test_product_tax_category.py b/erpnext/regional/doctype/product_tax_category/test_product_tax_category.py
new file mode 100644
index 0000000..2668f23
--- /dev/null
+++ b/erpnext/regional/doctype/product_tax_category/test_product_tax_category.py
@@ -0,0 +1,9 @@
+# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+
+# import frappe
+import unittest
+
+
+class TestProductTaxCategory(unittest.TestCase):
+ pass
diff --git a/erpnext/regional/doctype/south_africa_vat_settings/south_africa_vat_settings.py b/erpnext/regional/doctype/south_africa_vat_settings/south_africa_vat_settings.py
index d74154b..4c3e8a7 100644
--- a/erpnext/regional/doctype/south_africa_vat_settings/south_africa_vat_settings.py
+++ b/erpnext/regional/doctype/south_africa_vat_settings/south_africa_vat_settings.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class SouthAfricaVATSettings(Document):
pass
diff --git a/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py b/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py
index 1c36652..0f19f25 100644
--- a/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py
+++ b/erpnext/regional/doctype/south_africa_vat_settings/test_south_africa_vat_settings.py
@@ -4,5 +4,6 @@
# import frappe
import unittest
+
class TestSouthAfricaVATSettings(unittest.TestCase):
pass
diff --git a/erpnext/regional/doctype/tax_exemption_80g_certificate/tax_exemption_80g_certificate.py b/erpnext/regional/doctype/tax_exemption_80g_certificate/tax_exemption_80g_certificate.py
index 41a0f11..64b2ec5 100644
--- a/erpnext/regional/doctype/tax_exemption_80g_certificate/tax_exemption_80g_certificate.py
+++ b/erpnext/regional/doctype/tax_exemption_80g_certificate/tax_exemption_80g_certificate.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.model.document import Document
-from frappe.utils import getdate, flt, get_link_to_form
-from erpnext.accounts.utils import get_fiscal_year
from frappe.contacts.doctype.address.address import get_company_address
+from frappe.model.document import Document
+from frappe.utils import flt, get_link_to_form, getdate
+
+from erpnext.accounts.utils import get_fiscal_year
+
class TaxExemption80GCertificate(Document):
def validate(self):
diff --git a/erpnext/regional/doctype/tax_exemption_80g_certificate/test_tax_exemption_80g_certificate.py b/erpnext/regional/doctype/tax_exemption_80g_certificate/test_tax_exemption_80g_certificate.py
index 41b4203..74e9ced 100644
--- a/erpnext/regional/doctype/tax_exemption_80g_certificate/test_tax_exemption_80g_certificate.py
+++ b/erpnext/regional/doctype/tax_exemption_80g_certificate/test_tax_exemption_80g_certificate.py
@@ -3,14 +3,21 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
from frappe.utils import getdate
+
from erpnext.accounts.utils import get_fiscal_year
-from erpnext.non_profit.doctype.donation.test_donation import create_donor, create_mode_of_payment, create_donor_type
from erpnext.non_profit.doctype.donation.donation import create_donation
-from erpnext.non_profit.doctype.membership.test_membership import setup_membership, make_membership
+from erpnext.non_profit.doctype.donation.test_donation import (
+ create_donor,
+ create_donor_type,
+ create_mode_of_payment,
+)
from erpnext.non_profit.doctype.member.member import create_member
+from erpnext.non_profit.doctype.membership.test_membership import make_membership, setup_membership
+
class TestTaxExemption80GCertificate(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/regional/doctype/tax_exemption_80g_certificate_detail/tax_exemption_80g_certificate_detail.py b/erpnext/regional/doctype/tax_exemption_80g_certificate_detail/tax_exemption_80g_certificate_detail.py
index bdad798..76d8912 100644
--- a/erpnext/regional/doctype/tax_exemption_80g_certificate_detail/tax_exemption_80g_certificate_detail.py
+++ b/erpnext/regional/doctype/tax_exemption_80g_certificate_detail/tax_exemption_80g_certificate_detail.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class TaxExemption80GCertificateDetail(Document):
pass
diff --git a/erpnext/regional/doctype/uae_vat_account/uae_vat_account.py b/erpnext/regional/doctype/uae_vat_account/uae_vat_account.py
index 80d6b3a..a1b27d7 100644
--- a/erpnext/regional/doctype/uae_vat_account/uae_vat_account.py
+++ b/erpnext/regional/doctype/uae_vat_account/uae_vat_account.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class UAEVATAccount(Document):
pass
diff --git a/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py b/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py
index b88439f..cec30e6 100644
--- a/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py
+++ b/erpnext/regional/doctype/uae_vat_settings/test_uae_vat_settings.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestUAEVATSettings(unittest.TestCase):
pass
diff --git a/erpnext/regional/doctype/uae_vat_settings/uae_vat_settings.py b/erpnext/regional/doctype/uae_vat_settings/uae_vat_settings.py
index 20dc604..1bf37dd 100644
--- a/erpnext/regional/doctype/uae_vat_settings/uae_vat_settings.py
+++ b/erpnext/regional/doctype/uae_vat_settings/uae_vat_settings.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class UAEVATSettings(Document):
pass
diff --git a/erpnext/regional/france/utils.py b/erpnext/regional/france/utils.py
index 424615d..63c5a1f 100644
--- a/erpnext/regional/france/utils.py
+++ b/erpnext/regional/france/utils.py
@@ -2,7 +2,7 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
# don't remove this function it is used in tests
def test_method():
diff --git a/erpnext/regional/germany/setup.py b/erpnext/regional/germany/setup.py
index c1fa6e4..a68cecc 100644
--- a/erpnext/regional/germany/setup.py
+++ b/erpnext/regional/germany/setup.py
@@ -1,4 +1,3 @@
-import os
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
diff --git a/erpnext/regional/germany/utils/datev/datev_csv.py b/erpnext/regional/germany/utils/datev/datev_csv.py
index 122c15f..9d1fabb 100644
--- a/erpnext/regional/germany/utils/datev/datev_csv.py
+++ b/erpnext/regional/germany/utils/datev/datev_csv.py
@@ -4,12 +4,12 @@
import datetime
import zipfile
from csv import QUOTE_NONNUMERIC
-from six import BytesIO
-import six
import frappe
import pandas as pd
from frappe import _
+from six import BytesIO
+
from .datev_constants import DataCategory
@@ -33,6 +33,14 @@
if csv_class.DATA_CATEGORY == DataCategory.TRANSACTIONS:
result['Belegdatum'] = pd.to_datetime(result['Belegdatum'])
+ result['Beleginfo - Inhalt 6'] = pd.to_datetime(result['Beleginfo - Inhalt 6'])
+ result['Beleginfo - Inhalt 6'] = result['Beleginfo - Inhalt 6'].dt.strftime('%d%m%Y')
+
+ result['Fälligkeit'] = pd.to_datetime(result['Fälligkeit'])
+ result['Fälligkeit'] = result['Fälligkeit'].dt.strftime('%d%m%y')
+
+ result.sort_values(by='Belegdatum', inplace=True, kind='stable', ignore_index=True)
+
if csv_class.DATA_CATEGORY == DataCategory.ACCOUNT_NAMES:
result['Sprach-ID'] = 'de-DE'
diff --git a/erpnext/regional/india/__init__.py b/erpnext/regional/india/__init__.py
index faeb36f..5c4d308 100644
--- a/erpnext/regional/india/__init__.py
+++ b/erpnext/regional/india/__init__.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
from six import iteritems
states = [
diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py
index 4db5551..963c407 100644
--- a/erpnext/regional/india/setup.py
+++ b/erpnext/regional/india/setup.py
@@ -450,6 +450,26 @@
}
]
+ payment_entry_fields = [
+ dict(fieldname='gst_section', label='GST Details', fieldtype='Section Break', insert_after='deductions',
+ print_hide=1, collapsible=1),
+ dict(fieldname='company_address', label='Company Address', fieldtype='Link', insert_after='gst_section',
+ print_hide=1, options='Address'),
+ dict(fieldname='company_gstin', label='Company GSTIN',
+ fieldtype='Data', insert_after='company_address',
+ fetch_from='company_address.gstin', print_hide=1, read_only=1),
+ dict(fieldname='place_of_supply', label='Place of Supply',
+ fieldtype='Data', insert_after='company_gstin',
+ print_hide=1, read_only=1),
+ dict(fieldname='gst_column_break', fieldtype='Column Break',
+ insert_after='place_of_supply'),
+ dict(fieldname='customer_address', label='Customer Address', fieldtype='Link', insert_after='gst_column_break',
+ print_hide=1, options='Address', depends_on = 'eval:doc.party_type == "Customer"'),
+ dict(fieldname='customer_gstin', label='Customer GSTIN',
+ fieldtype='Data', insert_after='customer_address',
+ fetch_from='customer_address.gstin', print_hide=1, read_only=1)
+ ]
+
custom_fields = {
'Address': [
dict(fieldname='gstin', label='Party GSTIN', fieldtype='Data',
@@ -464,6 +484,7 @@
'Purchase Receipt': purchase_invoice_gst_fields,
'Sales Invoice': sales_invoice_gst_category + invoice_gst_fields + sales_invoice_shipping_fields + sales_invoice_gst_fields + si_ewaybill_fields,
'Delivery Note': sales_invoice_gst_fields + ewaybill_fields + sales_invoice_shipping_fields + delivery_note_gst_category,
+ 'Payment Entry': payment_entry_fields,
'Journal Entry': journal_entry_fields,
'Sales Order': sales_invoice_gst_fields,
'Tax Category': inter_state_gst_field,
diff --git a/erpnext/regional/india/test_utils.py b/erpnext/regional/india/test_utils.py
index a16f56c..2c77c8d 100644
--- a/erpnext/regional/india/test_utils.py
+++ b/erpnext/regional/india/test_utils.py
@@ -1,8 +1,10 @@
from __future__ import unicode_literals
import unittest
-import frappe
from unittest.mock import patch
+
+import frappe
+
from erpnext.regional.india.utils import validate_document_name
diff --git a/erpnext/regional/india/utils.py b/erpnext/regional/india/utils.py
index ce5aa10..bf06d4a 100644
--- a/erpnext/regional/india/utils.py
+++ b/erpnext/regional/india/utils.py
@@ -1,19 +1,19 @@
from __future__ import unicode_literals
-import frappe, re, json
+
+import json
+import re
+
+import frappe
from frappe import _
-import erpnext
-from frappe.utils import cstr, flt, cint, date_diff, nowdate, round_based_on_smallest_currency_fraction, money_in_words, getdate
-from erpnext.regional.india import states, state_numbers
-from erpnext.controllers.taxes_and_totals import get_itemised_tax, get_itemised_taxable_amount
+from frappe.model.utils import get_fetch_values
+from frappe.utils import cint, cstr, date_diff, flt, getdate, nowdate
+from six import string_types
+
from erpnext.controllers.accounts_controller import get_taxes_and_charges
+from erpnext.controllers.taxes_and_totals import get_itemised_tax, get_itemised_taxable_amount
from erpnext.hr.utils import get_salary_assignment
from erpnext.payroll.doctype.salary_structure.salary_structure import make_salary_slip
-from erpnext.regional.india import number_state_mapping
-from six import string_types
-from erpnext.accounts.general_ledger import make_gl_entries
-from erpnext.accounts.utils import get_account_currency
-from frappe.model.utils import get_fetch_values
-
+from erpnext.regional.india import number_state_mapping, state_numbers, states
GST_INVOICE_NUMBER_FORMAT = re.compile(r"^[a-zA-Z0-9\-/]+$") #alphanumeric and - /
GSTIN_FORMAT = re.compile("^[0-9]{2}[A-Z]{4}[0-9A-Z]{1}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}[1-9A-Z]{1}[0-9A-Z]{1}$")
@@ -767,6 +767,15 @@
if tax.account_head in gst_accounts.get('cess_account', []):
doc.itc_cess_amount += flt(tax.base_tax_amount_after_discount_amount)
+def update_place_of_supply(doc, method):
+ country = frappe.get_cached_value('Company', doc.company, 'country')
+ if country != 'India':
+ return
+
+ address = frappe.db.get_value("Address", doc.get('customer_address'), ["gst_state", "gst_state_number"], as_dict=1)
+ if address and address.gst_state and address.gst_state_number:
+ doc.place_of_supply = cstr(address.gst_state_number) + "-" + cstr(address.gst_state)
+
@frappe.whitelist()
def get_regional_round_off_accounts(company, account_list):
country = frappe.get_cached_value('Company', company, 'country')
@@ -887,4 +896,3 @@
gst_settings.remove(d)
gst_settings.save()
-
diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py
index 56f609e..d6c7f1d 100644
--- a/erpnext/regional/italy/utils.py
+++ b/erpnext/regional/italy/utils.py
@@ -2,12 +2,14 @@
import io
import json
+
import frappe
-from frappe.utils import flt, cstr
-from erpnext.controllers.taxes_and_totals import get_itemised_tax
from frappe import _
+from frappe.utils import cstr, flt
from frappe.utils.file_manager import remove_file
from six import string_types
+
+from erpnext.controllers.taxes_and_totals import get_itemised_tax
from erpnext.regional.italy import state_codes
diff --git a/erpnext/regional/report/datev/datev.py b/erpnext/regional/report/datev/datev.py
index 86aed2e..c46c0df 100644
--- a/erpnext/regional/report/datev/datev.py
+++ b/erpnext/regional/report/datev/datev.py
@@ -10,13 +10,18 @@
from __future__ import unicode_literals
import json
+
import frappe
+from frappe import _
from six import string_types
-from frappe import _
from erpnext.accounts.utils import get_fiscal_year
-from erpnext.regional.germany.utils.datev.datev_csv import zip_and_download, get_datev_csv
-from erpnext.regional.germany.utils.datev.datev_constants import Transactions, DebtorsCreditors, AccountNames
+from erpnext.regional.germany.utils.datev.datev_constants import (
+ AccountNames,
+ DebtorsCreditors,
+ Transactions,
+)
+from erpnext.regional.germany.utils.datev.datev_csv import get_datev_csv, zip_and_download
COLUMNS = [
{
@@ -44,6 +49,12 @@
"width": 100
},
{
+ "label": "BU-Schlüssel",
+ "fieldname": "BU-Schlüssel",
+ "fieldtype": "Data",
+ "width": 100
+ },
+ {
"label": "Belegdatum",
"fieldname": "Belegdatum",
"fieldtype": "Date",
@@ -114,6 +125,36 @@
"fieldname": "Beleginfo - Inhalt 4",
"fieldtype": "Data",
"width": 150
+ },
+ {
+ "label": "Beleginfo - Art 5",
+ "fieldname": "Beleginfo - Art 5",
+ "fieldtype": "Data",
+ "width": 150
+ },
+ {
+ "label": "Beleginfo - Inhalt 5",
+ "fieldname": "Beleginfo - Inhalt 5",
+ "fieldtype": "Data",
+ "width": 100
+ },
+ {
+ "label": "Beleginfo - Art 6",
+ "fieldname": "Beleginfo - Art 6",
+ "fieldtype": "Data",
+ "width": 150
+ },
+ {
+ "label": "Beleginfo - Inhalt 6",
+ "fieldname": "Beleginfo - Inhalt 6",
+ "fieldtype": "Date",
+ "width": 100
+ },
+ {
+ "label": "Fälligkeit",
+ "fieldname": "Fälligkeit",
+ "fieldtype": "Date",
+ "width": 100
}
]
@@ -161,6 +202,125 @@
def get_transactions(filters, as_dict=1):
+ def run(params_method, filters):
+ extra_fields, extra_joins, extra_filters = params_method(filters)
+ return run_query(filters, extra_fields, extra_joins, extra_filters, as_dict=as_dict)
+
+ def sort_by(row):
+ # "Belegdatum" is in the fifth column when list format is used
+ return row["Belegdatum" if as_dict else 5]
+
+ type_map = {
+ # specific query methods for some voucher types
+ "Payment Entry": get_payment_entry_params,
+ "Sales Invoice": get_sales_invoice_params,
+ "Purchase Invoice": get_purchase_invoice_params
+ }
+
+ only_voucher_type = filters.get("voucher_type")
+ transactions = []
+
+ for voucher_type, get_voucher_params in type_map.items():
+ if only_voucher_type and only_voucher_type != voucher_type:
+ continue
+
+ transactions.extend(run(params_method=get_voucher_params, filters=filters))
+
+ if not only_voucher_type or only_voucher_type not in type_map:
+ # generic query method for all other voucher types
+ filters["exclude_voucher_types"] = type_map.keys()
+ transactions.extend(run(params_method=get_generic_params, filters=filters))
+
+ return sorted(transactions, key=sort_by)
+
+
+def get_payment_entry_params(filters):
+ extra_fields = """
+ , 'Zahlungsreferenz' as 'Beleginfo - Art 5'
+ , pe.reference_no as 'Beleginfo - Inhalt 5'
+ , 'Buchungstag' as 'Beleginfo - Art 6'
+ , pe.reference_date as 'Beleginfo - Inhalt 6'
+ , '' as 'Fälligkeit'
+ """
+
+ extra_joins = """
+ LEFT JOIN `tabPayment Entry` pe
+ ON gl.voucher_no = pe.name
+ """
+
+ extra_filters = """
+ AND gl.voucher_type = 'Payment Entry'
+ """
+
+ return extra_fields, extra_joins, extra_filters
+
+
+def get_sales_invoice_params(filters):
+ extra_fields = """
+ , '' as 'Beleginfo - Art 5'
+ , '' as 'Beleginfo - Inhalt 5'
+ , '' as 'Beleginfo - Art 6'
+ , '' as 'Beleginfo - Inhalt 6'
+ , si.due_date as 'Fälligkeit'
+ """
+
+ extra_joins = """
+ LEFT JOIN `tabSales Invoice` si
+ ON gl.voucher_no = si.name
+ """
+
+ extra_filters = """
+ AND gl.voucher_type = 'Sales Invoice'
+ """
+
+ return extra_fields, extra_joins, extra_filters
+
+
+def get_purchase_invoice_params(filters):
+ extra_fields = """
+ , 'Lieferanten-Rechnungsnummer' as 'Beleginfo - Art 5'
+ , pi.bill_no as 'Beleginfo - Inhalt 5'
+ , 'Lieferanten-Rechnungsdatum' as 'Beleginfo - Art 6'
+ , pi.bill_date as 'Beleginfo - Inhalt 6'
+ , pi.due_date as 'Fälligkeit'
+ """
+
+ extra_joins = """
+ LEFT JOIN `tabPurchase Invoice` pi
+ ON gl.voucher_no = pi.name
+ """
+
+ extra_filters = """
+ AND gl.voucher_type = 'Purchase Invoice'
+ """
+
+ return extra_fields, extra_joins, extra_filters
+
+
+def get_generic_params(filters):
+ # produce empty fields so all rows will have the same length
+ extra_fields = """
+ , '' as 'Beleginfo - Art 5'
+ , '' as 'Beleginfo - Inhalt 5'
+ , '' as 'Beleginfo - Art 6'
+ , '' as 'Beleginfo - Inhalt 6'
+ , '' as 'Fälligkeit'
+ """
+ extra_joins = ""
+
+ if filters.get("exclude_voucher_types"):
+ # exclude voucher types that are queried by a dedicated method
+ exclude = "({})".format(', '.join("'{}'".format(key) for key in filters.get("exclude_voucher_types")))
+ extra_filters = "AND gl.voucher_type NOT IN {}".format(exclude)
+
+ # if voucher type filter is set, allow only this type
+ if filters.get("voucher_type"):
+ extra_filters += " AND gl.voucher_type = %(voucher_type)s"
+
+ return extra_fields, extra_joins, extra_filters
+
+
+def run_query(filters, extra_fields, extra_joins, extra_filters, as_dict=1):
"""
Get a list of accounting entries.
@@ -171,8 +331,7 @@
filters -- dict of filters to be passed to the sql query
as_dict -- return as list of dicts [0,1]
"""
- filter_by_voucher = 'AND gl.voucher_type = %(voucher_type)s' if filters.get('voucher_type') else ''
- gl_entries = frappe.db.sql("""
+ query = """
SELECT
/* either debit or credit amount; always positive */
@@ -187,6 +346,9 @@
/* against number or, if empty, party against number */
%(temporary_against_account_number)s as 'Gegenkonto (ohne BU-Schlüssel)',
+ /* disable automatic VAT deduction */
+ '40' as 'BU-Schlüssel',
+
gl.posting_date as 'Belegdatum',
gl.voucher_no as 'Belegfeld 1',
LEFT(gl.remarks, 60) as 'Buchungstext',
@@ -199,30 +361,34 @@
case gl.party_type when 'Customer' then 'Debitorennummer' when 'Supplier' then 'Kreditorennummer' else NULL end as 'Beleginfo - Art 4',
par.debtor_creditor_number as 'Beleginfo - Inhalt 4'
+ {extra_fields}
+
FROM `tabGL Entry` gl
/* Kontonummer */
- left join `tabAccount` acc
- on gl.account = acc.name
+ LEFT JOIN `tabAccount` acc
+ ON gl.account = acc.name
- left join `tabCustomer` cus
- on gl.party_type = 'Customer'
- and gl.party = cus.name
+ LEFT JOIN `tabParty Account` par
+ ON par.parent = gl.party
+ AND par.parenttype = gl.party_type
+ AND par.company = %(company)s
- left join `tabSupplier` sup
- on gl.party_type = 'Supplier'
- and gl.party = sup.name
-
- left join `tabParty Account` par
- on par.parent = gl.party
- and par.parenttype = gl.party_type
- and par.company = %(company)s
+ {extra_joins}
WHERE gl.company = %(company)s
AND DATE(gl.posting_date) >= %(from_date)s
AND DATE(gl.posting_date) <= %(to_date)s
- {}
- ORDER BY 'Belegdatum', gl.voucher_no""".format(filter_by_voucher), filters, as_dict=as_dict)
+
+ {extra_filters}
+
+ ORDER BY 'Belegdatum', gl.voucher_no""".format(
+ extra_fields=extra_fields,
+ extra_joins=extra_joins,
+ extra_filters=extra_filters
+ )
+
+ gl_entries = frappe.db.sql(query, filters, as_dict=as_dict)
return gl_entries
diff --git a/erpnext/regional/report/datev/test_datev.py b/erpnext/regional/report/datev/test_datev.py
index 59b878e..b538893 100644
--- a/erpnext/regional/report/datev/test_datev.py
+++ b/erpnext/regional/report/datev/test_datev.py
@@ -2,21 +2,27 @@
from __future__ import unicode_literals
import zipfile
-import frappe
-from six import BytesIO
from unittest import TestCase
-from frappe.utils import today, now_datetime, cstr
+
+import frappe
+from frappe.utils import cstr, now_datetime, today
+from six import BytesIO
+
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
-
-from erpnext.regional.report.datev.datev import validate
-from erpnext.regional.report.datev.datev import get_transactions
-from erpnext.regional.report.datev.datev import get_customers
-from erpnext.regional.report.datev.datev import get_suppliers
-from erpnext.regional.report.datev.datev import get_account_names
-from erpnext.regional.report.datev.datev import download_datev_csv
-
+from erpnext.regional.germany.utils.datev.datev_constants import (
+ AccountNames,
+ DebtorsCreditors,
+ Transactions,
+)
from erpnext.regional.germany.utils.datev.datev_csv import get_datev_csv, get_header
-from erpnext.regional.germany.utils.datev.datev_constants import Transactions, DebtorsCreditors, AccountNames
+from erpnext.regional.report.datev.datev import (
+ download_datev_csv,
+ get_account_names,
+ get_customers,
+ get_suppliers,
+ get_transactions,
+)
+
def make_company(company_name, abbr):
if not frappe.db.exists("Company", company_name):
diff --git a/erpnext/regional/report/electronic_invoice_register/electronic_invoice_register.py b/erpnext/regional/report/electronic_invoice_register/electronic_invoice_register.py
index 376ba3e..f4ce7a7 100644
--- a/erpnext/regional/report/electronic_invoice_register/electronic_invoice_register.py
+++ b/erpnext/regional/report/electronic_invoice_register/electronic_invoice_register.py
@@ -2,7 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from erpnext.accounts.report.sales_register.sales_register import _execute
+
def execute(filters=None):
return _execute(filters)
diff --git a/erpnext/regional/report/eway_bill/eway_bill.py b/erpnext/regional/report/eway_bill/eway_bill.py
index 4f777fc..c78084f 100644
--- a/erpnext/regional/report/eway_bill/eway_bill.py
+++ b/erpnext/regional/report/eway_bill/eway_bill.py
@@ -2,12 +2,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
import re
+
+import frappe
from frappe import _
from frappe.utils import nowdate
+
def execute(filters=None):
if not filters: filters.setdefault('posting_date', [nowdate(), nowdate()])
columns, data = [], []
@@ -41,7 +44,7 @@
}
# Regular expression set to remove all the special characters
- special_characters = "[$%^*()+\\[\]{};':\"\\|<>.?]"
+ special_characters = r"[$%^*()+\\[\]{};':\"\\|<>.?]"
for row in data:
set_defaults(row)
diff --git "a/erpnext/regional/report/fichier_des_ecritures_comptables_\133fec\135/fichier_des_ecritures_comptables_\133fec\135.py" "b/erpnext/regional/report/fichier_des_ecritures_comptables_\133fec\135/fichier_des_ecritures_comptables_\133fec\135.py"
index e903c9f..9567916 100644
--- "a/erpnext/regional/report/fichier_des_ecritures_comptables_\133fec\135/fichier_des_ecritures_comptables_\133fec\135.py"
+++ "b/erpnext/regional/report/fichier_des_ecritures_comptables_\133fec\135/fichier_des_ecritures_comptables_\133fec\135.py"
@@ -2,11 +2,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import format_datetime
-from frappe import _
+
import re
+import frappe
+from frappe import _
+from frappe.utils import format_datetime
+
+
def execute(filters=None):
account_details = {}
for acc in frappe.db.sql("""select name, is_group from tabAccount""", as_dict=1):
@@ -116,7 +119,7 @@
if d.get("voucher_no").startswith("{0}-".format(JournalCode)) or d.get("voucher_no").startswith("{0}/".format(JournalCode)):
EcritureNum = re.split("-|/", d.get("voucher_no"))[1]
else:
- EcritureNum = re.search("{0}(\d+)".format(JournalCode), d.get("voucher_no"), re.IGNORECASE).group(1)
+ EcritureNum = re.search(r"{0}(\d+)".format(JournalCode), d.get("voucher_no"), re.IGNORECASE).group(1)
EcritureDate = format_datetime(d.get("GlPostDate"), "yyyyMMdd")
diff --git a/erpnext/regional/report/gst_itemised_purchase_register/gst_itemised_purchase_register.py b/erpnext/regional/report/gst_itemised_purchase_register/gst_itemised_purchase_register.py
index b5948f9..092f72a 100644
--- a/erpnext/regional/report/gst_itemised_purchase_register/gst_itemised_purchase_register.py
+++ b/erpnext/regional/report/gst_itemised_purchase_register/gst_itemised_purchase_register.py
@@ -3,7 +3,10 @@
from __future__ import unicode_literals
-from erpnext.accounts.report.item_wise_purchase_register.item_wise_purchase_register import _execute
+from erpnext.accounts.report.item_wise_purchase_register.item_wise_purchase_register import (
+ _execute,
+)
+
def execute(filters=None):
return _execute(filters, additional_table_columns=[
diff --git a/erpnext/regional/report/gst_itemised_sales_register/gst_itemised_sales_register.py b/erpnext/regional/report/gst_itemised_sales_register/gst_itemised_sales_register.py
index e13f509..44f623b 100644
--- a/erpnext/regional/report/gst_itemised_sales_register/gst_itemised_sales_register.py
+++ b/erpnext/regional/report/gst_itemised_sales_register/gst_itemised_sales_register.py
@@ -5,6 +5,7 @@
from erpnext.accounts.report.item_wise_sales_register.item_wise_sales_register import _execute
+
def execute(filters=None):
return _execute(filters, additional_table_columns=[
dict(fieldtype='Data', label='Customer GSTIN', fieldname="customer_gstin", width=120),
diff --git a/erpnext/regional/report/gst_purchase_register/gst_purchase_register.py b/erpnext/regional/report/gst_purchase_register/gst_purchase_register.py
index 12e9676..e972444 100644
--- a/erpnext/regional/report/gst_purchase_register/gst_purchase_register.py
+++ b/erpnext/regional/report/gst_purchase_register/gst_purchase_register.py
@@ -5,6 +5,7 @@
from erpnext.accounts.report.purchase_register.purchase_register import _execute
+
def execute(filters=None):
return _execute(filters, additional_table_columns=[
dict(fieldtype='Data', label='Supplier GSTIN', fieldname="supplier_gstin", width=120),
diff --git a/erpnext/regional/report/gst_sales_register/gst_sales_register.py b/erpnext/regional/report/gst_sales_register/gst_sales_register.py
index 075bd48..6975af3 100644
--- a/erpnext/regional/report/gst_sales_register/gst_sales_register.py
+++ b/erpnext/regional/report/gst_sales_register/gst_sales_register.py
@@ -5,6 +5,7 @@
from erpnext.accounts.report.sales_register.sales_register import _execute
+
def execute(filters=None):
return _execute(filters, additional_table_columns=[
dict(fieldtype='Data', label='Customer GSTIN', fieldname="customer_gstin", width=120),
diff --git a/erpnext/regional/report/gstr_1/gstr_1.js b/erpnext/regional/report/gstr_1/gstr_1.js
index 444f5db..ef2bdb6 100644
--- a/erpnext/regional/report/gstr_1/gstr_1.js
+++ b/erpnext/regional/report/gstr_1/gstr_1.js
@@ -51,7 +51,9 @@
{ "value": "B2C Large", "label": __("B2C(Large) Invoices - 5A, 5B") },
{ "value": "B2C Small", "label": __("B2C(Small) Invoices - 7") },
{ "value": "CDNR-REG", "label": __("Credit/Debit Notes (Registered) - 9B") },
- { "value": "EXPORT", "label": __("Export Invoice - 6A") }
+ { "value": "CDNR-UNREG", "label": __("Credit/Debit Notes (Unregistered) - 9B") },
+ { "value": "EXPORT", "label": __("Export Invoice - 6A") },
+ { "value": "Advances", "label": __("Tax Liability (Advances Received) - 11A(1), 11A(2)") }
],
"default": "B2B"
}
diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py
index 9d4f920..e3e09ef 100644
--- a/erpnext/regional/report/gstr_1/gstr_1.py
+++ b/erpnext/regional/report/gstr_1/gstr_1.py
@@ -2,14 +2,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json
-from frappe import _
-from frappe.utils import flt, formatdate, now_datetime, getdate
+
+import json
from datetime import date
+
+import frappe
+from frappe import _
+from frappe.utils import flt, formatdate, getdate
from six import iteritems
-from erpnext.regional.doctype.gstr_3b_report.gstr_3b_report import get_period
+
from erpnext.regional.india.utils import get_gst_accounts
+
def execute(filters=None):
return Gstr1Report(filters).run()
@@ -50,26 +54,45 @@
self.get_invoice_items()
self.get_items_based_on_tax_rate()
self.invoice_fields = [d["fieldname"] for d in self.invoice_columns]
- self.get_data()
+
+ self.get_data()
return self.columns, self.data
def get_data(self):
if self.filters.get("type_of_business") in ("B2C Small", "B2C Large"):
self.get_b2c_data()
- else:
+ elif self.filters.get("type_of_business") == "Advances":
+ self.get_advance_data()
+ elif self.invoices:
for inv, items_based_on_rate in self.items_based_on_tax_rate.items():
invoice_details = self.invoices.get(inv)
for rate, items in items_based_on_rate.items():
row, taxable_value = self.get_row_data_for_invoice(inv, invoice_details, rate, items)
- if self.filters.get("type_of_business") == "CDNR-REG":
+ if self.filters.get("type_of_business") in ("CDNR-REG", "CDNR-UNREG"):
row.append("Y" if invoice_details.posting_date <= date(2017, 7, 1) else "N")
row.append("C" if invoice_details.is_return else "D")
if taxable_value:
self.data.append(row)
+ def get_advance_data(self):
+ advances_data = {}
+ advances = self.get_advance_entries()
+ for entry in advances:
+ # only consider IGST and SGST so as to avoid duplication of taxable amount
+ if entry.account_head in self.gst_accounts.igst_account or \
+ entry.account_head in self.gst_accounts.sgst_account:
+ advances_data.setdefault((entry.place_of_supply, entry.rate), [0.0, 0.0])
+ advances_data[(entry.place_of_supply, entry.rate)][0] += (entry.amount * 100 / entry.rate)
+ elif entry.account_head in self.gst_accounts.cess_account:
+ advances_data[(entry.place_of_supply, entry.rate)][1] += entry.amount
+
+ for key, value in advances_data.items():
+ row= [key[0], key[1], value[0], value[1]]
+ self.data.append(row)
+
def get_b2c_data(self):
b2cs_output = {}
@@ -106,7 +129,7 @@
def get_row_data_for_invoice(self, invoice, invoice_details, tax_rate, items):
row = []
for fieldname in self.invoice_fields:
- if self.filters.get("type_of_business") == "CDNR-REG" and fieldname == "invoice_value":
+ if self.filters.get("type_of_business") in ("CDNR-REG", "CDNR-UNREG") and fieldname == "invoice_value":
row.append(abs(invoice_details.base_rounded_total) or abs(invoice_details.base_grand_total))
elif fieldname == "invoice_value":
row.append(invoice_details.base_rounded_total or invoice_details.base_grand_total)
@@ -167,6 +190,16 @@
for d in invoice_data:
self.invoices.setdefault(d.invoice_number, d)
+ def get_advance_entries(self):
+ return frappe.db.sql("""
+ SELECT SUM(a.base_tax_amount) as amount, a.account_head, a.rate, p.place_of_supply
+ FROM `tabPayment Entry` p, `tabAdvance Taxes and Charges` a
+ WHERE p.docstatus = 1
+ AND p.name = a.parent
+ AND posting_date between %s and %s
+ GROUP BY a.account_head, p.place_of_supply, a.rate
+ """, (self.filters.get('from_date'), self.filters.get('to_date')), as_dict=1)
+
def get_conditions(self):
conditions = ""
@@ -198,6 +231,12 @@
elif self.filters.get("type_of_business") == "CDNR-REG":
conditions += """ AND (is_return = 1 OR is_debit_note = 1) AND IFNULL(gst_category, '') in ('Registered Regular', 'Deemed Export', 'SEZ')"""
+ elif self.filters.get("type_of_business") == "CDNR-UNREG":
+ b2c_limit = frappe.db.get_single_value('GST Settings', 'b2c_limit')
+ conditions += """ AND ifnull(SUBSTR(place_of_supply, 1, 2),'') != ifnull(SUBSTR(company_gstin, 1, 2),'')
+ AND ABS(grand_total) > {0} AND (is_return = 1 OR is_debit_note = 1)
+ AND IFNULL(gst_category, '') in ('Unregistered', 'Overseas')""".format(flt(b2c_limit))
+
elif self.filters.get("type_of_business") == "EXPORT":
conditions += """ AND is_return !=1 and gst_category = 'Overseas' """
@@ -503,6 +542,84 @@
"width": 80
}
]
+ elif self.filters.get("type_of_business") == "CDNR-UNREG":
+ self.invoice_columns = [
+ {
+ "fieldname": "customer_name",
+ "label": "Receiver Name",
+ "fieldtype": "Data",
+ "width": 120
+ },
+ {
+ "fieldname": "return_against",
+ "label": "Issued Against",
+ "fieldtype": "Link",
+ "options": "Sales Invoice",
+ "width": 120
+ },
+ {
+ "fieldname": "posting_date",
+ "label": "Note Date",
+ "fieldtype": "Date",
+ "width": 120
+ },
+ {
+ "fieldname": "invoice_number",
+ "label": "Note Number",
+ "fieldtype": "Link",
+ "options": "Sales Invoice",
+ "width":120
+ },
+ {
+ "fieldname": "export_type",
+ "label": "Export Type",
+ "fieldtype": "Data",
+ "hidden": 1
+ },
+ {
+ "fieldname": "reason_for_issuing_document",
+ "label": "Reason For Issuing document",
+ "fieldtype": "Data",
+ "width": 140
+ },
+ {
+ "fieldname": "place_of_supply",
+ "label": "Place Of Supply",
+ "fieldtype": "Data",
+ "width": 120
+ },
+ {
+ "fieldname": "gst_category",
+ "label": "GST Category",
+ "fieldtype": "Data"
+ },
+ {
+ "fieldname": "invoice_value",
+ "label": "Invoice Value",
+ "fieldtype": "Currency",
+ "width": 120
+ }
+ ]
+ self.other_columns = [
+ {
+ "fieldname": "cess_amount",
+ "label": "Cess Amount",
+ "fieldtype": "Currency",
+ "width": 100
+ },
+ {
+ "fieldname": "pre_gst",
+ "label": "PRE GST",
+ "fieldtype": "Data",
+ "width": 80
+ },
+ {
+ "fieldname": "document_type",
+ "label": "Document Type",
+ "fieldtype": "Data",
+ "width": 80
+ }
+ ]
elif self.filters.get("type_of_business") == "B2C Small":
self.invoice_columns = [
{
@@ -578,6 +695,25 @@
"width": 120
}
]
+ elif self.filters.get("type_of_business") == "Advances":
+ self.invoice_columns = [
+ {
+ "fieldname": "place_of_supply",
+ "label": "Place Of Supply",
+ "fieldtype": "Data",
+ "width": 120
+ }
+ ]
+
+ self.other_columns = [
+ {
+ "fieldname": "cess_amount",
+ "label": "Cess Amount",
+ "fieldtype": "Currency",
+ "width": 100
+ }
+ ]
+
self.columns = self.invoice_columns + self.tax_columns + self.other_columns
@frappe.whitelist()
@@ -616,12 +752,29 @@
out = get_export_json(res)
gst_json["exp"] = out
- elif filters["type_of_business"] == 'CDNR-REG':
+ elif filters["type_of_business"] == "CDNR-REG":
for item in report_data[:-1]:
res.setdefault(item["customer_gstin"], {}).setdefault(item["invoice_number"],[]).append(item)
out = get_cdnr_reg_json(res, gstin)
gst_json["cdnr"] = out
+ elif filters["type_of_business"] == "CDNR-UNREG":
+ for item in report_data[:-1]:
+ res.setdefault(item["invoice_number"],[]).append(item)
+
+ out = get_cdnr_unreg_json(res, gstin)
+ gst_json["cdnur"] = out
+
+ elif filters["type_of_business"] == "Advances":
+ for item in report_data[:-1]:
+ if not item.get("place_of_supply"):
+ frappe.throw(_("""{0} not entered in some entries.
+ Please update and try again""").format(frappe.bold("Place Of Supply")))
+
+ res.setdefault(item["place_of_supply"],[]).append(item)
+
+ out = get_advances_json(res, gstin)
+ gst_json["at"] = out
return {
'report_name': report_name,
@@ -701,6 +854,40 @@
return out
+def get_advances_json(data, gstin):
+ company_state_number = gstin[0:2]
+ out = []
+ for place_of_supply, items in iteritems(data):
+ supply_type = "INTRA" if company_state_number == place_of_supply.split('-')[0] else "INTER"
+ row = {
+ "pos": place_of_supply.split('-')[0],
+ "itms": [],
+ "sply_ty": supply_type
+ }
+
+ for item in items:
+ itms = {
+ 'rt': item['rate'],
+ 'ad_amount': flt(item.get('taxable_value')),
+ 'csamt': flt(item.get('cess_amount'))
+ }
+
+ if supply_type == "INTRA":
+ itms.update({
+ "samt": flt((itms["ad_amount"] * itms["rt"]) / 100),
+ "camt": flt((itms["ad_amount"] * itms["rt"]) / 100),
+ "rt": itms["rt"] * 2
+ })
+ else:
+ itms.update({
+ "iamt": flt((itms["ad_amount"] * itms["rt"]) / 100)
+ })
+
+ row['itms'].append(itms)
+ out.append(row)
+
+ return out
+
def get_b2cl_json(res, gstin):
out = []
for pos in res:
@@ -780,6 +967,27 @@
return out
+def get_cdnr_unreg_json(res, gstin):
+ out = []
+
+ for invoice, items in iteritems(res):
+ inv_item = {
+ "nt_num": items[0]["invoice_number"],
+ "nt_dt": getdate(items[0]["posting_date"]).strftime('%d-%m-%Y'),
+ "val": abs(flt(items[0]["invoice_value"])),
+ "ntty": items[0]["document_type"],
+ "pos": "%02d" % int(items[0]["place_of_supply"].split('-')[0]),
+ "typ": get_invoice_type_for_cdnrur(items[0])
+ }
+
+ inv_item["itms"] = []
+ for item in items:
+ inv_item["itms"].append(get_rate_and_tax_details(item, gstin))
+
+ out.append(inv_item)
+
+ return out
+
def get_invoice_type_for_cdnr(row):
if row.get('gst_category') == 'SEZ':
if row.get('export_type') == 'WPAY':
@@ -787,12 +995,23 @@
else:
invoice_type = 'SEWOP'
elif row.get('gst_category') == 'Deemed Export':
- row.invoice_type = 'DE'
+ invoice_type = 'DE'
elif row.get('gst_category') == 'Registered Regular':
invoice_type = 'R'
return invoice_type
+def get_invoice_type_for_cdnrur(row):
+ if row.get('gst_category') == 'Overseas':
+ if row.get('export_type') == 'WPAY':
+ invoice_type = 'EXPWP'
+ else:
+ invoice_type = 'EXPWOP'
+ elif row.get('gst_category') == 'Unregistered':
+ invoice_type = 'B2CL'
+
+ return invoice_type
+
def get_basic_invoice_detail(row):
return {
"inum": row["invoice_number"],
@@ -832,7 +1051,7 @@
["Dynamic Link", "link_name", "=", company],
["Dynamic Link", "parenttype", "=", "Address"],
]
- gstin = frappe.get_all("Address", filters=filters, pluck="gstin")
+ gstin = frappe.get_all("Address", filters=filters, pluck="gstin", order_by="is_primary_address desc")
if gstin and not all_gstins:
gstin = gstin[0]
diff --git a/erpnext/regional/report/gstr_2/gstr_2.py b/erpnext/regional/report/gstr_2/gstr_2.py
index 616c2b8..5e44955 100644
--- a/erpnext/regional/report/gstr_2/gstr_2.py
+++ b/erpnext/regional/report/gstr_2/gstr_2.py
@@ -2,10 +2,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from datetime import date
+
+import frappe
+
from erpnext.regional.report.gstr_1.gstr_1 import Gstr1Report
+
def execute(filters=None):
return Gstr2Report(filters).run()
diff --git a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py
index 1adddbd..7a938c7 100644
--- a/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py
+++ b/erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py
@@ -2,16 +2,20 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe import _
-from frappe.utils import flt, getdate, cstr
-from frappe.model.meta import get_field_precision
-from frappe.utils.xlsxutils import handle_html
-from six import iteritems
+
import json
+
+import frappe
+from frappe import _
+from frappe.model.meta import get_field_precision
+from frappe.utils import cstr, flt, getdate
+from six import iteritems
+
+import erpnext
from erpnext.regional.india.utils import get_gst_accounts
from erpnext.regional.report.gstr_1.gstr_1 import get_company_gstin_number
+
def execute(filters=None):
return _execute(filters)
diff --git a/erpnext/regional/report/irs_1099/irs_1099.py b/erpnext/regional/report/irs_1099/irs_1099.py
index f67d622..b1a5d10 100644
--- a/erpnext/regional/report/irs_1099/irs_1099.py
+++ b/erpnext/regional/report/irs_1099/irs_1099.py
@@ -3,16 +3,16 @@
import json
-from PyPDF2 import PdfFileWriter
-
import frappe
-from erpnext.accounts.utils import get_fiscal_year
from frappe import _
from frappe.utils import cstr, nowdate
from frappe.utils.data import fmt_money
from frappe.utils.jinja import render_template
from frappe.utils.pdf import get_pdf
from frappe.utils.print_format import read_multi_pdf
+from PyPDF2 import PdfFileWriter
+
+from erpnext.accounts.utils import get_fiscal_year
IRS_1099_FORMS_FILE_EXTENSION = ".pdf"
diff --git a/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.py b/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.py
index 54808e5..5300b92 100644
--- a/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.py
+++ b/erpnext/regional/report/professional_tax_deductions/professional_tax_deductions.py
@@ -2,9 +2,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from erpnext.regional.report.provident_fund_deductions.provident_fund_deductions import get_conditions
+
+from erpnext.regional.report.provident_fund_deductions.provident_fund_deductions import (
+ get_conditions,
+)
+
def execute(filters=None):
data = get_data(filters)
diff --git a/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.py b/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.py
index 82423f0..ae5d6b9 100644
--- a/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.py
+++ b/erpnext/regional/report/provident_fund_deductions/provident_fund_deductions.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import getdate
from frappe import _
+from frappe.utils import getdate
+
def execute(filters=None):
data = get_data(filters)
diff --git a/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py b/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py
index daa6976..e19aeaa 100644
--- a/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py
+++ b/erpnext/regional/report/uae_vat_201/test_uae_vat_201.py
@@ -1,21 +1,23 @@
# coding=utf-8
from __future__ import unicode_literals
-import erpnext
-import frappe
from unittest import TestCase
-from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+
+import frappe
+
+import erpnext
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
-from erpnext.stock.doctype.warehouse.test_warehouse import get_warehouse_account
+from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
from erpnext.regional.report.uae_vat_201.uae_vat_201 import (
- get_total_emiratewise,
- get_tourist_tax_return_total,
- get_tourist_tax_return_tax,
- get_zero_rated_total,
get_exempt_total,
- get_standard_rated_expenses_total,
get_standard_rated_expenses_tax,
+ get_standard_rated_expenses_total,
+ get_total_emiratewise,
+ get_tourist_tax_return_tax,
+ get_tourist_tax_return_total,
+ get_zero_rated_total,
)
+from erpnext.stock.doctype.warehouse.test_warehouse import get_warehouse_account
test_dependencies = ["Territory", "Customer Group", "Supplier Group", "Item"]
diff --git a/erpnext/regional/report/uae_vat_201/uae_vat_201.py b/erpnext/regional/report/uae_vat_201/uae_vat_201.py
index b061423..f4c049d 100644
--- a/erpnext/regional/report/uae_vat_201/uae_vat_201.py
+++ b/erpnext/regional/report/uae_vat_201/uae_vat_201.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
columns = get_columns()
data, emirates, amounts_by_emirate = get_data(filters)
diff --git a/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py b/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py
index dea17a6..77beff3 100644
--- a/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py
+++ b/erpnext/regional/report/vat_audit_report/test_vat_audit_report.py
@@ -2,16 +2,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from unittest import TestCase
+
+import frappe
from frappe.utils import today
from erpnext.accounts.doctype.account.test_account import create_account
-from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
-
+from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
from erpnext.regional.report.vat_audit_report.vat_audit_report import execute
+
class TestVATAuditReport(TestCase):
def setUp(self):
frappe.set_user("Administrator")
diff --git a/erpnext/regional/report/vat_audit_report/vat_audit_report.py b/erpnext/regional/report/vat_audit_report/vat_audit_report.py
index 88f6b92..3637bca 100644
--- a/erpnext/regional/report/vat_audit_report/vat_audit_report.py
+++ b/erpnext/regional/report/vat_audit_report/vat_audit_report.py
@@ -2,11 +2,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
+
+import frappe
from frappe import _
from frappe.utils import formatdate, get_link_to_form
+
def execute(filters=None):
return VATAuditReport(filters).run()
diff --git a/erpnext/regional/united_arab_emirates/setup.py b/erpnext/regional/united_arab_emirates/setup.py
index bd12d66..8b19050 100644
--- a/erpnext/regional/united_arab_emirates/setup.py
+++ b/erpnext/regional/united_arab_emirates/setup.py
@@ -3,7 +3,7 @@
from __future__ import unicode_literals
-import frappe, os, json
+import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from frappe.permissions import add_permission, update_permission_property
from erpnext.payroll.doctype.gratuity_rule.gratuity_rule import get_gratuity_rule
diff --git a/erpnext/regional/united_arab_emirates/utils.py b/erpnext/regional/united_arab_emirates/utils.py
index 7d5fd6e..66a9651 100644
--- a/erpnext/regional/united_arab_emirates/utils.py
+++ b/erpnext/regional/united_arab_emirates/utils.py
@@ -1,11 +1,14 @@
from __future__ import unicode_literals
+
import frappe
from frappe import _
-import erpnext
-from frappe.utils import flt, round_based_on_smallest_currency_fraction, money_in_words
-from erpnext.controllers.taxes_and_totals import get_itemised_tax
+from frappe.utils import flt, money_in_words, round_based_on_smallest_currency_fraction
from six import iteritems
+import erpnext
+from erpnext.controllers.taxes_and_totals import get_itemised_tax
+
+
def update_itemised_tax_data(doc):
if not doc.taxes: return
diff --git a/erpnext/regional/united_states/product_tax_category_data.json b/erpnext/regional/united_states/product_tax_category_data.json
new file mode 100644
index 0000000..4527bb2
--- /dev/null
+++ b/erpnext/regional/united_states/product_tax_category_data.json
@@ -0,0 +1,4084 @@
+{
+ "categories": [
+ {
+ "description": "An item commonly used by a student in a course of study. This category is limited to the following items...binders, blackboard chalk, cellophane tape, compasses, composition books, crayons, erasers, folders, glue/paste/glue sticks, highlighters, index cards, index card boxes, legal pads, lunch boxes, markers, notebooks, paper (copy, graph, tracing, manila, colored, construction, notebook), pencils, pencil boxes, pencil sharpeners, pens, posterboard, protractors, rulers, scissors, writing tablets.",
+ "name": "School Supplies",
+ "product_tax_code": "44121600A0001"
+ },
+ {
+ "description": "This is a labor charge for: the planning and design of interior spaces; preparation of layout drawings, schedules, and specifications pertaining to the planning and design of interior spaces; furniture arranging; design and planning of furniture, fixtures, and cabinetry; staging; lighting and sound design; and the selection, purchase, and arrangement of surface coverings, draperies, furniture, and other decorations.",
+ "name": "Interior Decorating Services",
+ "product_tax_code": "73890600A0000"
+ },
+ {
+ "description": "Ammunition for firearms with a barrel greater than an internal diameter of .50 caliber or a shotgun larger than 10 gauge., including bullets, shotgun shells, and gunpowder.",
+ "name": "Ammunition - designed for firearms other than small arms.",
+ "product_tax_code": "46101600A0002"
+ },
+ {
+ "description": "Firearms, limited to pistols, revolvers, rifles with a barrel greater than an internal diameter of .50 caliber or a shotgun larger than 10 gauge.",
+ "name": "Firearms - other than small arms",
+ "product_tax_code": "46101500A0002"
+ },
+ {
+ "description": "A charge for an objective visual examination of a house’s systems and physical structure. The charge includes a report of the inspector's findings including pictures, analysis, and recommendations.",
+ "name": "Home Inspection Services",
+ "product_tax_code": "80131802A0001"
+ },
+ {
+ "description": "A charge for custodial services to residential structures, including the cleaning of floors, carpets, walls, windows, appliances, furniture, fixtures, exterior cleaning, etc. No Tangible Personal Property is transferred.",
+ "name": "Cleaning/Janitorial Services - Residential",
+ "product_tax_code": "76111501A0001"
+ },
+ {
+ "description": "A subscription service for membership to an online dating platform.",
+ "name": "Online Dating Services",
+ "product_tax_code": "91000000A1111"
+ },
+ {
+ "description": "A charge for the service to maintain the proper operation of home or building gutters through cleaning out debris that could otherwise affect the proper water flow through the gutter system.",
+ "name": "Gutter Cleaning Services",
+ "product_tax_code": "72152602A0001"
+ },
+ {
+ "description": "Clothing - Swim Fins",
+ "name": "Clothing - Swim Fins",
+ "product_tax_code": "4914606A0001"
+ },
+ {
+ "description": "A series of related images which, when shown in succession, impart an impression of motion, together with accompanying sounds, if any. These goods can be streamed and/or downloaded to a device with permanent access granted. These goods include motion pictures, music videos, animations, news and entertainment programs, and live events, but do not include video greeting cards or video or electronic games.",
+ "name": "Digital Audio Visual Works - bundle - downloaded with permanent rights and streamed - non subscription",
+ "product_tax_code": "55111516A0110"
+ },
+ {
+ "description": "A series of related images which, when shown in succession, impart an impression of motion, together with accompanying sounds, if any. These goods can be streamed and/or downloaded to a device with access that expires after a stated period of time. These goods include motion pictures, music videos, animations, news and entertainment programs, and live events, but do not include video greeting cards or video or electronic games.",
+ "name": "Digital Audio Visual Works - bundle - downloaded with limited rights and streamed - non subscription",
+ "product_tax_code": "55111516A0210"
+ },
+ {
+ "description": "A series of related images which, when shown in succession, impart an impression of motion, together with accompanying sounds, if any. These goods are downloaded to a device with access that expires after a stated period of time. These goods include motion pictures, music videos, animations, news and entertainment programs, and live events, but do not include video greeting cards or video or electronic games.",
+ "name": "Digital Audio Visual Works - downloaded - non subscription - with limited rights",
+ "product_tax_code": "55111516A0020"
+ },
+ {
+ "description": "A series of related images which, when shown in succession, impart an impression of motion, together with accompanying sounds, if any. These goods are downloaded to a device with permanent access granted. These goods include motion pictures, music videos, animations, news and entertainment programs, and live events, but do not include video greeting cards or video or electronic games.",
+ "name": "Digital Audio Visual Works - downloaded - non subscription - with permanent rights",
+ "product_tax_code": "55111516A0010"
+ },
+ {
+ "description": "A series of related images which, when shown in succession, impart an impression of motion, together with accompanying sounds, if any. These goods are streamed to a device with access that expires after a stated period of time. These goods include motion pictures, music videos, animations, news and entertainment programs, and live events, but do not include video greeting cards or video or electronic games.",
+ "name": "Digital Audio Visual Works - streamed - non subscription - with limited rights",
+ "product_tax_code": "55111516A0030"
+ },
+ {
+ "description": "A series of related images which, when shown in succession, impart an impression of motion, together with accompanying sounds, if any. These goods are streamed to a device with access that is conditioned upon continued subscription payment. These goods include motion pictures, music videos, animations, news and entertainment programs, and live events, but do not include video greeting cards or video or electronic games.",
+ "name": "Digital Audio Visual Works - streamed - subscription - with conditional rights",
+ "product_tax_code": "55111516A0040"
+ },
+ {
+ "description": "A series of related images which, when shown in succession, impart an impression of motion, together with accompanying sounds, if any. These goods are streamed and/or downloaded to a device with access that is conditioned upon continued subscription payment. These goods include motion pictures, music videos, animations, news and entertainment programs, and live events, but do not include video greeting cards or video or electronic games.",
+ "name": "Digital Audio Visual Works - bundle - downloaded and streamed - subscription - with conditional rights",
+ "product_tax_code": "55111516A0310"
+ },
+ {
+ "description": "Works that result from the fixation of a series of musical, spoken, or other sounds that are transferred electronically. These goods are streamed to a device with access that is conditioned upon continued subscription payment. These goods include prerecorded or live music, prerecorded or live readings of books or other written materials, prerecorded or live speeches, ringtones, or other sound recordings, but not including audio greeting cards.",
+ "name": "Digital Audio Works - streamed - subscription - with conditional rights",
+ "product_tax_code": "55111512A0040"
+ },
+ {
+ "description": "Works that result from the fixation of a series of musical, spoken, or other sounds that are transferred electronically. These goods are streamed to a device with access that expires after a stated period of time. These goods include prerecorded or live music, prerecorded or live readings of books or other written materials, prerecorded or live speeches, ringtones, or other sound recordings, but not including audio greeting cards.",
+ "name": "Digital Audio Works - streamed - non subscription - with limited rights",
+ "product_tax_code": "55111512A0030"
+ },
+ {
+ "description": "Works that result from the fixation of a series of musical, spoken, or other sounds that are transferred electronically. These goods are downloaded to a device with permanent access granted. These goods include prerecorded or live music, prerecorded or live readings of books or other written materials, prerecorded or live speeches, ringtones, or other sound recordings, but not including audio greeting cards.",
+ "name": "Digital Audio Works - downloaded - non subscription - with permanent rights",
+ "product_tax_code": "55111512A0010"
+ },
+ {
+ "description": "Works that result from the fixation of a series of musical, spoken, or other sounds that are transferred electronically. These goods are downloaded to a device with access that expires after a stated period of time. These goods include prerecorded or live music, prerecorded or live readings of books or other written materials, prerecorded or live speeches, ringtones, or other sound recordings, but not including audio greeting cards.",
+ "name": "Digital Audio Works - downloaded - non subscription - with limited rights",
+ "product_tax_code": "55111512A0020"
+ },
+ {
+ "description": "A digital version of a traditional newspaper published at regular intervals with the entire publication or individual articles viewable (but not downloadable) on a device with access that is conditioned upon continued subscription payment.",
+ "name": "Digital Newspapers - viewable only - subscription - with conditional rights",
+ "product_tax_code": "55111507A0060"
+ },
+ {
+ "description": "A digital version of a traditional newspaper published at regular intervals with the entire publication or individual articles viewable (but not downloadable) on a device with permanent access granted. The publication is accessed without a subscription.",
+ "name": "Digital Newspapers - viewable only - non subscription - with permanent rights",
+ "product_tax_code": "55111507A0040"
+ },
+ {
+ "description": "A digital version of a traditional newspaper published at regular intervals with the entire publication or individual articles viewable (but not downloadable) on a device with access that expires after a stated period of time. The publication is accessed without a subscription.",
+ "name": "Digital Newspapers - viewable only - non subscription - with limited rights",
+ "product_tax_code": "55111507A0030"
+ },
+ {
+ "description": "A digital version of a traditional newspaper published at regular intervals. The publication is accessed via a subscription which also entitles the purchaser to physical copies of the media.",
+ "name": "Digital Newspapers - subscription tangible and digital",
+ "product_tax_code": "55111507A0070"
+ },
+ {
+ "description": "A digital version of a traditional newspaper published at regular intervals with the entire publication or individual articles downloaded to a device with access that is conditioned upon continued subscription payment.",
+ "name": "Digital Newspapers - downloadable - subscription - with conditional rights",
+ "product_tax_code": "55111507A0050"
+ },
+ {
+ "description": "A digital version of a traditional newspaper published at regular intervals with the entire publication or individual articles downloaded to a device with permanent access granted. The publication is accessed without a subscription.",
+ "name": "Digital Newspapers - downloadable - non subscription - with permanent rights",
+ "product_tax_code": "55111507A0010"
+ },
+ {
+ "description": "A digital version of a traditional newspaper published at regular intervals with the entire publication or individual articles downloaded to a device with access that expires after a stated period of time. The publication is accessed without a subscription.",
+ "name": "Digital Newspapers - downloadable - non subscription - with limited rights",
+ "product_tax_code": "55111507A0020"
+ },
+ {
+ "description": "A digital version of a traditional periodical published at regular intervals with the entire publication or individual articles viewable (but not downloadable) on a device with access that is conditioned upon continued subscription payment.",
+ "name": "Digital Magazines/Periodicals - viewable only - subscription - with conditional rights",
+ "product_tax_code": "55111506A0060"
+ },
+ {
+ "description": "A digital version of a traditional periodical published at regular intervals with the entire publication or individual articles viewable (but not downloadable) on a device with permanent access granted. The publication is accessed without a subscription.",
+ "name": "Digital Magazines/Periodicals - viewable only - non subscription - with permanent rights",
+ "product_tax_code": "55111506A0040"
+ },
+ {
+ "description": "A digital version of a traditional periodical published at regular intervals with the entire publication or individual articles viewable (but not downloadable) on a device with access that expires after a stated period of time. The publication is accessed without a subscription.",
+ "name": "Digital Magazines/Periodicals - viewable only - non subscription - with limited rights",
+ "product_tax_code": "55111506A0030"
+ },
+ {
+ "description": "A digital version of a traditional magazine published at regular intervals. The publication is accessed via a subscription which also entitles the purchaser to physical copies of the media.",
+ "name": "Digital Magazines/Periodicals - subscription tangible and digital",
+ "product_tax_code": "55111506A0070"
+ },
+ {
+ "description": "A digital version of a traditional periodical published at regular intervals with the entire publication or individual articles downloaded to a device with access that is conditioned upon continued subscription payment.",
+ "name": "Digital Magazines/Periodicals - downloadable - subscription - with conditional rights",
+ "product_tax_code": "55111506A0050"
+ },
+ {
+ "description": "A digital version of a traditional periodical published at regular intervals with the entire publication or individual articles downloaded to a device with permanent access granted. The publication is accessed without a subscription.",
+ "name": "Digital Magazines/Periodicals - downloadable - non subscription - with permanent rights",
+ "product_tax_code": "55111506A0010"
+ },
+ {
+ "description": "A digital version of a traditional periodical published at regular intervals with the entire publication or individual articles downloaded to a device with access that expires after a stated period of time. The publication is accessed without a subscription.",
+ "name": "Digital Magazines/Periodicals - downloadable - non subscription - with limited rights",
+ "product_tax_code": "55111506A0020"
+ },
+ {
+ "description": "Works that are generally recognized in the ordinary and usual sense as books and are transferred electronically. These goods are viewable (but not downloadable) on a device with access that is conditioned upon continued subscription payment. These goods include novels, autobiographies, encyclopedias, dictionaries, repair manuals, phone directories, business directories, zip code directories, cookbooks, etc.",
+ "name": "Digital Books - viewable only - subscription - with conditional rights",
+ "product_tax_code": "55111505A0060"
+ },
+ {
+ "description": "Works that are generally recognized in the ordinary and usual sense as books and are transferred electronically. These goods are downloaded to a device with access that is conditioned upon continued subscription payment. These goods include novels, autobiographies, encyclopedias, dictionaries, repair manuals, phone directories, business directories, zip code directories, cookbooks, etc.",
+ "name": "Digital Books - downloaded - subscription - with conditional rights",
+ "product_tax_code": "55111505A0050"
+ },
+ {
+ "description": "Works that are generally recognized in the ordinary and usual sense as books and are transferred electronically. These goods are downloaded to a device with permanent access granted. These goods include novels, autobiographies, encyclopedias, dictionaries, repair manuals, phone directories, business directories, zip code directories, cookbooks, etc.",
+ "name": "Digital Books - downloaded - non subscription - with permanent rights",
+ "product_tax_code": "55111505A0010"
+ },
+ {
+ "description": "Works that are generally recognized in the ordinary and usual sense as books and are transferred electronically. These goods are downloaded to a device with access that expires after a stated period of time. These goods include novels, autobiographies, encyclopedias, dictionaries, repair manuals, phone directories, business directories, zip code directories, cookbooks, etc.",
+ "name": "Digital Books - downloaded - non subscription - with limited rights",
+ "product_tax_code": "55111505A0020"
+ },
+ {
+ "description": "The final art used for actual reproduction by photomechanical or other processes or for display purposes, but does not include website or home page design, and that is transferred electronically. These goods are downloaded to a device with access that is conditioned upon continued subscription payment. These goods include drawings, paintings, designs, photographs, lettering, paste-ups, mechanicals, assemblies, charts, graphs, illustrative materials, etc.",
+ "name": "Digital Finished Artwork - downloaded - subscription - with conditional rights",
+ "product_tax_code": "82141502A0050"
+ },
+ {
+ "description": "The final art used for actual reproduction by photomechanical or other processes or for display purposes, but does not include website or home page design, and that is transferred electronically. These goods are downloaded to a device with permanent access granted. These goods include drawings, paintings, designs, photographs, lettering, paste-ups, mechanicals, assemblies, charts, graphs, illustrative materials, etc.",
+ "name": "Digital Finished Artwork - downloaded - non subscription - with permanent rights",
+ "product_tax_code": "82141502A0010"
+ },
+ {
+ "description": "The final art used for actual reproduction by photomechanical or other processes or for display purposes, but does not include website or home page design, and that is transferred electronically. These goods are downloaded to a device with access that expires after a stated period of time. These goods include drawings, paintings, designs, photographs, lettering, paste-ups, mechanicals, assemblies, charts, graphs, illustrative materials, etc.",
+ "name": "Digital Finished Artwork - downloaded - non subscription - with limited rights",
+ "product_tax_code": "82141502A0020"
+ },
+ {
+ "description": "Individual digital news articles, newsletters, and other stand-alone documents. These goods are viewable (but not downloadable) on a device with access that is conditioned upon continued subscription payment.",
+ "name": "Digital other news or documents - viewable only - subscription - with conditional rights",
+ "product_tax_code": "82111900A0002"
+ },
+ {
+ "description": "Individual digital news articles, newsletters, and other stand-alone documents. These goods are viewable (but not downloadable) on a device with permanent access granted.",
+ "name": "Digital other news or documents - viewable only - non subscription - with permanent rights",
+ "product_tax_code": "82111900A0005"
+ },
+ {
+ "description": "Individual digital news articles, newsletters, and other stand-alone documents. These goods are viewable (but not downloadable) on a device with access that expires after a stated period of time.",
+ "name": "Digital other news or documents - viewable only - non subscription - with limited rights",
+ "product_tax_code": "82111900A0006"
+ },
+ {
+ "description": "Individual digital news articles, newsletters, and other stand-alone documents. These goods are downloaded to a device with access that is conditioned upon continued subscription payment.",
+ "name": "Digital other news or documents - downloadable - subscription - with conditional rights",
+ "product_tax_code": "82111900A0001"
+ },
+ {
+ "description": "Individual digital news articles, newsletters, and other stand-alone documents. These goods are downloaded to a device with permanent access granted. These publications are accessed without a subscription.",
+ "name": "Digital other news or documents - downloadable - non subscription - with permanent rights",
+ "product_tax_code": "82111900A0003"
+ },
+ {
+ "description": "Individual digital news articles, newsletters, and other stand-alone documents. These goods are downloaded to a device with access that expires after a stated period of time.",
+ "name": "Digital other news or documents - downloadable - non subscription - with limited rights",
+ "product_tax_code": "82111900A0004"
+ },
+ {
+ "description": "Works that are required as part of a formal academic education program and are transferred electronically. These goods are downloaded to a device with permanent access granted.",
+ "name": "Digital School Textbooks - downloaded - non subscription - with permanent rights",
+ "product_tax_code": "55111513A0010"
+ },
+ {
+ "description": "Works that are required as part of a formal academic education program and are transferred electronically. These goods are downloaded to a device with access that expires after a stated period of time.",
+ "name": "Digital School Textbooks - downloaded - non subscription - with limited rights",
+ "product_tax_code": "55111513A0020"
+ },
+ {
+ "description": "An electronic greeting \"card\" typically sent via email that contains only static images or text, rather than an audio visual or audio only experience.",
+ "name": "Digital Greeting Cards - Static text and/or images only",
+ "product_tax_code": "14111605A0003"
+ },
+ {
+ "description": "An electronic greeting \"card\" typically sent via email that contains a series of related images which, when shown in succession, impart an impression of motion, together with accompanying sounds, if any.",
+ "name": "Digital Greeting Cards - Audio Visual",
+ "product_tax_code": "14111605A0001"
+ },
+ {
+ "description": "An electronic greeting \"card\" typically sent via email that contains an audio only message.",
+ "name": "Digital Greeting Cards - Audio Only",
+ "product_tax_code": "14111605A0002"
+ },
+ {
+ "description": "Digital images that are downloaded to a device with permanent access granted.",
+ "name": "Digital Photographs/Images - downloaded - non subscription - with permanent rights for permanent use",
+ "product_tax_code": "60121011A0001"
+ },
+ {
+ "description": "Video or electronic games in the common sense are transferred electronically. These goods are streamed to a device with access that is conditioned upon continued subscription payment.",
+ "name": "Video Games - streamed - subscription - with conditional rights",
+ "product_tax_code": "60141104A0040"
+ },
+ {
+ "description": "Video or electronic games in the common sense are transferred electronically. These goods are streamed to a device with access that expires after a stated period of time.",
+ "name": "Video Games - streamed - non subscription - with limited rights",
+ "product_tax_code": "60141104A0030"
+ },
+ {
+ "description": "Video or electronic games in the common sense are transferred electronically. These goods are downloaded to a device with access that is conditioned upon continued subscription payment.",
+ "name": "Video Games - downloaded - subscription - with conditional rights",
+ "product_tax_code": "60141104A0050"
+ },
+ {
+ "description": "Video or electronic games in the common sense are transferred electronically. These goods are downloaded to a device with permanent access granted.",
+ "name": "Video Games - downloaded - non subscription - with permanent rights",
+ "product_tax_code": "60141104A0010"
+ },
+ {
+ "description": "Video or electronic games in the common sense are transferred electronically. These goods are downloaded to a device with access that expires after a stated period of time.",
+ "name": "Video Games - downloaded - non subscription - with limited rights",
+ "product_tax_code": "60141104A0020"
+ },
+ {
+ "description": "The conceptualize, design, program or maintain a website. The code is unique to a particular client's website.",
+ "name": "Web Site Design",
+ "product_tax_code": "81112103A0000"
+ },
+ {
+ "description": "The process of renting or buying space to house a website on the World Wide Web. Website content such as HTML, CSS, and images has to be housed on a server to be viewable online.",
+ "name": "Web Hosting Services",
+ "product_tax_code": "81112105A0000"
+ },
+ {
+ "description": "A charge separately stated from the sale of the product itself that entitles the purchaser to future repair and labor services to return the defective item of tangible personal property to its original state. The warranty contract is optional to the purchaser. Motor vehicle warranties are excluded.",
+ "name": "Warranty - Optional",
+ "product_tax_code": "81111818A0000"
+ },
+ {
+ "description": "A charge separately stated from the sale of the product itself that entitles the purchaser to future repair and labor services to return the defective item of tangible personal property to its original state. The warranty contract is mandatory and is required to be purchased on conjunction with the purchased tangible personal property. Motor vehicle warranties are excluded.",
+ "name": "Warranty - Mandatory",
+ "product_tax_code": "81111818A0001"
+ },
+ {
+ "description": "Personal or small group teaching, designed to help people who need extra help with their studies",
+ "name": "Tutoring",
+ "product_tax_code": "86132001A0000"
+ },
+ {
+ "description": "Self Study web based training, not instructor led. This does not include downloads of video replays.",
+ "name": "Training Services - Self Study Web Based",
+ "product_tax_code": "86132000A0002"
+ },
+ {
+ "description": "Live training web based. This does not include video replays of the instruction or course.",
+ "name": "Training Services - Live Virtual",
+ "product_tax_code": "86132201A0000"
+ },
+ {
+ "description": "Charges for installing, configuring, debugging, modifying, testing, or troubleshooting computer hardware, networks, programs or software. Labor only charge.",
+ "name": "Technical Support Services",
+ "product_tax_code": "81111811A0001"
+ },
+ {
+ "description": "A charge to preserve an animal's body via mounting or stuffing, for the purpose of display or study. The customer provide the animal. This a labor charge, with any non-separately stated property transferred in performing the service considered inconsequential.",
+ "name": "Taxidermy Services",
+ "product_tax_code": "82151508A0000"
+ },
+ {
+ "description": "A charge to have files or documents shredded either onsite or offsite.",
+ "name": "Shredding Service",
+ "product_tax_code": "44101603A9007"
+ },
+ {
+ "description": "A charge to repair or restore footwear was broken, worn, damaged, defective, or malfunctioning. This a labor charge, with any non-separately stated property transferred in performing the service considered inconsequential. Note: This product tax code will partially apply tax in CA, MI, IL.",
+ "name": "Shoe Repair",
+ "product_tax_code": "53111600A9007"
+ },
+ {
+ "description": "A charge for the printing, imprinting, lithographing, mimeographing, photocopying, and similar reproductions of various articles including mailers, catalogs, letterhead, envelopes, business cards, presentation folders, forms, signage, etc. The end result is the transfer of tangible personal property to the customer.",
+ "name": "Printing",
+ "product_tax_code": "82121500A0000"
+ },
+ {
+ "description": "Service processing payroll checks and tracking payroll data; including printing employees’ payroll checks, pay statements, management reports, tracking payroll taxes, preparing tax returns and producing W-2’s for distribution.",
+ "name": "Payroll Services",
+ "product_tax_code": "87210202A0000"
+ },
+ {
+ "description": "A charge to repair or restore to operating condition a motor vehicle that was broken, worn, damaged, defective, or malfunctioning. This a labor charge, with any non-separately stated property transferred in performing the service considered inconsequential.",
+ "name": "Motor Vehicle Repair",
+ "product_tax_code": "25100000A9007"
+ },
+ {
+ "description": "A charge to make customer provided meat suitable for human consumption, typically referred to a butcher or slaughter services.",
+ "name": "Meat Processing",
+ "product_tax_code": "42447000A0000"
+ },
+ {
+ "description": "A charge to repair or restore to operating condition a machine that was broken, worn, damaged, defective, or malfunctioning. This a labor charge, with any non-separately stated property transferred in performing the service considered inconsequential.",
+ "name": "Machine Repair",
+ "product_tax_code": "23019007A0000"
+ },
+ {
+ "description": "A charge to provide laundry services to linens and the like. This charge is not for clothing items. The business customer is the owner of the items being cleaned.",
+ "name": "Linen Services - Laundry only - items other than clothing",
+ "product_tax_code": "91111502A1601"
+ },
+ {
+ "description": "A charge to provide laundry services to clothing. The business customer is the owner of the items being cleaned.",
+ "name": "Linen Services - Laundry only",
+ "product_tax_code": "91111502A1600"
+ },
+ {
+ "description": "A charge to repair or restore jewelry that was broken, worn, damaged, defective, or malfunctioning. This a labor charge, with any non-separately stated property transferred in performing the service considered inconsequential.",
+ "name": "Jewelry Repair",
+ "product_tax_code": "54119007A0000"
+ },
+ {
+ "description": "A charge for the wrapping of articles in a box or bag with paper and other decorative additions. The wrapping not linked the purchased of the article(s) and is performed by a party other vendor of the article(s).",
+ "name": "Gift Wrapping - separate from purchase of article",
+ "product_tax_code": "14111601A9007"
+ },
+ {
+ "description": "A charge for the wrapping of articles in a box or bag with paper and other decorative additions. The charge is separately stated from the article.",
+ "name": "Gift Wrapping - in conjunction with purchase of article",
+ "product_tax_code": "14111601A0001"
+ },
+ {
+ "description": "A charge to perform an alteration on a item of clothing by a service provider other than vendor of the article. The alteration is not linked to the clothing purchase. Alterations could include hemming of a dress, shortening of pants, adjusting the waistline of a garment, etc.",
+ "name": "Garment Alterations- separate from purchase of garment",
+ "product_tax_code": "81149000A0000"
+ },
+ {
+ "description": "A charge to perform an alteration on a item of clothing by the vendor of the article. The alteration is separately stated from the clothing, but contracted for at the time of the clothing purchase. Alterations could include hemming of a dress, shortening of pants, adjusting the waistline of a garment, etc.",
+ "name": "Garment Alterations- in conjunction with purchase of garment",
+ "product_tax_code": "81149000A0001"
+ },
+ {
+ "description": "A separately stated labor charge to cover a piece of furniture previously owned by the customer with new fabric coverings. Any materials transferred as part of the service are separately stated.",
+ "name": "Furniture Reupholstering",
+ "product_tax_code": "72153614A0000"
+ },
+ {
+ "description": "A charge to create a finished good from materials supplied by the customer. This is a labor only charge to transform a customer's existing property.",
+ "name": "Fabrication",
+ "product_tax_code": "23839000A0000"
+ },
+ {
+ "description": "E-file services for tax returns",
+ "name": "Electronic Filing Service",
+ "product_tax_code": "72910000A0000"
+ },
+ {
+ "description": "Private schools, not college or university",
+ "name": "Educational Services",
+ "product_tax_code": "86132209A0000"
+ },
+ {
+ "description": "A charge to a non-commercial customer for the cleaning or renovating items other than clothing by immersion and agitation, spraying, vaporization, or immersion only, in a volatile, commercially moisture-free solvent or by the use of a volatile or inflammable product. This does not include the use of a self-service coin (or credit card) operated cleaning machine.",
+ "name": "Dry Cleaning - items other than clothing",
+ "product_tax_code": "91111503A1601"
+ },
+ {
+ "description": "A charge to repair or restore to operating condition computer hardware that was broken, worn, damaged, defective, or malfunctioning. This a labor charge, with any non-separately stated property transferred in performing the service considered inconsequential.",
+ "name": "Computer Repair",
+ "product_tax_code": "81112300A0000"
+ },
+ {
+ "description": "A charge to clean, wash or wax a motor vehicle, other than a self-service coin (or credit card) operated washing station. This a labor charge, with any non-separately stated property transferred in performing the service considered inconsequential.",
+ "name": "Car Washing",
+ "product_tax_code": "81119200A0000"
+ },
+ {
+ "description": "A charge to assemble goods for a purchaser who will later sell the assembled goods to end consumers.",
+ "name": "Assembly - prior to final purchase of article",
+ "product_tax_code": "93121706A0001"
+ },
+ {
+ "description": "A charge separately stated from the sale of the product itself to bring the article to its finished state and in the condition specified by the buyer.",
+ "name": "Assembly - in conjunction with final purchase of article",
+ "product_tax_code": "93121706A0000"
+ },
+ {
+ "description": "A charge to repair or restore to operating condition an appliance (dishwasher, washing machine, refrigerator, etc.) that was broken, worn, damaged, defective, or malfunctioning. This a labor charge, with any non-separately stated property transferred in performing the service considered inconsequential.",
+ "name": "Appliance Repair",
+ "product_tax_code": "52143609A0000"
+ },
+ {
+ "description": "A charge to repair or restore to operating condition an aircraft that was broken, worn, damaged, defective, or malfunctioning. This a labor charge, with any non-separately stated property transferred in performing the service considered inconsequential. Commercial aircraft is excluded.",
+ "name": "Aircraft Repair",
+ "product_tax_code": "78181800A0000"
+ },
+ {
+ "description": "A charge for the printing, imprinting, or lithographing on any article supplied by the customer. The customer owns the article throughout the process. This a labor charge, with any non-separately stated property transferred in performing the service considered inconsequential.",
+ "name": "Printing - customer supplied articles",
+ "product_tax_code": "19009"
+ },
+ {
+ "description": "A charge to a non-commercial customer for the cleaning or renovating clothing by immersion and agitation, spraying, vaporization, or immersion only, in a volatile, commercially moisture-free solvent or by the use of a volatile or inflammable product. This does not include the use of a self-service coin (or credit card) operated cleaning machine.",
+ "name": "Dry Cleaning Services",
+ "product_tax_code": "19006"
+ },
+ {
+ "description": "A charge to repair or restore tangible personal property that was broken, worn, damaged, defective, or malfunctioning. This a labor charge, with any non-separately stated property transferred in performing the service considered inconsequential.",
+ "name": "Repair Services",
+ "product_tax_code": "19007"
+ },
+ {
+ "description": "Food for household pets that is consumed for nutritional value. This code is not intended for food related to working farm animals or animals raised for meat or milk production. This code is intended for retail sales made directly to end consumers.",
+ "name": "OTC Pet Food",
+ "product_tax_code": "10122100A0000"
+ },
+ {
+ "description": "Food bundle or basket containing food staples combined with candy, with the candy comprising between 25% and 49% of the overall value of the bundle (food comprises 51 to 75%). Note that any candy containing flour should be considered as food (and not candy) when determining bundle percentages.",
+ "name": "Food/Candy Bundle - with Candy 25% to 49%",
+ "product_tax_code": "50193400A0008"
+ },
+ {
+ "description": "Food bundle or basket containing food staples combined with candy, with the candy comprising between 11% and 24% of the overall value of the bundle (food comprises 76% to 89%). Note that any candy containing flour should be considered as food (and not candy) when determining bundle percentages.",
+ "name": "Food/Candy Bundle - with Candy 11% to 24%",
+ "product_tax_code": "50193400A0009"
+ },
+ {
+ "description": "Food bundle or basket containing food staples combined with candy, with the candy comprising 10% or less of the overall value of the bundle (food comprises 90% or more). Note that any candy containing flour should be considered as food (and not candy) when determining bundle percentages.",
+ "name": "Food/Candy Bundle - with Candy 10% or less",
+ "product_tax_code": "50193400A0010"
+ },
+ {
+ "description": "Food bundle or basket containing food staples combined with candy, with the candy comprising 50% or more of the overall value of the bundle (food comprises 50% or less). Note that any candy containing flour should be considered as food (and not candy) when determining bundle percentages.",
+ "name": "Food/Candy Bundle - with Candy 50% or more",
+ "product_tax_code": "50193400A0007"
+ },
+ {
+ "description": "Male or female condoms and vaginal sponges used to prevent pregnancy and/or exposure to STDs, containing a spermicidal lubricant as indicated by a \"drug facts\" panel or a statement of active ingredients, sold under prescription order of a licensed professional.",
+ "name": "Condoms with Spermicide with Prescription",
+ "product_tax_code": "53131622A0004"
+ },
+ {
+ "description": "Over-the-Counter emergency contraceptive pills act to prevent pregnancy after intercourse. The contraceptive contains a hormone that prevents ovulation, fertilization, or implantation of an embryo.",
+ "name": "Birth Control - Over-the-Counter Oral Contraceptives",
+ "product_tax_code": "51350000A0001"
+ },
+ {
+ "description": "An oral medication containing hormones effective in altering the menstrual cycle to eliminate ovulation and prevent pregnancy, available only under prescription order of a licensed professional. Other than preventing pregnancy, hormonal birth control can also be used to treat various conditions, such as Polycystic Ovary Syndrome, Endometriosis, Primary Ovarian Insufficiency, etc.",
+ "name": "Birth Control - Prescription Oral Contraceptives",
+ "product_tax_code": "51350000A0000"
+ },
+ {
+ "description": "Over-the-Counter emergency contraceptive pills act to prevent pregnancy after intercourse, sold under prescription order of a licensed professional. The contraceptive contains a hormone that prevents ovulation, fertilization, or implantation of an embryo.",
+ "name": "Birth Control - Over-the-Counter Oral Contraceptives with Prescription",
+ "product_tax_code": "51350000A0002"
+ },
+ {
+ "description": "Barrier based prescription only birth control methods, including the diaphragm and cervical cap that prevent the joining of the sperm and egg, available only under prescription order of a licensed professional.",
+ "name": "Birth Control - Prescription non-Oral Contraceptives - Barriers",
+ "product_tax_code": "42143103A0000"
+ },
+ {
+ "description": "Hormonal based birth control methods other than the oral pill, including intrauterine devices, injections, skin implants, transdermal patches, and vaginal rings that release a continuous dose of hormones to eliminate ovulation and prevent pregnancy, available only under prescription order of a licensed professional.",
+ "name": "Birth Control - Prescription non-Oral Contraceptives - Hormonal",
+ "product_tax_code": "51350000A0003"
+ },
+ {
+ "description": "Male or female condoms and vaginal sponges used to prevent pregnancy and/or exposure to STDs, sold under prescription order of a licensed professional.",
+ "name": "Condoms with Prescription",
+ "product_tax_code": "53131622A0003"
+ },
+ {
+ "description": "Feminine hygiene product designed to absorb the menstrual flow. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Tampons, menstrual cups, pads, liners",
+ "product_tax_code": "53131615A0000"
+ },
+ {
+ "description": "Infant washable/reusable cloth diapers.",
+ "name": "Clothing - Cloth Diapers",
+ "product_tax_code": "53102305A0001"
+ },
+ {
+ "description": "Clothing - Diaper liners",
+ "name": "Clothing - Diaper liners",
+ "product_tax_code": "53102308A0000"
+ },
+ {
+ "description": "Clothing - Adult diapers",
+ "name": "Clothing - Adult diapers",
+ "product_tax_code": "53102306A0000"
+ },
+ {
+ "description": "Clothing - Infant diapers",
+ "name": "Clothing - Infant diapers",
+ "product_tax_code": "53102305A0000"
+ },
+ {
+ "description": "Food and Beverage - Candy containing flour as an ingredient",
+ "name": "Food and Beverage - Candy containing flour as an ingredient",
+ "product_tax_code": "50161800A0001"
+ },
+ {
+ "description": "Food and Beverage - Food and Food Ingredients for Home Consumption",
+ "name": "Food and Beverage - Food and Food Ingredients for Home Consumption",
+ "product_tax_code": "50000000A0000"
+ },
+ {
+ "description": "Clothing - Zippers",
+ "name": "Clothing - Zippers",
+ "product_tax_code": "53141503A0000"
+ },
+ {
+ "description": "Clothing - Gorgets",
+ "name": "Clothing - Gorgets",
+ "product_tax_code": "53102519A0000"
+ },
+ {
+ "description": "Clothing - Shoulder boards or epaulettes",
+ "name": "Clothing - Shoulder boards or epaulettes",
+ "product_tax_code": "53102520A0000"
+ },
+ {
+ "description": "Yarn - For use other than fabricating/repairing clothing",
+ "name": "Yarn - For use other than fabricating/repairing clothing",
+ "product_tax_code": "11151700A0001"
+ },
+ {
+ "description": "Clothing - Snaps",
+ "name": "Clothing - Snaps",
+ "product_tax_code": "53141506A0000"
+ },
+ {
+ "description": "Clothing - Clasps",
+ "name": "Clothing - Clasps",
+ "product_tax_code": "53141507A0000"
+ },
+ {
+ "description": "Clothing - Buttons",
+ "name": "Clothing - Buttons",
+ "product_tax_code": "53141505A0000"
+ },
+ {
+ "description": "Clothing - Clothing - Fabric dye",
+ "name": "Clothing - Fabric dye",
+ "product_tax_code": "60105810A0000"
+ },
+ {
+ "description": "Clothing - Fabric for use in clothing",
+ "name": "Clothing - Fabric for use in clothing",
+ "product_tax_code": "11160000A0000"
+ },
+ {
+ "description": "Clothing - Clothing - Yarn",
+ "name": "Clothing - Yarn",
+ "product_tax_code": "11151700A0000"
+ },
+ {
+ "description": "A lump sum charge where both the downloaded digital products and the service components each are greater than 10% of the bundle.",
+ "name": "Digital Products (> 10%) / General Services (> 10%) Bundle",
+ "product_tax_code": "55111500A5000"
+ },
+ {
+ "description": "Services provided by a licensed or registered professional in the medical field. Examples: Doctor, dentist, nurse, optometrist, etc.",
+ "name": "Medical Professional Services - Physician, Dentist, and similar",
+ "product_tax_code": "62139900A0000"
+ },
+ {
+ "description": "The puncturing or penetration of the skin of a person and the insertion of jewelry or other adornment into the opening.",
+ "name": "Body Piercing",
+ "product_tax_code": "72990190A0000"
+ },
+ {
+ "description": "Cosmetic beauty treatment for the fingernails and toenails. Consists of filing, cutting and shaping and the application of polish.",
+ "name": "Manicure Services",
+ "product_tax_code": "72310104A0000"
+ },
+ {
+ "description": "Performing tests and research for a particular client in connection with the development of particular products, property, goods or services that the client sells to consumers in the regular course of business.",
+ "name": "Marketing Services",
+ "product_tax_code": "87420300A0000"
+ },
+ {
+ "description": "Performing surveying and mapping services of the surface of the earth, including the sea floor. These services may include surveying and mapping of areas above or below the surface of the earth, such as the creation of view easements or segregating rights in parcels of land by creating underground utility easements.",
+ "name": "Property Surveying Services",
+ "product_tax_code": "87130000A0000"
+ },
+ {
+ "description": "Providing a systematic inquiry, examination, or analysis of people, events or documents, to determine the facts of a given situation. The evaluation is submitted in the form of a report or provided as a testimony in legal proceedings. Techniques such as surveillance, background checks, computer searches, fingerprinting, lie detector services, and interviews may be used to gather the information.",
+ "name": "Private Investigator Services",
+ "product_tax_code": "73810204A0000"
+ },
+ {
+ "description": "The provision of expertise or strategic advice that is presented for consideration and decision-making.",
+ "name": "Consulting Services",
+ "product_tax_code": "87480000A0000"
+ },
+ {
+ "description": "Services relating to advocating for the passage or defeat of legislation to members or staff of the government.",
+ "name": "Lobbying Services",
+ "product_tax_code": "87439901A0000"
+ },
+ {
+ "description": "Preparation of materials, written or otherwise, that are designed to influence the general public or other groups by promoting the interests of a service recipient.",
+ "name": "Public Relations",
+ "product_tax_code": "87430000A0000"
+ },
+ {
+ "description": "Services related to the art and science of designing and building structures for human habitation or use and includes planning, providing preliminary studies, designs, specifications, working drawings and providing for general administration of construction contracts.",
+ "name": "Architectural Services",
+ "product_tax_code": "87120000A0000"
+ },
+ {
+ "description": "Services provided by a profession trained to apply physical laws and principles of engineering in the design, development, and utilization of machines, materials, instruments, structures, processes, and systems. The services involve any of the following activities: provision of advice, preparation of feasibility studies, preparation of preliminary and final plans and designs, provision of technical services during the construction or installation phase, inspection and evaluation of engineering projects, and related services.",
+ "name": "Engineering Services",
+ "product_tax_code": "87110000A0000"
+ },
+ {
+ "description": "Services that provide non-medical care and supervision for infant to school-age children or senior citizens.",
+ "name": "Childcare Services / Adultcare",
+ "product_tax_code": "83510000A0000"
+ },
+ {
+ "description": "Services provided by a facility for overnight care of an animal not related to veterinary care.",
+ "name": "Pet Services - Boarding",
+ "product_tax_code": "81291000A0001"
+ },
+ {
+ "description": "Services relating to or concerned with the law. Such services include, but are not limited to, representation by an attorney (or other person, when permitted) in an administrative or legal proceeding, legal drafting, paralegal services, legal research services, arbitration, mediation, and court reporting services.",
+ "name": "Legal Services",
+ "product_tax_code": "81110000A0000"
+ },
+ {
+ "description": "Medical procedure performed on an individual that is directed at improving the individual's appearance and that does not meaningfully promote the proper function of the body or prevent or treat illness or disease.",
+ "name": "Cosmetic Medical Procedure",
+ "product_tax_code": "80110517A0000"
+ },
+ {
+ "description": "Alarm monitoring involves people using computers, software, and telecommunications to monitor homes and businesses for break-ins, fires, and other unexpected events.",
+ "name": "Security - Alarm Services",
+ "product_tax_code": "73829901A0000"
+ },
+ {
+ "description": "Services related to protecting persons or their property, preventing the theft of goods, merchandise, or money. Responding to alarm signal device, burglar alarm, television camera, still camera, or a mechanical or electronic device installed or used to prevent or detect burglary, theft, shoplifting, pilferage, losses, or other security measures. Providing management and control of crowds for safety and protection.",
+ "name": "Security - Guard Services",
+ "product_tax_code": "73810105A0000"
+ },
+ {
+ "description": "Transporting under armed private security guard from one place to another any currency, jewels, stocks, bonds, paintings, or other valuables of any kind in a specially equipped motor vehicle that offers a high degree of security.",
+ "name": "Armored Car Services",
+ "product_tax_code": "73810101A0000"
+ },
+ {
+ "description": "Services related to providing personnel, on a temporary basis, to perform work or labor under the supervision or control of another.",
+ "name": "Temporary Help Services",
+ "product_tax_code": "73630103A0000"
+ },
+ {
+ "description": "Services employment agencies provide are finding a job for a job-seeker and finding an employee for an employer.",
+ "name": "Employment Services",
+ "product_tax_code": "73610000A0000"
+ },
+ {
+ "description": "Services to industrial, commercial or income-producing real property, such as as management, electrical, plumbing, painting and carpentry, provided to income-producing property.",
+ "name": "Building Management Services",
+ "product_tax_code": "73490000A0000"
+ },
+ {
+ "description": "Services which include, but are not limited to, editing, letter writing, proofreading, resume writing, typing or word processing. Not including court reporting and stenographic services.",
+ "name": "Secretarial Services",
+ "product_tax_code": "73389903A0000"
+ },
+ {
+ "description": "Services that include typing, taking shorthand, and taking and transcribing dictation for others for a consideration.",
+ "name": "Stenographic Services",
+ "product_tax_code": "73380200A0000"
+ },
+ {
+ "description": "A process that uses needles and colored ink to permanently put a mark or design on a person’s skin. Also applying permanent make-up, such as eyelining and other permanent colors to enhance the skin of the face, lips, eyelids, and eyebrows.",
+ "name": "Tattooing Services",
+ "product_tax_code": "72990106A0000"
+ },
+ {
+ "description": "A variety of personal services typically with the purpose of improving health, beauty and relaxation through treatments such as hair, massages and facials.",
+ "name": "Spa Services",
+ "product_tax_code": "72990201A0000"
+ },
+ {
+ "description": "Services where the use of structured touch, include holding, applying pressure, positioning, and mobilizing soft tissue of the body by manual technique. Note: This does not include medical massage prescribed by a physician.",
+ "name": "Massage Services",
+ "product_tax_code": "72990200A0000"
+ },
+ {
+ "description": "The measurement, processing and communication of financial information about economic entities including, but is not limited to, financial accounting, management accounting, auditing, cost containment and auditing services, taxation and accounting information systems; excluding general bookkeeping service.",
+ "name": "Accounting Services",
+ "product_tax_code": "87210200A0000"
+ },
+ {
+ "description": "The training of an animal to obey certain commands.",
+ "name": "Pet Services - Obedience Training",
+ "product_tax_code": "81291000A0002"
+ },
+ {
+ "description": "Credit monitoring services are companies consumers pay to keep an eye on your credit files. The services notifies one when they see activity in credit files, so one can determine if that activity is a result of action one took or possibly fraudulent",
+ "name": "Credit Monitoring Services",
+ "product_tax_code": "56145000A0000"
+ },
+ {
+ "description": "Grooming services for an animal such as haircuts, bathing, nail trimming, and flea dips.",
+ "name": "Pet Services - Grooming",
+ "product_tax_code": "81291000A0000"
+ },
+ {
+ "description": "Debt collection is when a collection agency or company tries to collect past-due debts from borrowers.",
+ "name": "Debt Collection Services",
+ "product_tax_code": "73229902A0000"
+ },
+ {
+ "description": "A service that arranges introductions, for a fee, for strangers seeking romantic partners or friends. This excludes online dating services.",
+ "name": "Dating Services",
+ "product_tax_code": "72990301A0000"
+ },
+ {
+ "description": "A service that allows merchants to accept credit cards as well as send credit card payment details to the credit card network. It then forwards the payment authorization back to the acquiring bank.",
+ "name": "Credit Card Processing Services",
+ "product_tax_code": "52232000A0000"
+ },
+ {
+ "description": "Services for artificial tanning and skin beautification.",
+ "name": "Tanning Services",
+ "product_tax_code": "72990105A0000"
+ },
+ {
+ "description": "Credit reporting agencies receive various types of information which can be included in their offerings for customers.",
+ "name": "Credit Reporting Services",
+ "product_tax_code": "73230000A0000"
+ },
+ {
+ "description": "Miscellaneous personal services are generally services that affect the appearance or comfort of people. This does not include haircutting/styling services",
+ "name": "Personal Services",
+ "product_tax_code": "72990000A0000"
+ },
+ {
+ "description": "The removal of hair from the face or body using chemicals or heat energy.",
+ "name": "Electrolysis",
+ "product_tax_code": "72310102A0000"
+ },
+ {
+ "description": "Services provided to insurance companies providing insurance to consumers. Examples are loss or damage appraisals, inspections, actuarial services, claims adjustment or processing. Investigations as excluded from this definition.",
+ "name": "Insurance Services",
+ "product_tax_code": "64110000A0000"
+ },
+ {
+ "description": "An at-home infectious disease test kit that can be sold without a prescription.",
+ "name": "Infectious Disease Test - Over-the-Counter",
+ "product_tax_code": "41116205A0005"
+ },
+ {
+ "description": "An at-home infectious disease test kit that can only be sold with a prescription.",
+ "name": "Infectious Disease Test - Prescription only",
+ "product_tax_code": "41116205A0004"
+ },
+ {
+ "description": "Online database information retrieval service (personal or individual)",
+ "name": "Online database information retrieval service (personal or individual)",
+ "product_tax_code": "81111902A0001"
+ },
+ {
+ "description": "Database information retrieval",
+ "name": "Database information retrieval (personal or individual)",
+ "product_tax_code": "81111901A0001"
+ },
+ {
+ "description": "Services provided by beauty shops and barber shops, including but not limited to haircutting, hair coloring, shampooing, blow drying, permanents, hair extensions, hair straightening, and hair restorations.",
+ "name": "Hairdressing Services",
+ "product_tax_code": "19008"
+ },
+ {
+ "description": "Professional services which are not subject to a service-specific tax levy.",
+ "name": "Professional Services",
+ "product_tax_code": "19005"
+ },
+ {
+ "description": "Online database information retrieval service",
+ "name": "Online database information retrieval service",
+ "product_tax_code": "81111902A0000"
+ },
+ {
+ "description": "Database information retrieval",
+ "name": "Database information retrieval",
+ "product_tax_code": "81111901A0000"
+ },
+ {
+ "description": "Cash donation",
+ "name": "Cash donation",
+ "product_tax_code": "14111803A0002"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and billed directly to Medicaid, medical grade oyxgen.",
+ "name": "Medical Oxygen with Prescription billed to Medicaid",
+ "product_tax_code": "42271700A0008"
+ },
+ {
+ "description": "When sold without prescription order of a licensed professional, a machine used that filters a patient's blood to remove excess water and waste products when the kidneys are damaged,",
+ "name": "Kidney Dialysis Equipment for home use without Prescription",
+ "product_tax_code": "42161800A0006"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and reimbursed by Medicaid, equipment that: can withstand repeated use; is primarily and customarily used to serve a medical purpose; generally is not useful to a person in the absence of illness or injury; and is not worn in or on the body. Home use means the equipment is sold to an individual for use at home, regardless of where the individual resides. Examples include hospital beds, commode chairs, bed pans, shower and bath aids, IV poles, etc.",
+ "name": "Durable Medical Equipment for home use with Prescription reimbursed by Medicaid",
+ "product_tax_code": "42140000A0005"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and billed directly to Medicare, a machine used that filters a patient's blood to remove excess water and waste products when the kidneys are damaged, dysfunctional, or missing. The kidney dialysis machine is an artificial part which augments the natural functioning of the kidneys.",
+ "name": "Kidney Dialysis Equipment for home use with Prescription billed to Medicare",
+ "product_tax_code": "42161800A0002"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and reimbursed by Medicare, equipment that: can withstand repeated use; is primarily and customarily used to serve a medical purpose; generally is not useful to a person in the absence of illness or injury; and is not worn in or on the body. Home use means the equipment is sold to an individual for use at home, regardless of where the individual resides. Examples include hospital beds, commode chairs, bed pans, shower and bath aids, IV poles, etc.",
+ "name": "Durable Medical Equipment for home use with Prescription reimbursed by Medicare",
+ "product_tax_code": "42140000A0004"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and reimbursed by Medicare, equipment used to administer oxygen directly into the lungs of the patient for the relief of conditions in which the human body experiences an abnormal deficiency or inadequate supply of oxygen. Oxygen equipment means oxygen cylinders, cylinder transport devices, including sheaths and carts, cylinder studs and support devices, regulators, flowmeters, tank wrenches, oxygen concentrators, liquid oxygen base dispensers, liquid oxygen portable dispensers, oxygen tubing, nasal cannulas, face masks, oxygen humidifiers, and oxygen fittings and accessories.",
+ "name": "Oxygen Delivery Equipment for home use with Prescription reimbursed by Medicare",
+ "product_tax_code": "42271700A0004"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional, equipment that: can withstand repeated use; is primarily and customarily used to serve a medical purpose; generally is not useful to a person in the absence of illness or injury; and is not worn in or on the body. Home use means the equipment is sold to an individual for use at home, regardless of where the individual resides. Examples include hospital beds, commode chairs, bed pans, shower and bath aids, IV poles, etc.",
+ "name": "Durable Medical Equipment for home use with Prescription",
+ "product_tax_code": "42140000A0001"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and billed directly to Medicare, equipment used to administer oxygen directly into the lungs of the patient for the relief of conditions in which the human body experiences an abnormal deficiency or inadequate supply of oxygen. Oxygen equipment means oxygen cylinders, cylinder transport devices, including sheaths and carts, cylinder studs and support devices, regulators, flowmeters, tank wrenches, oxygen concentrators, liquid oxygen base dispensers, liquid oxygen portable dispensers, oxygen tubing, nasal cannulas, face masks, oxygen humidifiers, and oxygen fittings and accessories.",
+ "name": "Oxygen Delivery Equipment for home use with Prescription billed to Medicare",
+ "product_tax_code": "42271700A0002"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and reimbursed by Medicaid, medical grade oyxgen.",
+ "name": "Medical Oxygen with Prescription reimbursed by Medicaid",
+ "product_tax_code": "42271700A0010"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional, medical grade oyxgen.",
+ "name": "Medical Oxygen with Prescription",
+ "product_tax_code": "42271700A0012"
+ },
+ {
+ "description": "When sold without prescription order of a licensed professional, medical grade oyxgen.",
+ "name": "Medical Oxygen without Prescription",
+ "product_tax_code": "42271700A0011"
+ },
+ {
+ "description": "Equipment which is primarily and customarily used to provide or increase the ability to move from one place to another, sold without a prescription, and which is appropriate for use either in a home or a motor vehicle; Is not generally used by persons with normal mobility; and does not include any motor vehicle or equipment on a motor vehicle normally provided by a motor vehicle manufacturer. Examples include wheelchairs, crutches, canes, walkers, chair lifts, etc.",
+ "name": "Mobility Enhancing Equipment without Prescription",
+ "product_tax_code": "42211500A0006"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and billed directly to Medicaid, equipment used to administer oxygen directly into the lungs of the patient for the relief of conditions in which the human body experiences an abnormal deficiency or inadequate supply of oxygen. Oxygen equipment means oxygen cylinders, cylinder transport devices, including sheaths and carts, cylinder studs and support devices, regulators, flowmeters, tank wrenches, oxygen concentrators, liquid oxygen base dispensers, liquid oxygen portable dispensers, oxygen tubing, nasal cannulas, face masks, oxygen humidifiers, and oxygen fittings and accessories.",
+ "name": "Oxygen Delivery Equipment for home use with Prescription billed to Medicaid",
+ "product_tax_code": "42271700A0003"
+ },
+ {
+ "description": "Synthetic or animal-based insulin used as an injectible drug for diabetes patients, sold under prescription order of a licensed professional.",
+ "name": "Insulin with Prescription",
+ "product_tax_code": "51183603A0000"
+ },
+ {
+ "description": "Devices used by diabetic individuals to monitor sugar levels in the blood, sold under prescription order of a licensed professional.",
+ "name": "Blood Glucose Monitoring Devices with Prescription",
+ "product_tax_code": "41116201A0000"
+ },
+ {
+ "description": "Devices used by diabetic individuals to monitor sugar levels in the blood, sold without prescription order of a licensed professional.",
+ "name": "Blood Glucose Monitoring Devices without Prescription",
+ "product_tax_code": "41116201A0001"
+ },
+ {
+ "description": "At home urine-based tests used to detect the presense of various drug substances in an individual.",
+ "name": "Drug Testing Kits",
+ "product_tax_code": "41116136A0001"
+ },
+ {
+ "description": "Single use hollow needle commonly used with a syringe to inject insulin into the body by diabetic individuals, sold under prescription order of a licensed professional.",
+ "name": "Hypodermic Needles/Syringes with prescription - Insulin",
+ "product_tax_code": "42142523A0002"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and reimbursed by Medicare, medical grade oyxgen.",
+ "name": "Medical Oxygen with Prescription reimbursed by Medicare",
+ "product_tax_code": "42271700A0009"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and billed directly to Medicare, medical grade oyxgen.",
+ "name": "Medical Oxygen with Prescription billed to Medicare",
+ "product_tax_code": "42271700A0007"
+ },
+ {
+ "description": "When sold without prescription order of a licensed professional, a replacement, corrective, or supportive device, worn on or in the body to: Artificially replace a missing portion of the body; Prevent or correct physical deformity or malfunction; or Support a weak or deformed portion of the body. Worn in or on the body means that the item is implanted or attached so that it becomes part of the body, or is carried by the body and does not hinder the mobility of the individual. Examples include artificial limbs, pacemakers, orthopedics, ostomy/colostomy devices, etc.",
+ "name": "Prosthetic Devices without Prescription",
+ "product_tax_code": "42242000A0006"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and billed directly to Medicaid, a replacement, corrective, or supportive device, worn on or in the body to: Artificially replace a missing portion of the body; Prevent or correct physical deformity or malfunction; or Support a weak or deformed portion of the body. Worn in or on the body means that the item is implanted or attached so that it becomes part of the body, or is carried by the body and does not hinder the mobility of the individual. Examples include artificial limbs, pacemakers, orthotics, orthopedics, ostomy/colostomy devices, catheters, etc.",
+ "name": "Prosthetic Devices with Prescription Billed to Medicaid",
+ "product_tax_code": "42242000A0003"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and billed directly to Medicare, a replacement, corrective, or supportive device, worn on or in the body to: Artificially replace a missing portion of the body; Prevent or correct physical deformity or malfunction; or Support a weak or deformed portion of the body. Worn in or on the body means that the item is implanted or attached so that it becomes part of the body, or is carried by the body and does not hinder the mobility of the individual. Examples include artificial limbs, pacemakers, orthotics, orthopedics, ostomy/colostomy devices, catheters, etc.",
+ "name": "Prosthetic Devices with Prescription Billed to Medicare",
+ "product_tax_code": "42242000A0002"
+ },
+ {
+ "description": "At home saliva, cheeek swab or blood drop based tests used to detect various genetic markers in an individual.",
+ "name": "DNA Testing Kits",
+ "product_tax_code": "41116205A0003"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and reimbursed by Medicaid, nutritional tube feeding equipment including button-style feeding tubes, standard G-tubes, NG-tubes, extension sets, adapters, feeding pumps, feeding pump delivery sets.",
+ "name": "Enteral Feeding Equipment for home use with Prescription reimbursed by Medicaid",
+ "product_tax_code": "42231500A0005"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and reimbursed by Medicaid, equipment used to administer oxygen directly into the lungs of the patient for the relief of conditions in which the human body experiences an abnormal deficiency or inadequate supply of oxygen. Oxygen equipment means oxygen cylinders, cylinder transport devices, including sheaths and carts, cylinder studs and support devices, regulators, flowmeters, tank wrenches, oxygen concentrators, liquid oxygen base dispensers, liquid oxygen portable dispensers, oxygen tubing, nasal cannulas, face masks, oxygen humidifiers, and oxygen fittings and accessories.",
+ "name": "Oxygen Delivery Equipment for home use with Prescription reimbursed by Medicaid",
+ "product_tax_code": "42271700A0005"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional, equipment used to administer oxygen directly into the lungs of the patient for the relief of conditions in which the human body experiences an abnormal deficiency or inadequate supply of oxygen. Oxygen equipment means oxygen cylinders, cylinder transport devices, including sheaths and carts, cylinder studs and support devices, regulators, flowmeters, tank wrenches, oxygen concentrators, liquid oxygen base dispensers, liquid oxygen portable dispensers, oxygen tubing, nasal cannulas, face masks, oxygen humidifiers, and oxygen fittings and accessories.",
+ "name": "Oxygen Delivery Equipment for home use with Prescription",
+ "product_tax_code": "42271700A0001"
+ },
+ {
+ "description": "Synthetic or animal-based insulin used as an injectible drug for diabetes patients, sold without prescription order of a licensed professional.",
+ "name": "Insulin without Prescription",
+ "product_tax_code": "51183603A0001"
+ },
+ {
+ "description": "Single use hollow needle commonly used with a syringe to inject insulin into the body by diabetic individuals, sold without prescription order of a licensed professional.",
+ "name": "Hypodermic Needles/Syringes without prescription - Insulin",
+ "product_tax_code": "42142523A0001"
+ },
+ {
+ "description": "When sold without prescription order of a licensed professional, equipment used to administer oxygen directly into the lungs of the patient for the relief of conditions in which the human body experiences an abnormal deficiency or inadequate supply of oxygen. Oxygen equipment means oxygen cylinders, cylinder transport devices, including sheaths and carts, cylinder studs and support devices, regulators, flowmeters, tank wrenches, oxygen concentrators, liquid oxygen base dispensers, liquid oxygen portable dispensers, oxygen tubing, nasal cannulas, face masks, oxygen humidifiers, and oxygen fittings and accessories.",
+ "name": "Oxygen Delivery Equipment for home use without Prescription",
+ "product_tax_code": "42271700A0006"
+ },
+ {
+ "description": "At home blood-prick based tests used to monitor cholesterol levels in an individual.",
+ "name": "Cholesterol Testing Kits",
+ "product_tax_code": "41116202A0001"
+ },
+ {
+ "description": "Single use supplies utilized by diabetics in the regular blood sugar monitoring regimen. Includes skin puncture lancets, test strips for blood glucose monitors, visual read test strips, and urine test strips, sold under prescription order of a licensed professional.",
+ "name": "Diabetic Testing Supplies - single use - with Prescription",
+ "product_tax_code": "41116120A0002"
+ },
+ {
+ "description": "A breast pump is a mechanical device that lactating women use to extract milk from their breasts. They may be manual devices powered by hand or foot movements or automatic devices powered by electricity.",
+ "name": "Breast Pumps",
+ "product_tax_code": "42231901A0000"
+ },
+ {
+ "description": "At home urine-based tests used to detect pregancy hormone levels.",
+ "name": "Pregenacy Testing Kits",
+ "product_tax_code": "41116205A0001"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional, and reimbursed by Medicaid, equipment which is primarily and customarily used to provide or increase the ability to move from one place to another and which is appropriate for use either in a home or a motor vehicle; Is not generally used by persons with normal mobility; and Does not include any motor vehicle or equipment on a motor vehicle normally provided by a motor vehicle manufacturer. Examples include wheelchairs, crutches, canes, walkers, chair lifts, etc.",
+ "name": "Mobility Enhancing Equipment with Prescription Reimbursed by Medicaid",
+ "product_tax_code": "42211500A0005"
+ },
+ {
+ "description": "When sold without prescription order of a licensed professional, a replacement, corrective, or supportive device, worn in the mouth, including dentures, orthodontics, crowns, bridges, etc.",
+ "name": "Dental Prosthetics without Prescription",
+ "product_tax_code": "42151500A0002"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional, a replacement, corrective, or supportive device, worn in the mouth, including dentures, orthodontics, crowns, bridges, etc.",
+ "name": "Dental Prosthetics with Prescription",
+ "product_tax_code": "42151500A0001"
+ },
+ {
+ "description": "At home urine-based tests used to detect impending ovulation to assist in pregnancy planning.",
+ "name": "Ovulation Testing Kits",
+ "product_tax_code": "41116205A0002"
+ },
+ {
+ "description": "When sold without prescription order of a licensed professional, nutritional tube feeding equipment including button-style feeding tubes, standard G-tubes, NG-tubes, extension sets, adapters, feeding pumps, feeding pump delivery sets.",
+ "name": "Enteral Feeding Equipment for home use without Prescription",
+ "product_tax_code": "42231500A0006"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and reimbursed by Medicare, nutritional tube feeding equipment including button-style feeding tubes, standard G-tubes, NG-tubes, extension sets, adapters, feeding pumps, feeding pump delivery sets.",
+ "name": "Enteral Feeding Equipment for home use with Prescription reimbursed by Medicare",
+ "product_tax_code": "42231500A0004"
+ },
+ {
+ "description": "When sold without prescription order of a licensed professional, equipment that: can withstand repeated use; is primarily and customarily used to serve a medical purpose; generally is not useful to a person in the absence of illness or injury; and is not worn in or on the body. Home use means the equipment is sold to an individual for use at home, regardless of where the individual resides. Examples include hospital beds, commode chairs, bed pans, IV poles, etc.",
+ "name": "Durable Medical Equipment for home use without Prescription",
+ "product_tax_code": "42140000A0006"
+ },
+ {
+ "description": "Male or female condoms used to prevent pregnancy or exposure to STDs, containing a spermicidal lubricant as indicated by a \"drug facts\" panel or a statement of active ingredients.",
+ "name": "Condoms with Spermicide",
+ "product_tax_code": "53131622A0001"
+ },
+ {
+ "description": "Single use supplies utilized by diabetics in the regular blood sugar monitoring regimen. Includes skin puncture lancets, test strips for blood glucose monitors, visual read test strips, and urine test strips.",
+ "name": "Diabetic Testing Supplies - single use - without Prescription",
+ "product_tax_code": "41116120A0001"
+ },
+ {
+ "description": "An electronic device that clips onto a patient's finger to measure heart rate and oxygen saturation in his or her red blood cells.",
+ "name": "Pulse Oximeter",
+ "product_tax_code": "42181801A0000"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional, equipment which is primarily and customarily used to provide or increase the ability to move from one place to another and which is appropriate for use either in a home or a motor vehicle; Is not generally used by persons with normal mobility; and Does not include any motor vehicle or equipment on a motor vehicle normally provided by a motor vehicle manufacturer. Examples include wheelchairs, crutches, canes, walkers, chair lifts, etc.",
+ "name": "Mobility Enhancing Equipment with Prescription",
+ "product_tax_code": "42211500A0001"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional, a replacement, corrective, or supportive device, worn on or in the body to: Artificially replace a missing portion of the body; Prevent or correct physical deformity or malfunction; or Support a weak or deformed portion of the body. Worn in or on the body means that the item is implanted or attached so that it becomes part of the body, or is carried by the body and does not hinder the mobility of the individual. Examples include artificial limbs, pacemakers, orthotics, orthopedics, ostomy/colostomy devices, catheters, etc.",
+ "name": "Prosthetic Devices with Prescription",
+ "product_tax_code": "42242000A0001"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and billed directly to Medicare, nutritional tube feeding equipment including button-style feeding tubes, standard G-tubes, NG-tubes, extension sets, adapters, feeding pumps, feeding pump delivery sets.",
+ "name": "Enteral Feeding Equipment for home use with Prescription billed to Medicare",
+ "product_tax_code": "42231500A0002"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and billed directly to Medicaid, equipment that: can withstand repeated use; is primarily and customarily used to serve a medical purpose; generally is not useful to a person in the absence of illness or injury; and is not worn in or on the body. Home use means the equipment is sold to an individual for use at home, regardless of where the individual resides. Examples include hospital beds, commode chairs, bed pans, shower and bath aids, IV poles, etc.",
+ "name": "Durable Medical Equipment for home use with Prescription billed to Medicaid",
+ "product_tax_code": "42140000A0003"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and reimbursed by Medicare, a replacement, corrective, or supportive device, worn on or in the body to: Artificially replace a missing portion of the body; Prevent or correct physical deformity or malfunction; or Support a weak or deformed portion of the body. Worn in or on the body means that the item is implanted or attached so that it becomes part of the body, or is carried by the body and does not hinder the mobility of the individual. Examples include artificial limbs, pacemakers, orthotics, orthopedics, ostomy/colostomy devices, catheters, etc.",
+ "name": "Prosthetic Devices with Prescription Reimbursed by Medicare",
+ "product_tax_code": "42242000A0004"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional, and billed to Medicare, equipment which is primarily and customarily used to provide or increase the ability to move from one place to another and which is appropriate for use either in a home or a motor vehicle; Is not generally used by persons with normal mobility; and Does not include any motor vehicle or equipment on a motor vehicle normally provided by a motor vehicle manufacturer. Examples include wheelchairs, crutches, canes, walkers, chair lifts, etc.",
+ "name": "Mobility Enhancing Equipment with Prescription Billed to Medicare",
+ "product_tax_code": "42211500A0002"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional, and billed to Medicaid, equipment which is primarily and customarily used to provide or increase the ability to move from one place to another and which is appropriate for use either in a home or a motor vehicle; Is not generally used by persons with normal mobility; and Does not include any motor vehicle or equipment on a motor vehicle normally provided by a motor vehicle manufacturer. Examples include wheelchairs, crutches, canes, walkers, chair lifts, etc.",
+ "name": "Mobility Enhancing Equipment with Prescription Billed to Medicaid",
+ "product_tax_code": "42211500A0003"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and reimbursed by Medicare, a machine used that filters a patient's blood to remove excess water and waste products when the kidneys are damaged, dysfunctional, or missing. The kidney dialysis machine is an artificial part which augments the natural functioning of the kidneys.",
+ "name": "Kidney Dialysis Equipment for home use with Prescription reimbursed by Medicare",
+ "product_tax_code": "42161800A0004"
+ },
+ {
+ "description": "At home digital or manual (aneroid) sphygmomanometers, also known as a blood pressure meter, blood pressure monitor, or blood pressure gauge, are devices used to measure blood pressure, composed of an inflatable cuff to collapse and then release the artery under the cuff in a controlled manner.",
+ "name": "Blood Pressure Testing Devices",
+ "product_tax_code": "42181600A0001"
+ },
+ {
+ "description": "A topical preparation containing a spermicidal lubricant to prevent pregnancy as indicated by a \"drug facts\" panel or a statement of active ingredients.",
+ "name": "Contraceptive Ointments",
+ "product_tax_code": "53131622A0002"
+ },
+ {
+ "description": "Male or female condoms used to prevent pregnacy or exposure to STDs.",
+ "name": "Condoms",
+ "product_tax_code": "53131622A0000"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and billed directly to Medicare, equipment that: can withstand repeated use; is primarily and customarily used to serve a medical purpose; generally is not useful to a person in the absence of illness or injury; and is not worn in or on the body. Home use means the equipment is sold to an individual for use at home, regardless of where the individual resides. Examples include hospital beds, commode chairs, bed pans, shower and bath aids, IV poles, etc.",
+ "name": "Durable Medical Equipment for home use with Prescription billed to Medicare",
+ "product_tax_code": "42140000A0002"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and reimbursed by Medicaid, a replacement, corrective, or supportive device, worn on or in the body to: Artificially replace a missing portion of the body; Prevent or correct physical deformity or malfunction; or Support a weak or deformed portion of the body. Worn in or on the body means that the item is implanted or attached so that it becomes part of the body, or is carried by the body and does not hinder the mobility of the individual. Examples include artificial limbs, pacemakers, orthotics, orthopedics, ostomy/colostomy devices, catheters, etc.",
+ "name": "Prosthetic Devices with Prescription Reimbursed by Medicaid",
+ "product_tax_code": "42242000A0005"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional, and reimbursed by Medicare, equipment which is primarily and customarily used to provide or increase the ability to move from one place to another and which is appropriate for use either in a home or a motor vehicle; Is not generally used by persons with normal mobility; and Does not include any motor vehicle or equipment on a motor vehicle normally provided by a motor vehicle manufacturer. Examples include wheelchairs, crutches, canes, walkers, chair lifts, etc.",
+ "name": "Mobility Enhancing Equipment with Prescription Reimbursed by Medicare",
+ "product_tax_code": "42211500A0004"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and billed directly to Medicaid, nutritional tube feeding equipment including button-style feeding tubes, standard G-tubes, NG-tubes, extension sets, adapters, feeding pumps, feeding pump delivery sets.",
+ "name": "Enteral Feeding Equipment for home use with prescription billed to Medicaid",
+ "product_tax_code": "42231500A0003"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional, nutritional tube feeding equipment including button-style feeding tubes, standard G-tubes, NG-tubes, extension sets, adapters, feeding pumps, feeding pump delivery sets.",
+ "name": "Enteral Feeding Equipment for home use with Prescription",
+ "product_tax_code": "42231500A0001"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and billed directly to Medicaid, a machine used that filters a patient's blood to remove excess water and waste products when the kidneys are damaged, dysfunctional, or missing. The kidney dialysis machine is an artificial part which augments the natural functioning of the kidneys.",
+ "name": "Kidney Dialysis Equipment for home use with Prescription billed to Medicaid",
+ "product_tax_code": "42161800A0003"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional and reimbursed by Medicaid, a machine used that filters a patient's blood to remove excess water and waste products when the kidneys are damaged, dysfunctional, or missing. The kidney dialysis machine is an artificial part which augments the natural functioning of the kidneys.",
+ "name": "Kidney Dialysis Equipment for home use with Prescription and reimbursed by Medicaid",
+ "product_tax_code": "42161800A0005"
+ },
+ {
+ "description": "When sold under prescription order of a licensed professional, a machine used that filters a patient's blood to remove excess water and waste products when the kidneys are damaged, dysfunctional, or missing. The kidney dialysis machine is an artificial part which augments the natural functioning of the kidneys.",
+ "name": "Kidney Dialysis Equipment for home use with Prescription",
+ "product_tax_code": "42161800A0001"
+ },
+ {
+ "description": "Handbags, Purses",
+ "name": "Handbags, Purses",
+ "product_tax_code": "53121600A0000"
+ },
+ {
+ "description": "Video Gaming Console - Fixed",
+ "name": "Video Gaming Console - Fixed",
+ "product_tax_code": "52161557A0000"
+ },
+ {
+ "description": "Video Cameras",
+ "name": "Video Cameras",
+ "product_tax_code": "45121515A0000"
+ },
+ {
+ "description": "Portable audio equipment that records digital music for playback",
+ "name": "Digital Music Players",
+ "product_tax_code": "52161543A0000"
+ },
+ {
+ "description": "A type of consumer electronic device used to play vinyl recordings.",
+ "name": "Audio Turntables",
+ "product_tax_code": "52161548A0000"
+ },
+ {
+ "description": "Video Gaming Console - Portable",
+ "name": "Video Gaming Console - Portable",
+ "product_tax_code": "52161558A0000"
+ },
+ {
+ "description": "A framed display designed to display preloaded digital images (jpeg or any digital image format). Has slots for flash memory cards and/or an interface for digital photo camera connection.",
+ "name": "Digital Picture Frames",
+ "product_tax_code": "52161549A0000"
+ },
+ {
+ "description": "Digital Cameras",
+ "name": "Digital Cameras",
+ "product_tax_code": "45121504A0000"
+ },
+ {
+ "description": "Mobile Phones",
+ "name": "Mobile Phones",
+ "product_tax_code": "43191501A0000"
+ },
+ {
+ "description": "A digital wristwatch that provides many other features besides timekeeping. Like a smartphone, a smartwatch has a touchscreen display, which allows you to perform actions by tapping or swiping on the screen. Smartwatches include allow access to apps, similar to apps for smartphones and tablets.",
+ "name": "Watches - Smart",
+ "product_tax_code": "54111500A0001"
+ },
+ {
+ "description": "A bicycle helmet that is NOT marketed and labeled as being intended for youth.",
+ "name": "Bicycle Helmets - Adult",
+ "product_tax_code": "46181704A0003"
+ },
+ {
+ "description": "A bicycle helmet marketed and labeled as being intended for youth.",
+ "name": "Bicycle Helmets - Youth",
+ "product_tax_code": "46181704A0002"
+ },
+ {
+ "description": "Luggage",
+ "name": "Luggage",
+ "product_tax_code": "53121500A0000"
+ },
+ {
+ "description": "Clothing - Sleep or eye mask",
+ "name": "Clothing - Sleep or eye mask",
+ "product_tax_code": "53102607A0000"
+ },
+ {
+ "description": "Clothing - Pocket protectors",
+ "name": "Clothing - Pocket protectors",
+ "product_tax_code": "53102514A0000"
+ },
+ {
+ "description": "Clothing - Button covers",
+ "name": "Clothing - Button covers",
+ "product_tax_code": "53102515A0000"
+ },
+ {
+ "description": "Shoe Inserts/Insoles",
+ "name": "Clothing - Shoe Inserts/Insoles",
+ "product_tax_code": "46182208A0000"
+ },
+ {
+ "description": "Aprons - Household/Kitchen",
+ "name": "Clothing - Aprons - Household/Kitchen",
+ "product_tax_code": "46181501A0002"
+ },
+ {
+ "description": "Hunting Vests",
+ "name": "Clothing - Hunting Vests",
+ "product_tax_code": "53103100A0003"
+ },
+ {
+ "description": "Clothing apparel/uniforms that are specific to the training and competition of various martial arts.",
+ "name": "Clothing - Martial Arts Attire",
+ "product_tax_code": "53102717A0001"
+ },
+ {
+ "description": "Clothing - Umbrellas",
+ "name": "Clothing - Umbrellas",
+ "product_tax_code": "53102505A0000"
+ },
+ {
+ "description": "Briefcases",
+ "name": "Briefcases",
+ "product_tax_code": "53121701A0000"
+ },
+ {
+ "description": "Wallets",
+ "name": "Wallets",
+ "product_tax_code": "53121600A0001"
+ },
+ {
+ "description": "Wristwatch timepieces",
+ "name": "Watches",
+ "product_tax_code": "54111500A0000"
+ },
+ {
+ "description": "Jewelry",
+ "name": "Jewelry",
+ "product_tax_code": "54100000A0000"
+ },
+ {
+ "description": "Non-prescription sunglasses",
+ "name": "Sunglasses - Non-Rx",
+ "product_tax_code": "42142905A0001"
+ },
+ {
+ "description": "Wigs, Hairpieces, Hair extensions",
+ "name": "Clothing - Wigs, Hairpieces, Hair extensions",
+ "product_tax_code": "53102500A0002"
+ },
+ {
+ "description": "Hair notions, hair clips, barrettes, hair bows, hair nets, etc.",
+ "name": "Clothing - Hair Accessories",
+ "product_tax_code": "53102500A0001"
+ },
+ {
+ "description": "Clothing - Headbands",
+ "name": "Clothing - Headbands",
+ "product_tax_code": "53102513A0000"
+ },
+ {
+ "description": "These supplies contain medication such as an antibiotic ointment. They are a labeled with a \"drug facts\" panel or a statement of active ingredients. A wound care supply is defined as an item that is applied directly to or inside a wound to absorb wound drainage, protect healing tissue, maintain a moist or dry wound environment (as appropriate), or prevent bacterial contamination. Examples include bandages, dressings, gauze, medical tape. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Wound Care Supplies - Bandages, Dressings, Gauze - Medicated",
+ "product_tax_code": "42311514A0000"
+ },
+ {
+ "description": "A wound care supply is defined as an item that is applied directly to or inside a wound to absorb wound drainage, protect healing tissue, maintain a moist or dry wound environment (as appropriate), or prevent bacterial contamination. Examples include bandages, dressings, gauze, medical tape. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Wound Care Supplies - Bandages, Dressings, Gauze",
+ "product_tax_code": "42311500A0001"
+ },
+ {
+ "description": "Toothpaste containing \"drug facts\" panel or a statement of active ingredients. These products do contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Toothpaste",
+ "product_tax_code": "53131502A0000"
+ },
+ {
+ "description": "Disposable moistened cleansing wipes - non medicated. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Baby Wipes/Cleansing Wipes",
+ "product_tax_code": "53131624A0000"
+ },
+ {
+ "description": "Toilet Paper. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Toilet Paper",
+ "product_tax_code": "14111704A0000"
+ },
+ {
+ "description": "A lotion, spray, gel, foam, stick or other topical product that absorbs or reflects some of the sun's ultraviolet (UV) radiation and thus helps protect against sunburn. Sunscreen contains a \"drug facts\" label or statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Sunscreen",
+ "product_tax_code": "53131609A0000"
+ },
+ {
+ "description": "Soaps, body washes, shower gels for personal hygiene containing antibacterial. These products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Soaps - Antibacterial",
+ "product_tax_code": "53131608A0001"
+ },
+ {
+ "description": "Over-the-counter nicotine replacement products, including patches, gum, lozenges, sprays and inhalers. These products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Smoking Cessation Products",
+ "product_tax_code": "51143218A0000"
+ },
+ {
+ "description": "Lotions, moisturizers, creams, powders, sprays, etc that promote optimal skin health. These products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Skin Care Products- Medicated",
+ "product_tax_code": "51241200A0001"
+ },
+ {
+ "description": "A hair care product for cleansing the hair/scalp, with anti-dandruff active ingredients. These products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Shampoo - medicated (anti-dandruff)",
+ "product_tax_code": "53131628A0001"
+ },
+ {
+ "description": "A multi-purpose skin protectorant and topical ointment. These products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Petroleum Jelly",
+ "product_tax_code": "53131641A0000"
+ },
+ {
+ "description": "An over-the-counter drug via RX is a substance that contains a label identifying it as a drug and including a \"drug facts\" panel or a statement of active ingredients, that can be obtained without a prescription, but is sold under prescription order of a licensed professional. A drug can be intended for internal (ingestible, implant, injectable) or external (topical) application to the human body. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Over-the-Counter Drugs via Prescription",
+ "product_tax_code": "51030"
+ },
+ {
+ "description": "Flexible adhesive strips that attach over the bridge of the nose to lift the sides of the nose, opening the nasal passages to provide relief for congestion and snoring. The products are drug free and contain no active drug ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Nasal Breathing Strips",
+ "product_tax_code": "42312402A0001"
+ },
+ {
+ "description": "Therapeutic mouthwash, having active ingredients (such as antiseptic, or flouride) intended to help control or reduce conditions like bad breath, gingivitis, plaque, and tooth decay. These products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Mouthwash - Therapeutic",
+ "product_tax_code": "53131501A0000"
+ },
+ {
+ "description": "Multiple use medical thermometers for oral, temporal/forehead, or rectal body temperature diagnostics. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Medical Thermometers - Reusable",
+ "product_tax_code": "42182200A0002"
+ },
+ {
+ "description": "One-time use medical thermometers for oral, temporal/forehead, or rectal body temperature diagnostics. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Medical Thermometers - Disposable",
+ "product_tax_code": "42182200A0001"
+ },
+ {
+ "description": "Masks designed for one-time use to protect the wearer from contamination of breathable particles. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Medical Masks",
+ "product_tax_code": "42131713A0001"
+ },
+ {
+ "description": "A medicated skin protectorant for the lips. These products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Lip Balm - Medicated",
+ "product_tax_code": "53131630A0001"
+ },
+ {
+ "description": "A skin protectorant for the lips. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Lip Balm",
+ "product_tax_code": "53131630A0000"
+ },
+ {
+ "description": "Artificial devices to correct or alleviate hearing deficiencies, sold under prescription order of a licensed professional. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Hearing Aids with Prescription",
+ "product_tax_code": "42211705A0000"
+ },
+ {
+ "description": "Artificial deives to correct or alleviate hearing deficiencies, sold without a prescription order of a licensed professional. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Hearing Aids without Prescription",
+ "product_tax_code": "42211705A0001"
+ },
+ {
+ "description": "Batteries specifically labeled and designed to operate hearing aid devices, sold under prescription order of a licensed professional. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Hearing Aid Batteries with Prescription",
+ "product_tax_code": "26111710A0001"
+ },
+ {
+ "description": "Batteries specifically labeled and designed to operate hearing aid devices, sold without a prescription order of a licensed professional. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Hearing Aid Batteries without Prescription",
+ "product_tax_code": "26111710A0002"
+ },
+ {
+ "description": "A liquid, gel, foam, or wipe generally used to decrease infectious agents on the hands. Alcohol-based versions typically contain some combination of isopropyl alcohol, ethanol (ethyl alcohol), or n-propanol. Alcohol-free products are generally based on disinfectants, or on antimicrobial agents. These products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Hand Sanitizers",
+ "product_tax_code": "53131626A0000"
+ },
+ {
+ "description": "Topical foams, creams, gels, etc that prevent hair loss and promote hair regrowth. These products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Hair Loss Products",
+ "product_tax_code": "51182001A0001"
+ },
+ {
+ "description": "A collection of mixed supplies and equipment that is used to give medical treatment, often housed in durable plastic boxes, fabric pouches or in wall mounted cabinets. Exempt or low rated qualifying medicinal items (eg. OTC drugs) make up 51% or more of the value of the kit. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "First Aid Kits - 51% or more medicinal items",
+ "product_tax_code": "42172001A0002"
+ },
+ {
+ "description": "A collection of mixed supplies and equipment that is used to give medical treatment, often housed in durable plastic boxes, fabric pouches or in wall mounted cabinets. Exempt or low rated qualifying medicinal items (eg. OTC drugs) make up 50% or less of the value of the kit. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "First Aid Kits - 50% or less medicinal items",
+ "product_tax_code": "42172001A0001"
+ },
+ {
+ "description": "Over-the-counter antifungal creams, ointments or suppositories to treat yeast infections, containing a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Feminine Yeast Treatments",
+ "product_tax_code": "51302300A0001"
+ },
+ {
+ "description": "Vaginal cleaning products include douches and wipes with medication such as an antiseptic, containing a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Feminine Cleansing Solutions - Medicated",
+ "product_tax_code": "53131615A0002"
+ },
+ {
+ "description": "Vaginal cleaning products include douches and wipes. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Feminine Cleansing Solutions",
+ "product_tax_code": "53131615A0001"
+ },
+ {
+ "description": "Single use disposable gloves (latex, nitrile, vinyl, etc) that while appropriate for multiple uses, have an application in a first aid or medical setting. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Disposable Gloves",
+ "product_tax_code": "42132203A0000"
+ },
+ {
+ "description": "Personal under-arm deodorants/antiperspirants. These products do contain a \"drug facts\" panel or a statement of active ingredients, typically aluminum. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Deodorant/Antiperspirant",
+ "product_tax_code": "53131606A0000"
+ },
+ {
+ "description": "Denture adhesives are pastes, powders or adhesive pads that may be placed in/on dentures to help them stay in place. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Denture creams/adhesives",
+ "product_tax_code": "53131510A0000"
+ },
+ {
+ "description": "Toothbrushes. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Toothbrushes",
+ "product_tax_code": "53131503A0000"
+ },
+ {
+ "description": "Dental Floss/picks. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Dental Floss/picks",
+ "product_tax_code": "53131504A0000"
+ },
+ {
+ "description": "Single use cotton balls or swabs for multi-purpose use other than applying medicines and cleaning wounds, due to not being sterile. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Cotton Balls/Swabs - Unsterile",
+ "product_tax_code": "42141500A0002"
+ },
+ {
+ "description": "Single use cotton balls or swabs for application of antiseptics and medications and to cleanse scratches, cuts or minor wounds. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Cotton Balls/Swabs - Sterile",
+ "product_tax_code": "42141500A0001"
+ },
+ {
+ "description": "Corrective lenses, eyeglasses, sold under prescription order of a licensed professional. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Corrective Lenses, Eyeglasses with Prescription",
+ "product_tax_code": "42142900A0001"
+ },
+ {
+ "description": "Corrective lenses, including eyeglasses and contact lenses, sold without a prescription order of a licensed professional. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Corrective Lenses without Prescription",
+ "product_tax_code": "42142900A0002"
+ },
+ {
+ "description": "Liquid solution for lubricating/rewetting, but not disinfecting, contact lenses. This solution is applied directly to the lens, rather then inserted into the eye. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Contact Lens Lubricating Solutions - For lens",
+ "product_tax_code": "42142914A0001"
+ },
+ {
+ "description": "Liquid solution for lubricating/rewetting, but not disinfecting, contact lenses. This solution is applied directly to the eye. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Contact Lens Lubricating Solutions - For eyes",
+ "product_tax_code": "42142914A0002"
+ },
+ {
+ "description": "Contact lenses, sold under prescription order of a licensed professional. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Contact Lenses with Prescription",
+ "product_tax_code": "42142913A0000"
+ },
+ {
+ "description": "Liquid solution for cleaning and disinfecting contact lenses. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Contact Lens Disinfecting Solutions",
+ "product_tax_code": "42142914A0000"
+ },
+ {
+ "description": "A reusable pain management supply that includes artificial ice packs, gel packs, heat wraps, etc used for pain relief. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Cold or Hot Therapy Packs - Reusable",
+ "product_tax_code": "42142100A0002"
+ },
+ {
+ "description": "A heating pad is a pad used for warming of parts of the body in order to manage pain. Types of heating pads include electrical, chemical and hot water bottles. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Heating Pads",
+ "product_tax_code": "42142100A0001"
+ },
+ {
+ "description": "A single use pain management supply that includes artificial ice packs, gel packs, heat wraps, etc used for pain relief. These products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Cold or Hot Therapy Packs - Disposable - Medicated",
+ "product_tax_code": "42142100A0004"
+ },
+ {
+ "description": "A single use pain management supply that includes artificial ice packs, gel packs, heat wraps, etc used for pain relief. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Cold or Hot Therapy Packs - Disposable",
+ "product_tax_code": "42142100A0003"
+ },
+ {
+ "description": "Baby powder is an astringent powder used for preventing diaper rash, as a spray, and for other cosmetic uses. It may be composed of talcum (in which case it is also called talcum powder) or corn starch. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Baby Powder",
+ "product_tax_code": "53131649A0001"
+ },
+ {
+ "description": "Baby oil is an inert (typically mineral) oil for the purpose of keeping skin soft and supple. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Baby Oil",
+ "product_tax_code": "51241900A0001"
+ },
+ {
+ "description": "A cosmetic foam or gel used for shaving preparation. The purpose of shaving cream is to soften the hair by providing lubrication. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Shaving Creams",
+ "product_tax_code": "53131611A0000"
+ },
+ {
+ "description": "Personal under-arm deodorants/antiperspirants containing natural ingredients and/or ingredients that are not considered drugs. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Deodorant - Natural or no active ingredients",
+ "product_tax_code": "53131606A0001"
+ },
+ {
+ "description": "A hair care product for cleansing the hair/scalp. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Shampoo",
+ "product_tax_code": "53131628A0000"
+ },
+ {
+ "description": "Various surfactant preparations to improve cleaning, enhance the enjoyment of bathing, and serve as a vehicle for cosmetic agents. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Bubble Bath, Bath Salts/Oils/Crystals",
+ "product_tax_code": "53131612A0001"
+ },
+ {
+ "description": "Cosmetic mouthwash may temporarily control bad breath and leave behind a pleasant taste, but has no chemical or biological application beyond their temporary benefit. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Mouthwash - Cosmetic",
+ "product_tax_code": "53131501A0001"
+ },
+ {
+ "description": "Teeth whitening gels, rinse, strips, trays, etc containing bleaching agents. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Teeth Whitening Kits",
+ "product_tax_code": "42151506A0000"
+ },
+ {
+ "description": "A hair care product typically applied and rinsed after shampooing that is used to improve the feel, appearance and manageability of hair. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Conditioner - Hair",
+ "product_tax_code": "53131628A0002"
+ },
+ {
+ "description": "Depilatories are cosmetic preparations used to remove hair from the skin. Chemical depilatories are available in gel, cream, lotion, aerosol, roll-on, and powder forms. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Hair Removal Products",
+ "product_tax_code": "53131623A0000"
+ },
+ {
+ "description": "Breath spray is a product sprayed into the mouth and breath strips dissolve in the mouth for the purpose of eliminating halitosis. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Breath Spray/dissolvable strips",
+ "product_tax_code": "53131509A0000"
+ },
+ {
+ "description": "Lotions, moisturizers, creams, powders, sprays, etc that promote optimal skin health. These products do not contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Skin Care Products",
+ "product_tax_code": "51241200A0002"
+ },
+ {
+ "description": "Liquid drops to be placed inside the ear canal to reduce the symptoms of an ear ache, or to act as an ear drying aid, or to loosen, cleanse, and aid in the removal of ear wax. These products contain a \"drug facts\" panel or a statement of active ingredients. Examples include Ear Ache, Swimmers' Ears, and Ear Wax removal drops. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Ear Drops - Medicated",
+ "product_tax_code": "51241000A0001"
+ },
+ {
+ "description": "Topical medicated solutions for treating skin acne. These products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Acne Treatments",
+ "product_tax_code": "51241400A0001"
+ },
+ {
+ "description": "A skin cream forming a protective barrier to help heal and soothe diaper rash discomfort. These products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Diaper Cream",
+ "product_tax_code": "51241859A0001"
+ },
+ {
+ "description": "A liquid solution typically used as a topical antiseptic. The products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Isopropyl (Rubbing) Alcohol",
+ "product_tax_code": "51471901A0000"
+ },
+ {
+ "description": "Hydrogen peroxide is a mild antiseptic used on the skin to prevent infection of minor cuts, scrapes, and burns. It may also be used as a mouth rinse to help remove mucus or to relieve minor mouth irritation (e.g., due to canker/cold sores, gingivitis). These products contain a \"drug facts\" panel or a statement of active ingredients. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Hydrogen Peroxide",
+ "product_tax_code": "51473503A0000"
+ },
+ {
+ "description": "Articles intended to be rubbed, poured, sprinkled, or sprayed on, introduced into, or otherwise applied to the human body or any part thereof for beautifying, promoting attractiveness, or altering the appearance. This category supports only the following items: Acrylic fingernail glue, Acrylic fingernails, Artificial eyelashes, Blush, Bronzer, Body glitter, Concealer, Eyelash glue, Finger/toenail decorations, Finger/toenail polish, Nail polish remover, Hair coloring, Hair mousse/gel, Hair oil, Hair spray, Hair relaxer, Hair wave treatment, Hair wax, Lip gloss, Lip liner, Lipstick, Liquid foundation, Makeup, Mascara, Nail polish remover, Powder foundation, Cologne, Perfume. This code is intended for sales directly to end consumers that are NOT healthcare providers.",
+ "name": "Cosmetics - Beautifying",
+ "product_tax_code": "53131619A0001"
+ },
+ {
+ "description": "Power cords",
+ "name": "Power cords",
+ "product_tax_code": "26121636A0000"
+ },
+ {
+ "description": "Archery accessories including quivers, releases, arrow shafts, armguards, hunting belts, bow parts, cleaning products, mounted safety equipment, scopes, sights, hunting slings, string wax, targets, target throwers, etc.",
+ "name": "Archery Accessories",
+ "product_tax_code": "49181602A0002"
+ },
+ {
+ "description": "Landscape soil, mulch, compost - residential",
+ "name": "Landscape Soil, Mulch, Compost - Residential",
+ "product_tax_code": "11121700A0001"
+ },
+ {
+ "description": "Firearms, limited to pistols, revolvers, rifles with a barrel no greater than an internal diameter of .50 caliber or a shotguns of 10 gauge or smaller.",
+ "name": "Firearms",
+ "product_tax_code": "46101500A0001"
+ },
+ {
+ "description": "Firearm accessories including repair parts, cleaning products, holsters, mounted safety equipment, choke tubes, scopes, shooting tripod/bipod/monopod, shooting bags/pouches, sights, etc.",
+ "name": "Firearm Accessories",
+ "product_tax_code": "46101506A0001"
+ },
+ {
+ "description": "Portable fuel container",
+ "name": "Portable Fuel Container",
+ "product_tax_code": "24111808A0001"
+ },
+ {
+ "description": "Hard and soft cases designed specifically for firearms equipment",
+ "name": "Gun Cases",
+ "product_tax_code": "46101801A0000"
+ },
+ {
+ "description": "Primary archery equipment including bows, crossbow, and bow strings.",
+ "name": "Archery Equipment",
+ "product_tax_code": "49181602A0001"
+ },
+ {
+ "description": "Hard and soft cases designed specifically for archery equipment.",
+ "name": "Archery Cases",
+ "product_tax_code": "46101801A0001"
+ },
+ {
+ "description": "Protective earmuffs to muffle the sound of gunfire.",
+ "name": "Hearing Protection Earmuffs",
+ "product_tax_code": "46181902A0001"
+ },
+ {
+ "description": "Ammunition for firearms with a barrel no greater than an internal diameter of .50 caliber or a shotgun of 10 gauge or smaller., including bullets, shotgun shells, and gunpowder.",
+ "name": "Ammunition",
+ "product_tax_code": "46101600A0001"
+ },
+ {
+ "description": "Bedclothes items including sheets, pillow cases, bedspreads, comforters, blankets, throws, duvet covers, pillow shams, bed skirts, mattress pad, mattress toppers, and pillows.",
+ "name": "Bedding",
+ "product_tax_code": "52121500A0000"
+ },
+ {
+ "description": "Towels used for individual drying of persons, including bath towels, beach towels, wash cloths, hand towels, fact towels, sport towels, etc.",
+ "name": "Bath towels",
+ "product_tax_code": "52121700A0000"
+ },
+ {
+ "description": "WaterSense labeled urinals.",
+ "name": "Urinals - WaterSense",
+ "product_tax_code": "30181506A0000"
+ },
+ {
+ "description": "WaterSense labeled toilets.",
+ "name": "Toilets - WaterSense",
+ "product_tax_code": "30181505A0000"
+ },
+ {
+ "description": "WaterSense labeled irrigation controllers, which act like a thermostat for your sprinkler system telling it when to turn on and off, use local weather and landscape conditions to tailor watering schedules to actual conditions on the site.",
+ "name": "Irrigation Controls - WaterSense",
+ "product_tax_code": "21102503A0001"
+ },
+ {
+ "description": "Ceiling Fans carrying an Energy Star rating.",
+ "name": "Ceiling fans - Energy Star",
+ "product_tax_code": "40101609A0000"
+ },
+ {
+ "description": "Standard incandescent light bulbs carrying an Energy Star rating.",
+ "name": "Incandescent Light Bulbs - Energy Star",
+ "product_tax_code": "39101612A0001"
+ },
+ {
+ "description": "Compact Fluorescent light (CFL) bulbs carrying an Energy Star rating.",
+ "name": "Compact Fluorescent Light Bulbs - Energy Star",
+ "product_tax_code": "39101619A0001"
+ },
+ {
+ "description": "Domestic appliance carrying an Energy Star Rating which reduces and maintains the level of humidity in the air.",
+ "name": "Dehumidifier - Energy Star",
+ "product_tax_code": "40101902A0000"
+ },
+ {
+ "description": "Domestic air conditioning (central or room) systems carrying Energy Star rating.",
+ "name": "Air conditioners - Energy Star",
+ "product_tax_code": "40101701A0000"
+ },
+ {
+ "description": "Artificial ice, blue ice, ice packs, reusable ice",
+ "name": "Artificial Ice",
+ "product_tax_code": "24121512A0000"
+ },
+ {
+ "description": "A port replicator is an attachment for a notebook computer that allows a number of devices such as a printer, large monitor, and keyboard to be simultaneously connected.",
+ "name": "Port Replicators",
+ "product_tax_code": "43211603A0000"
+ },
+ {
+ "description": "Computer Mouse/Pointing Devices",
+ "name": "Computer Mouse/Pointing Devices",
+ "product_tax_code": "43211708A0000"
+ },
+ {
+ "description": "Storage drives, hard drives, Zip drives, etc.",
+ "name": "Computer Drives",
+ "product_tax_code": "43201800A0001"
+ },
+ {
+ "description": "An in home programmable thermostat, such as a WiFi enabled smart thermostat, carrying an Energy Star rating.",
+ "name": "Programmable Wall Thermostat - Energy Star",
+ "product_tax_code": "41112209A0001"
+ },
+ {
+ "description": "Domestic gas or oil boilers for space or water heating carrying an Energy Star rating.",
+ "name": "Boilers - Energy Star",
+ "product_tax_code": "40102004A0001"
+ },
+ {
+ "description": "Domestic water heater carrying Energy Star rating.",
+ "name": "Water heater - Energy Star",
+ "product_tax_code": "40101825A0000"
+ },
+ {
+ "description": "Domestic freezers carrying Energy Star rating.",
+ "name": "Freezers- Energy Star",
+ "product_tax_code": "52141506A0000"
+ },
+ {
+ "description": "Domestic air source heat pumps carrying Energy Star rating.",
+ "name": "Heat Pumps - Energy Star",
+ "product_tax_code": "40101806A0000"
+ },
+ {
+ "description": "Domestic gas or oil furnaces carrying an Energy Star rating.",
+ "name": "Furnaces - Energy Star",
+ "product_tax_code": "40101805A0000"
+ },
+ {
+ "description": "Plywood, window film, storm shutters, hurricane shutters or other materials specifically designed to protect windows.",
+ "name": "Storm shutters/window protection devices",
+ "product_tax_code": "30151801A0001"
+ },
+ {
+ "description": "Smoke Detectors",
+ "name": "Smoke Detectors",
+ "product_tax_code": "46191501A0000"
+ },
+ {
+ "description": "Mobile phone charging device/cord",
+ "name": "Mobile Phone Charging Device/cord",
+ "product_tax_code": "43191501A0002"
+ },
+ {
+ "description": "A webcam is a video camera that feeds or streams an image or video in real time to or through a computer to a computer network, such as the Internet. Webcams are typically small cameras that sit on a desk, attach to a user's monitor, or are built into the hardware",
+ "name": "Web Camera",
+ "product_tax_code": "45121520A0000"
+ },
+ {
+ "description": "A sound card is an expansion component used in computers to receive and send audio.",
+ "name": "Sound Cards",
+ "product_tax_code": "43201502A0000"
+ },
+ {
+ "description": "Computer Speakers",
+ "name": "Computer Speakers",
+ "product_tax_code": "43211607A0000"
+ },
+ {
+ "description": "Computer Microphones",
+ "name": "Computer Microphones",
+ "product_tax_code": "43211719A0000"
+ },
+ {
+ "description": "A docking station is a hardware frame and set of electrical connection interfaces that enable a notebook computer to effectively serve as a desktop computer.",
+ "name": "Docking Stations",
+ "product_tax_code": "43211602A0000"
+ },
+ {
+ "description": "Computer Batteries",
+ "name": "Computer Batteries",
+ "product_tax_code": "26111711A0001"
+ },
+ {
+ "description": "Computer Monitor/Displays",
+ "name": "Computer Monitor/Displays",
+ "product_tax_code": "43211900A0000"
+ },
+ {
+ "description": "Computer Keyboards",
+ "name": "Computer Keyboards",
+ "product_tax_code": "43211706A0000"
+ },
+ {
+ "description": "Printer Ink",
+ "name": "Printer Ink",
+ "product_tax_code": "44103105A0000"
+ },
+ {
+ "description": "Printer Paper",
+ "name": "Printer Paper",
+ "product_tax_code": "14111507A0000"
+ },
+ {
+ "description": "Non-electric can opener",
+ "name": "Can opener - manual",
+ "product_tax_code": "52151605A0001"
+ },
+ {
+ "description": "Sheet music - Student",
+ "name": "Sheet music - Student",
+ "product_tax_code": "55101514A0000"
+ },
+ {
+ "description": "Musical instruments - Student",
+ "name": "Musical instruments - Student",
+ "product_tax_code": "60130000A0001"
+ },
+ {
+ "description": "Reference printed material commonly used by a student in a course of study as a reference and to learn the subject being taught.",
+ "name": "Dictionaries/Thesauruses",
+ "product_tax_code": "55101526A0001"
+ },
+ {
+ "description": "An item commonly used by a student in a course of study for artwork. This category is limited to the following items...clay and glazes, paints, paintbrushes for artwork, sketch and drawing pads, watercolors.",
+ "name": "School Art Supplies",
+ "product_tax_code": "60121200A0001"
+ },
+ {
+ "description": "A calendar based notebook to aid in outlining one's daily appointments, classes, activities, etc.",
+ "name": "Daily Planners",
+ "product_tax_code": "44112004A0001"
+ },
+ {
+ "description": "Portable self-powered or battery powered radio, two-way radio, weatherband radio.",
+ "name": "Portable Radios",
+ "product_tax_code": "43191510A0000"
+ },
+ {
+ "description": "Single or multi-pack AA, AAA, c, D, 6-volt or 9-volt batteries, excluding automobile or boat batteries.",
+ "name": "Alkaline Batteries",
+ "product_tax_code": "26111702A0000"
+ },
+ {
+ "description": "Routers",
+ "name": "Routers",
+ "product_tax_code": "43222609A0000"
+ },
+ {
+ "description": "Removable storage media such as compact disks, flash drives, thumb drives, flash memory cards.",
+ "name": "Computer Storage Media",
+ "product_tax_code": "43202000A0000"
+ },
+ {
+ "description": "Computer Printer",
+ "name": "Computer Printer",
+ "product_tax_code": "43212100A0001"
+ },
+ {
+ "description": "Portable self-powered or battery powered light sources, including flashlights, lanterns, emergency glow sticks or light sticks.",
+ "name": "Portable Light Sources",
+ "product_tax_code": "39111610A0000"
+ },
+ {
+ "description": "Canned software on tangible media that is used for non-recreational purposes, such as Antivirus, Database, Educational, Financial, Word processing, etc.",
+ "name": "Software - Prewritten, tangible media - Non-recreational",
+ "product_tax_code": "43230000A1101"
+ },
+ {
+ "description": "Personal computers, including laptops, tablets, desktops.",
+ "name": "Personal Computers",
+ "product_tax_code": "43211500A0001"
+ },
+ {
+ "description": "A device that joins pages of paper or similar material by fastening a thin metal staple through the sheets and folding the ends underneath.",
+ "name": "Staplers/Staples",
+ "product_tax_code": "44121615A0000"
+ },
+ {
+ "description": "Pins/tacks to secure papers, pictures, calendars, etc. to bulletin boards, walls, etc.",
+ "name": "Push pins/tacks",
+ "product_tax_code": "44122106A0000"
+ },
+ {
+ "description": "Bags/packs designed to carry students' books during the school day. This category does not include backpags for traveling, hiking, camping, etc.",
+ "name": "Bookbags/Backpacks - Student",
+ "product_tax_code": "53121603A0001"
+ },
+ {
+ "description": "Ground anchor systems and tie down kits for securing property against severe weather.",
+ "name": "Ground Anchor Systems and Tie-down Kits",
+ "product_tax_code": "31162108A0000"
+ },
+ {
+ "description": "An expansion card that allows the computer to send graphical information to a video display device such as a monitor, TV, or projector. Video cards are often used by gamers in place of integrated graphics due to their extra processing power and video ram.",
+ "name": "Video/Graphics Card",
+ "product_tax_code": "43201401A0000"
+ },
+ {
+ "description": "Scanners",
+ "name": "Scanners",
+ "product_tax_code": "43211711A0000"
+ },
+ {
+ "description": "Modems",
+ "name": "Modems",
+ "product_tax_code": "43222628A0000"
+ },
+ {
+ "description": "A map that could be used by a student in a course of study as a reference and to learn the subject being taught.",
+ "name": "Maps - Student",
+ "product_tax_code": "60103410A0001"
+ },
+ {
+ "description": "Tarps, plastic sheeting, plastic drop cloths, waterproof sheeting.",
+ "name": "Tarpaulins and Weatherproof Sheeting",
+ "product_tax_code": "24141506A0000"
+ },
+ {
+ "description": "Portable generator used to provide light or communications or power appliances during a power outage.",
+ "name": "Portable Generator",
+ "product_tax_code": "26111604A0001"
+ },
+ {
+ "description": "Headphones/Earbuds",
+ "name": "Headphones/Earbuds",
+ "product_tax_code": "52161514A0000"
+ },
+ {
+ "description": "A portable electronic device for reading digital books and periodicals.",
+ "name": "E-Book Readers",
+ "product_tax_code": "43211519A0000"
+ },
+ {
+ "description": "Mobile phone batteries",
+ "name": "Mobile Phone Batteries",
+ "product_tax_code": "43191501A0001"
+ },
+ {
+ "description": "A globe that could be used by a student in a course of study as a reference and to learn the subject being taught.",
+ "name": "Globes - Student",
+ "product_tax_code": "60104414A0001"
+ },
+ {
+ "description": "Domestic standard size refrigerators carrying Energy Star rating.",
+ "name": "Refrigerators - Energy Star",
+ "product_tax_code": "52141501A0000"
+ },
+ {
+ "description": "Non-electric food or beverage cooler.",
+ "name": "Food Storage Cooler",
+ "product_tax_code": "52152002A0001"
+ },
+ {
+ "description": "A motherboard is the physical component in a computer that contains the computer's basic circuitry and other components",
+ "name": "Motherboards",
+ "product_tax_code": "43201513A0000"
+ },
+ {
+ "description": "Calculators",
+ "name": "Calculators",
+ "product_tax_code": "44101807A0000"
+ },
+ {
+ "description": "Axes/Hatchets",
+ "name": "Axes/Hatchets",
+ "product_tax_code": "27112005A0000"
+ },
+ {
+ "description": "Water conserving products are for conserving or retaining groundwater; recharging water tables; or decreasing ambient air temperature, and so limiting water evaporation. Examples include soil sufactants, a soaker or drip-irrigation hose, a moisture control for a sprinkler or irrigation system, a rain barrel or an alternative rain and moisture collection system, a permeable ground cover surface that allows water to reach underground basins, aquifers or water collection points.",
+ "name": "Water Conserving Products",
+ "product_tax_code": "21102500A0001"
+ },
+ {
+ "description": "Domestic clothes drying appliances carrying Energy Star rating.",
+ "name": "Clothes drying machine - Energy Star",
+ "product_tax_code": "52141602A0000"
+ },
+ {
+ "description": "Software - Prewritten, electronic delivery - Business Use",
+ "name": "Software - Prewritten, electronic delivery - Business Use",
+ "product_tax_code": "43230000A9200"
+ },
+ {
+ "description": "Software - Custom, electronic delivery - Business Use",
+ "name": "Software - Custom, electronic delivery - Business Use",
+ "product_tax_code": "43230000A9201"
+ },
+ {
+ "description": "Food and Beverage - Sugar and Sugar Substitutes",
+ "name": "Food and Beverage - Sugar and Sugar Substitutes",
+ "product_tax_code": "50161900A0000"
+ },
+ {
+ "description": "Food and Beverage - Eggs and egg products",
+ "name": "Food and Beverage - Eggs and egg products",
+ "product_tax_code": "50131600A0000"
+ },
+ {
+ "description": "Food and Beverage - Coffee, coffee substitutes and tea",
+ "name": "Food and Beverage - Coffee, coffee substitutes and tea",
+ "product_tax_code": "50201700A0000"
+ },
+ {
+ "description": "Food and Beverage - Candy",
+ "name": "Food and Beverage - Candy",
+ "product_tax_code": "50161800A0000"
+ },
+ {
+ "description": "Food and Beverage - Butter, Margarine, Shortening and Cooking Oils",
+ "name": "Food and Beverage - Butter, Margarine, Shortening and Cooking Oils",
+ "product_tax_code": "50151500A0000"
+ },
+ {
+ "description": "Clothing - Facial shields",
+ "name": "Clothing - Facial shields",
+ "product_tax_code": "46181702A0001"
+ },
+ {
+ "description": "Clothing - Hard hats",
+ "name": "Clothing - Hard hats",
+ "product_tax_code": "46181701A0001"
+ },
+ {
+ "description": "Clothing - Cleanroom footwear",
+ "name": "Clothing - Cleanroom footwear",
+ "product_tax_code": "46181603A0001"
+ },
+ {
+ "description": "Clothing - Fire retardant footwear",
+ "name": "Clothing - Fire retardant footwear",
+ "product_tax_code": "46181601A0001"
+ },
+ {
+ "description": "Clothing - Protective pants",
+ "name": "Clothing - Protective pants",
+ "product_tax_code": "46181527A0001"
+ },
+ {
+ "description": "Clothing - Garters",
+ "name": "Clothing - Garters",
+ "product_tax_code": "53102509A0000"
+ },
+ {
+ "description": "Software maintenance and support - Optional maintenance and support charges for custom software including items delivered electronically (includes support services only - no updates/upgrades)",
+ "name": "Software maintenance and support - Optional, custom, electronic delivery (support services only)",
+ "product_tax_code": "81112200A2222"
+ },
+ {
+ "description": "Software maintenance and support - Mandatory maintenance and support charges for prewritten software including items delivered by load and leave",
+ "name": "Software maintenance and support - Mandatory, prewritten, load and leave delivery",
+ "product_tax_code": "81112200A1310"
+ },
+ {
+ "description": "Software maintenance and support - Mandatory maintenance and support charges for prewritten software including items delivered electronically",
+ "name": "Software maintenance and support - Mandatory, prewritten, electronic delivery",
+ "product_tax_code": "81112200A1210"
+ },
+ {
+ "description": "Electronic software documentation or user manuals - For prewritten software & delivered electronically",
+ "name": "Electronic software documentation or user manuals - Prewritten, electronic delivery",
+ "product_tax_code": "55111601A1200"
+ },
+ {
+ "description": "Clothing - Fur Ear muffs or scarves",
+ "name": "Clothing - Fur Ear muffs or scarves",
+ "product_tax_code": "53102502A0001"
+ },
+ {
+ "description": "Clothing - Safety glasses",
+ "name": "Clothing - Safety glasses",
+ "product_tax_code": "46181802A0001"
+ },
+ {
+ "description": "Software - Prewritten & delivered on tangible media",
+ "name": "Software - Prewritten, tangible media",
+ "product_tax_code": "43230000A1100"
+ },
+ {
+ "description": "Mainframe administration services\r\n",
+ "name": "Mainframe administration services\r\n",
+ "product_tax_code": "81111802A0000"
+ },
+ {
+ "description": "Co-location service",
+ "name": "Co-location service",
+ "product_tax_code": "81111814A0000"
+ },
+ {
+ "description": "Information management system for mine action IMSMA\r\n",
+ "name": "Information management system for mine action IMSMA\r\n",
+ "product_tax_code": "81111710A0000"
+ },
+ {
+ "description": "Local area network LAN maintenance or support",
+ "name": "Local area network LAN maintenance or support",
+ "product_tax_code": "81111803A0000"
+ },
+ {
+ "description": "Data center services",
+ "name": "Data center services",
+ "product_tax_code": "81112003A0000"
+ },
+ {
+ "description": "Wide area network WAN maintenance or support",
+ "name": "Wide area network WAN maintenance or support",
+ "product_tax_code": "81111804A0000"
+ },
+ {
+ "description": "Electronic data interchange EDI design\r\n",
+ "name": "Electronic data interchange EDI design\r\n",
+ "product_tax_code": "81111703A0000"
+ },
+ {
+ "description": "Software maintenance and support - Optional maintenance and support charges for prewritten software including items delivered on tangible media (includes support services only - no updates/upgrades)",
+ "name": "Software maintenance and support - Optional, prewritten, tangible media (support services only)",
+ "product_tax_code": "81112200A1122"
+ },
+ {
+ "description": "Software maintenance and support - Optional maintenance and support charges for prewritten software including items delivered on tangible media (includes software updates/upgrades)",
+ "name": "Software maintenance and support - Optional, prewritten, tangible media (incl. updates/upgrades)",
+ "product_tax_code": "81112200A1121"
+ },
+ {
+ "description": "Clothing - Safety sleeves",
+ "name": "Clothing - Safety sleeves",
+ "product_tax_code": "46181516A0001"
+ },
+ {
+ "description": "Clothing - Fire retardant apparel",
+ "name": "Clothing - Fire retardant apparel",
+ "product_tax_code": "46181508A0001"
+ },
+ {
+ "description": "Software maintenance and support - Optional maintenance and support charges for prewritten software including items delivered by load and leave (includes support services only - no updates/upgrades)",
+ "name": "Software maintenance and support - Optional, prewritten, load and leave delivery (support services only)",
+ "product_tax_code": "81112200A1322"
+ },
+ {
+ "description": "Software maintenance and support - Optional maintenance and support charges for prewritten software including items delivered by load and leave (includes software updates/upgrades)",
+ "name": "Software maintenance and support - Optional, prewritten, load and leave delivery (incl. updates/upgrades)",
+ "product_tax_code": "81112200A1321"
+ },
+ {
+ "description": "Software maintenance and support - Optional maintenance and support charges for prewritten software including items delivered electronically (includes support services only - no updates/upgrades)",
+ "name": "Software maintenance and support - Optional, prewritten, electronic delivery (support services only)",
+ "product_tax_code": "81112200A1222"
+ },
+ {
+ "description": "Software maintenance and support - Optional maintenance and support charges for custom software including items delivered on tangible media (includes support services only - no updates/upgrades)",
+ "name": "Software maintenance and support - Optional maintenance and support charges for custom software including items delivered on tangible media (includes support services only - no updates/upgrades)\r\n",
+ "product_tax_code": "81112200A2122"
+ },
+ {
+ "description": "Clothing - Protective ponchos",
+ "name": "Clothing - Protective ponchos",
+ "product_tax_code": "46181506A0001"
+ },
+ {
+ "description": "Clothing - Protective gloves",
+ "name": "Clothing - Protective gloves",
+ "product_tax_code": "46181504A0001"
+ },
+ {
+ "description": "Clothing - Synthetic Fur Vest",
+ "name": "Clothing - Synthetic Fur Vest",
+ "product_tax_code": "53103100A0002"
+ },
+ {
+ "description": "Software maintenance and support - Optional maintenance and support charges for custom software including items delivered on tangible media (includes software updates/upgrades)",
+ "name": "Software maintenance and support - Optional, custom, tangible media (incl. updates/upgrades)",
+ "product_tax_code": "81112200A2121"
+ },
+ {
+ "description": "Computer graphics service\r\n",
+ "name": "Computer graphics service\r\n",
+ "product_tax_code": "81111512A0000"
+ },
+ {
+ "description": "Proprietary or licensed systems maintenance or support",
+ "name": "Proprietary or licensed systems maintenance or support",
+ "product_tax_code": "81111805A0000"
+ },
+ {
+ "description": "Software - Prewritten & delivered electronically",
+ "name": "Software - Prewritten, electronic delivery",
+ "product_tax_code": "43230000A1200"
+ },
+ {
+ "description": "Software maintenance and support - Optional maintenance and support charges for prewritten software including items delivered electronically (includes software updates/upgrades)",
+ "name": "Software maintenance and support - Optional, prewritten, electronic delivery (incl. updates/upgrades)",
+ "product_tax_code": "81112200A1221"
+ },
+ {
+ "description": "Software maintenance and support - Optional maintenance and support charges for custom software including items delivered by load and leave (includes support services only - no updates/upgrades)",
+ "name": "Software maintenance and support - Optional, custom, load and leave delivery (support services only)",
+ "product_tax_code": "81112200A2322"
+ },
+ {
+ "description": "Software maintenance and support - Optional maintenance and support charges for custom software including items delivered by load and leave (includes software updates/upgrades)",
+ "name": "Software maintenance and support - Optional, custom, load and leave delivery (incl. updates/upgrades)",
+ "product_tax_code": "81112200A2321"
+ },
+ {
+ "description": "Software maintenance and support - Optional maintenance and support charges for custom software including items delivered electronically (includes software updates/upgrades)",
+ "name": "Software maintenance and support - Optional, custom, electronic delivery (incl. updates/upgrades)",
+ "product_tax_code": "81112200A2221"
+ },
+ {
+ "description": "Software maintenance and support - Mandatory maintenance and support charges for custom software including items delivered on tangible media",
+ "name": "Software maintenance and support - Mandatory, custom, tangible media",
+ "product_tax_code": "81112200A2110"
+ },
+ {
+ "description": "Software maintenance and support - Mandatory maintenance and support charges for custom software including items delivered electronically",
+ "name": "Software maintenance and support - Mandatory, custom, electronic delivery",
+ "product_tax_code": "81112200A2210"
+ },
+ {
+ "description": "Food and Beverage - Fish and seafood",
+ "name": "Food and Beverage - Fish and seafood",
+ "product_tax_code": "50121500A0000"
+ },
+ {
+ "description": "Food and Beverage - Ice cubes",
+ "name": "Food and Beverage - Ice cubes",
+ "product_tax_code": "50202302A0000"
+ },
+ {
+ "description": "Food and Beverage - Cooking Ingredients",
+ "name": "Food and Beverage - Cooking Ingredients",
+ "product_tax_code": "50181700A0000"
+ },
+ {
+ "description": "Food and Beverage - Cocoa and Cocoa products",
+ "name": "Food and Beverage - Cocoa and Cocoa products",
+ "product_tax_code": "50161511A0000"
+ },
+ {
+ "description": "Food and Beverage - Baby foods and formulas",
+ "name": "Food and Beverage - Baby foods and formulas",
+ "product_tax_code": "42231800A0000"
+ },
+ {
+ "description": "Clothing - Hazardous material protective footwear",
+ "name": "Clothing - Hazardous material protective footwear",
+ "product_tax_code": "46181602A0001"
+ },
+ {
+ "description": "Clothing - Welder gloves",
+ "name": "Clothing - Welder gloves",
+ "product_tax_code": "46181540A0001"
+ },
+ {
+ "description": "Clothing - Protective shirts",
+ "name": "Clothing - Protective shirts",
+ "product_tax_code": "46181526A0001"
+ },
+ {
+ "description": "Gift Cards",
+ "name": "Gift Cards",
+ "product_tax_code": "14111803A0001"
+ },
+ {
+ "description": "Clothing - Leg protectors",
+ "name": "Clothing - Leg protectors",
+ "product_tax_code": "46181520A0001"
+ },
+ {
+ "description": "Clothing - Protective coveralls",
+ "name": "Clothing - Protective coveralls",
+ "product_tax_code": "46181503A0001"
+ },
+ {
+ "description": "Internet or intranet client application development services\r\n",
+ "name": "Internet or intranet client application development services\r\n",
+ "product_tax_code": "81111509A0000"
+ },
+ {
+ "description": "Database design\r\n",
+ "name": "Database design\r\n",
+ "product_tax_code": "81111704A0000"
+ },
+ {
+ "description": "Computer programmers\r\n",
+ "name": "Computer programmers\r\n",
+ "product_tax_code": "81111600A0000"
+ },
+ {
+ "description": "Clothing - Synthetic Fur Hat",
+ "name": "Clothing - Synthetic Fur Hat",
+ "product_tax_code": "53102504A0002"
+ },
+ {
+ "description": "System or application programming management service\r\n",
+ "name": "System or application programming management service\r\n",
+ "product_tax_code": "81111511A0000"
+ },
+ {
+ "description": "Food and Beverage - Fruit",
+ "name": "Food and Beverage - Fruit",
+ "product_tax_code": "50300000A0000"
+ },
+ {
+ "description": "Food and Beverage - Vegetables",
+ "name": "Food and Beverage - Vegetables",
+ "product_tax_code": "50400000A0000"
+ },
+ {
+ "description": "Food and Beverage - Dried fruit, unsweetened",
+ "name": "Food and Beverage - Dried fruit, unsweetened",
+ "product_tax_code": "50320000A0000"
+ },
+ {
+ "description": "Food and Beverage - Snack Foods",
+ "name": "Food and Beverage - Snack Foods",
+ "product_tax_code": "50192100A0000"
+ },
+ {
+ "description": "Food and Beverage - Processed Nuts and Seeds",
+ "name": "Food and Beverage - Nuts and seeds that have been processed or treated by salting, spicing, smoking, roasting, or other means",
+ "product_tax_code": "50101716A0001"
+ },
+ {
+ "description": "Food and Beverage - Non-Alcoholic Beer, Wine",
+ "name": "Food and Beverage - Non-Alcoholic Beer, Wine",
+ "product_tax_code": "50202300A0001"
+ },
+ {
+ "description": "Food and Beverage - Ice Cream, sold in container less than one pint",
+ "name": "Food and Beverage - Ice Cream, sold in container less than one pint",
+ "product_tax_code": "50192304A0000"
+ },
+ {
+ "description": "Food and Beverage - Alcoholic beverages - Spirits",
+ "name": "Food and Beverage - Alcoholic beverages - Spirits",
+ "product_tax_code": "50202206A0000"
+ },
+ {
+ "description": "Food and Beverage - Wine",
+ "name": "Food and Beverage - Alcoholic beverages - Wine",
+ "product_tax_code": "50202203A0000"
+ },
+ {
+ "description": "Electronic content bundle - Delivered electronically with less than permanent rights of usage and streamed",
+ "name": "Electronic content bundle - Delivered electronically with less than permanent rights of usage and streamed",
+ "product_tax_code": "55111500A9220"
+ },
+ {
+ "description": "Clothing - Welding masks",
+ "name": "Clothing - Welding masks",
+ "product_tax_code": "46181703A0001"
+ },
+ {
+ "description": "Clothing - Protective wear dispenser",
+ "name": "Clothing - Protective wear dispenser",
+ "product_tax_code": "46181553A0001"
+ },
+ {
+ "description": "Clothing - Anti cut gloves",
+ "name": "Clothing - Anti cut gloves",
+ "product_tax_code": "46181536A0001"
+ },
+ {
+ "description": "Clothing - Reflective apparel or accessories",
+ "name": "Clothing - Reflective apparel or accessories",
+ "product_tax_code": "46181531A0001"
+ },
+ {
+ "description": "Clothing - Heat resistant clothing",
+ "name": "Clothing - Heat resistant clothing",
+ "product_tax_code": "46181518A0001"
+ },
+ {
+ "description": "Clothing - Cleanroom apparel",
+ "name": "Clothing - Cleanroom apparel",
+ "product_tax_code": "46181512A0001"
+ },
+ {
+ "description": "Clothing - Hazardous material protective apparel",
+ "name": "Clothing - Hazardous material protective apparel",
+ "product_tax_code": "46181509A0001"
+ },
+ {
+ "description": "Clothing - Safety vests",
+ "name": "Clothing - Safety vests",
+ "product_tax_code": "46181507A0001"
+ },
+ {
+ "description": "Clothing - Protective knee pads",
+ "name": "Clothing - Protective knee pads",
+ "product_tax_code": "46181505A0001"
+ },
+ {
+ "description": "Clothing - Bullet proof vests",
+ "name": "Clothing - Bullet proof vests",
+ "product_tax_code": "46181502A0001"
+ },
+ {
+ "description": "Clothing - Vest or waistcoats",
+ "name": "Clothing - Vest or waistcoats",
+ "product_tax_code": "53103100A0000"
+ },
+ {
+ "description": "Clothing - Prisoner uniform",
+ "name": "Clothing - Prisoner uniform",
+ "product_tax_code": "53102716A0000"
+ },
+ {
+ "description": "Clothing - Paramedic uniforms",
+ "name": "Clothing - Paramedic uniforms",
+ "product_tax_code": "53102712A0000"
+ },
+ {
+ "description": "Clothing - Ambulance officers uniforms",
+ "name": "Clothing - Ambulance officers uniforms",
+ "product_tax_code": "53102709A0000"
+ },
+ {
+ "description": "Clothing - Doctors coat",
+ "name": "Clothing - Doctors coat",
+ "product_tax_code": "53102707A0000"
+ },
+ {
+ "description": "Clothing - Sweat bands",
+ "name": "Clothing - Sweat bands",
+ "product_tax_code": "53102506A0000"
+ },
+ {
+ "description": "Clothing - Helmet parts or accessories",
+ "name": "Clothing - Helmet parts or accessories",
+ "product_tax_code": "46181706A0001"
+ },
+ {
+ "description": "Clothing - Fur Vest",
+ "name": "Clothing - Fur Vest",
+ "product_tax_code": "53103100A0001"
+ },
+ {
+ "description": "Clothing - Fur Gloves",
+ "name": "Clothing - Fur Gloves",
+ "product_tax_code": "53102503A0001"
+ },
+ {
+ "description": "Clothing - Motorcycle helmets",
+ "name": "Clothing - Motorcycle helmets",
+ "product_tax_code": "46181705A0001"
+ },
+ {
+ "description": "Operating system programming services\r\n",
+ "name": "Operating system programming services\r\n",
+ "product_tax_code": "81111505A0000"
+ },
+ {
+ "description": "Local area network communications design\r\n",
+ "name": "Local area network communications design\r\n",
+ "product_tax_code": "81111702A0000"
+ },
+ {
+ "description": "Clothing - Eye shields",
+ "name": "Clothing - Eye shields",
+ "product_tax_code": "46181803A0001"
+ },
+ {
+ "description": "Clothing - Welders helmet",
+ "name": "Clothing - Welders helmet",
+ "product_tax_code": "46181711A0001"
+ },
+ {
+ "description": "Clothing - Footwear covers",
+ "name": "Clothing - Footwear covers",
+ "product_tax_code": "46181606A0001"
+ },
+ {
+ "description": "Clothing - Cooling vest",
+ "name": "Clothing - Cooling vest",
+ "product_tax_code": "46181554A0001"
+ },
+ {
+ "description": "Clothing - Protective mesh jacket",
+ "name": "Clothing - Protective mesh jacket",
+ "product_tax_code": "46181551A0001"
+ },
+ {
+ "description": "Clothing - Protective scarf",
+ "name": "Clothing - Protective scarf",
+ "product_tax_code": "46181550A0001"
+ },
+ {
+ "description": "Clothing - Neck gaitor",
+ "name": "Clothing - Neck gaitor",
+ "product_tax_code": "46181549A0001"
+ },
+ {
+ "description": "Clothing - Welder bib",
+ "name": "Clothing - Welder bib",
+ "product_tax_code": "46181548A0001"
+ },
+ {
+ "description": "Clothing - Waterproof cap cover",
+ "name": "Clothing - Waterproof cap cover",
+ "product_tax_code": "46181547A0001"
+ },
+ {
+ "description": "Clothing - Waterproof suit",
+ "name": "Clothing - Waterproof suit",
+ "product_tax_code": "46181545A0001"
+ },
+ {
+ "description": "Clothing - Waterproof trousers or pants",
+ "name": "Clothing - Waterproof trousers or pants",
+ "product_tax_code": "46181544A0001"
+ },
+ {
+ "description": "Clothing - Protective mittens",
+ "name": "Clothing - Protective mittens",
+ "product_tax_code": "46181542A0001"
+ },
+ {
+ "description": "Clothing - Chemical resistant gloves",
+ "name": "Clothing - Chemical resistant gloves",
+ "product_tax_code": "46181541A0001"
+ },
+ {
+ "description": "Clothing - Anti vibratory gloves",
+ "name": "Clothing - Anti vibratory gloves",
+ "product_tax_code": "46181539A0001"
+ },
+ {
+ "description": "Clothing - Thermal gloves",
+ "name": "Clothing - Thermal gloves",
+ "product_tax_code": "46181538A0001"
+ },
+ {
+ "description": "Clothing - Insulated gloves",
+ "name": "Clothing - Insulated gloves",
+ "product_tax_code": "46181537A0001"
+ },
+ {
+ "description": "Clothing - Protective socks or hosiery",
+ "name": "Clothing - Protective socks or hosiery",
+ "product_tax_code": "46181535A0001"
+ },
+ {
+ "description": "Clothing - Protective wristbands",
+ "name": "Clothing - Protective wristbands",
+ "product_tax_code": "46181534A0001"
+ },
+ {
+ "description": "Clothing - Protective coats",
+ "name": "Clothing - Protective coats",
+ "product_tax_code": "46181533A0001"
+ },
+ {
+ "description": "Clothing - Insulated clothing for cold environments",
+ "name": "Clothing - Insulated clothing for cold environments",
+ "product_tax_code": "46181529A0001"
+ },
+ {
+ "description": "Clothing - Protective frock",
+ "name": "Clothing - Protective frock",
+ "product_tax_code": "46181528A0001"
+ },
+ {
+ "description": "Clothing - Safety hoods",
+ "name": "Clothing - Safety hoods",
+ "product_tax_code": "46181522A0001"
+ },
+ {
+ "description": "Clothing - Insulated or flotation suits",
+ "name": "Clothing - Insulated or flotation suits",
+ "product_tax_code": "46181517A0001"
+ },
+ {
+ "description": "Clothing - Elbow protectors",
+ "name": "Clothing - Elbow protectors",
+ "product_tax_code": "46181514A0001"
+ },
+ {
+ "description": "Clothing - Protective aprons",
+ "name": "Clothing - Protective aprons",
+ "product_tax_code": "46181501A0001"
+ },
+ {
+ "description": "Clothing - Shoes",
+ "name": "Clothing - Shoes",
+ "product_tax_code": "53111600A0000"
+ },
+ {
+ "description": "Clothing - Athletic wear",
+ "name": "Clothing - Athletic wear",
+ "product_tax_code": "53102900A0000"
+ },
+ {
+ "description": "Clothing - Folkloric clothing",
+ "name": "Clothing - Folkloric clothing",
+ "product_tax_code": "53102200A0000"
+ },
+ {
+ "description": "Clothing - Overalls or coveralls",
+ "name": "Clothing - Overalls or coveralls",
+ "product_tax_code": "53102100A0000"
+ },
+ {
+ "description": "Clothing - Dresses or skirts or saris or kimonos",
+ "name": "Clothing - Dresses or skirts or saris or kimonos",
+ "product_tax_code": "53102000A0000"
+ },
+ {
+ "description": "Clothing - Suits",
+ "name": "Clothing - Suits",
+ "product_tax_code": "53101900A0000"
+ },
+ {
+ "description": "Clothing - Sport uniform",
+ "name": "Clothing - Sport uniform",
+ "product_tax_code": "53102717A0000"
+ },
+ {
+ "description": "Clothing - Judicial robe",
+ "name": "Clothing - Judicial robe",
+ "product_tax_code": "53102714A0000"
+ },
+ {
+ "description": "Clothing - Ushers uniforms",
+ "name": "Clothing - Ushers uniforms",
+ "product_tax_code": "53102713A0000"
+ },
+ {
+ "description": "Clothing - Nurses uniforms",
+ "name": "Clothing - Nurses uniforms",
+ "product_tax_code": "53102708A0000"
+ },
+ {
+ "description": "Clothing - School uniforms",
+ "name": "Clothing - School uniforms",
+ "product_tax_code": "53102705A0000"
+ },
+ {
+ "description": "Clothing - Institutional food preparation or service attire",
+ "name": "Clothing - Institutional food preparation or service attire",
+ "product_tax_code": "53102704A0000"
+ },
+ {
+ "description": "Clothing - Police uniforms",
+ "name": "Clothing - Police uniforms",
+ "product_tax_code": "53102703A0000"
+ },
+ {
+ "description": "Clothing - Customs uniforms",
+ "name": "Clothing - Customs uniforms",
+ "product_tax_code": "53102702A0000"
+ },
+ {
+ "description": "Clothing - Bandannas",
+ "name": "Clothing - Bandannas",
+ "product_tax_code": "53102511A0000"
+ },
+ {
+ "description": "Clothing - Armbands",
+ "name": "Clothing - Armbands",
+ "product_tax_code": "53102508A0000"
+ },
+ {
+ "description": "Clothing - Caps",
+ "name": "Clothing - Caps",
+ "product_tax_code": "53102516A0000"
+ },
+ {
+ "description": "Clothing - Protective finger cots",
+ "name": "Clothing - Protective finger cots",
+ "product_tax_code": "46181530A0001"
+ },
+ {
+ "description": "Application programming services\r\n",
+ "name": "Application programming services\r\n",
+ "product_tax_code": "81111504A0000"
+ },
+ {
+ "description": "Application implementation services\r\n",
+ "name": "Application implementation services\r\n",
+ "product_tax_code": "81111508A0000"
+ },
+ {
+ "description": "Clothing - Synthetic Fur Ear muffs or scarves",
+ "name": "Clothing - Synthetic Fur Ear muffs or scarves",
+ "product_tax_code": "53102502A0002"
+ },
+ {
+ "description": "Clothing - Fur Poncho or Cape",
+ "name": "Clothing - Fur Poncho or Cape",
+ "product_tax_code": "53101806A0001"
+ },
+ {
+ "description": "Food and Beverage - Vitamins and Supplements - labeled with nutritional facts",
+ "name": "Food and Beverage - Vitamins and Supplements - labeled with nutritional facts",
+ "product_tax_code": "50501500A0001"
+ },
+ {
+ "description": "Food and Beverage - Nuts and seeds",
+ "name": "Food and Beverage - Nuts and seeds",
+ "product_tax_code": "50101716A0000"
+ },
+ {
+ "description": "Food and Beverage - Milk Substitutes",
+ "name": "Food and Beverage - Milk Substitutes",
+ "product_tax_code": "50151515A9000"
+ },
+ {
+ "description": "Food and Beverage - Milk and milk products",
+ "name": "Food and Beverage - Milk and milk products",
+ "product_tax_code": "50131700A0000"
+ },
+ {
+ "description": "Food and Beverage - Cheese",
+ "name": "Food and Beverage - Cheese",
+ "product_tax_code": "50131800A0000"
+ },
+ {
+ "description": "Clothing - Sandals",
+ "name": "Clothing - Sandals",
+ "product_tax_code": "53111800A0000"
+ },
+ {
+ "description": "Clothing - Pajamas or nightshirts or robes",
+ "name": "Clothing - Pajamas or nightshirts or robes",
+ "product_tax_code": "53102600A0000"
+ },
+ {
+ "description": "Clothing - Sweaters",
+ "name": "Clothing - Sweaters",
+ "product_tax_code": "53101700A0000"
+ },
+ {
+ "description": "Clothing - Slacks or trousers or shorts",
+ "name": "Clothing - Slacks or trousers or shorts",
+ "product_tax_code": "53101500A0000"
+ },
+ {
+ "description": "Clothing - Firefighter uniform",
+ "name": "Clothing - Firefighter uniform",
+ "product_tax_code": "53102718A0000"
+ },
+ {
+ "description": "Clothing - Salon smocks",
+ "name": "Clothing - Salon smocks",
+ "product_tax_code": "53102711A0000"
+ },
+ {
+ "description": "Clothing - Military uniforms",
+ "name": "Clothing - Military uniforms",
+ "product_tax_code": "53102701A0000"
+ },
+ {
+ "description": "Clothing - Heel pads",
+ "name": "Clothing - Heel pads",
+ "product_tax_code": "53112003A0000"
+ },
+ {
+ "description": "Clothing - Shoelaces",
+ "name": "Clothing - Shoelaces",
+ "product_tax_code": "53112002A0000"
+ },
+ {
+ "description": "Clothing - Infant swaddles or buntings or receiving blankets",
+ "name": "Clothing - Infant swaddles or buntings or receiving blankets",
+ "product_tax_code": "53102608A0000"
+ },
+ {
+ "description": "Clothing - Hats",
+ "name": "Clothing - Hats",
+ "product_tax_code": "53102503A0000"
+ },
+ {
+ "description": "Clothing - Ties or scarves or mufflers",
+ "name": "Clothing - Ties or scarves or mufflers",
+ "product_tax_code": "53102502A0000"
+ },
+ {
+ "description": "Clothing - Belts or suspenders",
+ "name": "Clothing - Belts or suspenders",
+ "product_tax_code": "53102501A0000"
+ },
+ {
+ "description": "Clothing - Tights",
+ "name": "Clothing - Tights",
+ "product_tax_code": "53102404A0000"
+ },
+ {
+ "description": "Clothing - Disposable youth training pants",
+ "name": "Clothing - Disposable youth training pants",
+ "product_tax_code": "53102311A0000"
+ },
+ {
+ "description": "Clothing - Undershirts",
+ "name": "Clothing - Undershirts",
+ "product_tax_code": "53102301A0000"
+ },
+ {
+ "description": "Clothing - Insulated cold weather shoe",
+ "name": "Clothing - Insulated cold weather shoe",
+ "product_tax_code": "46181610A0000"
+ },
+ {
+ "description": "Food and Beverage - Grains, Rice, Cereal",
+ "name": "Food and Beverage - Grains, Rice, Cereal",
+ "product_tax_code": "50221200A0000"
+ },
+ {
+ "description": "Clothing - Shirts",
+ "name": "Clothing - Shirts",
+ "product_tax_code": "53101600A0000"
+ },
+ {
+ "description": "Clothing - Safety boots",
+ "name": "Clothing - Safety boots",
+ "product_tax_code": "46181604A0000"
+ },
+ {
+ "description": "Clothing - Shin guards",
+ "name": "Clothing - Shin guards",
+ "product_tax_code": "49161525A0001"
+ },
+ {
+ "description": "Clothing - Athletic supporter",
+ "name": "Clothing - Athletic supporter",
+ "product_tax_code": "49161517A0001"
+ },
+ {
+ "description": "Clothing - Cleated or spiked shoes",
+ "name": "Clothing - Cleated or spiked shoes",
+ "product_tax_code": "53111900A0002"
+ },
+ {
+ "description": "Wide area network communications design\r\n",
+ "name": "Wide area network communications design\r\n\r\n",
+ "product_tax_code": "81111701A0000"
+ },
+ {
+ "description": "Systems integration design\r\n",
+ "name": "Systems integration design\r\n",
+ "product_tax_code": "81111503A0000"
+ },
+ {
+ "description": "Clothing - Bridal Gown",
+ "name": "Clothing - Bridal Gown",
+ "product_tax_code": "53101801A0004"
+ },
+ {
+ "description": "Clothing - Waterproof cap",
+ "name": "Clothing - Waterproof cap",
+ "product_tax_code": "46181546A0000"
+ },
+ {
+ "description": "Food and Beverage - Yogurt",
+ "name": "Food and Beverage - Yogurt",
+ "product_tax_code": "50131800A0001"
+ },
+ {
+ "description": "Food and Beverage - Nut Butters",
+ "name": "Food and Beverage - Nut Butters",
+ "product_tax_code": "50480000A9000"
+ },
+ {
+ "description": "Food and Beverage - Jams and Jellies",
+ "name": "Food and Beverage - Jams and Jellies",
+ "product_tax_code": "50192401A0000"
+ },
+ {
+ "description": "Food and Beverage - Honey, Maple Syrup",
+ "name": "Food and Beverage - Honey, Maple Syrup",
+ "product_tax_code": "50161509A0000"
+ },
+ {
+ "description": "Food and Beverage - Foods for Immediate Consumption",
+ "name": "Food and Beverage - Foods for Immediate Consumption",
+ "product_tax_code": "90100000A0001"
+ },
+ {
+ "description": "Food and Beverage - Bread and Flour Products",
+ "name": "Food and Beverage - Bread and Flour Products",
+ "product_tax_code": "50180000A0000"
+ },
+ {
+ "description": "Clothing - Overshoes",
+ "name": "Clothing - Overshoes",
+ "product_tax_code": "53112000A0000"
+ },
+ {
+ "description": "Clothing - Athletic footwear",
+ "name": "Clothing - Athletic footwear",
+ "product_tax_code": "53111900A0000"
+ },
+ {
+ "description": "Clothing - Slippers",
+ "name": "Clothing - Slippers",
+ "product_tax_code": "53111700A0000"
+ },
+ {
+ "description": "Clothing - Boots",
+ "name": "Clothing - Boots",
+ "product_tax_code": "53111500A0000"
+ },
+ {
+ "description": "Clothing - T-Shirts",
+ "name": "Clothing - T-Shirts",
+ "product_tax_code": "53103000A0000"
+ },
+ {
+ "description": "Clothing - Swimwear",
+ "name": "Clothing - Swimwear",
+ "product_tax_code": "53102800A0000"
+ },
+ {
+ "description": "Clothing - Coats or jackets",
+ "name": "Clothing - Coats or jackets",
+ "product_tax_code": "53101800A0000"
+ },
+ {
+ "description": "Clothing - Prison officer uniform",
+ "name": "Clothing - Prison officer uniform",
+ "product_tax_code": "53102715A0000"
+ },
+ {
+ "description": "Clothing - Corporate uniforms",
+ "name": "Clothing - Corporate uniforms",
+ "product_tax_code": "53102710A0000"
+ },
+ {
+ "description": "Clothing - Security uniforms",
+ "name": "Clothing - Security uniforms",
+ "product_tax_code": "53102706A0000"
+ },
+ {
+ "description": "Clothing - Chevrons",
+ "name": "Clothing - Chevrons",
+ "product_tax_code": "53102518A0000"
+ },
+ {
+ "description": "Clothing - Disposable work coat",
+ "name": "Clothing - Disposable work coat",
+ "product_tax_code": "53103201A0000"
+ },
+ {
+ "description": "Clothing - Bath robes",
+ "name": "Clothing - Bath robes",
+ "product_tax_code": "53102606A0000"
+ },
+ {
+ "description": "Clothing - Bib",
+ "name": "Clothing - Bib",
+ "product_tax_code": "53102521A0000"
+ },
+ {
+ "description": "Clothing - Gloves or mittens",
+ "name": "Clothing - Gloves or mittens",
+ "product_tax_code": "53102504A0000"
+ },
+ {
+ "description": "Clothing - Mouth guards",
+ "name": "Clothing - Mouth guards",
+ "product_tax_code": "42152402A0001"
+ },
+ {
+ "description": "Clothing - Boxing gloves",
+ "name": "Clothing - Boxing gloves",
+ "product_tax_code": "49171600A0000"
+ },
+ {
+ "description": "Clothing - Golf shoes",
+ "name": "Clothing - Golf shoes",
+ "product_tax_code": "53111900A0004"
+ },
+ {
+ "description": "Clothing - Bowling shoes",
+ "name": "Clothing - Bowling shoes",
+ "product_tax_code": "53111900A0003"
+ },
+ {
+ "description": "Internet or intranet server application development services\r\n",
+ "name": "Internet or intranet server application development services\r\n",
+ "product_tax_code": "81111510A0000"
+ },
+ {
+ "description": "Data conversion service\r\n",
+ "name": "Data conversion service\r\n",
+ "product_tax_code": "81112010A0000"
+ },
+ {
+ "description": "Client or server programming services\r\n",
+ "name": "Client or server programming services\r\n",
+ "product_tax_code": "81111506A0000"
+ },
+ {
+ "description": "Clothing - Ballet or tap shoes",
+ "name": "Clothing - Ballet or tap shoes",
+ "product_tax_code": "53111900A0001"
+ },
+ {
+ "description": "Clothing - Golf gloves",
+ "name": "Clothing - Golf gloves",
+ "product_tax_code": "49211606A0000"
+ },
+ {
+ "description": "Hardware as a service (HaaS)",
+ "name": "Hardware as a service (HaaS)",
+ "product_tax_code": "81161900A0000"
+ },
+ {
+ "description": "Cloud-based platform as a service (PaaS) - Personal Use",
+ "name": "Cloud-based platform as a service (PaaS) - Personal Use",
+ "product_tax_code": "81162100A0000"
+ },
+ {
+ "description": "Clothing - Panty hose",
+ "name": "Clothing - Panty hose",
+ "product_tax_code": "53102403A0000"
+ },
+ {
+ "description": "Clothing - Brassieres",
+ "name": "Clothing - Brassieres",
+ "product_tax_code": "53102304A0000"
+ },
+ {
+ "description": "Clothing - Protective sandals",
+ "name": "Clothing - Protective sandals",
+ "product_tax_code": "46181608A0000"
+ },
+ {
+ "description": "Clothing - Tuxedo or Formalwear",
+ "name": "Clothing - Tuxedo or Formalwear",
+ "product_tax_code": "53101801A0001"
+ },
+ {
+ "description": "Clothing - Lab coats",
+ "name": "Clothing - Lab coats",
+ "product_tax_code": "46181532A0000"
+ },
+ {
+ "description": "Systems planning services\r\n",
+ "name": "Systems planning services\r\n",
+ "product_tax_code": "81111707A0000"
+ },
+ {
+ "description": "Food and Beverage - Vitamins and Supplements",
+ "name": "Food and Beverage - Vitamins and Supplements - labeled with supplement facts",
+ "product_tax_code": "50501500A0000"
+ },
+ {
+ "description": "Food and Beverage - Jello and pudding mixes",
+ "name": "Food and Beverage - Jello and pudding mixes",
+ "product_tax_code": "50192404A0000"
+ },
+ {
+ "description": "Food and Beverage - Cooking spices",
+ "name": "Food and Beverage - Cooking spices",
+ "product_tax_code": "50171500A0000"
+ },
+ {
+ "description": "Food and Beverage - Alcoholic beverages - Beer/Malt Beverages",
+ "name": "Food and Beverage - Alcoholic beverages - Beer/Malt Beverages",
+ "product_tax_code": "50202201A0000"
+ },
+ {
+ "description": "Food and Beverage - Ice Cream, packaged",
+ "name": "Food and Beverage - Ice Cream, packaged",
+ "product_tax_code": "50192303A0000"
+ },
+ {
+ "description": "Electronic content bundle - Delivered electronically with permanent rights of usage and streamed",
+ "name": "Electronic content bundle - Delivered electronically with permanent rights of usage and streamed",
+ "product_tax_code": "55111500A9210"
+ },
+ {
+ "description": "Clothing - Roller skates or roller blades",
+ "name": "Clothing - Roller skates or roller blades",
+ "product_tax_code": "49221509A0000"
+ },
+ {
+ "description": "Clothing - Ice Skates",
+ "name": "Clothing - Ice Skates",
+ "product_tax_code": "49151602A0000"
+ },
+ {
+ "description": "Clothing - Life vests or preservers ",
+ "name": "Clothing - Life vests or preservers ",
+ "product_tax_code": "46161604A0000"
+ },
+ {
+ "description": "Clothing - Swim goggles",
+ "name": "Clothing - Swim goggles",
+ "product_tax_code": "49141606A0000"
+ },
+ {
+ "description": "Clothing - Bowling gloves",
+ "name": "Clothing - Bowling gloves",
+ "product_tax_code": "49211606A0002"
+ },
+ {
+ "description": "Fire Extinguishers",
+ "name": "Fire Extinguishers",
+ "product_tax_code": "46191601A0000"
+ },
+ {
+ "description": "Carbon Monoxide Detectors",
+ "name": "Carbon Monoxide Detectors",
+ "product_tax_code": "46191509A0001"
+ },
+ {
+ "description": "Ladder used for home emergency evacuation.",
+ "name": "Emergency/rescue ladder",
+ "product_tax_code": "30191501A0001"
+ },
+ {
+ "description": "Candles to be used a light source.",
+ "name": "Candles",
+ "product_tax_code": "39112604A0001"
+ },
+ {
+ "description": "Non-electric water container to store water for emergency usage.",
+ "name": "Water storage container",
+ "product_tax_code": "24111810A0001"
+ },
+ {
+ "description": "Duct Tape",
+ "name": "Duct Tape",
+ "product_tax_code": "31201501A0000"
+ },
+ {
+ "description": "Gas-powered chainsaw.",
+ "name": "Garden chainsaw",
+ "product_tax_code": "27112038A0000"
+ },
+ {
+ "description": "Chainsaw accessories include chains, lubricants, motor oil, chain sharpeners, bars, wrenches, carrying cases, repair parts, safety apparel.",
+ "name": "Chainsaw accessories",
+ "product_tax_code": "27112038A0001"
+ },
+ {
+ "description": "Shower curtain/liner used to keep water from escaping a showering area.",
+ "name": "Shower Curtain or Liner",
+ "product_tax_code": "30181607A0000"
+ },
+ {
+ "description": "Dish towels used for kitchenware drying.",
+ "name": "Dish towels",
+ "product_tax_code": "52121601A0000"
+ },
+ {
+ "description": "A bumper/liner that borders the interior walls/slats of the crib to help protect the baby.",
+ "name": "Crib bumpers/liners",
+ "product_tax_code": "56101804A0001"
+ },
+ {
+ "description": "A small mat/rug used to cover portion of bathroom floor.",
+ "name": "Bath Mats/rugs",
+ "product_tax_code": "52101507A0000"
+ },
+ {
+ "description": "A handheld computer that is capable of plotting graphs, solving simultaneous equations, and performing other tasks with variables.",
+ "name": "Graphing Calculators",
+ "product_tax_code": "44101808A0001"
+ },
+ {
+ "description": "Portable locks used by students in a school setting to prevent use, theft, vandalism or harm.",
+ "name": "Padlocks - Student",
+ "product_tax_code": "46171501A0001"
+ },
+ {
+ "description": "Domestic clothes washing appliances carrying Energy Star rating.",
+ "name": "Clothes Washing Machine - Energy Star",
+ "product_tax_code": "52141601A0000"
+ },
+ {
+ "description": "WaterSense labeled showerheads.",
+ "name": "Showerheads - WaterSense",
+ "product_tax_code": "30181801A0000"
+ },
+ {
+ "description": "Domestic dish washing appliances carrying Energy Star rating.",
+ "name": "Dishwashers - Energy Star",
+ "product_tax_code": "52141505A0000"
+ },
+ {
+ "description": "WaterSense labeled sprinkler body is the exterior shell that connects to the irrigation system piping and houses the spray nozzle that applies water on the landscape.",
+ "name": "Spray Water Sprinkler Bodies - WaterSense",
+ "product_tax_code": "21101803A0001"
+ },
+ {
+ "description": "Ropes and Cords",
+ "name": "Ropes and Cords",
+ "product_tax_code": "31151500A0000"
+ },
+ {
+ "description": "Light emitting diode (LED) bulbs carrying an Energy Star rating.",
+ "name": "LED Bulbs - Energy Star",
+ "product_tax_code": "39101628A0001"
+ },
+ {
+ "description": "WaterSense labeled bathroom sink faucets and accessories.",
+ "name": "Bathroom Faucets - WaterSense",
+ "product_tax_code": "30181702A0001"
+ },
+ {
+ "description": "Cables with industry standard connection and termination configurations used to connect various peripherals and equipment to computers.",
+ "name": "Computer Cables",
+ "product_tax_code": "43202222A0001"
+ },
+ {
+ "description": "Canned software delivered electronically that is used for non-recreational purposes, such as Antivirus, Database, Educational, Financial, Word processing, etc.",
+ "name": "Software - Prewritten, Electronic delivery - Non-recreational",
+ "product_tax_code": "43230000A1102"
+ },
+ {
+ "description": "Clothing - Baseball batting gloves",
+ "name": "Clothing - Baseball batting gloves",
+ "product_tax_code": "49211606A0001"
+ },
+ {
+ "description": "Cloud-based platform as a service (PaaS) - Business Use",
+ "name": "Cloud-based platform as a service (PaaS) - Business Use",
+ "product_tax_code": "81162100A9000"
+ },
+ {
+ "description": "Cloud-based Infrastructure as a service (IaaS) - Personal Use",
+ "name": "Cloud-based infrastructure as a service (IaaS) - Personal Use",
+ "product_tax_code": "81162200A0000"
+ },
+ {
+ "description": "Clothing - Costume Mask",
+ "name": "Clothing - Costume Mask",
+ "product_tax_code": "60122800A0000"
+ },
+ {
+ "description": "Clothing - Ski boots",
+ "name": "Clothing - Ski boots",
+ "product_tax_code": "53111900A0005"
+ },
+ {
+ "description": "Personal computer PC application design\r\n",
+ "name": "Personal computer PC application design\r\n",
+ "product_tax_code": "81111502A0000"
+ },
+ {
+ "description": "Network planning services\r\n",
+ "name": "Network planning services\r\n",
+ "product_tax_code": "81111706A0000"
+ },
+ {
+ "description": "ERP or database applications programming services\r\n",
+ "name": "ERP or database applications programming services\r\n",
+ "product_tax_code": "81111507A0000"
+ },
+ {
+ "description": "Content or data classification services\r\n",
+ "name": "Content or data classification services\r\n",
+ "product_tax_code": "81112009A0000"
+ },
+ {
+ "description": "Clothing - Prom Dress",
+ "name": "Clothing - Prom Dress",
+ "product_tax_code": "53101801A0003"
+ },
+ {
+ "description": "Clothing - Formal Dress",
+ "name": "Clothing - Formal Dress",
+ "product_tax_code": "53101801A0002"
+ },
+ {
+ "description": "Clothing - Handkerchiefs",
+ "name": "Clothing - Handkerchiefs",
+ "product_tax_code": "53102512A0000"
+ },
+ {
+ "description": "Clothing - Protective lens",
+ "name": "Clothing - Protective lens",
+ "product_tax_code": "46181811A0001"
+ },
+ {
+ "description": "Clothing - Body shaping garments",
+ "name": "Clothing - Body shaping garments",
+ "product_tax_code": "53102307A0000"
+ },
+ {
+ "description": "Clothing - Underpants",
+ "name": "Clothing - Underpants",
+ "product_tax_code": "53102303A0000"
+ },
+ {
+ "description": "Clothing - Waterproof boot",
+ "name": "Clothing - Waterproof boot",
+ "product_tax_code": "46181611A0000"
+ },
+ {
+ "description": "Electronic software documentation or user manuals - For prewritten software & delivered by load and leave",
+ "name": "Electronic software documentation or user manuals - Prewritten, load and leave delivery",
+ "product_tax_code": "55111601A1300"
+ },
+ {
+ "description": "Electronic software documentation or user manuals - For custom software & delivered on tangible media",
+ "name": "Electronic software documentation or user manuals - Custom, tangible media",
+ "product_tax_code": "55111601A2100"
+ },
+ {
+ "description": "Electronic software documentation or user manuals - For custom software & delivered by load and leave",
+ "name": "Electronic software documentation or user manuals - Custom, load and leave delivery",
+ "product_tax_code": "55111601A2300"
+ },
+ {
+ "description": "Electronic software documentation or user manuals - For custom software & delivered electronically",
+ "name": "Electronic software documentation or user manuals - Custom, electronic delivery",
+ "product_tax_code": "55111601A2200"
+ },
+ {
+ "description": "Electronic publications and music - Streamed",
+ "name": "Electronic publications and music - Streamed",
+ "product_tax_code": "55111500A1500"
+ },
+ {
+ "description": "Electronic publications and music - Delivered electronically with permanent rights of usage",
+ "name": "Electronic publications and music - Delivered electronically with permanent rights of usage",
+ "product_tax_code": "55111500A1210"
+ },
+ {
+ "description": "Electronic publications and music - Delivered electronically with less than permanent rights of usage",
+ "name": "Electronic publications and music - Delivered electronically with less than permanent rights of usage",
+ "product_tax_code": "55111500A1220"
+ },
+ {
+ "description": "Software - Custom & delivered on tangible media",
+ "name": "Software - Custom, tangible media",
+ "product_tax_code": "43230000A2100"
+ },
+ {
+ "description": "Software - Prewritten & delivered by digital keycode printed on tangible media",
+ "name": "Software - Prewritten, delivered by digital keycode printed on tangible media",
+ "product_tax_code": "43230000A1400"
+ },
+ {
+ "description": "Software - Prewritten & delivered by load and leave",
+ "name": "Software - Prewritten, load and leave delivery",
+ "product_tax_code": "43230000A1300"
+ },
+ {
+ "description": "Internet cloud storage service\r\n",
+ "name": "Internet cloud storage service\r\n",
+ "product_tax_code": "81111513A0000"
+ },
+ {
+ "description": "Computer or network or internet security\r\n",
+ "name": "Computer or network or internet security\r\n",
+ "product_tax_code": "81111801A0000"
+ },
+ {
+ "description": "Document scanning service\r\n",
+ "name": "Document scanning service\r\n",
+ "product_tax_code": "81112005A0000"
+ },
+ {
+ "description": "Cloud-based software as a service (SaaS) - Business Use",
+ "name": "Cloud-based software as a service (SaaS) - Business Use",
+ "product_tax_code": "81162000A9000"
+ },
+ {
+ "description": "Demining geographical or geospatial information system GIS\r\n",
+ "name": "Demining geographical or geospatial information system GIS\r\n",
+ "product_tax_code": "81111709A0000"
+ },
+ {
+ "description": "Content or data standardization services\r\n",
+ "name": "Content or data standardization services\r\n",
+ "product_tax_code": "81112007A0000"
+ },
+ {
+ "description": "Data processing or preparation services\r\n",
+ "name": "Data processing or preparation services\r\n",
+ "product_tax_code": "81112002A0000"
+ },
+ {
+ "description": "Database analysis service\r\n",
+ "name": "Database analysis service\r\n",
+ "product_tax_code": "81111806A0000"
+ },
+ {
+ "description": "Electronic software documentation or user manuals - For prewritten software & delivered on tangible media",
+ "name": "Electronic software documentation or user manuals - Prewritten, tangible media",
+ "product_tax_code": "55111601A1100"
+ },
+ {
+ "description": "Cloud-based software as a service (SaaS) - Personal Use",
+ "name": "Cloud-based software as a service (SaaS) - Personal Use",
+ "product_tax_code": "81162000A0000"
+ },
+ {
+ "description": "Clothing - Costume",
+ "name": "Clothing - Costume",
+ "product_tax_code": "60141401A0000"
+ },
+ {
+ "description": "Online data processing service\r\n",
+ "name": "Online data processing service\r\n",
+ "product_tax_code": "81112001A0000"
+ },
+ {
+ "description": "System usability services\r\n",
+ "name": "System usability services\r\n",
+ "product_tax_code": "81111820A0000"
+ },
+ {
+ "description": "Services that provide both essential proactive and reactive operations and maintenance support.",
+ "name": "IT Support Services",
+ "product_tax_code": "81111811A0000"
+ },
+ {
+ "description": "System analysis service\r\n",
+ "name": "System analysis service\r\n",
+ "product_tax_code": "81111808A0000"
+ },
+ {
+ "description": "Data storage service\r\n",
+ "name": "Data storage service\r\n",
+ "product_tax_code": "81112006A0000"
+ },
+ {
+ "description": "Quality assurance services\r\n",
+ "name": "Quality assurance services\r\n",
+ "product_tax_code": "81111819A0000"
+ },
+ {
+ "description": "Software - Custom & delivered by load & leave",
+ "name": "Software - Custom, load and leave delivery",
+ "product_tax_code": "43230000A2300"
+ },
+ {
+ "description": "Food and Beverage - Meat Sticks, Meat Jerky",
+ "name": "Food and Beverage - Meat Sticks, Meat Jerky",
+ "product_tax_code": "50112000A0000"
+ },
+ {
+ "description": "Clothing - Synthetic Fur Poncho or Cape",
+ "name": "Clothing - Synthetic Fur Poncho or Cape",
+ "product_tax_code": "53101806A0002"
+ },
+ {
+ "description": "Clothing - Wetsuit",
+ "name": "Clothing - Wetsuit",
+ "product_tax_code": "49141506A0000"
+ },
+ {
+ "description": "Cloud-based business process as a service - Business Use",
+ "name": "Cloud-based business process as a service - Business Use",
+ "product_tax_code": "81162300A9000"
+ },
+ {
+ "description": "Cloud-based infrastructure as a service (IaaS) - Business Use",
+ "name": "Cloud-based infrastructure as a service (IaaS) - Business Use",
+ "product_tax_code": "81162200A9000"
+ },
+ {
+ "description": "Clothing - Belt Buckle",
+ "name": "Clothing - Belt Buckle",
+ "product_tax_code": "53102501A0001"
+ },
+ {
+ "description": "Clothing - Shower Cap",
+ "name": "Clothing - Shower Cap",
+ "product_tax_code": "53131601A0000"
+ },
+ {
+ "description": "Clothing - Eye shield garters",
+ "name": "Clothing - Eye shield garters",
+ "product_tax_code": "46181809A0001"
+ },
+ {
+ "description": "Clothing - Socks",
+ "name": "Clothing - Socks",
+ "product_tax_code": "53102402A0000"
+ },
+ {
+ "description": "Clothing - Stockings",
+ "name": "Clothing - Stockings",
+ "product_tax_code": "53102401A0000"
+ },
+ {
+ "description": "Food and Beverage - Meat and meat products",
+ "name": "Food and Beverage - Meat and meat products",
+ "product_tax_code": "50110000A0000"
+ },
+ {
+ "description": "Clothing - Slips",
+ "name": "Clothing - Slips",
+ "product_tax_code": "53102302A0000"
+ },
+ {
+ "description": "Clothing - Goggle protective covers",
+ "name": "Clothing - Goggle protective covers",
+ "product_tax_code": "46181808A0001"
+ },
+ {
+ "description": "Clothing - Goggles",
+ "name": "Clothing - Goggles",
+ "product_tax_code": "46181804A0001"
+ },
+ {
+ "description": "Clothing - Football receiver gloves",
+ "name": "Clothing - Football receiver gloves",
+ "product_tax_code": "49211606A0004"
+ },
+ {
+ "description": "Disaster recovery services",
+ "name": "Disaster recovery services",
+ "product_tax_code": "81112004A0000"
+ },
+ {
+ "description": "Clothing - Mountain climbing boot",
+ "name": "Clothing - Mountain climbing boot",
+ "product_tax_code": "46181613A0000"
+ },
+ {
+ "description": "Software maintenance and support - Mandatory maintenance and support charges for prewritten software including items delivered on tangible media",
+ "name": "Software maintenance and support - Mandatory, prewritten, tangible media",
+ "product_tax_code": "81112200A1110"
+ },
+ {
+ "description": "Clothing - Military boot",
+ "name": "Clothing - Military boot",
+ "product_tax_code": "46181612A0000"
+ },
+ {
+ "description": "Carbonated beverages marketed as energy drinks, carrying a Supplement Facts Label, that contain a blend of energy enhancing vitamins, minerals, herbals, stimulants, etc.",
+ "name": "Energy Beverages - Carbonated - with Supplement Facts Label",
+ "product_tax_code": "50202309A0001"
+ },
+ {
+ "description": "Non-carbonated beverages marketed as energy drinks, carrying a Supplement Facts Label, that contain a blend of energy enhancing vitamins, minerals, herbals, stimulants, etc.",
+ "name": "Energy Beverages - Non-Carbonated - with Supplement Facts Label",
+ "product_tax_code": "50202309A0000"
+ },
+ {
+ "description": "Food bundle or basket containing food staples combined with tangible personal property, with the food comprising 90% or more of the overall value of the bundle, where all food consists of candy (not containing flour).",
+ "name": "Food/TPP Bundle - with Food 90% or more - Food is all Candy",
+ "product_tax_code": "50193400A0001"
+ },
+ {
+ "description": "Food bundle or basket containing food staples combined with tangible personal property, with the food comprising less 90% or more of the overall value of the bundle.",
+ "name": "Food/TPP Bundle - with Food 90% or more",
+ "product_tax_code": "50193400A0000"
+ },
+ {
+ "description": "Food bundle or basket containing food staples combined with tangible personal property, with the food comprising between 76% and 89% of the overall value of the bundle, where all food consists of candy (not containing flour).",
+ "name": "Food/TPP Bundle - with Food between 76% and 89% - Food is all Candy",
+ "product_tax_code": "50193400A0005"
+ },
+ {
+ "description": "Food bundle or basket containing food staples combined with tangible personal property, with the food comprising between 76% and 89% of the overall value of the bundle.",
+ "name": "Food/TPP Bundle - with Food between 76% and 89%",
+ "product_tax_code": "50193400A0004"
+ },
+ {
+ "description": "Food bundle or basket containing food staples combined with tangible personal property, with the food comprising between 50% and 75% of the overall value of the bundle, where all food consists of candy (not containing flour).",
+ "name": "Food/TPP Bundle - with Food between 50% and 75% - Food is all Candy",
+ "product_tax_code": "50193400A0003"
+ },
+ {
+ "description": "Food bundle or basket containing food staples combined with tangible personal property, with the food comprising between 50% and 75% of the overall value of the bundle.",
+ "name": "Food/TPP Bundle - with Food between 50% and 75%",
+ "product_tax_code": "50193400A0002"
+ },
+ {
+ "description": "Food/TPP Bundle - with Food less than 50%",
+ "name": "Food/TPP Bundle - with Food less than 50%",
+ "product_tax_code": "50193400A0006"
+ },
+ {
+ "description": "Ready to drink beverages, not containing milk, formulated and labled for their nutritional value, such as increased caloric or protein intake and containing natrual or artificial sweeteners.",
+ "name": "Nutritional Supplement/protein drinks, shakes - contains no milk",
+ "product_tax_code": "50501703A0000"
+ },
+ {
+ "description": "Ready to drink beverages, containing milk, formulated and labled for their nutritional value, such as increased caloric or protein intake.",
+ "name": "Nutritional Supplement/protein drinks, shakes - contains milk",
+ "product_tax_code": "50501703A0001"
+ },
+ {
+ "description": "Powdered mixes to be reconstituted into a drinkable beverage using water.",
+ "name": "Powdered Drink Mixes - to be mixed with water",
+ "product_tax_code": "50202311A0000"
+ },
+ {
+ "description": "Powdered mixes to be reconstituted into a drinkable beverage using milk or a milk substitute.",
+ "name": "Powdered Drink Mixes - to be mixed with milk",
+ "product_tax_code": "50202311A0001"
+ },
+ {
+ "description": "Food and Beverage - Granola Bars, Cereal Bars, Energy Bars, Protein Bars containing no flour",
+ "name": "Food and Beverage - Granola Bars, Cereal Bars, Energy Bars, Protein Bars containing no flour",
+ "product_tax_code": "50221202A0002"
+ },
+ {
+ "description": "Food and Beverage - Granola Bars, Cereal Bars, Energy Bars, Protein Bars containing flour",
+ "name": "Food and Beverage - Granola Bars, Cereal Bars, Energy Bars, Protein Bars containing flour",
+ "product_tax_code": "50221202A0001"
+ },
+ {
+ "description": "Nutritional supplement in powder form, dairy based or plant based, focused on increasing ones intake of protein for various benefits.",
+ "name": "Protein Powder",
+ "product_tax_code": "50501703A0002"
+ },
+ {
+ "description": "Ready to drink non-carbonated beverage containing tea with natural or artificial sweeteners.",
+ "name": "Bottled tea - non-carbonated - sweetened",
+ "product_tax_code": "50201712A0003"
+ },
+ {
+ "description": "Ready to drink non-carbonated beverage containing tea without natural or artificial sweeteners.",
+ "name": "Bottled tea - non-carbonated - unsweetened",
+ "product_tax_code": "50201712A0000"
+ },
+ {
+ "description": "Ready to drink carbonated beverage containing tea with natural or artificial sweeteners.",
+ "name": "Bottled tea - carbonated - sweetened",
+ "product_tax_code": "50201712A0002"
+ },
+ {
+ "description": "Ready to drink carbonated beverage containing tea and without any natural or artificial sweeteners.",
+ "name": "Bottled tea - carbonated - unsweetened",
+ "product_tax_code": "50201712A0001"
+ },
+ {
+ "description": "Ready to drink coffee based beverage containing milk or milk substitute.",
+ "name": "Bottled coffee - containing milk or milk substitute",
+ "product_tax_code": "50201708A0002"
+ },
+ {
+ "description": "Ready to drink coffee based beverage not containing milk, containing natural or artificial sweetener.",
+ "name": "Bottled coffee - no milk - sweetened",
+ "product_tax_code": "50201708A0001"
+ },
+ {
+ "description": "Ready to drink coffee based beverage containing neither milk nor natural or artificial sweeteners.",
+ "name": "Bottled coffee - no milk - unsweetened",
+ "product_tax_code": "50201708A0000"
+ },
+ {
+ "description": "Carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 51 - 69% natural vegetable juice. This does not include flavored carbonated water. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Carbonated - 51-69% vegetable juice",
+ "product_tax_code": "50202306A0008"
+ },
+ {
+ "description": "Carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 1 - 9% natural fruit juice. This does not include flavored carbonated water. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Carbonated - 1-9% fruit juice",
+ "product_tax_code": "50202306A0001"
+ },
+ {
+ "description": "Non-carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 70 - 99% natural fruit juice. This does not include flavored water. This does include sweetened cocktail mixes that can be combined with alcohol. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Non-Carbonated - 70-99% fruit juice",
+ "product_tax_code": "50202304A0010"
+ },
+ {
+ "description": "Non-carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 51 - 69% natural vegetable juice. This does not include flavored water. This does include sweetened cocktail mixes that can be combined with alcohol. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Non-Carbonated - 51-69% vegetable juice",
+ "product_tax_code": "50202304A0009"
+ },
+ {
+ "description": "Non-carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 25 - 50% natural vegetable juice. This does not include flavored water. This does include sweetened cocktail mixes that can be combined with alcohol. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Non-Carbonated - 25-50% vegetable juice",
+ "product_tax_code": "50202304A0007"
+ },
+ {
+ "description": "Non-carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 10 - 24% natural fruit juice. This does not include flavored water. This does include sweetened cocktail mixes that can be combined with alcohol. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Non-Carbonated - 10-24% fruit juice",
+ "product_tax_code": "50202304A0004"
+ },
+ {
+ "description": "Non-carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 70 - 99% natural vegetable juice. This does not include flavored water. This does include sweetened cocktail mixes that can be combined with alcohol. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Non-Carbonated - 70-99% vegetable juice",
+ "product_tax_code": "50202304A0011"
+ },
+ {
+ "description": "Non-carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and zero natural fruit or vegetable juice. This does not include flavored water. This does include sweetened cocktail mixes that can be combined with alcohol. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Non-Carbonated - No fruit or vegetable juice",
+ "product_tax_code": "50202304A0001"
+ },
+ {
+ "description": "Non-carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 51 - 69% natural fruit juice. This does not include flavored water. This does include sweetened cocktail mixes that can be combined with alcohol. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Non-Carbonated - 51-69% fruit juice",
+ "product_tax_code": "50202304A0008"
+ },
+ {
+ "description": "Non-carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 1 - 9% natural vegetable juice. This does not include flavored water. This does include sweetened cocktail mixes that can be combined with alcohol. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Non-Carbonated - 1 -9% vegetable juice",
+ "product_tax_code": "50202304A0003"
+ },
+ {
+ "description": "Non-carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 1 - 9% natural fruit juice. This does not include flavored water. This does include sweetened cocktail mixes that can be combined with alcohol. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Non-Carbonated - 1-9% fruit juice",
+ "product_tax_code": "50202304A0002"
+ },
+ {
+ "description": "Non-carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 10 - 24% natural vegetable juice. This does not include flavored water. This does include sweetened cocktail mixes that can be combined with alcohol. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Non-Carbonated - 10-24% vegetable juice",
+ "product_tax_code": "50202304A0005"
+ },
+ {
+ "description": "Non-carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 25 - 50% natural fruit juice. This does not include flavored water. This does include sweetened cocktail mixes that can be combined with alcohol. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Non-Carbonated - 25-50% fruit juice",
+ "product_tax_code": "50202304A0006"
+ },
+ {
+ "description": "Non-carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 100% natural fruit or vegetable juice. This does not include flavored water. This does include sweetened cocktail mixes that can be combined with alcohol. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Non-Carbonated - 100% fruit or vegetable juice",
+ "product_tax_code": "50202304A0000"
+ },
+ {
+ "description": "Carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and zero natural fruit or vegetable juice. This does not include flavored carbonated water. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Carbonated - No fruit or vegetable juice",
+ "product_tax_code": "50202306A0000"
+ },
+ {
+ "description": "Carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 70 - 99% natural vegetable juice. This does not include flavored carbonated water. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Carbonated - 70-99% vegetable juice",
+ "product_tax_code": "50202306A0010"
+ },
+ {
+ "description": "Carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 70 - 99% natural fruit juice. This does not include flavored carbonated water. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Carbonated - 70-99% fruit juice",
+ "product_tax_code": "50202306A0009"
+ },
+ {
+ "description": "Carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 51 - 69% natural fruit juice. This does not include flavored carbonated water. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Carbonated - 51-69% fruit juice",
+ "product_tax_code": "50202306A0007"
+ },
+ {
+ "description": "Carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 25 - 50% natural vegetable juice. This does not flavored carbonated water. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Carbonated - 25-50% vegetable juice",
+ "product_tax_code": "50202306A0006"
+ },
+ {
+ "description": "Carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 25 - 50% natural fruit juice. This does not include flavored carbonated water. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Carbonated - 25-50% fruit juice",
+ "product_tax_code": "50202306A0005"
+ },
+ {
+ "description": "Carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 100% natural fruit or vegetable juice. This does not include flavored carbonated water. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Carbonated - 100% fruit or vegetable juice",
+ "product_tax_code": "50202306A0011"
+ },
+ {
+ "description": "Carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 10 - 24% natural vegetable juice. This does not include flavored carbonated water. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Carbonated - 10-24% vegetable juice",
+ "product_tax_code": "50202306A0004"
+ },
+ {
+ "description": "Carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 10 - 24% natural fruit juice. This does not include flavored carbonated water. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Carbonated - 10-24% fruit juice",
+ "product_tax_code": "50202306A0003"
+ },
+ {
+ "description": "Carbonated nonalcoholic beverages that contain natural or artificial sweeteners, and 1 - 9% natural vegetable juice. This does not include flavored carbonated water. This does include beverages marketed as energy drinks that carry a Nutrition Facts label and contain a blend of energy enhancing ingredients.",
+ "name": "Soft Drinks - Carbonated - 1 -9% vegetable juice",
+ "product_tax_code": "50202306A0002"
+ },
+ {
+ "description": "Bottled Water for human consumption, unsweetened, non-carbonated. Does not include distilled water.",
+ "name": "Bottled Water",
+ "product_tax_code": "50202301A0000"
+ },
+ {
+ "description": "Bottled Water for human consumption, containing natural or artificial sweeteners, non-carbonated.",
+ "name": "Bottled Water - Flavored",
+ "product_tax_code": "50202301A0001"
+ },
+ {
+ "description": "Bottled Water for human consumption, unsweetened, carbonated naturally. Includes carbonated waters containing only natural flavors or essences.",
+ "name": "Bottled Water - Carbonated Naturally",
+ "product_tax_code": "50202301A0003"
+ },
+ {
+ "description": "Bottled Water for human consumption, unsweetened, carbonated artificially during bottling process. Includes carbonated waters containing only natural flavors or essences.",
+ "name": "Bottled Water - Carbonated Artificially",
+ "product_tax_code": "50202301A0002"
+ },
+ {
+ "description": "Bottled Water for human consumption, containing natural or artificial sweeteners, carbonated.",
+ "name": "Bottled Water - Carbonated - Sweetened",
+ "product_tax_code": "50202301A0004"
+ },
+ {
+ "description": "Clothing - Sequins for use in clothing",
+ "name": "Clothing - Sequins for use in clothing",
+ "product_tax_code": "60123900A0000"
+ },
+ {
+ "description": "Clothing - Synthetic Fur Gloves",
+ "name": "Clothing - Synthetic Fur Gloves",
+ "product_tax_code": "53102503A0002"
+ },
+ {
+ "description": "Clothing - Synthetic Fur Coat or Jacket",
+ "name": "Clothing - Synthetic Fur Coat or Jacket",
+ "product_tax_code": "53101800A0002"
+ },
+ {
+ "description": "Clothing - Fur Hat",
+ "name": "Clothing - Fur Hat",
+ "product_tax_code": "53102504A0001"
+ },
+ {
+ "description": "Clothing - Fur Coat or Jacket",
+ "name": "Clothing - Fur Coat or Jacket",
+ "product_tax_code": "53101800A0001"
+ },
+ {
+ "description": "Cloud-based business process as a service",
+ "name": "Cloud-based business process as a service - Personal Use",
+ "product_tax_code": "81162300A0000"
+ },
+ {
+ "description": "Clothing - Shoulder pads for sports",
+ "name": "Clothing - Shoulder pads for sports",
+ "product_tax_code": "46181506A0002"
+ },
+ {
+ "description": "Mainframe software applications design\r\n",
+ "name": "Mainframe software applications design\r\n",
+ "product_tax_code": "81111501A0000"
+ },
+ {
+ "description": "Clothing - Safety shoes",
+ "name": "Clothing - Safety shoes",
+ "product_tax_code": "46181605A0000"
+ },
+ {
+ "description": "Clothing - Protective hood",
+ "name": "Clothing - Protective hood",
+ "product_tax_code": "46181710A0001"
+ },
+ {
+ "description": "Clothing - Face protection kit",
+ "name": "Clothing - Face protection kit",
+ "product_tax_code": "46181709A0001"
+ },
+ {
+ "description": "Clothing - Protective hair net",
+ "name": "Clothing - Protective hair net",
+ "product_tax_code": "46181708A0001"
+ },
+ {
+ "description": "Clothing - Facial shields parts or accessories",
+ "name": "Clothing - Facial shields parts or accessories",
+ "product_tax_code": "46181707A0001"
+ },
+ {
+ "description": "Clothing - Safety helmets",
+ "name": "Clothing - Safety helmets",
+ "product_tax_code": "46181704A0001"
+ },
+ {
+ "description": "Clothing - Poncho",
+ "name": "Clothing - Poncho",
+ "product_tax_code": "53101806A0000"
+ },
+ {
+ "description": "Clothing - Protective insole",
+ "name": "Clothing - Protective insole",
+ "product_tax_code": "46181609A0000"
+ },
+ {
+ "description": "Clothing - Protective clogs",
+ "name": "Clothing - Protective clogs",
+ "product_tax_code": "46181607A0000"
+ },
+ {
+ "description": "Clothing - Waterproof jacket or raincoat",
+ "name": "Clothing - Waterproof jacket or raincoat",
+ "product_tax_code": "46181543A0000"
+ },
+ {
+ "description": "Systems architecture\r\n",
+ "name": "Systems architecture\r\n",
+ "product_tax_code": "81111705A0000"
+ },
+ {
+ "description": "System installation service\r\n",
+ "name": "System installation service\r\n",
+ "product_tax_code": "81111809A0000"
+ },
+ {
+ "description": "Software maintenance and support - Mandatory maintenance and support charges for custom software including items delivered by load and leave",
+ "name": "Software maintenance and support - Mandatory, custom, load and leave delivery",
+ "product_tax_code": "81112200A2310"
+ },
+ {
+ "description": "Software coding service\r\n",
+ "name": "Software coding service\r\n",
+ "product_tax_code": "81111810A0000"
+ },
+ {
+ "description": "Software - Custom & delivered electronically",
+ "name": "Software - Custom, electronic delivery",
+ "product_tax_code": "43230000A2200"
+ },
+ {
+ "description": "Bathing suits and swim suits",
+ "name": "Clothing - Swimwear",
+ "product_tax_code": "20041"
+ },
+ {
+ "description": "Miscellaneous services which are not subject to a service-specific tax levy. This category will only treat services as taxable if the jurisdiction taxes services generally.",
+ "name": "General Services",
+ "product_tax_code": "19000"
+ },
+ {
+ "description": "Services provided to educate users on the proper use of a product. Live training in person",
+ "name": "Training Services - Live",
+ "product_tax_code": "19004"
+ },
+ {
+ "description": "Admission charges associated with entry to an event.",
+ "name": "Admission Services",
+ "product_tax_code": "19003"
+ },
+ {
+ "description": "Service of providing usage of a parking space.",
+ "name": "Parking Services",
+ "product_tax_code": "19002"
+ },
+ {
+ "description": "A charge separately stated from any sale of the product itself for the installation of tangible personal property. This a labor charge, with any non-separately stated property transferred in performing the service considered inconsequential.",
+ "name": "Installation Services",
+ "product_tax_code": "10040"
+ },
+ {
+ "description": "Services rendered for advertising which do not include the exchange of tangible personal property.",
+ "name": "Advertising Services",
+ "product_tax_code": "19001"
+ },
+ {
+ "description": "Digital products transferred electronically, meaning obtained by the purchaser by means other than tangible storage media.",
+ "name": "Digital Goods",
+ "product_tax_code": "31000"
+ },
+ {
+ "description": " All human wearing apparel suitable for general use",
+ "name": "Clothing",
+ "product_tax_code": "20010"
+ },
+ {
+ "description": "An over-the-counter drug is a substance that contains a label identifying it as a drug and including a \"drug facts\" panel or a statement of active ingredients, that can be obtained without a prescription. A drug can be intended for internal (ingestible, implant, injectable) or external (topical) application to the human body.",
+ "name": "Over-the-Counter Drugs",
+ "product_tax_code": "51010"
+ },
+ {
+ "description": "A substance that can only be obtained via a prescription of a licensed professional. A drug is a compound, substance, or preparation, and any component thereof, not including food or food ingredients, dietary supplements, or alcoholic beverages, that is: recognized in the official United States pharmacopoeia, official homeopathic pharmacopoeia of the United States, or official national formulary, and supplement to any of them; intended for use in the diagnosis, cure, mitigation, treatment, or prevention of disease; or intended to affect the structure or any function of the body. A drug can be intended for internal (ingestible, implant, injectable) or external (topical) application to the human body.",
+ "name": "Prescription Drugs",
+ "product_tax_code": "51020"
+ },
+ {
+ "description": "Food for humans consumption, unprepared",
+ "name": "Food & Groceries",
+ "product_tax_code": "40030"
+ },
+ {
+ "description": "Pre-written software, delivered electronically, but access remotely.",
+ "name": "Software as a Service",
+ "product_tax_code": "30070"
+ },
+ {
+ "description": "Periodicals, printed, sold by subscription",
+ "name": "Magazines & Subscriptions",
+ "product_tax_code": "81300"
+ },
+ {
+ "description": "Books, printed",
+ "name": "Books",
+ "product_tax_code": "81100"
+ },
+ {
+ "description": "Periodicals, printed, sold individually",
+ "name": "Magazine",
+ "product_tax_code": "81310"
+ },
+ {
+ "description": "Textbooks, printed",
+ "name": "Textbook",
+ "product_tax_code": "81110"
+ },
+ {
+ "description": "Religious books and manuals, printed",
+ "name": "Religious books",
+ "product_tax_code": "81120"
+ },
+ {
+ "description": "Non-food dietary supplements",
+ "name": "Supplements",
+ "product_tax_code": "40020"
+ },
+ {
+ "description": "Candy",
+ "name": "Candy",
+ "product_tax_code": "40010"
+ },
+ {
+ "description": "Soft drinks. Soda and similar drinks. Does not include water, juice, or milk.",
+ "name": "Soft Drinks",
+ "product_tax_code": "40050"
+ },
+ {
+ "description": "Bottled water for human consumption.",
+ "name": "Bottled Water",
+ "product_tax_code": "40060"
+ },
+ {
+ "description": "Ready to eat foods intended to be consumed on site by humans. Foods not considered to be Food & Grocery (not food for home consumption or food which requires further preparation to consume).",
+ "name": "Prepared Foods",
+ "product_tax_code": "41000"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/regional/united_states/setup.py b/erpnext/regional/united_states/setup.py
index 24ab1cf..9c183af 100644
--- a/erpnext/regional/united_states/setup.py
+++ b/erpnext/regional/united_states/setup.py
@@ -3,12 +3,41 @@
from __future__ import unicode_literals
import frappe
+import os
+import json
+from frappe.permissions import add_permission, update_permission_property
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
def setup(company=None, patch=True):
+ # Company independent fixtures should be called only once at the first company setup
+ if frappe.db.count('Company', {'country': 'United States'}) <=1:
+ setup_company_independent_fixtures(patch=patch)
+
+def setup_company_independent_fixtures(company=None, patch=True):
+ add_product_tax_categories()
make_custom_fields()
+ add_permissions()
+ frappe.enqueue('erpnext.regional.united_states.setup.add_product_tax_categories', now=False)
add_print_formats()
+# Product Tax categories imported from taxjar api
+def add_product_tax_categories():
+ with open(os.path.join(os.path.dirname(__file__), 'product_tax_category_data.json'), 'r') as f:
+ tax_categories = json.loads(f.read())
+ create_tax_categories(tax_categories['categories'])
+
+def create_tax_categories(data):
+ for d in data:
+ tax_category = frappe.new_doc('Product Tax Category')
+ tax_category.description = d.get("description")
+ tax_category.product_tax_code = d.get("product_tax_code")
+ tax_category.category_name = d.get("name")
+ try:
+ tax_category.db_insert()
+ except frappe.DuplicateEntryError:
+ pass
+
+
def make_custom_fields(update=True):
custom_fields = {
'Supplier': [
@@ -30,10 +59,29 @@
'Quotation': [
dict(fieldname='exempt_from_sales_tax', fieldtype='Check', insert_after='taxes_and_charges',
label='Is customer exempted from sales tax?')
+ ],
+ 'Sales Invoice Item': [
+ dict(fieldname='product_tax_category', fieldtype='Link', insert_after='description', options='Product Tax Category',
+ label='Product Tax Category', fetch_from='item_code.product_tax_category'),
+ dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount',
+ label='Tax Collectable', read_only=1),
+ dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable',
+ label='Taxable Amount', read_only=1)
+ ],
+ 'Item': [
+ dict(fieldname='product_tax_category', fieldtype='Link', insert_after='item_group', options='Product Tax Category',
+ label='Product Tax Category')
]
}
create_custom_fields(custom_fields, update=update)
+def add_permissions():
+ doctype = "Product Tax Category"
+ for role in ('Accounts Manager', 'Accounts User', 'System Manager','Item Manager', 'Stock Manager'):
+ add_permission(doctype, role, 0)
+ update_permission_property(doctype, role, 0, 'write', 1)
+ update_permission_property(doctype, role, 0, 'create', 1)
+
def add_print_formats():
frappe.reload_doc("regional", "print_format", "irs_1099_form")
frappe.db.set_value("Print Format", "IRS 1099 Form", "disabled", 0)
diff --git a/erpnext/regional/united_states/test_united_states.py b/erpnext/regional/united_states/test_united_states.py
index 513570e..19e9a35 100644
--- a/erpnext/regional/united_states/test_united_states.py
+++ b/erpnext/regional/united_states/test_united_states.py
@@ -1,8 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
import unittest
+
+import frappe
+
from erpnext.regional.report.irs_1099.irs_1099 import execute as execute_1099_report
diff --git a/erpnext/restaurant/doctype/restaurant/restaurant.py b/erpnext/restaurant/doctype/restaurant/restaurant.py
index 0bb7b69..486afc3 100644
--- a/erpnext/restaurant/doctype/restaurant/restaurant.py
+++ b/erpnext/restaurant/doctype/restaurant/restaurant.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class Restaurant(Document):
pass
diff --git a/erpnext/restaurant/doctype/restaurant/restaurant_dashboard.py b/erpnext/restaurant/doctype/restaurant/restaurant_dashboard.py
index adce5c7..5b78bb2 100644
--- a/erpnext/restaurant/doctype/restaurant/restaurant_dashboard.py
+++ b/erpnext/restaurant/doctype/restaurant/restaurant_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'restaurant',
diff --git a/erpnext/restaurant/doctype/restaurant/test_restaurant.py b/erpnext/restaurant/doctype/restaurant/test_restaurant.py
index 3ba7f57..574cd1f 100644
--- a/erpnext/restaurant/doctype/restaurant/test_restaurant.py
+++ b/erpnext/restaurant/doctype/restaurant/test_restaurant.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
test_records = [
diff --git a/erpnext/restaurant/doctype/restaurant_menu/restaurant_menu.py b/erpnext/restaurant/doctype/restaurant_menu/restaurant_menu.py
index 952c467..632f485 100644
--- a/erpnext/restaurant/doctype/restaurant_menu/restaurant_menu.py
+++ b/erpnext/restaurant/doctype/restaurant_menu/restaurant_menu.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class RestaurantMenu(Document):
def validate(self):
for d in self.items:
diff --git a/erpnext/restaurant/doctype/restaurant_menu/test_restaurant_menu.py b/erpnext/restaurant/doctype/restaurant_menu/test_restaurant_menu.py
index 29f95fd..00cbf35 100644
--- a/erpnext/restaurant/doctype/restaurant_menu/test_restaurant_menu.py
+++ b/erpnext/restaurant/doctype/restaurant_menu/test_restaurant_menu.py
@@ -3,9 +3,10 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
test_records = [
dict(doctype='Item', item_code='Food Item 1',
item_group='Products', is_stock_item=0),
diff --git a/erpnext/restaurant/doctype/restaurant_menu_item/restaurant_menu_item.py b/erpnext/restaurant/doctype/restaurant_menu_item/restaurant_menu_item.py
index cc86bb3..5d095f4 100644
--- a/erpnext/restaurant/doctype/restaurant_menu_item/restaurant_menu_item.py
+++ b/erpnext/restaurant/doctype/restaurant_menu_item/restaurant_menu_item.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class RestaurantMenuItem(Document):
pass
diff --git a/erpnext/restaurant/doctype/restaurant_order_entry/restaurant_order_entry.py b/erpnext/restaurant/doctype/restaurant_order_entry/restaurant_order_entry.py
index 357deaa..1ed5921 100644
--- a/erpnext/restaurant/doctype/restaurant_order_entry/restaurant_order_entry.py
+++ b/erpnext/restaurant/doctype/restaurant_order_entry/restaurant_order_entry.py
@@ -3,11 +3,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json
-from frappe.model.document import Document
+
+import json
+
+import frappe
from frappe import _
+from frappe.model.document import Document
+
from erpnext.controllers.queries import item_query
+
class RestaurantOrderEntry(Document):
pass
diff --git a/erpnext/restaurant/doctype/restaurant_order_entry_item/restaurant_order_entry_item.py b/erpnext/restaurant/doctype/restaurant_order_entry_item/restaurant_order_entry_item.py
index e0c051b..ee8928b 100644
--- a/erpnext/restaurant/doctype/restaurant_order_entry_item/restaurant_order_entry_item.py
+++ b/erpnext/restaurant/doctype/restaurant_order_entry_item/restaurant_order_entry_item.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class RestaurantOrderEntryItem(Document):
pass
diff --git a/erpnext/restaurant/doctype/restaurant_reservation/restaurant_reservation.py b/erpnext/restaurant/doctype/restaurant_reservation/restaurant_reservation.py
index f96de44..f6d2a7c 100644
--- a/erpnext/restaurant/doctype/restaurant_reservation/restaurant_reservation.py
+++ b/erpnext/restaurant/doctype/restaurant_reservation/restaurant_reservation.py
@@ -3,11 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.model.document import Document
+
from datetime import timedelta
+
+from frappe.model.document import Document
from frappe.utils import get_datetime
+
class RestaurantReservation(Document):
def validate(self):
if not self.reservation_end_time:
diff --git a/erpnext/restaurant/doctype/restaurant_reservation/test_restaurant_reservation.py b/erpnext/restaurant/doctype/restaurant_reservation/test_restaurant_reservation.py
index 71681b2..885da72 100644
--- a/erpnext/restaurant/doctype/restaurant_reservation/test_restaurant_reservation.py
+++ b/erpnext/restaurant/doctype/restaurant_reservation/test_restaurant_reservation.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestRestaurantReservation(unittest.TestCase):
pass
diff --git a/erpnext/restaurant/doctype/restaurant_table/restaurant_table.py b/erpnext/restaurant/doctype/restaurant_table/restaurant_table.py
index d5ea9d5..0b5d635 100644
--- a/erpnext/restaurant/doctype/restaurant_table/restaurant_table.py
+++ b/erpnext/restaurant/doctype/restaurant_table/restaurant_table.py
@@ -3,10 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, re
+
+import re
+
from frappe.model.document import Document
from frappe.model.naming import make_autoname
+
class RestaurantTable(Document):
def autoname(self):
prefix = re.sub('-+', '-', self.restaurant.replace(' ', '-'))
diff --git a/erpnext/restaurant/doctype/restaurant_table/test_restaurant_table.py b/erpnext/restaurant/doctype/restaurant_table/test_restaurant_table.py
index ffdb6f7..44059ae 100644
--- a/erpnext/restaurant/doctype/restaurant_table/test_restaurant_table.py
+++ b/erpnext/restaurant/doctype/restaurant_table/test_restaurant_table.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
test_records = [
diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py
index abf146c..4be8139 100644
--- a/erpnext/selling/doctype/customer/customer.py
+++ b/erpnext/selling/doctype/customer/customer.py
@@ -2,20 +2,26 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
import json
-from frappe.model.naming import set_name_by_naming_series
-from frappe import _, msgprint
+
+import frappe
import frappe.defaults
-from frappe.utils import flt, cint, cstr, today, get_formatted_email
+from frappe import _, msgprint
+from frappe.contacts.address_and_contact import (
+ delete_contact_and_address,
+ load_address_and_contact,
+)
from frappe.desk.reportview import build_match_conditions, get_filters_cond
-from erpnext.utilities.transaction_base import TransactionBase
-from erpnext.accounts.party import validate_party_accounts, get_dashboard_info, get_timeline_data # keep this
-from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
-from frappe.model.rename_doc import update_linked_doctypes
from frappe.model.mapper import get_mapped_doc
+from frappe.model.naming import set_name_by_naming_series
+from frappe.model.rename_doc import update_linked_doctypes
+from frappe.utils import cint, cstr, flt, get_formatted_email, today
from frappe.utils.user import get_users_with_role
+from erpnext.accounts.party import get_dashboard_info, validate_party_accounts
+from erpnext.utilities.transaction_base import TransactionBase
+
class Customer(TransactionBase):
def get_feed(self):
@@ -150,8 +156,14 @@
self.db_set('email_id', self.email_id)
def create_primary_address(self):
+ from frappe.contacts.doctype.address.address import get_address_display
+
if self.flags.is_new_doc and self.get('address_line1'):
- make_address(self)
+ address = make_address(self)
+ address_display = get_address_display(address.name)
+
+ self.db_set("customer_primary_address", address.name)
+ self.db_set("primary_address", address_display)
def update_lead_status(self):
'''If Customer created from Lead, update lead status to "Converted"
@@ -246,9 +258,15 @@
def on_trash(self):
if self.customer_primary_contact:
- frappe.db.sql("""update `tabCustomer`
- set customer_primary_contact=null, mobile_no=null, email_id=null
- where name=%s""", self.name)
+ frappe.db.sql("""
+ UPDATE `tabCustomer`
+ SET
+ customer_primary_contact=null,
+ customer_primary_address=null,
+ mobile_no=null,
+ email_id=null,
+ primary_address=null
+ WHERE name=%(name)s""", {"name": self.name})
delete_contact_and_address('Customer', self.name)
if self.lead_name:
diff --git a/erpnext/selling/doctype/customer/test_customer.py b/erpnext/selling/doctype/customer/test_customer.py
index 5b33731..fd1db8f 100644
--- a/erpnext/selling/doctype/customer/test_customer.py
+++ b/erpnext/selling/doctype/customer/test_customer.py
@@ -3,13 +3,14 @@
from __future__ import unicode_literals
-import frappe
import unittest
-from erpnext.accounts.party import get_due_date
+import frappe
from frappe.test_runner import make_test_records
-from erpnext.exceptions import PartyFrozen, PartyDisabled
from frappe.utils import flt
+
+from erpnext.accounts.party import get_due_date
+from erpnext.exceptions import PartyDisabled, PartyFrozen
from erpnext.selling.doctype.customer.customer import get_credit_limit, get_customer_outstanding
from erpnext.tests.utils import create_test_contact_and_address
@@ -19,6 +20,7 @@
from six import iteritems
+
class TestCustomer(unittest.TestCase):
def setUp(self):
if not frappe.get_value('Item', '_Test Item'):
@@ -253,10 +255,10 @@
return get_customer_outstanding('_Test Customer', '_Test Company')
def test_customer_credit_limit(self):
- from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
- from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
+ from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
+ from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
outstanding_amt = self.get_customer_outstanding_amount()
credit_limit = get_credit_limit('_Test Customer', '_Test Company')
@@ -374,4 +376,4 @@
else:
customer_name = frappe.db.get_value("Customer", customer_name)
- return customer_name
\ No newline at end of file
+ return customer_name
diff --git a/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.py b/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.py
index 60a4a9a..53bcc1b 100644
--- a/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.py
+++ b/erpnext/selling/doctype/customer_credit_limit/customer_credit_limit.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class CustomerCreditLimit(Document):
pass
diff --git a/erpnext/selling/doctype/industry_type/industry_type.py b/erpnext/selling/doctype/industry_type/industry_type.py
index 7a30d65..6d413ec 100644
--- a/erpnext/selling/doctype/industry_type/industry_type.py
+++ b/erpnext/selling/doctype/industry_type/industry_type.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class IndustryType(Document):
pass
diff --git a/erpnext/selling/doctype/industry_type/test_industry_type.py b/erpnext/selling/doctype/industry_type/test_industry_type.py
index ebc6366..d6cf79b 100644
--- a/erpnext/selling/doctype/industry_type/test_industry_type.py
+++ b/erpnext/selling/doctype/industry_type/test_industry_type.py
@@ -2,6 +2,6 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
import frappe
+
test_records = frappe.get_test_records('Industry Type')
diff --git a/erpnext/selling/doctype/installation_note/installation_note.py b/erpnext/selling/doctype/installation_note/installation_note.py
index ffcbb2d..128a941 100644
--- a/erpnext/selling/doctype/installation_note/installation_note.py
+++ b/erpnext/selling/doctype/installation_note/installation_note.py
@@ -2,15 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+import frappe
+from frappe import _
from frappe.utils import cstr, getdate
-from frappe import _
from erpnext.stock.utils import get_valid_serial_nos
-
from erpnext.utilities.transaction_base import TransactionBase
+
class InstallationNote(TransactionBase):
def __init__(self, *args, **kwargs):
super(InstallationNote, self).__init__(*args, **kwargs)
diff --git a/erpnext/selling/doctype/installation_note/test_installation_note.py b/erpnext/selling/doctype/installation_note/test_installation_note.py
index 553d070..abfda9c 100644
--- a/erpnext/selling/doctype/installation_note/test_installation_note.py
+++ b/erpnext/selling/doctype/installation_note/test_installation_note.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Installation Note')
diff --git a/erpnext/selling/doctype/installation_note_item/installation_note_item.py b/erpnext/selling/doctype/installation_note_item/installation_note_item.py
index 7e12052..862c2a1 100644
--- a/erpnext/selling/doctype/installation_note_item/installation_note_item.py
+++ b/erpnext/selling/doctype/installation_note_item/installation_note_item.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class InstallationNoteItem(Document):
pass
diff --git a/erpnext/selling/doctype/product_bundle/product_bundle.py b/erpnext/selling/doctype/product_bundle/product_bundle.py
index ae3482f..4c73916 100644
--- a/erpnext/selling/doctype/product_bundle/product_bundle.py
+++ b/erpnext/selling/doctype/product_bundle/product_bundle.py
@@ -2,13 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+import frappe
+from frappe import _
+from frappe.model.document import Document
from frappe.utils import get_link_to_form
-from frappe import _
-
-from frappe.model.document import Document
class ProductBundle(Document):
def autoname(self):
diff --git a/erpnext/selling/doctype/product_bundle/test_product_bundle.py b/erpnext/selling/doctype/product_bundle/test_product_bundle.py
index 7d1d372..13bd2a3 100644
--- a/erpnext/selling/doctype/product_bundle/test_product_bundle.py
+++ b/erpnext/selling/doctype/product_bundle/test_product_bundle.py
@@ -3,8 +3,8 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
import frappe
+
test_records = frappe.get_test_records('Product Bundle')
def make_product_bundle(parent, items, qty=None):
diff --git a/erpnext/selling/doctype/product_bundle_item/product_bundle_item.py b/erpnext/selling/doctype/product_bundle_item/product_bundle_item.py
index 8721bfa..5f71a27 100644
--- a/erpnext/selling/doctype/product_bundle_item/product_bundle_item.py
+++ b/erpnext/selling/doctype/product_bundle_item/product_bundle_item.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ProductBundleItem(Document):
pass
diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js
index 1223449..0e1a915 100644
--- a/erpnext/selling/doctype/quotation/quotation.js
+++ b/erpnext/selling/doctype/quotation/quotation.js
@@ -18,6 +18,8 @@
}
});
+ frm.set_df_property('packed_items', 'cannot_add_rows', true);
+ frm.set_df_property('packed_items', 'cannot_delete_rows', true);
},
refresh: function(frm) {
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index 3eba62b..43a4490 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -43,6 +43,8 @@
"ignore_pricing_rule",
"items_section",
"items",
+ "bundle_items_section",
+ "packed_items",
"pricing_rule_details",
"pricing_rules",
"sec_break23",
@@ -926,6 +928,24 @@
"label": "Lost Reasons",
"options": "Quotation Lost Reason Detail",
"read_only": 1
+ },
+ {
+ "depends_on": "packed_items",
+ "fieldname": "packed_items",
+ "fieldtype": "Table",
+ "label": "Bundle Items",
+ "options": "Packed Item",
+ "print_hide": 1
+ },
+ {
+ "collapsible": 1,
+ "collapsible_depends_on": "packed_items",
+ "depends_on": "packed_items",
+ "fieldname": "bundle_items_section",
+ "fieldtype": "Section Break",
+ "label": "Bundle Items",
+ "options": "fa fa-suitcase",
+ "print_hide": 1
}
],
"icon": "fa fa-shopping-cart",
@@ -933,7 +953,7 @@
"is_submittable": 1,
"links": [],
"max_attachments": 1,
- "modified": "2020-10-30 13:58:59.212060",
+ "modified": "2021-08-27 20:10:07.864951",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation",
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index e4f8a47..99c43bf 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -2,10 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.mapper import get_mapped_doc
-from frappe.utils import flt, nowdate, getdate
from frappe import _
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import flt, getdate, nowdate
from erpnext.controllers.selling_controller import SellingController
@@ -31,6 +32,9 @@
if self.items:
self.with_items = 1
+ from erpnext.stock.doctype.packed_item.packed_item import make_packing_list
+ make_packing_list(self)
+
def validate_valid_till(self):
if self.valid_till and getdate(self.valid_till) < getdate(self.transaction_date):
frappe.throw(_("Valid till date cannot be before transaction date"))
diff --git a/erpnext/selling/doctype/quotation/quotation_dashboard.py b/erpnext/selling/doctype/quotation/quotation_dashboard.py
index d1bb788..9586cb1 100644
--- a/erpnext/selling/doctype/quotation/quotation_dashboard.py
+++ b/erpnext/selling/doctype/quotation/quotation_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'prevdoc_docname',
diff --git a/erpnext/selling/doctype/quotation/test_quotation.py b/erpnext/selling/doctype/quotation/test_quotation.py
index 527a999..a44089a 100644
--- a/erpnext/selling/doctype/quotation/test_quotation.py
+++ b/erpnext/selling/doctype/quotation/test_quotation.py
@@ -2,10 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import flt, add_days, nowdate, add_months, getdate
import unittest
+import frappe
+from frappe.utils import add_days, add_months, flt, getdate, nowdate
+
test_dependencies = ["Product Bundle"]
@@ -133,8 +134,10 @@
def test_create_quotation_with_margin(self):
from erpnext.selling.doctype.quotation.quotation import make_sales_order
- from erpnext.selling.doctype.sales_order.sales_order \
- import make_delivery_note, make_sales_invoice
+ from erpnext.selling.doctype.sales_order.sales_order import (
+ make_delivery_note,
+ make_sales_invoice,
+ )
rate_with_margin = flt((1500*18.75)/100 + 1500)
@@ -226,9 +229,87 @@
expired_quotation.reload()
self.assertEqual(expired_quotation.status, "Expired")
+ def test_product_bundle_mapping_on_creating_so(self):
+ from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle
+ from erpnext.selling.doctype.quotation.quotation import make_sales_order
+ from erpnext.stock.doctype.item.test_item import make_item
+
+ make_item("_Test Product Bundle", {"is_stock_item": 0})
+ make_item("_Test Bundle Item 1", {"is_stock_item": 1})
+ make_item("_Test Bundle Item 2", {"is_stock_item": 1})
+
+ make_product_bundle("_Test Product Bundle",
+ ["_Test Bundle Item 1", "_Test Bundle Item 2"])
+
+ quotation = make_quotation(item_code="_Test Product Bundle", qty=1, rate=100)
+ sales_order = make_sales_order(quotation.name)
+
+ quotation_item = [quotation.items[0].item_code, quotation.items[0].rate, quotation.items[0].qty, quotation.items[0].amount]
+ so_item = [sales_order.items[0].item_code, sales_order.items[0].rate, sales_order.items[0].qty, sales_order.items[0].amount]
+
+ self.assertEqual(quotation_item, so_item)
+
+ quotation_packed_items = [
+ [quotation.packed_items[0].parent_item, quotation.packed_items[0].item_code, quotation.packed_items[0].qty],
+ [quotation.packed_items[1].parent_item, quotation.packed_items[1].item_code, quotation.packed_items[1].qty]
+ ]
+ so_packed_items = [
+ [sales_order.packed_items[0].parent_item, sales_order.packed_items[0].item_code, sales_order.packed_items[0].qty],
+ [sales_order.packed_items[1].parent_item, sales_order.packed_items[1].item_code, sales_order.packed_items[1].qty]
+ ]
+
+ self.assertEqual(quotation_packed_items, so_packed_items)
+
+ def test_product_bundle_price_calculation_when_calculate_bundle_price_is_unchecked(self):
+ from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle
+ from erpnext.stock.doctype.item.test_item import make_item
+
+ make_item("_Test Product Bundle", {"is_stock_item": 0})
+ bundle_item1 = make_item("_Test Bundle Item 1", {"is_stock_item": 1})
+ bundle_item2 = make_item("_Test Bundle Item 2", {"is_stock_item": 1})
+
+ make_product_bundle("_Test Product Bundle",
+ ["_Test Bundle Item 1", "_Test Bundle Item 2"])
+
+ bundle_item1.valuation_rate = 100
+ bundle_item1.save()
+
+ bundle_item2.valuation_rate = 200
+ bundle_item2.save()
+
+ quotation = make_quotation(item_code="_Test Product Bundle", qty=2, rate=100)
+ self.assertEqual(quotation.items[0].amount, 200)
+
+ def test_product_bundle_price_calculation_when_calculate_bundle_price_is_checked(self):
+ from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle
+ from erpnext.stock.doctype.item.test_item import make_item
+
+ make_item("_Test Product Bundle", {"is_stock_item": 0})
+ make_item("_Test Bundle Item 1", {"is_stock_item": 1})
+ make_item("_Test Bundle Item 2", {"is_stock_item": 1})
+
+ make_product_bundle("_Test Product Bundle",
+ ["_Test Bundle Item 1", "_Test Bundle Item 2"])
+
+ enable_calculate_bundle_price()
+
+ quotation = make_quotation(item_code="_Test Product Bundle", qty=2, rate=100, do_not_submit=1)
+ quotation.packed_items[0].rate = 100
+ quotation.packed_items[1].rate = 200
+ quotation.save()
+
+ self.assertEqual(quotation.items[0].amount, 600)
+ self.assertEqual(quotation.items[0].rate, 300)
+
+ enable_calculate_bundle_price(enable=0)
test_records = frappe.get_test_records('Quotation')
+def enable_calculate_bundle_price(enable=1):
+ selling_settings = frappe.get_doc("Selling Settings")
+ selling_settings.editable_bundle_item_rates = enable
+ selling_settings.save()
+
def get_quotation_dict(party_name=None, item_code=None):
if not party_name:
party_name = '_Test Customer'
diff --git a/erpnext/selling/doctype/quotation_item/quotation_item.py b/erpnext/selling/doctype/quotation_item/quotation_item.py
index 7384871..ea47249 100644
--- a/erpnext/selling/doctype/quotation_item/quotation_item.py
+++ b/erpnext/selling/doctype/quotation_item/quotation_item.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class QuotationItem(Document):
pass
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index b42c615..f692690 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -43,6 +43,9 @@
}
}
});
+
+ frm.set_df_property('packed_items', 'cannot_add_rows', true);
+ frm.set_df_property('packed_items', 'cannot_delete_rows', true);
},
refresh: function(frm) {
if(frm.doc.docstatus === 1 && frm.doc.status !== 'Closed'
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index 38ea5c8..85282ca 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -55,6 +55,8 @@
"items_section",
"scan_barcode",
"items",
+ "packing_list",
+ "packed_items",
"pricing_rule_details",
"pricing_rules",
"section_break_31",
@@ -101,8 +103,6 @@
"in_words",
"advance_paid",
"disable_rounded_total",
- "packing_list",
- "packed_items",
"payment_schedule_section",
"payment_terms_template",
"payment_schedule",
@@ -1019,6 +1019,7 @@
{
"collapsible": 1,
"collapsible_depends_on": "packed_items",
+ "depends_on": "packed_items",
"fieldname": "packing_list",
"fieldtype": "Section Break",
"hide_days": 1,
@@ -1029,14 +1030,14 @@
"print_hide": 1
},
{
+ "depends_on": "packed_items",
"fieldname": "packed_items",
"fieldtype": "Table",
"hide_days": 1,
"hide_seconds": 1,
"label": "Packed Items",
"options": "Packed Item",
- "print_hide": 1,
- "read_only": 1
+ "print_hide": 1
},
{
"fieldname": "payment_schedule_section",
@@ -1511,7 +1512,7 @@
"idx": 105,
"is_submittable": 1,
"links": [],
- "modified": "2021-08-17 20:15:26.531553",
+ "modified": "2021-09-01 15:12:24.115483",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 5d44582..9367609 100755
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -2,24 +2,32 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
import json
+
+import frappe
import frappe.utils
-from frappe.utils import cstr, flt, getdate, cint, nowdate, add_days, get_link_to_form, strip_html
from frappe import _
-from six import string_types
-from frappe.model.utils import get_fetch_values
-from frappe.model.mapper import get_mapped_doc
-from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty
-from frappe.desk.notifications import clear_doctype_notifications
from frappe.contacts.doctype.address.address import get_company_address
+from frappe.desk.notifications import clear_doctype_notifications
+from frappe.model.mapper import get_mapped_doc
+from frappe.model.utils import get_fetch_values
+from frappe.utils import add_days, cint, cstr, flt, get_link_to_form, getdate, nowdate, strip_html
+from six import string_types
+
+from erpnext.accounts.doctype.sales_invoice.sales_invoice import (
+ unlink_inter_company_doc,
+ update_linked_doc,
+ validate_inter_company_party,
+)
from erpnext.controllers.selling_controller import SellingController
+from erpnext.manufacturing.doctype.production_plan.production_plan import (
+ get_items_for_material_requests,
+)
from erpnext.selling.doctype.customer.customer import check_credit_limit
-from erpnext.stock.doctype.item.item import get_item_defaults
from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults
-from erpnext.manufacturing.doctype.production_plan.production_plan import get_items_for_material_requests
-from erpnext.accounts.doctype.sales_invoice.sales_invoice import validate_inter_company_party, update_linked_doc,\
- unlink_inter_company_doc
+from erpnext.stock.doctype.item.item import get_item_defaults
+from erpnext.stock.stock_balance import get_reserved_qty, update_bin_qty
form_grid_templates = {
"items": "templates/form_grid/item_grid.html"
@@ -947,11 +955,52 @@
"pricing_rules"
],
"postprocess": update_item,
- "condition": lambda doc: doc.ordered_qty < doc.stock_qty and doc.item_code in items_to_map
+ "condition": lambda doc: doc.ordered_qty < doc.stock_qty and doc.item_code in items_to_map and not is_product_bundle(doc.item_code)
+ },
+ "Packed Item": {
+ "doctype": "Purchase Order Item",
+ "field_map": [
+ ["parent", "sales_order"],
+ ["uom", "uom"],
+ ["conversion_factor", "conversion_factor"],
+ ["parent_item", "product_bundle"],
+ ["rate", "rate"]
+ ],
+ "field_no_map": [
+ "price_list_rate",
+ "item_tax_template",
+ "discount_percentage",
+ "discount_amount",
+ "supplier",
+ "pricing_rules"
+ ],
}
}, target_doc, set_missing_values)
+
+ set_delivery_date(doc.items, source_name)
+
return doc
+def set_delivery_date(items, sales_order):
+ delivery_dates = frappe.get_all(
+ 'Sales Order Item',
+ filters = {
+ 'parent': sales_order
+ },
+ fields = ['delivery_date', 'item_code']
+ )
+
+ delivery_by_item = frappe._dict()
+ for date in delivery_dates:
+ delivery_by_item[date.item_code] = date.delivery_date
+
+ for item in items:
+ if item.product_bundle:
+ item.schedule_date = delivery_by_item[item.product_bundle]
+
+def is_product_bundle(item_code):
+ return frappe.db.exists('Product Bundle', item_code)
+
@frappe.whitelist()
def make_work_orders(items, sales_order, company, project=None):
'''Make Work Orders against the given Sales Order for the given `items`'''
diff --git a/erpnext/selling/doctype/sales_order/sales_order_dashboard.py b/erpnext/selling/doctype/sales_order/sales_order_dashboard.py
index 2a71c27..ee3c707 100644
--- a/erpnext/selling/doctype/sales_order/sales_order_dashboard.py
+++ b/erpnext/selling/doctype/sales_order/sales_order_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'sales_order',
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index d685fbf..bbfe7c0 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -1,21 +1,29 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import json
import unittest
+
import frappe
import frappe.permissions
-from frappe.utils import flt, add_days, nowdate, getdate
from frappe.core.doctype.user_permission.test_user_permission import create_user
-from erpnext.selling.doctype.sales_order.sales_order \
- import make_material_request, make_delivery_note, make_sales_invoice, WarehouseRequired
-from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
-from erpnext.selling.doctype.sales_order.sales_order import make_work_orders
+from frappe.utils import add_days, flt, getdate, nowdate
+
from erpnext.controllers.accounts_controller import update_child_qty_rate
-from erpnext.selling.doctype.sales_order.sales_order import make_raw_material_request
from erpnext.manufacturing.doctype.blanket_order.test_blanket_order import make_blanket_order
from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle
+from erpnext.selling.doctype.sales_order.sales_order import (
+ WarehouseRequired,
+ make_delivery_note,
+ make_material_request,
+ make_raw_material_request,
+ make_sales_invoice,
+ make_work_orders,
+)
from erpnext.stock.doctype.item.test_item import make_item
+from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
+
class TestSalesOrder(unittest.TestCase):
@@ -162,8 +170,8 @@
self.assertEqual(so.get("items")[0].delivered_qty, 9)
# Make return deliver note, sales invoice and check quantity
- from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
+ from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
dn1 = create_delivery_note(is_return=1, return_against=dn.name, qty=-3, do_not_submit=True)
dn1.items[0].against_sales_order = so.name
@@ -444,8 +452,8 @@
self.assertRaises(frappe.ValidationError, update_child_qty_rate,'Sales Order', trans_item, so.name)
def test_update_child_with_precision(self):
- from frappe.model.meta import get_field_precision
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
+ from frappe.model.meta import get_field_precision
precision = get_field_precision(frappe.get_meta("Sales Order Item").get_field("rate"))
@@ -731,9 +739,11 @@
frappe.db.set_value("Stock Settings", None, "auto_insert_price_list_rate_if_missing", 1)
def test_drop_shipping(self):
- from erpnext.selling.doctype.sales_order.sales_order import make_purchase_order_for_default_supplier, \
- update_status as so_update_status
from erpnext.buying.doctype.purchase_order.purchase_order import update_status
+ from erpnext.selling.doctype.sales_order.sales_order import (
+ make_purchase_order_for_default_supplier,
+ )
+ from erpnext.selling.doctype.sales_order.sales_order import update_status as so_update_status
# make items
po_item = make_item("_Test Item for Drop Shipping", {"is_stock_item": 1, "delivered_by_supplier": 1})
@@ -815,8 +825,10 @@
so.cancel()
def test_drop_shipping_partial_order(self):
- from erpnext.selling.doctype.sales_order.sales_order import make_purchase_order_for_default_supplier, \
- update_status as so_update_status
+ from erpnext.selling.doctype.sales_order.sales_order import (
+ make_purchase_order_for_default_supplier,
+ )
+ from erpnext.selling.doctype.sales_order.sales_order import update_status as so_update_status
# make items
po_item1 = make_item("_Test Item for Drop Shipping 1", {"is_stock_item": 1, "delivered_by_supplier": 1})
@@ -869,7 +881,9 @@
def test_drop_shipping_full_for_default_suppliers(self):
"""Test if multiple POs are generated in one go against different default suppliers."""
- from erpnext.selling.doctype.sales_order.sales_order import make_purchase_order_for_default_supplier
+ from erpnext.selling.doctype.sales_order.sales_order import (
+ make_purchase_order_for_default_supplier,
+ )
if not frappe.db.exists("Item", "_Test Item for Drop Shipping 1"):
make_item("_Test Item for Drop Shipping 1", {"is_stock_item": 1, "delivered_by_supplier": 1})
@@ -906,6 +920,38 @@
self.assertEqual(purchase_orders[0].supplier, '_Test Supplier')
self.assertEqual(purchase_orders[1].supplier, '_Test Supplier 1')
+ def test_product_bundles_in_so_are_replaced_with_bundle_items_in_po(self):
+ """
+ Tests if the the Product Bundles in the Items table of Sales Orders are replaced with
+ their child items(from the Packed Items table) on creating a Purchase Order from it.
+ """
+ from erpnext.selling.doctype.sales_order.sales_order import make_purchase_order
+
+ product_bundle = make_item("_Test Product Bundle", {"is_stock_item": 0})
+ make_item("_Test Bundle Item 1", {"is_stock_item": 1})
+ make_item("_Test Bundle Item 2", {"is_stock_item": 1})
+
+ make_product_bundle("_Test Product Bundle",
+ ["_Test Bundle Item 1", "_Test Bundle Item 2"])
+
+ so_items = [
+ {
+ "item_code": product_bundle.item_code,
+ "warehouse": "",
+ "qty": 2,
+ "rate": 400,
+ "delivered_by_supplier": 1,
+ "supplier": '_Test Supplier'
+ }
+ ]
+
+ so = make_sales_order(item_list=so_items)
+
+ purchase_order = make_purchase_order(so.name, selected_items=so_items)
+
+ self.assertEqual(purchase_order.items[0].item_code, "_Test Bundle Item 1")
+ self.assertEqual(purchase_order.items[1].item_code, "_Test Bundle Item 2")
+
def test_reserved_qty_for_closing_so(self):
bin = frappe.get_all("Bin", filters={"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC"},
fields=["reserved_qty"])
@@ -1043,8 +1089,7 @@
}]
})
so.submit()
- from erpnext.manufacturing.doctype.work_order.test_work_order import \
- make_wo_order_test_record
+ from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record
work_order = make_wo_order_test_record(item=item.item_code,
qty=1, do_not_save=True)
work_order.fg_warehouse = "_Test Warehouse - _TC"
@@ -1052,8 +1097,9 @@
work_order.submit()
make_stock_entry(item_code=item.item_code, target="_Test Warehouse - _TC", qty=1)
item_serial_no = frappe.get_doc("Serial No", {"item_code": item.item_code})
- from erpnext.manufacturing.doctype.work_order.work_order import \
- make_stock_entry as make_production_stock_entry
+ from erpnext.manufacturing.doctype.work_order.work_order import (
+ make_stock_entry as make_production_stock_entry,
+ )
se = frappe.get_doc(make_production_stock_entry(work_order.name, "Manufacture", 1))
se.submit()
reserved_serial_no = se.get("items")[2].serial_no
@@ -1085,8 +1131,9 @@
si = make_sales_invoice(so.name)
si.update_stock = 0
si.submit()
- from erpnext.accounts.doctype.sales_invoice.sales_invoice import \
- make_delivery_note as make_delivery_note_from_invoice
+ from erpnext.accounts.doctype.sales_invoice.sales_invoice import (
+ make_delivery_note as make_delivery_note_from_invoice,
+ )
dn = make_delivery_note_from_invoice(si.name)
dn.save()
dn.submit()
@@ -1123,6 +1170,7 @@
def test_cancel_sales_order_after_cancel_payment_entry(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry
+
# make a sales order
so = make_sales_order()
@@ -1232,7 +1280,9 @@
self.assertRaises(frappe.ValidationError, so.cancel)
def test_payment_terms_are_fetched_when_creating_sales_invoice(self):
- from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_terms_template
+ from erpnext.accounts.doctype.payment_entry.test_payment_entry import (
+ create_payment_terms_template,
+ )
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
automatically_fetch_payment_terms()
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.py b/erpnext/selling/doctype/sales_order_item/sales_order_item.py
index 62afef3..772aa6c 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.py
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.py
@@ -2,10 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+import frappe
from frappe.model.document import Document
+
class SalesOrderItem(Document):
pass
diff --git a/erpnext/selling/doctype/sales_partner_type/sales_partner_type.py b/erpnext/selling/doctype/sales_partner_type/sales_partner_type.py
index 68d289f..bdabef2 100644
--- a/erpnext/selling/doctype/sales_partner_type/sales_partner_type.py
+++ b/erpnext/selling/doctype/sales_partner_type/sales_partner_type.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class SalesPartnerType(Document):
pass
diff --git a/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py b/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py
index fb8f8b0..895b0ec 100644
--- a/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py
+++ b/erpnext/selling/doctype/sales_partner_type/test_sales_partner_type.py
@@ -5,5 +5,6 @@
import unittest
+
class TestSalesPartnerType(unittest.TestCase):
pass
diff --git a/erpnext/selling/doctype/sales_team/sales_team.py b/erpnext/selling/doctype/sales_team/sales_team.py
index 28bea25..9b542c0 100644
--- a/erpnext/selling/doctype/sales_team/sales_team.py
+++ b/erpnext/selling/doctype/sales_team/sales_team.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class SalesTeam(Document):
pass
diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.json b/erpnext/selling/doctype/selling_settings/selling_settings.json
index 717fd9b..59fcb98 100644
--- a/erpnext/selling/doctype/selling_settings/selling_settings.json
+++ b/erpnext/selling/doctype/selling_settings/selling_settings.json
@@ -18,17 +18,18 @@
"close_opportunity_after_days",
"item_price_settings_section",
"selling_price_list",
+ "maintain_same_rate_action",
+ "role_to_override_stop_action",
"column_break_15",
"maintain_same_sales_rate",
- "maintain_same_rate_action",
"editable_price_list_rate",
"validate_selling_price",
+ "editable_bundle_item_rates",
"sales_transactions_settings_section",
"so_required",
"dn_required",
"sales_update_frequency",
"column_break_5",
- "role_to_override_stop_action",
"allow_multiple_items",
"allow_against_multiple_purchase_orders",
"hide_tax_id"
@@ -146,15 +147,14 @@
{
"default": "Stop",
"depends_on": "maintain_same_sales_rate",
- "description": "Configure the action to stop the transaction or just warn if the same rate is not maintained.",
"fieldname": "maintain_same_rate_action",
"fieldtype": "Select",
- "label": "Action if Same Rate is Not Maintained",
+ "label": "Action if Same Rate is Not Maintained Throughout Sales Cycle",
"mandatory_depends_on": "maintain_same_sales_rate",
"options": "Stop\nWarn"
},
{
- "depends_on": "eval: doc.maintain_same_rate_action == 'Stop'",
+ "depends_on": "eval: doc.maintain_same_sales_rate && doc.maintain_same_rate_action == 'Stop'",
"fieldname": "role_to_override_stop_action",
"fieldtype": "Link",
"label": "Role Allowed to Override Stop Action",
@@ -191,6 +191,12 @@
"fieldname": "sales_transactions_settings_section",
"fieldtype": "Section Break",
"label": "Transaction Settings"
+ },
+ {
+ "default": "0",
+ "fieldname": "editable_bundle_item_rates",
+ "fieldtype": "Check",
+ "label": "Calculate Product Bundle Price based on Child Items' Rates"
}
],
"icon": "fa fa-cog",
@@ -198,7 +204,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
- "modified": "2021-08-06 22:25:50.119458",
+ "modified": "2021-09-01 22:55:33.803624",
"modified_by": "Administrator",
"module": "Selling",
"name": "Selling Settings",
@@ -217,4 +223,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
-}
\ No newline at end of file
+}
diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.py b/erpnext/selling/doctype/selling_settings/selling_settings.py
index b219e7e..5bed43e 100644
--- a/erpnext/selling/doctype/selling_settings/selling_settings.py
+++ b/erpnext/selling/doctype/selling_settings/selling_settings.py
@@ -4,17 +4,18 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-import frappe.defaults
-from frappe.utils import cint
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
+from frappe.model.document import Document
+from frappe.utils import cint
from frappe.utils.nestedset import get_root_of
-from frappe.model.document import Document
class SellingSettings(Document):
def on_update(self):
self.toggle_hide_tax_id()
+ self.toggle_editable_rate_for_bundle_items()
def validate(self):
for key in ["cust_master_name", "campaign_naming_by", "customer_group", "territory",
@@ -33,6 +34,11 @@
make_property_setter(doctype, "tax_id", "hidden", self.hide_tax_id, "Check", validate_fields_for_doctype=False)
make_property_setter(doctype, "tax_id", "print_hide", self.hide_tax_id, "Check", validate_fields_for_doctype=False)
+ def toggle_editable_rate_for_bundle_items(self):
+ editable_bundle_item_rates = cint(self.editable_bundle_item_rates)
+
+ make_property_setter("Packed Item", "rate", "read_only", not(editable_bundle_item_rates), "Check", validate_fields_for_doctype=False)
+
def set_default_customer_group_and_territory(self):
if not self.customer_group:
self.customer_group = get_root_of('Customer Group')
diff --git a/erpnext/selling/doctype/selling_settings/test_selling_settings.py b/erpnext/selling/doctype/selling_settings/test_selling_settings.py
index 961a54d..572a110 100644
--- a/erpnext/selling/doctype/selling_settings/test_selling_settings.py
+++ b/erpnext/selling/doctype/selling_settings/test_selling_settings.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestSellingSettings(unittest.TestCase):
pass
diff --git a/erpnext/selling/doctype/sms_center/sms_center.py b/erpnext/selling/doctype/sms_center/sms_center.py
index 87846a8..45aee4e 100644
--- a/erpnext/selling/doctype/sms_center/sms_center.py
+++ b/erpnext/selling/doctype/sms_center/sms_center.py
@@ -2,14 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-
-from frappe.utils import cstr
-from frappe import msgprint, _
-
-from frappe.model.document import Document
-
+from frappe import _, msgprint
from frappe.core.doctype.sms_settings.sms_settings import send_sms
+from frappe.model.document import Document
+from frappe.utils import cstr
+
class SMSCenter(Document):
@frappe.whitelist()
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.py b/erpnext/selling/page/point_of_sale/point_of_sale.py
index 03c46bb..b4338c9 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.py
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.py
@@ -2,11 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, json
+
+import json
+
+import frappe
from frappe.utils.nestedset import get_root_of
-from frappe.utils import cint
-from erpnext.accounts.doctype.pos_profile.pos_profile import get_item_groups
+
from erpnext.accounts.doctype.pos_invoice.pos_invoice import get_stock_availability
+from erpnext.accounts.doctype.pos_profile.pos_profile import get_item_groups
+
def search_by_term(search_term, warehouse, price_list):
result = search_for_serial_or_batch_or_barcode_number(search_term) or {}
@@ -209,7 +213,6 @@
@frappe.whitelist()
def create_opening_voucher(pos_profile, company, balance_details):
- import json
balance_details = json.loads(balance_details)
new_pos_opening = frappe.get_doc({
diff --git a/erpnext/selling/page/point_of_sale/pos_payment.js b/erpnext/selling/page/point_of_sale/pos_payment.js
index 63306ad..8e69851 100644
--- a/erpnext/selling/page/point_of_sale/pos_payment.js
+++ b/erpnext/selling/page/point_of_sale/pos_payment.js
@@ -253,41 +253,6 @@
}
}
- setup_listener_for_payments() {
- frappe.realtime.on("process_phone_payment", (data) => {
- const doc = this.events.get_frm().doc;
- const { response, amount, success, failure_message } = data;
- let message, title;
-
- if (success) {
- title = __("Payment Received");
- if (amount >= doc.grand_total) {
- frappe.dom.unfreeze();
- message = __("Payment of {0} received successfully.", [format_currency(amount, doc.currency, 0)]);
- this.events.submit_invoice();
- cur_frm.reload_doc();
-
- } else {
- message = __("Payment of {0} received successfully. Waiting for other requests to complete...", [format_currency(amount, doc.currency, 0)]);
- }
- } else if (failure_message) {
- message = failure_message;
- title = __("Payment Failed");
- }
-
- frappe.msgprint({ "message": message, "title": title });
- });
- }
-
- auto_set_remaining_amount() {
- const doc = this.events.get_frm().doc;
- const remaining_amount = doc.grand_total - doc.paid_amount;
- const current_value = this.selected_mode ? this.selected_mode.get_value() : undefined;
- if (!current_value && remaining_amount > 0 && this.selected_mode) {
- this.selected_mode.set_value(remaining_amount);
- }
- }
-
attach_shortcuts() {
const ctrl_label = frappe.utils.is_mac() ? '⌘' : 'Ctrl';
this.$component.find('.submit-order-btn').attr("title", `${ctrl_label}+Enter`);
diff --git a/erpnext/selling/page/sales_funnel/sales_funnel.py b/erpnext/selling/page/sales_funnel/sales_funnel.py
index 78aaa49..043a3e7 100644
--- a/erpnext/selling/page/sales_funnel/sales_funnel.py
+++ b/erpnext/selling/page/sales_funnel/sales_funnel.py
@@ -2,11 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe import _
-from erpnext.accounts.report.utils import convert
+import frappe
import pandas as pd
+from frappe import _
+
+from erpnext.accounts.report.utils import convert
+
def validate_filters(from_date, to_date, company):
if from_date and to_date and (from_date >= to_date):
diff --git a/erpnext/selling/report/address_and_contacts/address_and_contacts.py b/erpnext/selling/report/address_and_contacts/address_and_contacts.py
index f295333..fea19f9 100644
--- a/erpnext/selling/report/address_and_contacts/address_and_contacts.py
+++ b/erpnext/selling/report/address_and_contacts/address_and_contacts.py
@@ -2,10 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from six.moves import range
-from six import iteritems
-import frappe
+import frappe
+from six import iteritems
+from six.moves import range
field_map = {
"Contact": [ "first_name", "last_name", "phone", "mobile_no", "email_id", "is_primary_contact" ],
diff --git a/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py b/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py
index 5523bad..c7040be 100644
--- a/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py
+++ b/erpnext/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.utils import flt
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py
index f15f63d..a29b5c8 100644
--- a/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py
+++ b/erpnext/selling/report/customer_acquisition_and_loyalty/customer_acquisition_and_loyalty.py
@@ -2,11 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import calendar
+
import frappe
from frappe import _
from frappe.utils import cint, cstr, getdate
+
def execute(filters=None):
common_columns = [
{
diff --git a/erpnext/selling/report/customer_credit_balance/customer_credit_balance.py b/erpnext/selling/report/customer_credit_balance/customer_credit_balance.py
index 6fb7666..ed2fbfd 100644
--- a/erpnext/selling/report/customer_credit_balance/customer_credit_balance.py
+++ b/erpnext/selling/report/customer_credit_balance/customer_credit_balance.py
@@ -2,10 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt
-from erpnext.selling.doctype.customer.customer import get_customer_outstanding, get_credit_limit
+
+from erpnext.selling.doctype.customer.customer import get_credit_limit, get_customer_outstanding
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/selling/report/customer_wise_item_price/customer_wise_item_price.py b/erpnext/selling/report/customer_wise_item_price/customer_wise_item_price.py
index eb9273a..535d551 100644
--- a/erpnext/selling/report/customer_wise_item_price/customer_wise_item_price.py
+++ b/erpnext/selling/report/customer_wise_item_price/customer_wise_item_price.py
@@ -4,10 +4,11 @@
from __future__ import unicode_literals
import frappe
+from frappe import _
+
from erpnext import get_default_company
from erpnext.accounts.party import get_party_details
from erpnext.stock.get_item_details import get_price_list_rate_for
-from frappe import _
def execute(filters=None):
diff --git a/erpnext/selling/report/inactive_customers/inactive_customers.py b/erpnext/selling/report/inactive_customers/inactive_customers.py
index e7aff36..c79efe2 100644
--- a/erpnext/selling/report/inactive_customers/inactive_customers.py
+++ b/erpnext/selling/report/inactive_customers/inactive_customers.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import cint
from frappe import _
+from frappe.utils import cint
+
def execute(filters=None):
if not filters: filters ={}
diff --git a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py
index 1700fc7..5396312 100644
--- a/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py
+++ b/erpnext/selling/report/item_wise_sales_history/item_wise_sales_history.py
@@ -2,11 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt
from frappe.utils.nestedset import get_descendants_of
+
def execute(filters=None):
filters = frappe._dict(filters or {})
if filters.from_date > filters.to_date:
diff --git a/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.py b/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.py
index e89c451..f241a3e 100644
--- a/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.py
+++ b/erpnext/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt
+
def execute(filters=None):
columns = get_columns()
data = get_data()
diff --git a/erpnext/selling/report/pending_so_items_for_purchase_request/test_pending_so_items_for_purchase_request.py b/erpnext/selling/report/pending_so_items_for_purchase_request/test_pending_so_items_for_purchase_request.py
index f2518f0..95e332a 100644
--- a/erpnext/selling/report/pending_so_items_for_purchase_request/test_pending_so_items_for_purchase_request.py
+++ b/erpnext/selling/report/pending_so_items_for_purchase_request/test_pending_so_items_for_purchase_request.py
@@ -2,12 +2,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import unittest
-from frappe.utils import nowdate, add_months
-from erpnext.selling.report.pending_so_items_for_purchase_request.pending_so_items_for_purchase_request\
- import execute
+
+from frappe.utils import add_months, nowdate
+
from erpnext.selling.doctype.sales_order.sales_order import make_material_request
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
+from erpnext.selling.report.pending_so_items_for_purchase_request.pending_so_items_for_purchase_request import (
+ execute,
+)
class TestPendingSOItemsForPurchaseRequest(unittest.TestCase):
diff --git a/erpnext/selling/report/quotation_trends/quotation_trends.py b/erpnext/selling/report/quotation_trends/quotation_trends.py
index 968e2ff..d2ee9a8 100644
--- a/erpnext/selling/report/quotation_trends/quotation_trends.py
+++ b/erpnext/selling/report/quotation_trends/quotation_trends.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe import _
-from erpnext.controllers.trends import get_columns, get_data
+
+from erpnext.controllers.trends import get_columns, get_data
+
def execute(filters=None):
if not filters: filters ={}
diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.py b/erpnext/selling/report/sales_analytics/sales_analytics.py
index d036a1c..56bcb31 100644
--- a/erpnext/selling/report/sales_analytics/sales_analytics.py
+++ b/erpnext/selling/report/sales_analytics/sales_analytics.py
@@ -2,12 +2,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _, scrub
-from frappe.utils import getdate, flt, add_to_date, add_days
+from frappe.utils import add_days, add_to_date, flt, getdate
from six import iteritems
+
from erpnext.accounts.utils import get_fiscal_year
+
def execute(filters=None):
return Analytics(filters).run()
@@ -293,7 +296,7 @@
return period
def get_period_date_ranges(self):
- from dateutil.relativedelta import relativedelta, MO
+ from dateutil.relativedelta import MO, relativedelta
from_date, to_date = getdate(self.filters.from_date), getdate(self.filters.to_date)
increment = {
diff --git a/erpnext/selling/report/sales_analytics/test_analytics.py b/erpnext/selling/report/sales_analytics/test_analytics.py
index 4d81a1e..a180099 100644
--- a/erpnext/selling/report/sales_analytics/test_analytics.py
+++ b/erpnext/selling/report/sales_analytics/test_analytics.py
@@ -2,11 +2,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-import frappe.defaults
+
import unittest
-from erpnext.selling.report.sales_analytics.sales_analytics import execute
+
+import frappe
+
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
+from erpnext.selling.report.sales_analytics.sales_analytics import execute
+
class TestAnalytics(unittest.TestCase):
def test_sales_analytics(self):
diff --git a/erpnext/selling/report/sales_order_analysis/sales_order_analysis.py b/erpnext/selling/report/sales_order_analysis/sales_order_analysis.py
index 00dcd69..805c3d8 100644
--- a/erpnext/selling/report/sales_order_analysis/sales_order_analysis.py
+++ b/erpnext/selling/report/sales_order_analysis/sales_order_analysis.py
@@ -2,10 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import copy
+
+import frappe
from frappe import _
-from frappe.utils import flt, date_diff, getdate
+from frappe.utils import date_diff, flt, getdate
+
def execute(filters=None):
if not filters:
diff --git a/erpnext/selling/report/sales_order_trends/sales_order_trends.py b/erpnext/selling/report/sales_order_trends/sales_order_trends.py
index de7d3f2..89daf44 100644
--- a/erpnext/selling/report/sales_order_trends/sales_order_trends.py
+++ b/erpnext/selling/report/sales_order_trends/sales_order_trends.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe import _
-from erpnext.controllers.trends import get_columns,get_data
+
+from erpnext.controllers.trends import get_columns, get_data
+
def execute(filters=None):
if not filters: filters ={}
diff --git a/erpnext/selling/report/sales_partner_commission_summary/sales_partner_commission_summary.py b/erpnext/selling/report/sales_partner_commission_summary/sales_partner_commission_summary.py
index 2c49d51..a84dec0 100644
--- a/erpnext/selling/report/sales_partner_commission_summary/sales_partner_commission_summary.py
+++ b/erpnext/selling/report/sales_partner_commission_summary/sales_partner_commission_summary.py
@@ -2,9 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import msgprint, _
-from frappe.utils import flt
+from frappe import _, msgprint
def execute(filters=None):
diff --git a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/item_group_wise_sales_target_variance.py b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/item_group_wise_sales_target_variance.py
index 24ca666..d4f49c71 100644
--- a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/item_group_wise_sales_target_variance.py
+++ b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/item_group_wise_sales_target_variance.py
@@ -2,12 +2,16 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt
-from erpnext.accounts.utils import get_fiscal_year
+
+from erpnext.accounts.doctype.monthly_distribution.monthly_distribution import (
+ get_periodwise_distribution_data,
+)
from erpnext.accounts.report.financial_statements import get_period_list
-from erpnext.accounts.doctype.monthly_distribution.monthly_distribution import get_periodwise_distribution_data
+from erpnext.accounts.utils import get_fiscal_year
+
def get_data_column(filters, partner_doctype):
data = []
@@ -44,18 +48,6 @@
if d.item_group not in item_groups:
item_groups.append(d.item_group)
- if item_groups:
- child_items = []
- for item_group in item_groups:
- if frappe.db.get_value("Item Group", {"name":item_group}, "is_group"):
- for child_item_group in frappe.get_all("Item Group", {"parent_item_group":item_group}):
- if child_item_group['name'] not in child_items:
- child_items.append(child_item_group['name'])
-
- for item in child_items:
- if item not in item_groups:
- item_groups.append(item)
-
date_field = ("transaction_date"
if filters.get('doctype') == "Sales Order" else "posting_date")
diff --git a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/sales_partner_target_variance_based_on_item_group.py b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/sales_partner_target_variance_based_on_item_group.py
index 87ed5a8..de21c4a 100644
--- a/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/sales_partner_target_variance_based_on_item_group.py
+++ b/erpnext/selling/report/sales_partner_target_variance_based_on_item_group/sales_partner_target_variance_based_on_item_group.py
@@ -2,8 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from erpnext.selling.report.sales_partner_target_variance_based_on_item_group.item_group_wise_sales_target_variance import get_data_column
+
+from erpnext.selling.report.sales_partner_target_variance_based_on_item_group.item_group_wise_sales_target_variance import (
+ get_data_column,
+)
+
def execute(filters=None):
data = []
diff --git a/erpnext/selling/report/sales_partner_transaction_summary/sales_partner_transaction_summary.py b/erpnext/selling/report/sales_partner_transaction_summary/sales_partner_transaction_summary.py
index f07293d..39ec072 100644
--- a/erpnext/selling/report/sales_partner_transaction_summary/sales_partner_transaction_summary.py
+++ b/erpnext/selling/report/sales_partner_transaction_summary/sales_partner_transaction_summary.py
@@ -2,9 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import msgprint, _
-from frappe.utils import flt
+from frappe import _, msgprint
def execute(filters=None):
diff --git a/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.py b/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.py
index 9917d72..13245b7 100644
--- a/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.py
+++ b/erpnext/selling/report/sales_person_commission_summary/sales_person_commission_summary.py
@@ -2,9 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import msgprint, _
-from frappe.utils import flt
+from frappe import _, msgprint
def execute(filters=None):
diff --git a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/sales_person_target_variance_based_on_item_group.py b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/sales_person_target_variance_based_on_item_group.py
index ea9bbab..83a1c2c 100644
--- a/erpnext/selling/report/sales_person_target_variance_based_on_item_group/sales_person_target_variance_based_on_item_group.py
+++ b/erpnext/selling/report/sales_person_target_variance_based_on_item_group/sales_person_target_variance_based_on_item_group.py
@@ -2,8 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from erpnext.selling.report.sales_partner_target_variance_based_on_item_group.item_group_wise_sales_target_variance import get_data_column
+
+from erpnext.selling.report.sales_partner_target_variance_based_on_item_group.item_group_wise_sales_target_variance import (
+ get_data_column,
+)
+
def execute(filters=None):
data = []
diff --git a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py
index 41c7f76..9dc2923 100644
--- a/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py
+++ b/erpnext/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py
@@ -2,11 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import msgprint, _
-from frappe.utils import flt
+from frappe import _, msgprint
+
from erpnext import get_company_currency
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/selling/report/territory_target_variance_based_on_item_group/territory_target_variance_based_on_item_group.py b/erpnext/selling/report/territory_target_variance_based_on_item_group/territory_target_variance_based_on_item_group.py
index b1d89cc..b340124 100644
--- a/erpnext/selling/report/territory_target_variance_based_on_item_group/territory_target_variance_based_on_item_group.py
+++ b/erpnext/selling/report/territory_target_variance_based_on_item_group/territory_target_variance_based_on_item_group.py
@@ -2,8 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from erpnext.selling.report.sales_partner_target_variance_based_on_item_group.item_group_wise_sales_target_variance import get_data_column
+
+from erpnext.selling.report.sales_partner_target_variance_based_on_item_group.item_group_wise_sales_target_variance import (
+ get_data_column,
+)
+
def execute(filters=None):
data = []
diff --git a/erpnext/selling/report/territory_wise_sales/territory_wise_sales.py b/erpnext/selling/report/territory_wise_sales/territory_wise_sales.py
index e883500..c334381 100644
--- a/erpnext/selling/report/territory_wise_sales/territory_wise_sales.py
+++ b/erpnext/selling/report/territory_wise_sales/territory_wise_sales.py
@@ -2,10 +2,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from erpnext import get_default_currency
from frappe import _
+from erpnext import get_default_currency
+
+
def execute(filters=None):
filters = frappe._dict(filters)
columns = get_columns()
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 2de57c8..955ef5e 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -90,10 +90,7 @@
this.frm.toggle_display("customer_name",
(this.frm.doc.customer_name && this.frm.doc.customer_name!==this.frm.doc.customer));
- if(this.frm.fields_dict.packed_items) {
- var packing_list_exists = (this.frm.doc.packed_items || []).length;
- this.frm.toggle_display("packing_list", packing_list_exists ? true : false);
- }
+
this.toggle_editable_price_list_rate();
}
diff --git a/erpnext/setup/default_energy_point_rules.py b/erpnext/setup/default_energy_point_rules.py
index 8dbccc4..c41d000 100644
--- a/erpnext/setup/default_energy_point_rules.py
+++ b/erpnext/setup/default_energy_point_rules.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
from frappe import _
doctype_rule_map = {
diff --git a/erpnext/setup/default_success_action.py b/erpnext/setup/default_success_action.py
index 827839f..be072fc 100644
--- a/erpnext/setup/default_success_action.py
+++ b/erpnext/setup/default_success_action.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
from frappe import _
doctype_list = [
diff --git a/erpnext/setup/doctype/authorization_control/authorization_control.py b/erpnext/setup/doctype/authorization_control/authorization_control.py
index fec5c7c..332d7f4 100644
--- a/erpnext/setup/doctype/authorization_control/authorization_control.py
+++ b/erpnext/setup/doctype/authorization_control/authorization_control.py
@@ -2,11 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import cstr, flt, has_common, comma_or
-from frappe import session, _
+from frappe import _, session
+from frappe.utils import comma_or, cstr, flt, has_common
+
from erpnext.utilities.transaction_base import TransactionBase
+
class AuthorizationControl(TransactionBase):
def get_appr_user_role(self, det, doctype_name, total, based_on, condition, item, company):
amt_list, appr_users, appr_roles = [], [], []
diff --git a/erpnext/setup/doctype/authorization_rule/authorization_rule.py b/erpnext/setup/doctype/authorization_rule/authorization_rule.py
index eb8e6eb..ab0f420 100644
--- a/erpnext/setup/doctype/authorization_rule/authorization_rule.py
+++ b/erpnext/setup/doctype/authorization_rule/authorization_rule.py
@@ -2,12 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-
-from frappe.utils import cstr, flt
-from frappe import _, msgprint
-
+from frappe import _
from frappe.model.document import Document
+from frappe.utils import cstr, flt
+
class AuthorizationRule(Document):
def check_duplicate_entry(self):
diff --git a/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py b/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py
index 332f103..8a0f664 100644
--- a/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py
+++ b/erpnext/setup/doctype/authorization_rule/test_authorization_rule.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Authorization Rule')
diff --git a/erpnext/setup/doctype/brand/brand.py b/erpnext/setup/doctype/brand/brand.py
index a8d1cf8..4cfb018 100644
--- a/erpnext/setup/doctype/brand/brand.py
+++ b/erpnext/setup/doctype/brand/brand.py
@@ -2,11 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
import copy
+import frappe
from frappe.model.document import Document
+
class Brand(Document):
pass
diff --git a/erpnext/setup/doctype/brand/test_brand.py b/erpnext/setup/doctype/brand/test_brand.py
index 25ed86e..16873c9 100644
--- a/erpnext/setup/doctype/brand/test_brand.py
+++ b/erpnext/setup/doctype/brand/test_brand.py
@@ -2,6 +2,6 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
import frappe
+
test_records = frappe.get_test_records('Brand')
diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js
index 56700af..8403193 100644
--- a/erpnext/setup/doctype/company/company.js
+++ b/erpnext/setup/doctype/company/company.js
@@ -55,10 +55,10 @@
{"fieldtype": "Button", "label": "Update", "fieldname": "update"},
]
});
-
+
dialog.fields_dict.update.$input.click(function() {
var args = dialog.get_values();
- if (!args) return;
+ if (!args) return;
frappe.show_alert(__("Update in progress. It might take a while."));
return frappe.call({
method: "erpnext.setup.doctype.company.company.enqueue_replace_abbr",
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 6dee2ad..6257d56 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -2,23 +2,24 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, os, json
-from frappe import _
-from frappe.utils import get_timestamp
-from frappe.utils import cint, today, formatdate
-import frappe.defaults
-from frappe.cache_manager import clear_defaults_cache
-
-from frappe.model.document import Document
-from frappe.contacts.address_and_contact import load_address_and_contact
-from frappe.utils.nestedset import NestedSet
-
-from past.builtins import cmp
import functools
+import json
+import os
+
+import frappe
+import frappe.defaults
+from frappe import _
+from frappe.cache_manager import clear_defaults_cache
+from frappe.contacts.address_and_contact import load_address_and_contact
+from frappe.utils import cint, formatdate, get_timestamp, today
+from frappe.utils.nestedset import NestedSet
+from past.builtins import cmp
+
from erpnext.accounts.doctype.account.account import get_account_currency
from erpnext.setup.setup_wizard.operations.taxes_setup import setup_taxes_and_charges
+
class Company(NestedSet):
nsm_parent_field = 'parent_company'
@@ -479,8 +480,9 @@
def update_company_monthly_sales(company):
'''Cache past year monthly sales of every company based on sales invoices'''
- from frappe.utils.goal import get_monthly_results
import json
+
+ from frappe.utils.goal import get_monthly_results
filter_str = "company = {0} and status != 'Draft' and docstatus=1".format(frappe.db.escape(company))
month_to_value_dict = get_monthly_results("Sales Invoice", "base_grand_total",
"posting_date", filter_str, "sum")
diff --git a/erpnext/setup/doctype/company/company_dashboard.py b/erpnext/setup/doctype/company/company_dashboard.py
index 2d76028..3afea09 100644
--- a/erpnext/setup/doctype/company/company_dashboard.py
+++ b/erpnext/setup/doctype/company/company_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'graph': True,
diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py
index 1b7fd4f..abc4689 100644
--- a/erpnext/setup/doctype/company/test_company.py
+++ b/erpnext/setup/doctype/company/test_company.py
@@ -2,12 +2,16 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-import unittest
import json
+import unittest
+
+import frappe
from frappe import _
from frappe.utils import random_string
-from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import get_charts_for_country
+
+from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import (
+ get_charts_for_country,
+)
test_ignore = ["Account", "Cost Center", "Payment Terms Template", "Salary Component", "Warehouse"]
test_dependencies = ["Fiscal Year"]
diff --git a/erpnext/setup/doctype/currency_exchange/currency_exchange.py b/erpnext/setup/doctype/currency_exchange/currency_exchange.py
index 6480f60..0b86e29 100644
--- a/erpnext/setup/doctype/currency_exchange/currency_exchange.py
+++ b/erpnext/setup/doctype/currency_exchange/currency_exchange.py
@@ -4,10 +4,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe import _, throw
from frappe.model.document import Document
-from frappe.utils import get_datetime_str, formatdate, nowdate, cint
+from frappe.utils import cint, formatdate, get_datetime_str, nowdate
+
class CurrencyExchange(Document):
def autoname(self):
diff --git a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py
index 4ff2dd7..2b007e9 100644
--- a/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py
+++ b/erpnext/setup/doctype/currency_exchange/test_currency_exchange.py
@@ -1,14 +1,16 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
-from __future__ import unicode_literals
-import frappe, unittest
-from frappe.utils import flt
+
+import unittest
+from unittest import mock
+
+import frappe
+from frappe.utils import cint, flt
+
from erpnext.setup.utils import get_exchange_rate
-from frappe.utils import cint
test_records = frappe.get_test_records('Currency Exchange')
-
def save_new_records(test_records):
for record in test_records:
# If both selling and buying enabled
@@ -37,18 +39,45 @@
curr_exchange.for_selling = record["for_selling"]
curr_exchange.insert()
+test_exchange_values = {
+ '2015-12-15': '66.999',
+ '2016-01-15': '65.1'
+}
+# Removing API call from get_exchange_rate
+def patched_requests_get(*args, **kwargs):
+ class PatchResponse:
+ def __init__(self, json_data, status_code):
+ self.json_data = json_data
+ self.status_code = status_code
+
+ def raise_for_status(self):
+ if self.status_code != 200:
+ raise frappe.DoesNotExistError
+
+ def json(self):
+ return self.json_data
+
+ if args[0] == "https://api.exchangerate.host/convert" and kwargs.get('params'):
+ if kwargs['params'].get('date') and kwargs['params'].get('from') and kwargs['params'].get('to'):
+ if test_exchange_values.get(kwargs['params']['date']):
+ return PatchResponse({'result': test_exchange_values[kwargs['params']['date']]}, 200)
+
+ return PatchResponse({'result': None}, 404)
+
+@mock.patch('requests.get', side_effect=patched_requests_get)
class TestCurrencyExchange(unittest.TestCase):
def clear_cache(self):
cache = frappe.cache()
- key = "currency_exchange_rate:{0}:{1}".format("USD", "INR")
- cache.delete(key)
+ for date in test_exchange_values.keys():
+ key = "currency_exchange_rate_{0}:{1}:{2}".format(date, "USD", "INR")
+ cache.delete(key)
def tearDown(self):
frappe.db.set_value("Accounts Settings", None, "allow_stale", 1)
self.clear_cache()
- def test_exchange_rate(self):
+ def test_exchange_rate(self, mock_get):
save_new_records(test_records)
frappe.db.set_value("Accounts Settings", None, "allow_stale", 1)
@@ -69,7 +98,11 @@
self.assertFalse(exchange_rate == 60)
self.assertEqual(flt(exchange_rate, 3), 66.999)
- def test_exchange_rate_strict(self):
+ exchange_rate = get_exchange_rate("USD", "INR", "2016-01-20", "for_buying")
+ self.assertFalse(exchange_rate == 60)
+ self.assertEqual(flt(exchange_rate, 3), 65.1)
+
+ def test_exchange_rate_strict(self, mock_get):
# strict currency settings
frappe.db.set_value("Accounts Settings", None, "allow_stale", 0)
frappe.db.set_value("Accounts Settings", None, "stale_days", 1)
@@ -79,7 +112,7 @@
self.clear_cache()
exchange_rate = get_exchange_rate("USD", "INR", "2016-01-15", "for_buying")
- self.assertEqual(flt(exchange_rate, 3), 67.235)
+ self.assertEqual(flt(exchange_rate, 3), 65.100)
exchange_rate = get_exchange_rate("USD", "INR", "2016-01-30", "for_selling")
self.assertEqual(exchange_rate, 62.9)
@@ -89,7 +122,7 @@
exchange_rate = get_exchange_rate("USD", "INR", "2015-12-15", "for_buying")
self.assertEqual(flt(exchange_rate, 3), 66.999)
- def test_exchange_rate_strict_switched(self):
+ def test_exchange_rate_strict_switched(self, mock_get):
# Start with allow_stale is True
exchange_rate = get_exchange_rate("USD", "INR", "2016-01-15", "for_buying")
self.assertEqual(exchange_rate, 65.1)
@@ -97,7 +130,7 @@
frappe.db.set_value("Accounts Settings", None, "allow_stale", 0)
frappe.db.set_value("Accounts Settings", None, "stale_days", 1)
- # Will fetch from fixer.io
self.clear_cache()
- exchange_rate = get_exchange_rate("USD", "INR", "2016-01-15", "for_buying")
- self.assertEqual(flt(exchange_rate, 3), 67.235)
+ exchange_rate = get_exchange_rate("USD", "INR", "2016-01-30", "for_buying")
+ self.assertFalse(exchange_rate == 65)
+ self.assertEqual(flt(exchange_rate, 3), 62.9)
diff --git a/erpnext/setup/doctype/customer_group/customer_group.py b/erpnext/setup/doctype/customer_group/customer_group.py
index c06669b..6e72810 100644
--- a/erpnext/setup/doctype/customer_group/customer_group.py
+++ b/erpnext/setup/doctype/customer_group/customer_group.py
@@ -2,11 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-
-
from frappe.utils.nestedset import NestedSet, get_root_of
+
+
class CustomerGroup(NestedSet):
nsm_parent_field = 'parent_customer_group'
def validate(self):
diff --git a/erpnext/setup/doctype/customer_group/test_customer_group.py b/erpnext/setup/doctype/customer_group/test_customer_group.py
index ec90b37..e04b79b 100644
--- a/erpnext/setup/doctype/customer_group/test_customer_group.py
+++ b/erpnext/setup/doctype/customer_group/test_customer_group.py
@@ -7,4 +7,5 @@
import frappe
+
test_records = frappe.get_test_records('Customer Group')
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index 6fbd4cd..4e9a8cc 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -2,19 +2,34 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe import _
-from frappe.utils import (fmt_money, formatdate, format_time, now_datetime,
- get_url_to_form, get_url_to_list, flt, get_link_to_report, add_to_date, today)
+
from datetime import timedelta
-from dateutil.relativedelta import relativedelta
-from frappe.core.doctype.user.user import STANDARD_USERS
+
+import frappe
import frappe.desk.notifications
+from dateutil.relativedelta import relativedelta
+from frappe import _
+from frappe.core.doctype.user.user import STANDARD_USERS
+from frappe.utils import (
+ add_to_date,
+ flt,
+ fmt_money,
+ format_time,
+ formatdate,
+ get_link_to_report,
+ get_url_to_form,
+ get_url_to_list,
+ now_datetime,
+ today,
+)
+
from erpnext.accounts.utils import get_balance_on, get_count_on, get_fiscal_year
user_specific_content = ["calendar_events", "todo_list"]
from frappe.model.document import Document
+
+
class EmailDigest(Document):
def __init__(self, *args, **kwargs):
super(EmailDigest, self).__init__(*args, **kwargs)
@@ -60,9 +75,6 @@
reference_name = self.name,
unsubscribe_message = _("Unsubscribe from this Email Digest"))
- frappe.set_user(original_user)
- frappe.set_user_lang(original_user)
-
def get_msg_html(self):
"""Build email digest content"""
frappe.flags.ignore_account_permission = True
diff --git a/erpnext/setup/doctype/email_digest/quotes.py b/erpnext/setup/doctype/email_digest/quotes.py
index 5451ee1..c77fe82 100644
--- a/erpnext/setup/doctype/email_digest/quotes.py
+++ b/erpnext/setup/doctype/email_digest/quotes.py
@@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
+
import random
+
def get_random_quote():
quotes = [
("Start by doing what's necessary; then do what's possible; and suddenly you are doing the impossible.", "Francis of Assisi"),
diff --git a/erpnext/setup/doctype/email_digest/test_email_digest.py b/erpnext/setup/doctype/email_digest/test_email_digest.py
index afe693a..b3d0ce3 100644
--- a/erpnext/setup/doctype/email_digest/test_email_digest.py
+++ b/erpnext/setup/doctype/email_digest/test_email_digest.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Email Digest')
diff --git a/erpnext/setup/doctype/email_digest_recipient/email_digest_recipient.py b/erpnext/setup/doctype/email_digest_recipient/email_digest_recipient.py
index 968c51c..5c8d695 100644
--- a/erpnext/setup/doctype/email_digest_recipient/email_digest_recipient.py
+++ b/erpnext/setup/doctype/email_digest_recipient/email_digest_recipient.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class EmailDigestRecipient(Document):
pass
diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.py b/erpnext/setup/doctype/global_defaults/global_defaults.py
index a0ba1ef..66d3b9e 100644
--- a/erpnext/setup/doctype/global_defaults/global_defaults.py
+++ b/erpnext/setup/doctype/global_defaults/global_defaults.py
@@ -2,11 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
"""Global Defaults"""
import frappe
import frappe.defaults
-from frappe.utils import cint
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
+from frappe.utils import cint
keydict = {
# "key in defaults": "key in Global Defaults"
@@ -22,6 +23,7 @@
from frappe.model.document import Document
+
class GlobalDefaults(Document):
def on_update(self):
diff --git a/erpnext/setup/doctype/global_defaults/test_global_defaults.py b/erpnext/setup/doctype/global_defaults/test_global_defaults.py
index 0495af7..70a7c08 100644
--- a/erpnext/setup/doctype/global_defaults/test_global_defaults.py
+++ b/erpnext/setup/doctype/global_defaults/test_global_defaults.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestGlobalDefaults(unittest.TestCase):
pass
diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py
index c46b6cc..ddf3e66 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -2,19 +2,22 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
import copy
+
+import frappe
from frappe import _
-from frappe.utils import nowdate, cint, cstr
+from frappe.utils import cint, cstr, nowdate
from frappe.utils.nestedset import NestedSet
-from frappe.website.website_generator import WebsiteGenerator
from frappe.website.utils import clear_cache
-from frappe.website.doctype.website_slideshow.website_slideshow import get_slideshow
-from erpnext.shopping_cart.product_info import set_product_info_for_website
-from erpnext.utilities.product import get_qty_in_stock
+from frappe.website.website_generator import WebsiteGenerator
from six.moves.urllib.parse import quote
-from erpnext.shopping_cart.product_query import ProductQuery
+
from erpnext.shopping_cart.filters import ProductFiltersBuilder
+from erpnext.shopping_cart.product_info import set_product_info_for_website
+from erpnext.shopping_cart.product_query import ProductQuery
+from erpnext.utilities.product import get_qty_in_stock
+
class ItemGroup(NestedSet, WebsiteGenerator):
nsm_parent_field = 'parent_item_group'
diff --git a/erpnext/setup/doctype/item_group/test_item_group.py b/erpnext/setup/doctype/item_group/test_item_group.py
index 745b13a..a816f39 100644
--- a/erpnext/setup/doctype/item_group/test_item_group.py
+++ b/erpnext/setup/doctype/item_group/test_item_group.py
@@ -2,10 +2,18 @@
# License: GNU General Public License v3. See license.txt
from __future__ import print_function, unicode_literals
+
import unittest
+
import frappe
-from frappe.utils.nestedset import NestedSetRecursionError, NestedSetMultipleRootsError, \
- NestedSetChildExistsError, NestedSetInvalidMergeError, rebuild_tree, get_ancestors_of
+from frappe.utils.nestedset import (
+ NestedSetChildExistsError,
+ NestedSetInvalidMergeError,
+ NestedSetMultipleRootsError,
+ NestedSetRecursionError,
+ get_ancestors_of,
+ rebuild_tree,
+)
test_records = frappe.get_test_records('Item Group')
diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py
index c1f9433..005cfec 100644
--- a/erpnext/setup/doctype/naming_series/naming_series.py
+++ b/erpnext/setup/doctype/naming_series/naming_series.py
@@ -2,15 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-
-from frappe.utils import cstr, cint
-from frappe import msgprint, throw, _
-
+from frappe import _, msgprint, throw
+from frappe.core.doctype.doctype.doctype import validate_series
from frappe.model.document import Document
from frappe.model.naming import parse_naming_series
from frappe.permissions import get_doctypes_with_read
-from frappe.core.doctype.doctype.doctype import validate_series
+from frappe.utils import cint, cstr
+
class NamingSeriesNotSetError(frappe.ValidationError): pass
@@ -79,7 +79,8 @@
options = self.scrub_options_list(ol)
# validate names
- for i in options: self.validate_series_name(i)
+ for i in options:
+ self.validate_series_name(i)
if options and self.user_must_always_select:
options = [''] + options
@@ -138,7 +139,7 @@
def validate_series_name(self, n):
import re
- if not re.match("^[\w\- /.#{}]*$", n, re.UNICODE):
+ if not re.match(r"^[\w\- \/.#{}]+$", n, re.UNICODE):
throw(_('Special Characters except "-", "#", ".", "/", "{" and "}" not allowed in naming series'))
@frappe.whitelist()
diff --git a/erpnext/setup/doctype/party_type/party_type.py b/erpnext/setup/doctype/party_type/party_type.py
index 96e6093..8424c7f 100644
--- a/erpnext/setup/doctype/party_type/party_type.py
+++ b/erpnext/setup/doctype/party_type/party_type.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class PartyType(Document):
pass
diff --git a/erpnext/setup/doctype/party_type/test_party_type.py b/erpnext/setup/doctype/party_type/test_party_type.py
index 079fe2f..e5f2908 100644
--- a/erpnext/setup/doctype/party_type/test_party_type.py
+++ b/erpnext/setup/doctype/party_type/test_party_type.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Party Type')
diff --git a/erpnext/setup/doctype/print_heading/print_heading.py b/erpnext/setup/doctype/print_heading/print_heading.py
index 3d5cd2d..cf25638 100644
--- a/erpnext/setup/doctype/print_heading/print_heading.py
+++ b/erpnext/setup/doctype/print_heading/print_heading.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class PrintHeading(Document):
pass
diff --git a/erpnext/setup/doctype/print_heading/test_print_heading.py b/erpnext/setup/doctype/print_heading/test_print_heading.py
index b2be2e3..06f801a 100644
--- a/erpnext/setup/doctype/print_heading/test_print_heading.py
+++ b/erpnext/setup/doctype/print_heading/test_print_heading.py
@@ -2,6 +2,6 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
import frappe
+
test_records = frappe.get_test_records('Print Heading')
diff --git a/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.py b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.py
index 42c5a5a..9131cc3 100644
--- a/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.py
+++ b/erpnext/setup/doctype/quotation_lost_reason/quotation_lost_reason.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class QuotationLostReason(Document):
pass
diff --git a/erpnext/setup/doctype/quotation_lost_reason/test_quotation_lost_reason.py b/erpnext/setup/doctype/quotation_lost_reason/test_quotation_lost_reason.py
index f6b30b6..ab8d61f 100644
--- a/erpnext/setup/doctype/quotation_lost_reason/test_quotation_lost_reason.py
+++ b/erpnext/setup/doctype/quotation_lost_reason/test_quotation_lost_reason.py
@@ -2,6 +2,6 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
import frappe
+
test_records = frappe.get_test_records('Quotation Lost Reason')
diff --git a/erpnext/setup/doctype/quotation_lost_reason_detail/quotation_lost_reason_detail.py b/erpnext/setup/doctype/quotation_lost_reason_detail/quotation_lost_reason_detail.py
index 7bb8d02..434f24e 100644
--- a/erpnext/setup/doctype/quotation_lost_reason_detail/quotation_lost_reason_detail.py
+++ b/erpnext/setup/doctype/quotation_lost_reason_detail/quotation_lost_reason_detail.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class QuotationLostReasonDetail(Document):
pass
diff --git a/erpnext/setup/doctype/sales_partner/sales_partner.py b/erpnext/setup/doctype/sales_partner/sales_partner.py
index 675f9ca..6c741a8 100644
--- a/erpnext/setup/doctype/sales_partner/sales_partner.py
+++ b/erpnext/setup/doctype/sales_partner/sales_partner.py
@@ -2,10 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+from frappe.contacts.address_and_contact import load_address_and_contact
from frappe.utils import cstr, filter_strip_join
from frappe.website.website_generator import WebsiteGenerator
-from frappe.contacts.address_and_contact import load_address_and_contact
+
class SalesPartner(WebsiteGenerator):
website = frappe._dict(
diff --git a/erpnext/setup/doctype/sales_partner/test_sales_partner.py b/erpnext/setup/doctype/sales_partner/test_sales_partner.py
index 4548a4e..6ece239 100644
--- a/erpnext/setup/doctype/sales_partner/test_sales_partner.py
+++ b/erpnext/setup/doctype/sales_partner/test_sales_partner.py
@@ -2,8 +2,8 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
import frappe
+
test_records = frappe.get_test_records('Sales Partner')
test_ignore = ["Item Group"]
diff --git a/erpnext/setup/doctype/sales_person/sales_person.py b/erpnext/setup/doctype/sales_person/sales_person.py
index 19c2e5b..c7cad6b 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.py
+++ b/erpnext/setup/doctype/sales_person/sales_person.py
@@ -2,12 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt
from frappe.utils.nestedset import NestedSet, get_root_of
+
from erpnext import get_default_currency
+
class SalesPerson(NestedSet):
nsm_parent_field = 'parent_sales_person'
diff --git a/erpnext/setup/doctype/sales_person/sales_person_dashboard.py b/erpnext/setup/doctype/sales_person/sales_person_dashboard.py
index 662008e..61c1ba4 100644
--- a/erpnext/setup/doctype/sales_person/sales_person_dashboard.py
+++ b/erpnext/setup/doctype/sales_person/sales_person_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'heatmap': True,
diff --git a/erpnext/setup/doctype/sales_person/test_sales_person.py b/erpnext/setup/doctype/sales_person/test_sales_person.py
index 8313cb4..497aaad 100644
--- a/erpnext/setup/doctype/sales_person/test_sales_person.py
+++ b/erpnext/setup/doctype/sales_person/test_sales_person.py
@@ -5,6 +5,7 @@
test_dependencies = ["Employee"]
import frappe
+
test_records = frappe.get_test_records('Sales Person')
test_ignore = ["Item Group"]
diff --git a/erpnext/setup/doctype/supplier_group/supplier_group.py b/erpnext/setup/doctype/supplier_group/supplier_group.py
index 9d84f90..0ca3525 100644
--- a/erpnext/setup/doctype/supplier_group/supplier_group.py
+++ b/erpnext/setup/doctype/supplier_group/supplier_group.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.utils.nestedset import NestedSet, get_root_of
+
class SupplierGroup(NestedSet):
nsm_parent_field = 'parent_supplier_group'
diff --git a/erpnext/setup/doctype/supplier_group/test_supplier_group.py b/erpnext/setup/doctype/supplier_group/test_supplier_group.py
index 0e3d23d..b3a6366 100644
--- a/erpnext/setup/doctype/supplier_group/test_supplier_group.py
+++ b/erpnext/setup/doctype/supplier_group/test_supplier_group.py
@@ -4,4 +4,5 @@
from __future__ import unicode_literals
import frappe
+
test_records = frappe.get_test_records('Supplier Group')
diff --git a/erpnext/setup/doctype/target_detail/target_detail.py b/erpnext/setup/doctype/target_detail/target_detail.py
index 633be45..89cd814 100644
--- a/erpnext/setup/doctype/target_detail/target_detail.py
+++ b/erpnext/setup/doctype/target_detail/target_detail.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class TargetDetail(Document):
pass
diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
index 5b00ccb..8c9059f 100644
--- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
+++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
@@ -2,15 +2,17 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
+import json
+
import frappe
from frappe import _, throw
-import json
from frappe.model.document import Document
-from frappe.utils.jinja import validate_template
from frappe.utils import cint
-
+from frappe.utils.jinja import validate_template
from six import string_types
+
class TermsandConditions(Document):
def validate(self):
if self.terms:
diff --git a/erpnext/setup/doctype/terms_and_conditions/test_terms_and_conditions.py b/erpnext/setup/doctype/terms_and_conditions/test_terms_and_conditions.py
index 6fea78f..abfa921 100644
--- a/erpnext/setup/doctype/terms_and_conditions/test_terms_and_conditions.py
+++ b/erpnext/setup/doctype/terms_and_conditions/test_terms_and_conditions.py
@@ -2,6 +2,6 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
import frappe
+
test_records = frappe.get_test_records('Terms and Conditions')
diff --git a/erpnext/setup/doctype/territory/territory.py b/erpnext/setup/doctype/territory/territory.py
index 7eefe77..f61796b 100644
--- a/erpnext/setup/doctype/territory/territory.py
+++ b/erpnext/setup/doctype/territory/territory.py
@@ -2,12 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.utils import flt
-from frappe import _
+import frappe
+from frappe import _
+from frappe.utils import flt
from frappe.utils.nestedset import NestedSet, get_root_of
+
class Territory(NestedSet):
nsm_parent_field = 'parent_territory'
diff --git a/erpnext/setup/doctype/territory/test_territory.py b/erpnext/setup/doctype/territory/test_territory.py
index efe00c5..a3aa866 100644
--- a/erpnext/setup/doctype/territory/test_territory.py
+++ b/erpnext/setup/doctype/territory/test_territory.py
@@ -2,8 +2,8 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
import frappe
+
test_records = frappe.get_test_records('Territory')
test_ignore = ["Item Group"]
diff --git a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py
index 933a8c3..aa0f79b 100644
--- a/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py
+++ b/erpnext/setup/doctype/transaction_deletion_record/test_transaction_deletion_record.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestTransactionDeletionRecord(unittest.TestCase):
def setUp(self):
create_company('Dunder Mifflin Paper Co')
diff --git a/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py b/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py
index 8a49155..efb038f 100644
--- a/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py
+++ b/erpnext/setup/doctype/transaction_deletion_record/transaction_deletion_record.py
@@ -3,11 +3,13 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-from frappe.utils import cint
+
import frappe
-from frappe.model.document import Document
from frappe import _
from frappe.desk.notifications import clear_notifications
+from frappe.model.document import Document
+from frappe.utils import cint
+
class TransactionDeletionRecord(Document):
def validate(self):
diff --git a/erpnext/setup/doctype/transaction_deletion_record_item/transaction_deletion_record_item.py b/erpnext/setup/doctype/transaction_deletion_record_item/transaction_deletion_record_item.py
index 2176cb1..a113d50 100644
--- a/erpnext/setup/doctype/transaction_deletion_record_item/transaction_deletion_record_item.py
+++ b/erpnext/setup/doctype/transaction_deletion_record_item/transaction_deletion_record_item.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class TransactionDeletionRecordItem(Document):
pass
diff --git a/erpnext/setup/doctype/uom/test_uom.py b/erpnext/setup/doctype/uom/test_uom.py
index 330d303..e222c13 100644
--- a/erpnext/setup/doctype/uom/test_uom.py
+++ b/erpnext/setup/doctype/uom/test_uom.py
@@ -2,6 +2,6 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
import frappe
+
test_records = frappe.get_test_records('UOM')
diff --git a/erpnext/setup/doctype/uom/uom.py b/erpnext/setup/doctype/uom/uom.py
index 404b84b..f0e97b3 100644
--- a/erpnext/setup/doctype/uom/uom.py
+++ b/erpnext/setup/doctype/uom/uom.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class UOM(Document):
pass
diff --git a/erpnext/setup/doctype/uom_conversion_factor/test_uom_conversion_factor.py b/erpnext/setup/doctype/uom_conversion_factor/test_uom_conversion_factor.py
index 04596ef..33795d6 100644
--- a/erpnext/setup/doctype/uom_conversion_factor/test_uom_conversion_factor.py
+++ b/erpnext/setup/doctype/uom_conversion_factor/test_uom_conversion_factor.py
@@ -5,5 +5,6 @@
import unittest
+
class TestUOMConversionFactor(unittest.TestCase):
pass
diff --git a/erpnext/setup/doctype/uom_conversion_factor/uom_conversion_factor.py b/erpnext/setup/doctype/uom_conversion_factor/uom_conversion_factor.py
index 3566c53..45342e9 100644
--- a/erpnext/setup/doctype/uom_conversion_factor/uom_conversion_factor.py
+++ b/erpnext/setup/doctype/uom_conversion_factor/uom_conversion_factor.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class UOMConversionFactor(Document):
pass
diff --git a/erpnext/setup/doctype/website_item_group/website_item_group.py b/erpnext/setup/doctype/website_item_group/website_item_group.py
index e416b50..2f72013 100644
--- a/erpnext/setup/doctype/website_item_group/website_item_group.py
+++ b/erpnext/setup/doctype/website_item_group/website_item_group.py
@@ -4,9 +4,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class WebsiteItemGroup(Document):
pass
diff --git a/erpnext/setup/install.py b/erpnext/setup/install.py
index bbee74c..cdc83c1 100644
--- a/erpnext/setup/install.py
+++ b/erpnext/setup/install.py
@@ -4,16 +4,18 @@
from __future__ import print_function, unicode_literals
import frappe
-from erpnext.accounts.doctype.cash_flow_mapper.default_cash_flow_mapper import DEFAULT_MAPPERS
-from .default_success_action import get_default_success_action
from frappe import _
-from frappe.utils import cint
-from frappe.installer import update_site_config
-from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
-from erpnext.setup.default_energy_point_rules import get_default_energy_point_rules
+from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
+from frappe.installer import update_site_config
+from frappe.utils import cint
from six import iteritems
+from erpnext.accounts.doctype.cash_flow_mapper.default_cash_flow_mapper import DEFAULT_MAPPERS
+from erpnext.setup.default_energy_point_rules import get_default_energy_point_rules
+
+from .default_success_action import get_default_success_action
+
default_mail_footer = """<div style="padding: 7px; text-align: right; color: #888"><small>Sent via
<a style="color: #888" href="http://erpnext.org">ERPNext</a></div>"""
diff --git a/erpnext/setup/setup_wizard/data/dashboard_charts.py b/erpnext/setup/setup_wizard/data/dashboard_charts.py
index 9ce64eb..5369bba 100644
--- a/erpnext/setup/setup_wizard/data/dashboard_charts.py
+++ b/erpnext/setup/setup_wizard/data/dashboard_charts.py
@@ -1,8 +1,10 @@
from __future__ import unicode_literals
-from frappe import _
-import frappe
+
import json
+import frappe
+
+
def get_company_for_dashboards():
company = frappe.defaults.get_defaults().company
if company:
diff --git a/erpnext/setup/setup_wizard/data/industry_type.py b/erpnext/setup/setup_wizard/data/industry_type.py
index 4fa9f8a..2c83a5c 100644
--- a/erpnext/setup/setup_wizard/data/industry_type.py
+++ b/erpnext/setup/setup_wizard/data/industry_type.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_industry_types():
return [
_('Accounting'),
diff --git a/erpnext/setup/setup_wizard/operations/company_setup.py b/erpnext/setup/setup_wizard/operations/company_setup.py
index 4833d93..bea3906 100644
--- a/erpnext/setup/setup_wizard/operations/company_setup.py
+++ b/erpnext/setup/setup_wizard/operations/company_setup.py
@@ -6,7 +6,6 @@
from frappe import _
from frappe.utils import cstr, getdate
from .default_website import website_maker
-from erpnext.accounts.doctype.account.account import RootNotEditable
def create_fiscal_year_and_company(args):
if (args.get('fy_start_date')):
diff --git a/erpnext/setup/setup_wizard/operations/default_website.py b/erpnext/setup/setup_wizard/operations/default_website.py
index 38b5c14..2288ae0 100644
--- a/erpnext/setup/setup_wizard/operations/default_website.py
+++ b/erpnext/setup/setup_wizard/operations/default_website.py
@@ -2,11 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+import frappe
from frappe import _
from frappe.utils import nowdate
+
class website_maker(object):
def __init__(self, args):
self.args = args
diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py
index cd49a18..907967c 100644
--- a/erpnext/setup/setup_wizard/operations/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py
@@ -3,16 +3,20 @@
from __future__ import unicode_literals
-import frappe, os, json
+import json
+import os
+import frappe
from frappe import _
+from frappe.desk.doctype.global_search_settings.global_search_settings import (
+ update_global_search_doctypes,
+)
from frappe.desk.page.setup_wizard.setup_wizard import make_records
from frappe.utils import cstr, getdate
-from frappe.desk.doctype.global_search_settings.global_search_settings import update_global_search_doctypes
+from frappe.utils.nestedset import rebuild_tree
from erpnext.accounts.doctype.account.account import RootNotEditable
from erpnext.regional.address_template.setup import set_up_address_templates
-from frappe.utils.nestedset import rebuild_tree
default_lead_sources = ["Existing Customer", "Reference", "Advertisement",
"Cold Calling", "Exhibition", "Supplier Reference", "Mass Mailing",
diff --git a/erpnext/setup/setup_wizard/operations/sample_data.py b/erpnext/setup/setup_wizard/operations/sample_data.py
index c6d9f08..3aef40d 100644
--- a/erpnext/setup/setup_wizard/operations/sample_data.py
+++ b/erpnext/setup/setup_wizard/operations/sample_data.py
@@ -3,11 +3,15 @@
from __future__ import unicode_literals
+import json
+import os
+import random
+
import frappe
-from frappe.utils.make_random import add_random_children
import frappe.utils
-import random, os, json
from frappe import _
+from frappe.utils.make_random import add_random_children
+
def make_sample_data(domains, make_dependent = False):
"""Create a few opportunities, quotes, material requests, issues, todos, projects
diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py
index f63d269..ecb07d5 100644
--- a/erpnext/setup/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/setup_wizard/setup_wizard.py
@@ -6,7 +6,10 @@
import frappe
from frappe import _
-from .operations import install_fixtures as fixtures, company_setup, sample_data
+from .operations import company_setup
+from .operations import install_fixtures as fixtures
+from .operations import sample_data
+
def get_setup_stages(args=None):
if frappe.db.sql("select name from tabCompany"):
@@ -106,7 +109,7 @@
def make_sample_data(domains):
try:
sample_data.make_sample_data(domains)
- except:
+ except Exception:
# clear message
if frappe.message_log:
frappe.message_log.pop()
diff --git a/erpnext/setup/setup_wizard/utils.py b/erpnext/setup/setup_wizard/utils.py
index 4223f00..30b88ae 100644
--- a/erpnext/setup/setup_wizard/utils.py
+++ b/erpnext/setup/setup_wizard/utils.py
@@ -1,8 +1,10 @@
from __future__ import unicode_literals
-import json, os
+
+import json
+import os
from frappe.desk.page.setup_wizard.setup_wizard import setup_complete
-from erpnext.setup.setup_wizard import setup_wizard
+
def complete():
with open(os.path.join(os.path.dirname(__file__),
diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py
index e49259e..2302a66 100644
--- a/erpnext/setup/utils.py
+++ b/erpnext/setup/utils.py
@@ -2,12 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt, add_days
-from frappe.utils import get_datetime_str, nowdate
+from frappe.utils import add_days, flt, get_datetime_str, nowdate
+
from erpnext import get_default_company
+
def get_root_of(doctype):
"""Get root element of a DocType with a tree structure"""
result = frappe.db.sql_list("""select name from `tab%s`
@@ -109,7 +111,7 @@
value = response.json()["result"]
cache.setex(name=key, time=21600, value=flt(value))
return flt(value)
- except:
+ except Exception:
frappe.log_error(title="Get Exchange Rate")
frappe.msgprint(_("Unable to find exchange rate for {0} to {1} for key date {2}. Please create a Currency Exchange record manually").format(from_currency, to_currency, transaction_date))
return 0.0
diff --git a/erpnext/setup/workspace/home/home.json b/erpnext/setup/workspace/home/home.json
index cc9569f..a4e7ad8 100644
--- a/erpnext/setup/workspace/home/home.json
+++ b/erpnext/setup/workspace/home/home.json
@@ -1,7 +1,7 @@
{
"category": "",
"charts": [],
- "content": "[{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"Your Shortcuts\",\"level\":4,\"col\":12}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Item\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Customer\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Supplier\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Sales Invoice\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Leaderboard\",\"col\":4}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"Reports & Masters\",\"level\":4,\"col\":12}},{\"type\":\"card\",\"data\":{\"card_name\":\"Accounting\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Stock\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Human Resources\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"CRM\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Data Import and Settings\",\"col\":4}}]",
+ "content": "[{\"type\":\"header\",\"data\":{\"text\":\"Your Shortcuts\",\"level\":4,\"col\":12}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Item\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Customer\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Supplier\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Sales Invoice\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Leaderboard\",\"col\":4}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"Reports & Masters\",\"level\":4,\"col\":12}},{\"type\":\"card\",\"data\":{\"card_name\":\"Accounting\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Stock\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Human Resources\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"CRM\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Data Import and Settings\",\"col\":4}}]",
"creation": "2020-01-23 13:46:38.833076",
"developer_mode_only": 0,
"disable_user_customization": 0,
diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index e9f4bd5..3f1dfde 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -2,16 +2,20 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import throw, _
import frappe.defaults
-from frappe.utils import cint, flt, get_fullname, cstr
+from frappe import _, throw
from frappe.contacts.doctype.address.address import get_address_display
-from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import get_shopping_cart_settings
-from frappe.utils.nestedset import get_root_of
-from erpnext.accounts.utils import get_account_name
-from erpnext.utilities.product import get_qty_in_stock
from frappe.contacts.doctype.contact.contact import get_contact_name
+from frappe.utils import cint, cstr, flt, get_fullname
+from frappe.utils.nestedset import get_root_of
+
+from erpnext.accounts.utils import get_account_name
+from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import (
+ get_shopping_cart_settings,
+)
+from erpnext.utilities.product import get_qty_in_stock
class WebsitePriceListMissingError(frappe.ValidationError):
diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
index efed196..8f4afda 100644
--- a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
+++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.py
@@ -4,11 +4,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import _, msgprint
-from frappe.utils import flt
+from frappe import _
from frappe.model.document import Document
-from frappe.utils import get_datetime, get_datetime_str, now_datetime
+from frappe.utils import flt
+
class ShoppingCartSetupError(frappe.ValidationError): pass
diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py b/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py
index 9965e1a..f8a22b0 100644
--- a/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py
+++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/test_shopping_cart_settings.py
@@ -4,9 +4,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import unittest
-from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import ShoppingCartSetupError
+
+import frappe
+
+from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import (
+ ShoppingCartSetupError,
+)
+
class TestShoppingCartSettings(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/shopping_cart/filters.py b/erpnext/shopping_cart/filters.py
index 7dfa09e..aaeff0f 100644
--- a/erpnext/shopping_cart/filters.py
+++ b/erpnext/shopping_cart/filters.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _dict
+
class ProductFiltersBuilder:
def __init__(self, item_group=None):
if not item_group or item_group == "Products Settings":
diff --git a/erpnext/shopping_cart/product_info.py b/erpnext/shopping_cart/product_info.py
index 6c9e531..fa68636 100644
--- a/erpnext/shopping_cart/product_info.py
+++ b/erpnext/shopping_cart/product_info.py
@@ -4,10 +4,14 @@
from __future__ import unicode_literals
import frappe
+
from erpnext.shopping_cart.cart import _get_cart_quotation, _set_price_list
-from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings \
- import get_shopping_cart_settings, show_quantity_in_website
-from erpnext.utilities.product import get_price, get_qty_in_stock, get_non_stock_item_status
+from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import (
+ get_shopping_cart_settings,
+ show_quantity_in_website,
+)
+from erpnext.utilities.product import get_non_stock_item_status, get_price, get_qty_in_stock
+
@frappe.whitelist(allow_guest=True)
def get_product_info_for_website(item_code, skip_quotation_creation=False):
diff --git a/erpnext/shopping_cart/product_query.py b/erpnext/shopping_cart/product_query.py
index 6c92d96..5cc0505 100644
--- a/erpnext/shopping_cart/product_query.py
+++ b/erpnext/shopping_cart/product_query.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
import frappe
+
from erpnext.shopping_cart.product_info import get_product_info_for_website
+
class ProductQuery:
"""Query engine for product listing
diff --git a/erpnext/shopping_cart/search.py b/erpnext/shopping_cart/search.py
index 9f674dc..5d2de78 100644
--- a/erpnext/shopping_cart/search.py
+++ b/erpnext/shopping_cart/search.py
@@ -1,9 +1,9 @@
import frappe
from frappe.search.full_text_search import FullTextSearch
-from whoosh.fields import TEXT, ID, KEYWORD, Schema
from frappe.utils import strip_html_tags
-from whoosh.qparser import MultifieldParser, FieldsPlugin, WildcardPlugin
from whoosh.analysis import StemmingAnalyzer
+from whoosh.fields import ID, KEYWORD, TEXT, Schema
+from whoosh.qparser import FieldsPlugin, MultifieldParser, WildcardPlugin
from whoosh.query import Prefix
INDEX_NAME = "products"
diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py
index ac61aeb..d1284cd 100644
--- a/erpnext/shopping_cart/test_shopping_cart.py
+++ b/erpnext/shopping_cart/test_shopping_cart.py
@@ -2,12 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import unittest
+
import frappe
-from frappe.utils import nowdate, add_months
-from erpnext.shopping_cart.cart import _get_cart_quotation, update_cart, get_party
+from frappe.utils import add_months, nowdate
+
+from erpnext.accounts.doctype.tax_rule.tax_rule import ConflictingTaxRule
+from erpnext.shopping_cart.cart import _get_cart_quotation, get_party, update_cart
from erpnext.tests.utils import create_test_contact_and_address
-from erpnext.accounts.doctype.tax_rule.tax_rule import ConflictingTaxRule
# test_dependencies = ['Payment Terms Template']
diff --git a/erpnext/shopping_cart/utils.py b/erpnext/shopping_cart/utils.py
index 0e1466f..f412e61 100644
--- a/erpnext/shopping_cart/utils.py
+++ b/erpnext/shopping_cart/utils.py
@@ -4,8 +4,11 @@
from __future__ import unicode_literals
import frappe
-import frappe.defaults
-from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import is_cart_enabled
+
+from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import (
+ is_cart_enabled,
+)
+
def show_cart_count():
if (is_cart_enabled() and
diff --git a/erpnext/startup/__init__.py b/erpnext/startup/__init__.py
index deef4ba..3aa5297 100644
--- a/erpnext/startup/__init__.py
+++ b/erpnext/startup/__init__.py
@@ -19,7 +19,6 @@
# default settings that can be made for a user.
from __future__ import unicode_literals
-
product_name = "ERPNext"
user_defaults = {
"Company": "company",
diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py
index 2b80fb8..bb76f5a 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -3,9 +3,11 @@
from __future__ import unicode_literals
+
import frappe
from frappe.utils import cint
+
def boot_session(bootinfo):
"""boot session - send website info if guest"""
diff --git a/erpnext/startup/filters.py b/erpnext/startup/filters.py
index 9821016..c0ccf54 100644
--- a/erpnext/startup/filters.py
+++ b/erpnext/startup/filters.py
@@ -1,5 +1,5 @@
-import frappe
+
def get_filters_config():
filters_config = {
diff --git a/erpnext/startup/leaderboard.py b/erpnext/startup/leaderboard.py
index a89435d..60e67f8 100644
--- a/erpnext/startup/leaderboard.py
+++ b/erpnext/startup/leaderboard.py
@@ -1,8 +1,10 @@
-from __future__ import unicode_literals, print_function
+from __future__ import print_function, unicode_literals
+
import frappe
from frappe.utils import cint
+
def get_leaderboards():
leaderboards = {
"Customer": {
diff --git a/erpnext/startup/notifications.py b/erpnext/startup/notifications.py
index 8e880dc..01bb344 100644
--- a/erpnext/startup/notifications.py
+++ b/erpnext/startup/notifications.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+
def get_notification_config():
notifications = { "for_doctype":
{
diff --git a/erpnext/stock/__init__.py b/erpnext/stock/__init__.py
index 283f7d5..575aa0f 100644
--- a/erpnext/stock/__init__.py
+++ b/erpnext/stock/__init__.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
import frappe
from frappe import _
diff --git a/erpnext/stock/dashboard/item_dashboard.py b/erpnext/stock/dashboard/item_dashboard.py
index 45e6628..df6b632 100644
--- a/erpnext/stock/dashboard/item_dashboard.py
+++ b/erpnext/stock/dashboard/item_dashboard.py
@@ -2,7 +2,8 @@
import frappe
from frappe.model.db_query import DatabaseQuery
-from frappe.utils import flt, cint
+from frappe.utils import cint, flt
+
@frappe.whitelist()
def get_data(item_code=None, warehouse=None, item_group=None,
diff --git a/erpnext/stock/dashboard/warehouse_capacity_dashboard.py b/erpnext/stock/dashboard/warehouse_capacity_dashboard.py
index 70b030e..5d8b703 100644
--- a/erpnext/stock/dashboard/warehouse_capacity_dashboard.py
+++ b/erpnext/stock/dashboard/warehouse_capacity_dashboard.py
@@ -2,10 +2,11 @@
import frappe
from frappe.model.db_query import DatabaseQuery
-from frappe.utils import nowdate
-from frappe.utils import flt
+from frappe.utils import flt, nowdate
+
from erpnext.stock.utils import get_stock_balance
+
@frappe.whitelist()
def get_data(item_code=None, warehouse=None, parent_warehouse=None,
company=None, start=0, sort_by="stock_capacity", sort_order="desc"):
diff --git a/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py b/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py
index 2258532..1753002 100644
--- a/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py
+++ b/erpnext/stock/dashboard_chart_source/warehouse_wise_stock_value/warehouse_wise_stock_value.py
@@ -2,11 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, json
+
+import frappe
from frappe import _
from frappe.utils.dashboard import cache_source
+
from erpnext.stock.utils import get_stock_value_from_bin
+
@frappe.whitelist()
@cache_source
def get(chart_name = None, chart = None, no_cache = None, filters = None, from_date = None,
diff --git a/erpnext/stock/doctype/batch/batch.py b/erpnext/stock/doctype/batch/batch.py
index b37ae3f..76db581 100644
--- a/erpnext/stock/doctype/batch/batch.py
+++ b/erpnext/stock/doctype/batch/batch.py
@@ -2,15 +2,16 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-from six import text_type
+
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.model.naming import make_autoname, revert_series_if_last
-from frappe.utils import flt, cint, get_link_to_form
-from frappe.utils.jinja import render_template
+from frappe.utils import cint, flt, get_link_to_form
from frappe.utils.data import add_days
-from six import string_types
+from frappe.utils.jinja import render_template
+from six import text_type
+
class UnableToSelectBatchError(frappe.ValidationError):
pass
diff --git a/erpnext/stock/doctype/batch/test_batch.py b/erpnext/stock/doctype/batch/test_batch.py
index a85a022..7998930 100644
--- a/erpnext/stock/doctype/batch/test_batch.py
+++ b/erpnext/stock/doctype/batch/test_batch.py
@@ -2,15 +2,17 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.exceptions import ValidationError
import unittest
-from erpnext.stock.doctype.batch.batch import get_batch_qty, UnableToSelectBatchError, get_batch_no
+import frappe
+from frappe.exceptions import ValidationError
from frappe.utils import cint, flt
+
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
+from erpnext.stock.doctype.batch.batch import UnableToSelectBatchError, get_batch_no, get_batch_qty
from erpnext.stock.get_item_details import get_item_details
+
class TestBatch(unittest.TestCase):
def test_item_has_batch_enabled(self):
self.assertRaises(ValidationError, frappe.get_doc({
diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py
index 4364201..5fbc2d8 100644
--- a/erpnext/stock/doctype/bin/bin.py
+++ b/erpnext/stock/doctype/bin/bin.py
@@ -2,10 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import flt, nowdate
-import frappe.defaults
from frappe.model.document import Document
+from frappe.utils import flt, nowdate
+
class Bin(Document):
def before_save(self):
diff --git a/erpnext/stock/doctype/bin/test_bin.py b/erpnext/stock/doctype/bin/test_bin.py
index fb32ce2..f0dbe8c 100644
--- a/erpnext/stock/doctype/bin/test_bin.py
+++ b/erpnext/stock/doctype/bin/test_bin.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Bin')
diff --git a/erpnext/stock/doctype/customs_tariff_number/customs_tariff_number.py b/erpnext/stock/doctype/customs_tariff_number/customs_tariff_number.py
index b0b3e6a..d484301 100644
--- a/erpnext/stock/doctype/customs_tariff_number/customs_tariff_number.py
+++ b/erpnext/stock/doctype/customs_tariff_number/customs_tariff_number.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class CustomsTariffNumber(Document):
pass
diff --git a/erpnext/stock/doctype/customs_tariff_number/test_customs_tariff_number.py b/erpnext/stock/doctype/customs_tariff_number/test_customs_tariff_number.py
index d7e0306..7c9807c 100644
--- a/erpnext/stock/doctype/customs_tariff_number/test_customs_tariff_number.py
+++ b/erpnext/stock/doctype/customs_tariff_number/test_customs_tariff_number.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestCustomsTariffNumber(unittest.TestCase):
pass
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index 9581896..fdc8763 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -543,6 +543,7 @@
{
"collapsible": 1,
"collapsible_depends_on": "packed_items",
+ "depends_on": "packed_items",
"fieldname": "packing_list",
"fieldtype": "Section Break",
"label": "Packing List",
@@ -551,6 +552,7 @@
"print_hide": 1
},
{
+ "depends_on": "packed_items",
"fieldname": "packed_items",
"fieldtype": "Table",
"label": "Packed Items",
@@ -1306,7 +1308,7 @@
"idx": 146,
"is_submittable": 1,
"links": [],
- "modified": "2021-08-17 20:15:50.574966",
+ "modified": "2021-08-27 20:14:40.215231",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note",
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index f99a01b..5542cd0 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -4,17 +4,17 @@
from __future__ import unicode_literals
import frappe
-import frappe.defaults
-from erpnext.controllers.selling_controller import SellingController
-from erpnext.stock.doctype.batch.batch import set_batch_nos
-from erpnext.stock.doctype.serial_no.serial_no import get_delivery_note_serial_no
from frappe import _
from frappe.contacts.doctype.address.address import get_company_address
from frappe.desk.notifications import clear_doctype_notifications
from frappe.model.mapper import get_mapped_doc
from frappe.model.utils import get_fetch_values
from frappe.utils import cint, flt
+
from erpnext.controllers.accounts_controller import get_taxes_and_charges
+from erpnext.controllers.selling_controller import SellingController
+from erpnext.stock.doctype.batch.batch import set_batch_nos
+from erpnext.stock.doctype.serial_no.serial_no import get_delivery_note_serial_no
form_grid_templates = {
"items": "templates/form_grid/item_grid.html"
@@ -331,7 +331,7 @@
credit_note_link = frappe.utils.get_link_to_form('Sales Invoice', return_invoice.name)
frappe.msgprint(_("Credit Note {0} has been created automatically").format(credit_note_link))
- except:
+ except Exception:
frappe.throw(_("Could not create Credit Note automatically, please uncheck 'Issue Credit Note' and submit again"))
def update_billed_amount_based_on_so(so_detail, update_modified=True):
@@ -668,8 +668,13 @@
return make_inter_company_transaction("Delivery Note", source_name, target_doc)
def make_inter_company_transaction(doctype, source_name, target_doc=None):
- from erpnext.accounts.doctype.sales_invoice.sales_invoice import (validate_inter_company_transaction,
- get_inter_company_details, update_address, update_taxes, set_purchase_references)
+ from erpnext.accounts.doctype.sales_invoice.sales_invoice import (
+ get_inter_company_details,
+ set_purchase_references,
+ update_address,
+ update_taxes,
+ validate_inter_company_transaction,
+ )
if doctype == 'Delivery Note':
source_doc = frappe.get_doc(doctype, source_name)
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
index 9db5db8..31fc708 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'delivery_note',
diff --git a/erpnext/stock/doctype/delivery_note/test_delivery_note.py b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
index b333a6b..7fda94b 100644
--- a/erpnext/stock/doctype/delivery_note/test_delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/test_delivery_note.py
@@ -3,26 +3,40 @@
from __future__ import unicode_literals
-import unittest
-import frappe
+
import json
-import frappe.defaults
-from frappe.utils import nowdate, nowtime, cstr, flt
-from erpnext.stock.stock_ledger import get_previous_sle
-from erpnext.accounts.utils import get_balance_on
-from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries
-from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_invoice, make_delivery_trip
-from erpnext.stock.doctype.stock_entry.test_stock_entry \
- import make_stock_entry, make_serialized_item, get_qty_after_transaction
-from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos, SerialNoWarehouseError
-from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation \
- import create_stock_reconciliation, set_valuation_method
-from erpnext.selling.doctype.sales_order.test_sales_order \
- import make_sales_order, create_dn_against_so, automatically_fetch_payment_terms, compare_payment_schedules
+import unittest
+
+import frappe
+from frappe.utils import cstr, flt, nowdate, nowtime
+
from erpnext.accounts.doctype.account.test_account import get_inventory_account
-from erpnext.stock.doctype.warehouse.test_warehouse import get_warehouse
-from erpnext.stock.doctype.item.test_item import make_item
+from erpnext.accounts.utils import get_balance_on
from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle
+from erpnext.selling.doctype.sales_order.test_sales_order import (
+ automatically_fetch_payment_terms,
+ compare_payment_schedules,
+ create_dn_against_so,
+ make_sales_order,
+)
+from erpnext.stock.doctype.delivery_note.delivery_note import (
+ make_delivery_trip,
+ make_sales_invoice,
+)
+from erpnext.stock.doctype.item.test_item import make_item
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries
+from erpnext.stock.doctype.serial_no.serial_no import SerialNoWarehouseError, get_serial_nos
+from erpnext.stock.doctype.stock_entry.test_stock_entry import (
+ get_qty_after_transaction,
+ make_serialized_item,
+ make_stock_entry,
+)
+from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import (
+ create_stock_reconciliation,
+ set_valuation_method,
+)
+from erpnext.stock.doctype.warehouse.test_warehouse import get_warehouse
+from erpnext.stock.stock_ledger import get_previous_sle
class TestDeliveryNote(unittest.TestCase):
@@ -540,7 +554,10 @@
def test_dn_billing_status_case2(self):
# SO -> SI and SO -> DN1, DN2
- from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note, make_sales_invoice
+ from erpnext.selling.doctype.sales_order.sales_order import (
+ make_delivery_note,
+ make_sales_invoice,
+ )
so = make_sales_order()
@@ -579,8 +596,10 @@
def test_dn_billing_status_case3(self):
# SO -> DN1 -> SI and SO -> SI and SO -> DN2
- from erpnext.selling.doctype.sales_order.sales_order \
- import make_delivery_note, make_sales_invoice as make_sales_invoice_from_so
+ from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note
+ from erpnext.selling.doctype.sales_order.sales_order import (
+ make_sales_invoice as make_sales_invoice_from_so,
+ )
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
so = make_sales_order()
@@ -626,8 +645,8 @@
def test_dn_billing_status_case4(self):
# SO -> SI -> DN
- from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_delivery_note
+ from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
so = make_sales_order()
@@ -777,7 +796,9 @@
self.assertTrue("TESTBATCH" in dn.packed_items[0].batch_no, "Batch number not added in packed item")
def test_payment_terms_are_fetched_when_creating_sales_invoice(self):
- from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_terms_template
+ from erpnext.accounts.doctype.payment_entry.test_payment_entry import (
+ create_payment_terms_template,
+ )
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
automatically_fetch_payment_terms()
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py
index 8bd381a..693caab 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class DeliveryNoteItem(Document):
pass
diff --git a/erpnext/stock/doctype/delivery_settings/delivery_settings.py b/erpnext/stock/doctype/delivery_settings/delivery_settings.py
index 909efda..c25907d 100644
--- a/erpnext/stock/doctype/delivery_settings/delivery_settings.py
+++ b/erpnext/stock/doctype/delivery_settings/delivery_settings.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class DeliverySettings(Document):
pass
diff --git a/erpnext/stock/doctype/delivery_settings/test_delivery_settings.py b/erpnext/stock/doctype/delivery_settings/test_delivery_settings.py
index 4395d26..25c9da1 100644
--- a/erpnext/stock/doctype/delivery_settings/test_delivery_settings.py
+++ b/erpnext/stock/doctype/delivery_settings/test_delivery_settings.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestDeliverySettings(unittest.TestCase):
pass
diff --git a/erpnext/stock/doctype/delivery_stop/delivery_stop.py b/erpnext/stock/doctype/delivery_stop/delivery_stop.py
index 768d161..f94ccb8 100644
--- a/erpnext/stock/doctype/delivery_stop/delivery_stop.py
+++ b/erpnext/stock/doctype/delivery_stop/delivery_stop.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class DeliveryStop(Document):
pass
diff --git a/erpnext/stock/doctype/delivery_trip/delivery_trip.py b/erpnext/stock/doctype/delivery_trip/delivery_trip.py
index f76bb87..fe98182 100644
--- a/erpnext/stock/doctype/delivery_trip/delivery_trip.py
+++ b/erpnext/stock/doctype/delivery_trip/delivery_trip.py
@@ -10,8 +10,8 @@
from frappe import _
from frappe.contacts.doctype.address.address import get_address_display
from frappe.model.document import Document
-from frappe.utils import cint, get_datetime, get_link_to_form
from frappe.model.mapper import get_mapped_doc
+from frappe.utils import cint, get_datetime, get_link_to_form
class DeliveryTrip(Document):
diff --git a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py
index 1e71603..c9081c9 100644
--- a/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py
+++ b/erpnext/stock/doctype/delivery_trip/test_delivery_trip.py
@@ -5,12 +5,17 @@
import unittest
-import erpnext
import frappe
-from erpnext.stock.doctype.delivery_trip.delivery_trip import get_contact_and_address, notify_customers, make_expense_claim
-from erpnext.tests.utils import create_test_contact_and_address
from frappe.utils import add_days, flt, now_datetime, nowdate
+import erpnext
+from erpnext.stock.doctype.delivery_trip.delivery_trip import (
+ get_contact_and_address,
+ make_expense_claim,
+ notify_customers,
+)
+from erpnext.tests.utils import create_test_contact_and_address
+
class TestDeliveryTrip(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 422fe3e..50fdd38 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -1,24 +1,42 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
+import copy
import itertools
import json
-import erpnext
-import frappe
-import copy
-from erpnext.controllers.item_variant import (ItemVariantExistsError,
- copy_attributes_to_variant, get_variant, make_variant_item_code, validate_item_variant_attributes)
-from erpnext.setup.doctype.item_group.item_group import (get_parent_item_groups, invalidate_cache_for)
-from frappe import _, msgprint
-from frappe.utils import (cint, cstr, flt, formatdate, getdate,
- now_datetime, random_string, strip, get_link_to_form, nowtime)
-from frappe.utils.html_utils import clean_html
-from frappe.website.doctype.website_slideshow.website_slideshow import \
- get_slideshow
+import frappe
+from frappe import _
+from frappe.utils import (
+ cint,
+ cstr,
+ flt,
+ formatdate,
+ get_link_to_form,
+ getdate,
+ now_datetime,
+ nowtime,
+ random_string,
+ strip,
+)
+from frappe.utils.html_utils import clean_html
+from frappe.website.doctype.website_slideshow.website_slideshow import get_slideshow
from frappe.website.utils import clear_cache
from frappe.website.website_generator import WebsiteGenerator
+import erpnext
+from erpnext.controllers.item_variant import (
+ ItemVariantExistsError,
+ copy_attributes_to_variant,
+ get_variant,
+ make_variant_item_code,
+ validate_item_variant_attributes,
+)
+from erpnext.setup.doctype.item_group.item_group import (
+ get_parent_item_groups,
+ invalidate_cache_for,
+)
+
class DuplicateReorderRows(frappe.ValidationError):
pass
diff --git a/erpnext/stock/doctype/item/item_dashboard.py b/erpnext/stock/doctype/item/item_dashboard.py
index b3e4796..e80ed6f 100644
--- a/erpnext/stock/doctype/item/item_dashboard.py
+++ b/erpnext/stock/doctype/item/item_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'heatmap': True,
diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py
index 7a9985d..0ed2761 100644
--- a/erpnext/stock/doctype/item/test_item.py
+++ b/erpnext/stock/doctype/item/test_item.py
@@ -2,21 +2,31 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import unittest
-import frappe
-import json
+import json
+import unittest
+
+import frappe
from frappe.test_runner import make_test_objects
-from erpnext.controllers.item_variant import (create_variant, ItemVariantExistsError,
- InvalidItemAttributeValueError, get_variant)
-from erpnext.stock.doctype.item.item import StockExistsForTemplate, InvalidBarcode
-from erpnext.stock.doctype.item.item import (get_uom_conv_factor, get_item_attribute,
- validate_is_stock_item, get_timeline_data)
+
+from erpnext.controllers.item_variant import (
+ InvalidItemAttributeValueError,
+ ItemVariantExistsError,
+ create_variant,
+ get_variant,
+)
+from erpnext.stock.doctype.item.item import (
+ InvalidBarcode,
+ StockExistsForTemplate,
+ get_item_attribute,
+ get_timeline_data,
+ get_uom_conv_factor,
+ validate_is_stock_item,
+)
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
from erpnext.stock.get_item_details import get_item_details
from erpnext.tests.utils import change_settings
-
test_ignore = ["BOM"]
test_dependencies = ["Warehouse", "Item Group", "Item Tax Template", "Brand", "Item Attribute"]
diff --git a/erpnext/stock/doctype/item_alternative/item_alternative.py b/erpnext/stock/doctype/item_alternative/item_alternative.py
index 190cb62..6080fb4 100644
--- a/erpnext/stock/doctype/item_alternative/item_alternative.py
+++ b/erpnext/stock/doctype/item_alternative/item_alternative.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
class ItemAlternative(Document):
def validate(self):
self.has_alternative_item()
diff --git a/erpnext/stock/doctype/item_alternative/test_item_alternative.py b/erpnext/stock/doctype/item_alternative/test_item_alternative.py
index 8f76844..2be8ef7 100644
--- a/erpnext/stock/doctype/item_alternative/test_item_alternative.py
+++ b/erpnext/stock/doctype/item_alternative/test_item_alternative.py
@@ -2,17 +2,27 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
-import frappe, json
-from frappe.utils import flt
-from erpnext.stock.doctype.item.test_item import create_item
-from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom
-from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
-from erpnext.manufacturing.doctype.work_order.work_order import make_stock_entry
-from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation
-from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record
-from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt, make_rm_stock_entry
+
+import json
import unittest
+import frappe
+from frappe.utils import flt
+
+from erpnext.buying.doctype.purchase_order.purchase_order import (
+ make_purchase_receipt,
+ make_rm_stock_entry,
+)
+from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
+from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom
+from erpnext.manufacturing.doctype.work_order.test_work_order import make_wo_order_test_record
+from erpnext.manufacturing.doctype.work_order.work_order import make_stock_entry
+from erpnext.stock.doctype.item.test_item import create_item
+from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import (
+ create_stock_reconciliation,
+)
+
+
class TestItemAlternative(unittest.TestCase):
def setUp(self):
make_items()
diff --git a/erpnext/stock/doctype/item_attribute/item_attribute.py b/erpnext/stock/doctype/item_attribute/item_attribute.py
index 3764738..9894788 100644
--- a/erpnext/stock/doctype/item_attribute/item_attribute.py
+++ b/erpnext/stock/doctype/item_attribute/item_attribute.py
@@ -2,13 +2,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
+from frappe.model.document import Document
from frappe.utils import flt
-from erpnext.controllers.item_variant import (validate_is_incremental,
- validate_item_attribute_value, InvalidItemAttributeValueError)
+from erpnext.controllers.item_variant import (
+ InvalidItemAttributeValueError,
+ validate_is_incremental,
+ validate_item_attribute_value,
+)
class ItemAttributeIncrementError(frappe.ValidationError): pass
diff --git a/erpnext/stock/doctype/item_attribute/test_item_attribute.py b/erpnext/stock/doctype/item_attribute/test_item_attribute.py
index 07af176..fc809f4 100644
--- a/erpnext/stock/doctype/item_attribute/test_item_attribute.py
+++ b/erpnext/stock/doctype/item_attribute/test_item_attribute.py
@@ -2,13 +2,16 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
+
import unittest
+import frappe
+
test_records = frappe.get_test_records('Item Attribute')
from erpnext.stock.doctype.item_attribute.item_attribute import ItemAttributeIncrementError
+
class TestItemAttribute(unittest.TestCase):
def setUp(self):
if frappe.db.exists("Item Attribute", "_Test_Length"):
diff --git a/erpnext/stock/doctype/item_attribute_value/item_attribute_value.py b/erpnext/stock/doctype/item_attribute_value/item_attribute_value.py
index edbab00..ceffb49 100644
--- a/erpnext/stock/doctype/item_attribute_value/item_attribute_value.py
+++ b/erpnext/stock/doctype/item_attribute_value/item_attribute_value.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ItemAttributeValue(Document):
pass
diff --git a/erpnext/stock/doctype/item_customer_detail/item_customer_detail.py b/erpnext/stock/doctype/item_customer_detail/item_customer_detail.py
index 3e4e850..55fd0ec 100644
--- a/erpnext/stock/doctype/item_customer_detail/item_customer_detail.py
+++ b/erpnext/stock/doctype/item_customer_detail/item_customer_detail.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class ItemCustomerDetail(Document):
pass
diff --git a/erpnext/stock/doctype/item_default/item_default.py b/erpnext/stock/doctype/item_default/item_default.py
index 935f0ff..6239c54 100644
--- a/erpnext/stock/doctype/item_default/item_default.py
+++ b/erpnext/stock/doctype/item_default/item_default.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class ItemDefault(Document):
pass
diff --git a/erpnext/stock/doctype/item_manufacturer/item_manufacturer.py b/erpnext/stock/doctype/item_manufacturer/item_manufacturer.py
index 939abf8..044ac7c 100644
--- a/erpnext/stock/doctype/item_manufacturer/item_manufacturer.py
+++ b/erpnext/stock/doctype/item_manufacturer/item_manufacturer.py
@@ -8,6 +8,7 @@
from frappe import _
from frappe.model.document import Document
+
class ItemManufacturer(Document):
def validate(self):
self.validate_duplicate_entry()
diff --git a/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py b/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py
index 1cef20c..5a4ca6a 100644
--- a/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py
+++ b/erpnext/stock/doctype/item_manufacturer/test_item_manufacturer.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestItemManufacturer(unittest.TestCase):
pass
diff --git a/erpnext/stock/doctype/item_price/item_price.py b/erpnext/stock/doctype/item_price/item_price.py
index e82a19b..3f0fc41 100644
--- a/erpnext/stock/doctype/item_price/item_price.py
+++ b/erpnext/stock/doctype/item_price/item_price.py
@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
diff --git a/erpnext/stock/doctype/item_price/test_item_price.py b/erpnext/stock/doctype/item_price/test_item_price.py
index f3d406e..5ed8092 100644
--- a/erpnext/stock/doctype/item_price/test_item_price.py
+++ b/erpnext/stock/doctype/item_price/test_item_price.py
@@ -2,11 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import unittest
+
import frappe
from frappe.test_runner import make_test_records_for_doctype
-from erpnext.stock.get_item_details import get_price_list_rate_for, process_args
+
from erpnext.stock.doctype.item_price.item_price import ItemPriceDuplicateItem
+from erpnext.stock.get_item_details import get_price_list_rate_for, process_args
class TestItemPrice(unittest.TestCase):
diff --git a/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.py b/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.py
index 785737b..0dd7e43 100644
--- a/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.py
+++ b/erpnext/stock/doctype/item_quality_inspection_parameter/item_quality_inspection_parameter.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class ItemQualityInspectionParameter(Document):
pass
diff --git a/erpnext/stock/doctype/item_reorder/item_reorder.py b/erpnext/stock/doctype/item_reorder/item_reorder.py
index 5cdaa22..598339d 100644
--- a/erpnext/stock/doctype/item_reorder/item_reorder.py
+++ b/erpnext/stock/doctype/item_reorder/item_reorder.py
@@ -4,9 +4,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class ItemReorder(Document):
pass
diff --git a/erpnext/stock/doctype/item_supplier/item_supplier.py b/erpnext/stock/doctype/item_supplier/item_supplier.py
index 5dda535..9b5da55 100644
--- a/erpnext/stock/doctype/item_supplier/item_supplier.py
+++ b/erpnext/stock/doctype/item_supplier/item_supplier.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class ItemSupplier(Document):
pass
diff --git a/erpnext/stock/doctype/item_tax/item_tax.py b/erpnext/stock/doctype/item_tax/item_tax.py
index 7c9e811..33c1e49 100644
--- a/erpnext/stock/doctype/item_tax/item_tax.py
+++ b/erpnext/stock/doctype/item_tax/item_tax.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class ItemTax(Document):
pass
diff --git a/erpnext/stock/doctype/item_variant/item_variant.py b/erpnext/stock/doctype/item_variant/item_variant.py
index 5d5a022..47ab07f 100644
--- a/erpnext/stock/doctype/item_variant/item_variant.py
+++ b/erpnext/stock/doctype/item_variant/item_variant.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ItemVariant(Document):
pass
diff --git a/erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.py b/erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.py
index d1a1eb5..78dda65 100644
--- a/erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.py
+++ b/erpnext/stock/doctype/item_variant_attribute/item_variant_attribute.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class ItemVariantAttribute(Document):
pass
diff --git a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.py b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.py
index 78f1131..cb6626f 100644
--- a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.py
+++ b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.model.document import Document
from frappe import _
+from frappe.model.document import Document
+
class ItemVariantSettings(Document):
invalid_fields_for_copy_fields_in_variants = ['barcodes']
diff --git a/erpnext/stock/doctype/item_variant_settings/test_item_variant_settings.py b/erpnext/stock/doctype/item_variant_settings/test_item_variant_settings.py
index 9a800c0..040382a 100644
--- a/erpnext/stock/doctype/item_variant_settings/test_item_variant_settings.py
+++ b/erpnext/stock/doctype/item_variant_settings/test_item_variant_settings.py
@@ -5,5 +5,6 @@
import unittest
+
class TestItemVariantSettings(unittest.TestCase):
pass
diff --git a/erpnext/stock/doctype/item_website_specification/item_website_specification.py b/erpnext/stock/doctype/item_website_specification/item_website_specification.py
index e3041cf..85491b7 100644
--- a/erpnext/stock/doctype/item_website_specification/item_website_specification.py
+++ b/erpnext/stock/doctype/item_website_specification/item_website_specification.py
@@ -4,9 +4,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class ItemWebsiteSpecification(Document):
pass
diff --git a/erpnext/stock/doctype/landed_cost_item/landed_cost_item.py b/erpnext/stock/doctype/landed_cost_item/landed_cost_item.py
index 493e8b2..7dd3aa5 100644
--- a/erpnext/stock/doctype/landed_cost_item/landed_cost_item.py
+++ b/erpnext/stock/doctype/landed_cost_item/landed_cost_item.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class LandedCostItem(Document):
pass
diff --git a/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.py b/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.py
index 38f4eaf..3d81d96 100644
--- a/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.py
+++ b/erpnext/stock/doctype/landed_cost_purchase_receipt/landed_cost_purchase_receipt.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class LandedCostPurchaseReceipt(Document):
pass
diff --git a/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.py b/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.py
index 0dc396a..e649e4d 100644
--- a/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.py
+++ b/erpnext/stock/doctype/landed_cost_taxes_and_charges/landed_cost_taxes_and_charges.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class LandedCostTaxesandCharges(Document):
pass
diff --git a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py
index bf969f9..51ccea9 100644
--- a/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py
+++ b/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py
@@ -2,14 +2,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
-from frappe.utils import flt
-from frappe.model.meta import get_field_precision
from frappe.model.document import Document
-from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
-from erpnext.accounts.doctype.account.account import get_account_currency
+from frappe.model.meta import get_field_precision
+from frappe.utils import flt
+
+import erpnext
from erpnext.controllers.taxes_and_totals import init_landed_taxes_and_totals
+from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+
class LandedCostVoucher(Document):
@frappe.whitelist()
diff --git a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py
index cb09d93..58a72f7 100644
--- a/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py
+++ b/erpnext/stock/doctype/landed_cost_voucher/test_landed_cost_voucher.py
@@ -3,15 +3,20 @@
from __future__ import unicode_literals
+
import unittest
+
import frappe
from frappe.utils import flt
-from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt \
- import get_gl_entries, test_records as pr_test_records, make_purchase_receipt
+
+from erpnext.accounts.doctype.account.test_account import create_account, get_inventory_account
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
-from erpnext.accounts.doctype.account.test_account import get_inventory_account
-from erpnext.accounts.doctype.account.test_account import create_account
from erpnext.assets.doctype.asset.test_asset import create_asset_category, create_fixed_asset_item
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import (
+ get_gl_entries,
+ make_purchase_receipt,
+)
+
class TestLandedCostVoucher(unittest.TestCase):
def test_landed_cost_voucher(self):
@@ -208,7 +213,10 @@
self.assertEqual(pr.items[1].landed_cost_voucher_amount, 100)
def test_multi_currency_lcv(self):
- from erpnext.setup.doctype.currency_exchange.test_currency_exchange import test_records, save_new_records
+ from erpnext.setup.doctype.currency_exchange.test_currency_exchange import (
+ save_new_records,
+ test_records,
+ )
save_new_records(test_records)
diff --git a/erpnext/stock/doctype/manufacturer/manufacturer.py b/erpnext/stock/doctype/manufacturer/manufacturer.py
index b624f73..314a280 100644
--- a/erpnext/stock/doctype/manufacturer/manufacturer.py
+++ b/erpnext/stock/doctype/manufacturer/manufacturer.py
@@ -3,10 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
+
+from frappe.contacts.address_and_contact import load_address_and_contact
from frappe.model.document import Document
+
class Manufacturer(Document):
def onload(self):
"""Load address and contacts in `__onload`"""
diff --git a/erpnext/stock/doctype/manufacturer/test_manufacturer.py b/erpnext/stock/doctype/manufacturer/test_manufacturer.py
index 996f6b2..c0c61b0 100644
--- a/erpnext/stock/doctype/manufacturer/test_manufacturer.py
+++ b/erpnext/stock/doctype/manufacturer/test_manufacturer.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Manufacturer')
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index 026b85e..9eb4721 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -5,19 +5,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-import json
-from frappe.utils import cstr, flt, getdate, new_line_sep, nowdate, add_days, get_link_to_form
-from frappe import msgprint, _
+import frappe
+from frappe import _, msgprint
from frappe.model.mapper import get_mapped_doc
-from erpnext.stock.stock_balance import update_bin_qty, get_indented_qty
+from frappe.utils import cstr, flt, get_link_to_form, getdate, new_line_sep, nowdate
+
+from erpnext.buying.utils import check_on_hold_or_closed_status, validate_for_items
from erpnext.controllers.buying_controller import BuyingController
from erpnext.manufacturing.doctype.work_order.work_order import get_item_details
-from erpnext.buying.utils import check_on_hold_or_closed_status, validate_for_items
from erpnext.stock.doctype.item.item import get_item_defaults
-
-from six import string_types
+from erpnext.stock.stock_balance import get_indented_qty, update_bin_qty
form_grid_templates = {
"items": "templates/form_grid/material_request_grid.html"
diff --git a/erpnext/stock/doctype/material_request/material_request_dashboard.py b/erpnext/stock/doctype/material_request/material_request_dashboard.py
index e1e4faf..291cfb5 100644
--- a/erpnext/stock/doctype/material_request/material_request_dashboard.py
+++ b/erpnext/stock/doctype/material_request/material_request_dashboard.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
from frappe import _
diff --git a/erpnext/stock/doctype/material_request/test_material_request.py b/erpnext/stock/doctype/material_request/test_material_request.py
index b4776ba..5c2ac25 100644
--- a/erpnext/stock/doctype/material_request/test_material_request.py
+++ b/erpnext/stock/doctype/material_request/test_material_request.py
@@ -5,11 +5,20 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, unittest, erpnext
+
+import unittest
+
+import frappe
from frappe.utils import flt, today
-from erpnext.stock.doctype.material_request.material_request \
- import raise_work_orders, make_stock_entry, make_purchase_order, make_supplier_quotation
+
from erpnext.stock.doctype.item.test_item import create_item
+from erpnext.stock.doctype.material_request.material_request import (
+ make_purchase_order,
+ make_stock_entry,
+ make_supplier_quotation,
+ raise_work_orders,
+)
+
class TestMaterialRequest(unittest.TestCase):
def test_make_purchase_order(self):
diff --git a/erpnext/stock/doctype/material_request_item/material_request_item.py b/erpnext/stock/doctype/material_request_item/material_request_item.py
index e0066e6..0c98b97 100644
--- a/erpnext/stock/doctype/material_request_item/material_request_item.py
+++ b/erpnext/stock/doctype/material_request_item/material_request_item.py
@@ -4,10 +4,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+import frappe
from frappe.model.document import Document
+
class MaterialRequestItem(Document):
pass
diff --git a/erpnext/stock/doctype/packed_item/packed_item.json b/erpnext/stock/doctype/packed_item/packed_item.json
index bb396e8..830d546 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.json
+++ b/erpnext/stock/doctype/packed_item/packed_item.json
@@ -16,6 +16,7 @@
"conversion_factor",
"column_break_9",
"qty",
+ "rate",
"uom",
"section_break_9",
"serial_no",
@@ -215,13 +216,23 @@
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "Conversion Factor"
+ },
+ {
+ "fetch_from": "item_code.valuation_rate",
+ "fetch_if_empty": 1,
+ "fieldname": "rate",
+ "fieldtype": "Currency",
+ "in_list_view": 1,
+ "label": "Rate",
+ "print_hide": 1,
+ "read_only": 1
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2021-05-26 07:08:05.111385",
+ "modified": "2021-09-01 15:10:29.646399",
"modified_by": "Administrator",
"module": "Stock",
"name": "Packed Item",
diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py
index 4ab71bd..08a2447 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.py
+++ b/erpnext/stock/doctype/packed_item/packed_item.py
@@ -4,10 +4,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json
-from frappe.utils import cstr, flt
-from erpnext.stock.get_item_details import get_item_details
+
+import json
+
+import frappe
from frappe.model.document import Document
+from frappe.utils import cstr, flt
+
+from erpnext.stock.get_item_details import get_item_details
+
class PackedItem(Document):
pass
@@ -39,8 +44,10 @@
# check if exists
exists = 0
for d in doc.get("packed_items"):
- if d.parent_item == main_item_row.item_code and d.item_code == packing_item_code and\
- d.parent_detail_docname == main_item_row.name:
+ if d.parent_item == main_item_row.item_code and d.item_code == packing_item_code:
+ if d.parent_detail_docname != main_item_row.name:
+ d.parent_detail_docname = main_item_row.name
+
pi, exists = d, 1
break
@@ -86,6 +93,9 @@
cleanup_packing_list(doc, parent_items)
+ if frappe.db.get_single_value("Selling Settings", "editable_bundle_item_rates"):
+ update_product_bundle_price(doc, parent_items)
+
def cleanup_packing_list(doc, parent_items):
"""Remove all those child items which are no longer present in main item table"""
delete_list = []
@@ -103,6 +113,40 @@
if d not in delete_list:
doc.append("packed_items", d)
+def update_product_bundle_price(doc, parent_items):
+ """Updates the prices of Product Bundles based on the rates of the Items in the bundle."""
+
+ if not doc.get('items'):
+ return
+
+ parent_items_index = 0
+ bundle_price = 0
+
+ for bundle_item in doc.get("packed_items"):
+ if parent_items[parent_items_index][0] == bundle_item.parent_item:
+ bundle_item_rate = bundle_item.rate if bundle_item.rate else 0
+ bundle_price += bundle_item.qty * bundle_item_rate
+ else:
+ update_parent_item_price(doc, parent_items[parent_items_index][0], bundle_price)
+
+ bundle_price = 0
+ parent_items_index += 1
+
+ # for the last product bundle
+ if doc.get("packed_items"):
+ update_parent_item_price(doc, parent_items[parent_items_index][0], bundle_price)
+
+def update_parent_item_price(doc, parent_item_code, bundle_price):
+ parent_item_doc = doc.get('items', {'item_code': parent_item_code})[0]
+
+ current_parent_item_price = parent_item_doc.amount
+ if current_parent_item_price != bundle_price:
+ parent_item_doc.amount = bundle_price
+ update_parent_item_rate(parent_item_doc, bundle_price)
+
+def update_parent_item_rate(parent_item_doc, bundle_price):
+ parent_item_doc.rate = bundle_price/parent_item_doc.qty
+
@frappe.whitelist()
def get_items_from_product_bundle(args):
args = json.loads(args)
diff --git a/erpnext/stock/doctype/packing_slip/test_packing_slip.py b/erpnext/stock/doctype/packing_slip/test_packing_slip.py
index 1f2af02..193adfc 100644
--- a/erpnext/stock/doctype/packing_slip/test_packing_slip.py
+++ b/erpnext/stock/doctype/packing_slip/test_packing_slip.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('Packing Slip')
diff --git a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py
index b0a8559..8363968 100644
--- a/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py
+++ b/erpnext/stock/doctype/packing_slip_item/packing_slip_item.py
@@ -4,9 +4,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class PackingSlipItem(Document):
pass
diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py
index 516ae43..dffbe80 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.py
+++ b/erpnext/stock/doctype/pick_list/pick_list.py
@@ -3,16 +3,21 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
-from six import iteritems
-from frappe.model.document import Document
-from frappe import _
from collections import OrderedDict
-from frappe.utils import floor, flt, today, cint
-from frappe.model.mapper import get_mapped_doc, map_child_doc
+
+import frappe
+from frappe import _
+from frappe.model.document import Document
+from frappe.model.mapper import map_child_doc
+from frappe.utils import cint, floor, flt, today
+from six import iteritems
+
+from erpnext.selling.doctype.sales_order.sales_order import (
+ make_delivery_note as create_delivery_note_from_sales_order,
+)
from erpnext.stock.get_item_details import get_conversion_factor
-from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note as create_delivery_note_from_sales_order
# TODO: Prioritize SO or WO group warehouse
diff --git a/erpnext/stock/doctype/pick_list/pick_list_dashboard.py b/erpnext/stock/doctype/pick_list/pick_list_dashboard.py
index 7c321c4..50a767b 100644
--- a/erpnext/stock/doctype/pick_list/pick_list_dashboard.py
+++ b/erpnext/stock/doctype/pick_list/pick_list_dashboard.py
@@ -1,5 +1,5 @@
from __future__ import unicode_literals
-from frappe import _
+
def get_data():
return {
diff --git a/erpnext/stock/doctype/pick_list/test_pick_list.py b/erpnext/stock/doctype/pick_list/test_pick_list.py
index 84566b8..aa710ad 100644
--- a/erpnext/stock/doctype/pick_list/test_pick_list.py
+++ b/erpnext/stock/doctype/pick_list/test_pick_list.py
@@ -3,15 +3,19 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
+import frappe
+
test_dependencies = ['Item', 'Sales Invoice', 'Stock Entry', 'Batch']
-from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
from erpnext.stock.doctype.item.test_item import create_item
from erpnext.stock.doctype.pick_list.pick_list import create_delivery_note
-from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation \
- import EmptyStockReconciliationItemsError
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
+from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import (
+ EmptyStockReconciliationItemsError,
+)
+
class TestPickList(unittest.TestCase):
diff --git a/erpnext/stock/doctype/pick_list_item/pick_list_item.py b/erpnext/stock/doctype/pick_list_item/pick_list_item.py
index 8797b8d..4cd81f7 100644
--- a/erpnext/stock/doctype/pick_list_item/pick_list_item.py
+++ b/erpnext/stock/doctype/pick_list_item/pick_list_item.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class PickListItem(Document):
pass
diff --git a/erpnext/stock/doctype/price_list/price_list.py b/erpnext/stock/doctype/price_list/price_list.py
index 002d3d8..01040c6 100644
--- a/erpnext/stock/doctype/price_list/price_list.py
+++ b/erpnext/stock/doctype/price_list/price_list.py
@@ -2,11 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _, throw
-from frappe.utils import cint
from frappe.model.document import Document
-import frappe.defaults
+from frappe.utils import cint
+
class PriceList(Document):
def validate(self):
@@ -37,7 +38,9 @@
def check_impact_on_shopping_cart(self):
"Check if Price List currency change impacts Shopping Cart."
- from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import validate_cart_settings
+ from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import (
+ validate_cart_settings,
+ )
doc_before_save = self.get_doc_before_save()
currency_changed = self.currency != doc_before_save.currency
diff --git a/erpnext/stock/doctype/price_list/test_price_list.py b/erpnext/stock/doctype/price_list/test_price_list.py
index 2c287c9..baf6170 100644
--- a/erpnext/stock/doctype/price_list/test_price_list.py
+++ b/erpnext/stock/doctype/price_list/test_price_list.py
@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
# test_ignore = ["Item"]
diff --git a/erpnext/stock/doctype/price_list_country/price_list_country.py b/erpnext/stock/doctype/price_list_country/price_list_country.py
index db1a060..a57729f 100644
--- a/erpnext/stock/doctype/price_list_country/price_list_country.py
+++ b/erpnext/stock/doctype/price_list_country/price_list_country.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class PriceListCountry(Document):
pass
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
index ece6d6f..07a568d 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
@@ -2,21 +2,19 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-
-from frappe.utils import flt, cint, nowdate
-
-from frappe import throw, _
-import frappe.defaults
-from frappe.utils import getdate
-from erpnext.controllers.buying_controller import BuyingController
-from erpnext.accounts.utils import get_account_currency
+from frappe import _, throw
from frappe.desk.notifications import clear_doctype_notifications
from frappe.model.mapper import get_mapped_doc
-from erpnext.buying.utils import check_on_hold_or_closed_status
+from frappe.utils import cint, flt, getdate, nowdate
+from six import iteritems
+
+from erpnext.accounts.utils import get_account_currency
from erpnext.assets.doctype.asset.asset import get_asset_account, is_cwip_accounting_enabled
from erpnext.assets.doctype.asset_category.asset_category import get_asset_category_account
-from six import iteritems
+from erpnext.buying.utils import check_on_hold_or_closed_status
+from erpnext.controllers.buying_controller import BuyingController
from erpnext.stock.doctype.delivery_note.delivery_note import make_inter_company_transaction
form_grid_templates = {
@@ -254,7 +252,9 @@
return process_gl_map(gl_entries)
def make_item_gl_entries(self, gl_entries, warehouse_account=None):
- from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import get_purchase_document_details
+ from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import (
+ get_purchase_document_details,
+ )
stock_rbnb = self.get_company_default("stock_received_but_not_billed")
landed_cost_entries = get_item_account_wise_additional_cost(self.name)
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py
index 3832c82..b60850f 100644
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_dashboard.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
from frappe import _
+
def get_data():
return {
'fieldname': 'purchase_receipt_no',
diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
index 2314508..044856c 100644
--- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
+++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py
@@ -2,20 +2,22 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import unittest
+
import json
-import frappe, erpnext
-import frappe.defaults
-from frappe.utils import cint, flt, cstr, today, random_string, add_days
-from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
-from erpnext.stock.doctype.item.test_item import create_item
-from erpnext.stock.doctype.serial_no.serial_no import SerialNoDuplicateError
-from erpnext.accounts.doctype.account.test_account import get_inventory_account
-from erpnext.stock.doctype.item.test_item import make_item
+import unittest
+
+import frappe
+from frappe.utils import add_days, cint, cstr, flt, today
from six import iteritems
-from erpnext.stock.stock_ledger import SerialNoExistsInFutureTransaction
+
+import erpnext
+from erpnext.accounts.doctype.account.test_account import get_inventory_account
+from erpnext.stock.doctype.item.test_item import create_item, make_item
+from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
+from erpnext.stock.doctype.serial_no.serial_no import SerialNoDuplicateError, get_serial_nos
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
-from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+from erpnext.stock.stock_ledger import SerialNoExistsInFutureTransaction
+
class TestPurchaseReceipt(unittest.TestCase):
def setUp(self):
@@ -275,11 +277,16 @@
receive more than the required qty in the PO.
Expected Result: Error Raised for Over Receipt against PO.
"""
+ from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt
+ from erpnext.buying.doctype.purchase_order.purchase_order import (
+ make_rm_stock_entry as make_subcontract_transfer_entry,
+ )
+ from erpnext.buying.doctype.purchase_order.test_purchase_order import (
+ create_purchase_order,
+ make_subcontracted_item,
+ update_backflush_based_on,
+ )
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
- from erpnext.buying.doctype.purchase_order.test_purchase_order import (update_backflush_based_on,
- make_subcontracted_item, create_purchase_order)
- from erpnext.buying.doctype.purchase_order.purchase_order import (make_purchase_receipt,
- make_rm_stock_entry as make_subcontract_transfer_entry)
update_backflush_based_on("Material Transferred for Subcontract")
item_code = "_Test Subcontracted FG Item 1"
@@ -526,7 +533,9 @@
pr.cancel()
def test_closed_purchase_receipt(self):
- from erpnext.stock.doctype.purchase_receipt.purchase_receipt import update_purchase_receipt_status
+ from erpnext.stock.doctype.purchase_receipt.purchase_receipt import (
+ update_purchase_receipt_status,
+ )
pr = make_purchase_receipt(do_not_submit=True)
pr.submit()
@@ -539,9 +548,11 @@
def test_pr_billing_status(self):
# PO -> PR1 -> PI and PO -> PI and PO -> PR2
+ from erpnext.buying.doctype.purchase_order.purchase_order import (
+ make_purchase_invoice as make_purchase_invoice_from_po,
+ )
+ from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_receipt
from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
- from erpnext.buying.doctype.purchase_order.purchase_order \
- import make_purchase_receipt, make_purchase_invoice as make_purchase_invoice_from_po
po = create_purchase_order()
@@ -748,7 +759,10 @@
pr.cancel()
def test_make_purchase_invoice_from_pr_for_returned_qty(self):
- from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order, create_pr_against_po
+ from erpnext.buying.doctype.purchase_order.test_purchase_order import (
+ create_pr_against_po,
+ create_purchase_order,
+ )
po = create_purchase_order()
pr = create_pr_against_po(po.name)
@@ -879,10 +893,15 @@
def test_subcontracted_pr_for_multi_transfer_batches(self):
+ from erpnext.buying.doctype.purchase_order.purchase_order import (
+ make_purchase_receipt,
+ make_rm_stock_entry,
+ )
+ from erpnext.buying.doctype.purchase_order.test_purchase_order import (
+ create_purchase_order,
+ update_backflush_based_on,
+ )
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
- from erpnext.buying.doctype.purchase_order.purchase_order import make_rm_stock_entry, make_purchase_receipt
- from erpnext.buying.doctype.purchase_order.test_purchase_order import (update_backflush_based_on,
- create_purchase_order)
update_backflush_based_on("Material Transferred for Subcontract")
item_code = "_Test Subcontracted FG Item 3"
@@ -952,8 +971,7 @@
- Create PI from PO and submit
- Create PR from PO and submit
"""
- from erpnext.buying.doctype.purchase_order import test_purchase_order
- from erpnext.buying.doctype.purchase_order import purchase_order
+ from erpnext.buying.doctype.purchase_order import purchase_order, test_purchase_order
po = test_purchase_order.create_purchase_order()
@@ -974,8 +992,7 @@
- Create partial PI from PO and submit
- Create PR from PO and submit
"""
- from erpnext.buying.doctype.purchase_order import test_purchase_order
- from erpnext.buying.doctype.purchase_order import purchase_order
+ from erpnext.buying.doctype.purchase_order import purchase_order, test_purchase_order
po = test_purchase_order.create_purchase_order()
@@ -1038,8 +1055,12 @@
frappe.db.set_value('Company', company, 'enable_perpetual_inventory_for_non_stock_items', before_test_value)
def test_purchase_receipt_with_exchange_rate_difference(self):
- from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice as create_purchase_invoice
- from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import make_purchase_receipt as create_purchase_receipt
+ from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import (
+ make_purchase_receipt as create_purchase_receipt,
+ )
+ from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import (
+ make_purchase_invoice as create_purchase_invoice,
+ )
pi = create_purchase_invoice(company="_Test Company with perpetual inventory",
cost_center = "Main - TCP1",
@@ -1065,10 +1086,18 @@
self.assertEqual(discrepancy_caused_by_exchange_rate_diff, amount)
def test_payment_terms_are_fetched_when_creating_purchase_invoice(self):
- from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_terms_template
+ from erpnext.accounts.doctype.payment_entry.test_payment_entry import (
+ create_payment_terms_template,
+ )
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
- from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order, make_pr_against_po
- from erpnext.selling.doctype.sales_order.test_sales_order import automatically_fetch_payment_terms, compare_payment_schedules
+ from erpnext.buying.doctype.purchase_order.test_purchase_order import (
+ create_purchase_order,
+ make_pr_against_po,
+ )
+ from erpnext.selling.doctype.sales_order.test_sales_order import (
+ automatically_fetch_payment_terms,
+ compare_payment_schedules,
+ )
automatically_fetch_payment_terms()
diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
index 82cc98e..3efa66e 100644
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.json
@@ -10,6 +10,7 @@
"barcode",
"section_break_2",
"item_code",
+ "product_bundle",
"supplier_part_no",
"column_break_2",
"item_name",
@@ -956,12 +957,19 @@
"no_copy": 1,
"print_hide": 1,
"read_only": 1
+ },
+ {
+ "fieldname": "product_bundle",
+ "fieldtype": "Link",
+ "label": "Product Bundle",
+ "options": "Product Bundle",
+ "read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2021-03-29 04:17:00.336298",
+ "modified": "2021-09-01 16:02:40.338597",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Item",
diff --git a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.py b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.py
index b79bb5d..2d25140 100644
--- a/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.py
+++ b/erpnext/stock/doctype/purchase_receipt_item/purchase_receipt_item.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class PurchaseReceiptItem(Document):
pass
diff --git a/erpnext/stock/doctype/putaway_rule/putaway_rule.py b/erpnext/stock/doctype/putaway_rule/putaway_rule.py
index 315e723..aa9d896 100644
--- a/erpnext/stock/doctype/putaway_rule/putaway_rule.py
+++ b/erpnext/stock/doctype/putaway_rule/putaway_rule.py
@@ -3,16 +3,20 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import copy
import json
from collections import defaultdict
-from six import string_types
+
+import frappe
from frappe import _
-from frappe.utils import flt, floor, nowdate, cint
from frappe.model.document import Document
-from erpnext.stock.utils import get_stock_balance
+from frappe.utils import cint, floor, flt, nowdate
+from six import string_types
+
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+from erpnext.stock.utils import get_stock_balance
+
class PutawayRule(Document):
def validate(self):
diff --git a/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py b/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py
index 0590ae1..0aa7610 100644
--- a/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py
+++ b/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py
@@ -2,14 +2,18 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
-import frappe
+
import unittest
-from erpnext.stock.doctype.item.test_item import make_item
-from erpnext.stock.get_item_details import get_conversion_factor
-from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
-from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
+
+import frappe
+
from erpnext.stock.doctype.batch.test_batch import make_new_batch
+from erpnext.stock.doctype.item.test_item import make_item
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
+from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
+from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
+from erpnext.stock.get_item_details import get_conversion_factor
+
class TestPutawayRule(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/stock/doctype/quality_inspection/quality_inspection.py b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
index 469511a..8b2f8da 100644
--- a/erpnext/stock/doctype/quality_inspection/quality_inspection.py
+++ b/erpnext/stock/doctype/quality_inspection/quality_inspection.py
@@ -2,13 +2,17 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
+from frappe import _
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
-from frappe import _
-from frappe.utils import flt, cint
-from erpnext.stock.doctype.quality_inspection_template.quality_inspection_template \
- import get_template_details
+from frappe.utils import cint, flt
+
+from erpnext.stock.doctype.quality_inspection_template.quality_inspection_template import (
+ get_template_details,
+)
+
class QualityInspection(Document):
def validate(self):
diff --git a/erpnext/stock/doctype/quality_inspection_parameter/quality_inspection_parameter.py b/erpnext/stock/doctype/quality_inspection_parameter/quality_inspection_parameter.py
index 8678422..fa68201 100644
--- a/erpnext/stock/doctype/quality_inspection_parameter/quality_inspection_parameter.py
+++ b/erpnext/stock/doctype/quality_inspection_parameter/quality_inspection_parameter.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class QualityInspectionParameter(Document):
pass
diff --git a/erpnext/stock/doctype/quality_inspection_parameter/test_quality_inspection_parameter.py b/erpnext/stock/doctype/quality_inspection_parameter/test_quality_inspection_parameter.py
index cefdc08..f3041aa 100644
--- a/erpnext/stock/doctype/quality_inspection_parameter/test_quality_inspection_parameter.py
+++ b/erpnext/stock/doctype/quality_inspection_parameter/test_quality_inspection_parameter.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestQualityInspectionParameter(unittest.TestCase):
pass
diff --git a/erpnext/stock/doctype/quality_inspection_parameter_group/quality_inspection_parameter_group.py b/erpnext/stock/doctype/quality_inspection_parameter_group/quality_inspection_parameter_group.py
index 1a3b1a0..b5e28f3 100644
--- a/erpnext/stock/doctype/quality_inspection_parameter_group/quality_inspection_parameter_group.py
+++ b/erpnext/stock/doctype/quality_inspection_parameter_group/quality_inspection_parameter_group.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class QualityInspectionParameterGroup(Document):
pass
diff --git a/erpnext/stock/doctype/quality_inspection_parameter_group/test_quality_inspection_parameter_group.py b/erpnext/stock/doctype/quality_inspection_parameter_group/test_quality_inspection_parameter_group.py
index 212d4b8..ded47e8 100644
--- a/erpnext/stock/doctype/quality_inspection_parameter_group/test_quality_inspection_parameter_group.py
+++ b/erpnext/stock/doctype/quality_inspection_parameter_group/test_quality_inspection_parameter_group.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestQualityInspectionParameterGroup(unittest.TestCase):
pass
diff --git a/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py b/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py
index b10fa31..7b56603 100644
--- a/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py
+++ b/erpnext/stock/doctype/quality_inspection_reading/quality_inspection_reading.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class QualityInspectionReading(Document):
pass
diff --git a/erpnext/stock/doctype/quality_inspection_template/quality_inspection_template.py b/erpnext/stock/doctype/quality_inspection_template/quality_inspection_template.py
index 971b3c2..50e28a6 100644
--- a/erpnext/stock/doctype/quality_inspection_template/quality_inspection_template.py
+++ b/erpnext/stock/doctype/quality_inspection_template/quality_inspection_template.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe.model.document import Document
+
class QualityInspectionTemplate(Document):
pass
diff --git a/erpnext/stock/doctype/quality_inspection_template/test_quality_inspection_template.py b/erpnext/stock/doctype/quality_inspection_template/test_quality_inspection_template.py
index b16efa8..6286523 100644
--- a/erpnext/stock/doctype/quality_inspection_template/test_quality_inspection_template.py
+++ b/erpnext/stock/doctype/quality_inspection_template/test_quality_inspection_template.py
@@ -5,5 +5,6 @@
import unittest
+
class TestQualityInspectionTemplate(unittest.TestCase):
pass
diff --git a/erpnext/stock/doctype/quick_stock_balance/quick_stock_balance.py b/erpnext/stock/doctype/quick_stock_balance/quick_stock_balance.py
index efa9519..8ca5521 100644
--- a/erpnext/stock/doctype/quick_stock_balance/quick_stock_balance.py
+++ b/erpnext/stock/doctype/quick_stock_balance/quick_stock_balance.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.model.document import Document
+
from erpnext.stock.utils import get_stock_balance, get_stock_value_on
+
class QuickStockBalance(Document):
pass
diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
index b22759d..62b3a6a 100644
--- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
+++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py
@@ -3,14 +3,22 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from rq.timeouts import JobTimeoutException
-from frappe.model.document import Document
-from frappe.utils import cint, get_link_to_form, add_to_date, now, today, time_diff_in_hours
-from erpnext.stock.stock_ledger import repost_future_sle
-from erpnext.accounts.utils import update_gl_entries_after, check_if_stock_and_account_balance_synced
-from frappe.utils.user import get_users_with_role
+
+import frappe
from frappe import _
+from frappe.model.document import Document
+from frappe.utils import cint, get_link_to_form, now, today
+from frappe.utils.user import get_users_with_role
+from rq.timeouts import JobTimeoutException
+
+import erpnext
+from erpnext.accounts.utils import (
+ check_if_stock_and_account_balance_synced,
+ update_gl_entries_after,
+)
+from erpnext.stock.stock_ledger import repost_future_sle
+
+
class RepostItemValuation(Document):
def validate(self):
self.set_status()
diff --git a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py
index 13ceb68..c70a9ec 100644
--- a/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py
+++ b/erpnext/stock/doctype/repost_item_valuation/test_repost_item_valuation.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestRepostItemValuation(unittest.TestCase):
pass
diff --git a/erpnext/stock/doctype/serial_no/serial_no.py b/erpnext/stock/doctype/serial_no/serial_no.py
index 70312bc..82d8aae 100644
--- a/erpnext/stock/doctype/serial_no/serial_no.py
+++ b/erpnext/stock/doctype/serial_no/serial_no.py
@@ -2,19 +2,20 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
import json
+import frappe
+from frappe import ValidationError, _
from frappe.model.naming import make_autoname
-from frappe.utils import cint, cstr, flt, add_days, nowdate, getdate, get_link_to_form
-from erpnext.stock.get_item_details import get_reserved_qty_for_so
-
-from frappe import _, ValidationError
-
-from erpnext.controllers.stock_controller import StockController
+from frappe.utils import add_days, cint, cstr, flt, get_link_to_form, getdate, nowdate
from six import string_types
from six.moves import map
+from erpnext.controllers.stock_controller import StockController
+from erpnext.stock.get_item_details import get_reserved_qty_for_so
+
+
class SerialNoCannotCreateDirectError(ValidationError): pass
class SerialNoCannotCannotChangeError(ValidationError): pass
class SerialNoNotRequiredError(ValidationError): pass
@@ -573,7 +574,7 @@
if batch_nos:
try:
filters["batch_no"] = json.loads(batch_nos) if (type(json.loads(batch_nos)) == list) else [json.loads(batch_nos)]
- except:
+ except Exception:
filters["batch_no"] = [batch_nos]
if posting_date:
diff --git a/erpnext/stock/doctype/serial_no/test_serial_no.py b/erpnext/stock/doctype/serial_no/test_serial_no.py
index 0eccce3..818c163 100644
--- a/erpnext/stock/doctype/serial_no/test_serial_no.py
+++ b/erpnext/stock/doctype/serial_no/test_serial_no.py
@@ -5,12 +5,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, unittest
-from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
-from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
+import unittest
+
+import frappe
+
from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+from erpnext.stock.doctype.stock_entry.test_stock_entry import make_serialized_item
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
test_dependencies = ["Item"]
@@ -18,6 +21,7 @@
from erpnext.stock.doctype.serial_no.serial_no import *
+
class TestSerialNo(unittest.TestCase):
def test_cannot_create_direct(self):
frappe.delete_doc_if_exists("Serial No", "_TCSER0001")
diff --git a/erpnext/stock/doctype/shipment/shipment.py b/erpnext/stock/doctype/shipment/shipment.py
index 01fcee4..2cacd0d 100644
--- a/erpnext/stock/doctype/shipment/shipment.py
+++ b/erpnext/stock/doctype/shipment/shipment.py
@@ -3,12 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt, get_time
-from frappe.model.document import Document
-from erpnext.accounts.party import get_party_shipping_address
from frappe.contacts.doctype.contact.contact import get_default_contact
+from frappe.model.document import Document
+from frappe.utils import flt, get_time
+
+from erpnext.accounts.party import get_party_shipping_address
+
class Shipment(Document):
def validate(self):
diff --git a/erpnext/stock/doctype/shipment/test_shipment.py b/erpnext/stock/doctype/shipment/test_shipment.py
index db2f116..9914cf8 100644
--- a/erpnext/stock/doctype/shipment/test_shipment.py
+++ b/erpnext/stock/doctype/shipment/test_shipment.py
@@ -2,12 +2,15 @@
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
+
+import unittest
from datetime import date, timedelta
import frappe
-import unittest
+
from erpnext.stock.doctype.delivery_note.delivery_note import make_shipment
+
class TestShipment(unittest.TestCase):
def test_shipment_from_delivery_note(self):
delivery_note = create_test_delivery_note()
diff --git a/erpnext/stock/doctype/shipment_delivery_note/shipment_delivery_note.py b/erpnext/stock/doctype/shipment_delivery_note/shipment_delivery_note.py
index 4342151..795c952 100644
--- a/erpnext/stock/doctype/shipment_delivery_note/shipment_delivery_note.py
+++ b/erpnext/stock/doctype/shipment_delivery_note/shipment_delivery_note.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ShipmentDeliveryNote(Document):
pass
diff --git a/erpnext/stock/doctype/shipment_parcel/shipment_parcel.py b/erpnext/stock/doctype/shipment_parcel/shipment_parcel.py
index 53e6ed5..69fecb6 100644
--- a/erpnext/stock/doctype/shipment_parcel/shipment_parcel.py
+++ b/erpnext/stock/doctype/shipment_parcel/shipment_parcel.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ShipmentParcel(Document):
pass
diff --git a/erpnext/stock/doctype/shipment_parcel_template/shipment_parcel_template.py b/erpnext/stock/doctype/shipment_parcel_template/shipment_parcel_template.py
index 2a8d58d..0eaa2d3 100644
--- a/erpnext/stock/doctype/shipment_parcel_template/shipment_parcel_template.py
+++ b/erpnext/stock/doctype/shipment_parcel_template/shipment_parcel_template.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ShipmentParcelTemplate(Document):
pass
diff --git a/erpnext/stock/doctype/shipment_parcel_template/test_shipment_parcel_template.py b/erpnext/stock/doctype/shipment_parcel_template/test_shipment_parcel_template.py
index 6e2caa7..5f2a399 100644
--- a/erpnext/stock/doctype/shipment_parcel_template/test_shipment_parcel_template.py
+++ b/erpnext/stock/doctype/shipment_parcel_template/test_shipment_parcel_template.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestShipmentParcelTemplate(unittest.TestCase):
pass
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index 8f34794..908020d 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -1101,4 +1101,3 @@
}
$.extend(cur_frm.cscript, new erpnext.stock.StockEntry({frm: cur_frm}));
-
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 760cb7d..41ca830 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -2,27 +2,39 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-import frappe.defaults
-from frappe import _
-from frappe.utils import cstr, cint, flt, comma_or, getdate, nowdate, formatdate, format_time
-from erpnext.stock.utils import get_incoming_rate
-from erpnext.stock.stock_ledger import get_previous_sle, NegativeStockError, get_valuation_rate
-from erpnext.stock.get_item_details import get_bin_details, get_default_cost_center, get_conversion_factor, get_reserved_qty_for_so
-from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults
-from erpnext.setup.doctype.brand.brand import get_brand_defaults
-from erpnext.stock.doctype.batch.batch import get_batch_no, set_batch_nos, get_batch_qty
-from erpnext.stock.doctype.item.item import get_item_defaults
-from erpnext.manufacturing.doctype.bom.bom import validate_bom_no, add_additional_cost
-from erpnext.stock.utils import get_bin
-from frappe.model.mapper import get_mapped_doc
-from erpnext.stock.doctype.serial_no.serial_no import update_serial_nos_after_submit, get_serial_nos
-from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import OpeningEntryAccountError
-from erpnext.accounts.general_ledger import process_gl_map
-from erpnext.controllers.taxes_and_totals import init_landed_taxes_and_totals
+
import json
-from six import string_types, itervalues, iteritems
+import frappe
+from frappe import _
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import cint, comma_or, cstr, flt, format_time, formatdate, getdate, nowdate
+from six import iteritems, itervalues, string_types
+
+import erpnext
+from erpnext.accounts.general_ledger import process_gl_map
+from erpnext.controllers.taxes_and_totals import init_landed_taxes_and_totals
+from erpnext.manufacturing.doctype.bom.bom import add_additional_cost, validate_bom_no
+from erpnext.setup.doctype.brand.brand import get_brand_defaults
+from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults
+from erpnext.stock.doctype.batch.batch import get_batch_no, get_batch_qty, set_batch_nos
+from erpnext.stock.doctype.item.item import get_item_defaults
+from erpnext.stock.doctype.serial_no.serial_no import (
+ get_serial_nos,
+ update_serial_nos_after_submit,
+)
+from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import (
+ OpeningEntryAccountError,
+)
+from erpnext.stock.get_item_details import (
+ get_bin_details,
+ get_conversion_factor,
+ get_default_cost_center,
+ get_reserved_qty_for_so,
+)
+from erpnext.stock.stock_ledger import NegativeStockError, get_previous_sle, get_valuation_rate
+from erpnext.stock.utils import get_bin, get_incoming_rate
+
class IncorrectValuationRateError(frappe.ValidationError): pass
class DuplicateEntryForWorkOrderError(frappe.ValidationError): pass
@@ -1200,10 +1212,10 @@
wo_item_qty = item.transferred_qty or item.required_qty
- req_qty_each = (
- (flt(wo_item_qty) - flt(item.consumed_qty)) /
- (flt(work_order_qty) - flt(wo.produced_qty))
- )
+ wo_qty_consumed = flt(wo_item_qty) - flt(item.consumed_qty)
+ wo_qty_to_produce = flt(work_order_qty) - flt(wo.produced_qty)
+
+ req_qty_each = (wo_qty_consumed) / (wo_qty_to_produce or 1)
qty = req_qty_each * flt(self.fg_completed_qty)
@@ -1582,7 +1594,7 @@
if material_request and material_request not in material_requests:
material_requests.append(material_request)
frappe.db.set_value('Material Request', material_request, 'transfer_status', status)
-
+
def update_items_for_process_loss(self):
process_loss_dict = {}
for d in self.get("items"):
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
index 563fcb0..f54dc46 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry_utils.py
@@ -2,11 +2,14 @@
# See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe.utils import cint, flt
+import frappe
+from frappe.utils import cint, flt
from six import string_types
+import erpnext
+
+
@frappe.whitelist()
def make_stock_entry(**args):
'''Helper function to make a Stock Entry
diff --git a/erpnext/stock/doctype/stock_entry/test_stock_entry.py b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
index a0e7051..46619eb 100644
--- a/erpnext/stock/doctype/stock_entry/test_stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/test_stock_entry.py
@@ -2,21 +2,33 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, unittest
-import frappe.defaults
-from frappe.utils import flt, nowdate, nowtime
-from erpnext.stock.doctype.serial_no.serial_no import *
-from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import StockFreezeError
-from erpnext.stock.stock_ledger import get_previous_sle
+
+import unittest
+
+import frappe
from frappe.permissions import add_user_permission, remove_user_permission
-from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation
-from erpnext.stock.doctype.item.test_item import set_item_variant_settings, make_item_variant, create_item
-from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
-from erpnext.accounts.doctype.account.test_account import get_inventory_account
-from erpnext.stock.doctype.stock_entry.stock_entry import move_sample_to_retention_warehouse, make_stock_in_entry
-from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import OpeningEntryAccountError
+from frappe.utils import flt, nowdate, nowtime
from six import iteritems
+from erpnext.accounts.doctype.account.test_account import get_inventory_account
+from erpnext.stock.doctype.item.test_item import (
+ create_item,
+ make_item_variant,
+ set_item_variant_settings,
+)
+from erpnext.stock.doctype.serial_no.serial_no import * # noqa
+from erpnext.stock.doctype.stock_entry.stock_entry import move_sample_to_retention_warehouse
+from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
+from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import StockFreezeError
+from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import (
+ OpeningEntryAccountError,
+)
+from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import (
+ create_stock_reconciliation,
+)
+from erpnext.stock.stock_ledger import get_previous_sle
+
+
def get_sle(**args):
condition, values = "", []
for key, value in iteritems(args):
@@ -539,8 +551,9 @@
frappe.db.set_value("Stock Settings", None, "stock_frozen_upto_days", 0)
def test_work_order(self):
- from erpnext.manufacturing.doctype.work_order.work_order \
- import make_stock_entry as _make_stock_entry
+ from erpnext.manufacturing.doctype.work_order.work_order import (
+ make_stock_entry as _make_stock_entry,
+ )
bom_no, bom_operation_cost = frappe.db.get_value("BOM", {"item": "_Test FG Item 2",
"is_default": 1, "docstatus": 1}, ["name", "operating_cost"])
@@ -618,8 +631,8 @@
s2.cancel()
def test_retain_sample(self):
- from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
from erpnext.stock.doctype.batch.batch import get_batch_qty
+ from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
create_warehouse("Test Warehouse for Sample Retention")
frappe.db.set_value("Stock Settings", None, "sample_retention_warehouse", "Test Warehouse for Sample Retention - _TC")
diff --git a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_manufacture.js b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_manufacture.js
index 285ae4f..e51c90c 100644
--- a/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_manufacture.js
+++ b/erpnext/stock/doctype/stock_entry/tests/test_stock_entry_for_manufacture.js
@@ -24,4 +24,3 @@
() => done()
]);
});
-
diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py
index a5623fd..6c03425 100644
--- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py
+++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class StockEntryDetail(Document):
pass
diff --git a/erpnext/stock/doctype/stock_entry_type/stock_entry_type.py b/erpnext/stock/doctype/stock_entry_type/stock_entry_type.py
index 1069ec8..3d6e264 100644
--- a/erpnext/stock/doctype/stock_entry_type/stock_entry_type.py
+++ b/erpnext/stock/doctype/stock_entry_type/stock_entry_type.py
@@ -3,9 +3,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class StockEntryType(Document):
def validate(self):
if self.add_to_transit and self.purpose != 'Material Transfer':
diff --git a/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py b/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py
index 4fa73fd..7eea8f5 100644
--- a/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py
+++ b/erpnext/stock/doctype/stock_entry_type/test_stock_entry_type.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestStockEntryType(unittest.TestCase):
pass
diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
index be1f00e..caa1d42 100644
--- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
+++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
@@ -3,14 +3,18 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
+from datetime import date
+
import frappe
from frappe import _
-from frappe.utils import flt, getdate, add_days, formatdate, get_datetime, cint
-from frappe.model.document import Document
-from datetime import date
-from erpnext.controllers.item_variant import ItemTemplateCannotHaveStock
-from erpnext.accounts.utils import get_fiscal_year
from frappe.core.doctype.role.role import get_users
+from frappe.model.document import Document
+from frappe.utils import add_days, cint, flt, formatdate, get_datetime, getdate
+
+from erpnext.accounts.utils import get_fiscal_year
+from erpnext.controllers.item_variant import ItemTemplateCannotHaveStock
+
class StockFreezeError(frappe.ValidationError): pass
class BackDatedStockTransaction(frappe.ValidationError): pass
@@ -27,7 +31,7 @@
def validate(self):
self.flags.ignore_submit_comment = True
- from erpnext.stock.utils import validate_warehouse_company, validate_disabled_warehouse
+ from erpnext.stock.utils import validate_disabled_warehouse, validate_warehouse_company
self.validate_mandatory()
self.validate_item()
self.validate_batch()
diff --git a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py
index af2ada8..61bae49 100644
--- a/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py
+++ b/erpnext/stock/doctype/stock_ledger_entry/test_stock_ledger_entry.py
@@ -3,19 +3,25 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
-from frappe.utils import today, add_days
-from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
-from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation \
- import create_stock_reconciliation
-from erpnext.stock.doctype.item.test_item import make_item
-from erpnext.stock.stock_ledger import get_previous_sle
-from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
-from erpnext.stock.doctype.landed_cost_voucher.test_landed_cost_voucher import create_landed_cost_voucher
-from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
-from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import BackDatedStockTransaction
+
+import frappe
from frappe.core.page.permission_manager.permission_manager import reset
+from frappe.utils import add_days, today
+
+from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
+from erpnext.stock.doctype.item.test_item import make_item
+from erpnext.stock.doctype.landed_cost_voucher.test_landed_cost_voucher import (
+ create_landed_cost_voucher,
+)
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
+from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
+from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import BackDatedStockTransaction
+from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import (
+ create_stock_reconciliation,
+)
+from erpnext.stock.stock_ledger import get_previous_sle
+
class TestStockLedgerEntry(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
index aa502a4..84f65a0 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
@@ -302,4 +302,3 @@
};
cur_frm.cscript = new erpnext.stock.StockReconciliation({frm: cur_frm});
-
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
index 24b7b9a..fa96c5a 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
@@ -2,15 +2,18 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-import frappe.defaults
-from frappe import msgprint, _
-from frappe.utils import cstr, flt, cint
-from erpnext.controllers.stock_controller import StockController
+
+import frappe
+from frappe import _, msgprint
+from frappe.utils import cint, cstr, flt
+
+import erpnext
from erpnext.accounts.utils import get_company_default
-from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
-from erpnext.stock.utils import get_stock_balance, get_incoming_rate, get_available_serial_nos
+from erpnext.controllers.stock_controller import StockController
from erpnext.stock.doctype.batch.batch import get_batch_qty
+from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+from erpnext.stock.utils import get_stock_balance
+
class OpeningEntryAccountError(frappe.ValidationError): pass
class EmptyStockReconciliationItemsError(frappe.ValidationError): pass
@@ -159,8 +162,11 @@
raise frappe.ValidationError(self.validation_messages)
def validate_item(self, item_code, row):
- from erpnext.stock.doctype.item.item import validate_end_of_life, \
- validate_is_stock_item, validate_cancelled_item
+ from erpnext.stock.doctype.item.item import (
+ validate_cancelled_item,
+ validate_end_of_life,
+ validate_is_stock_item,
+ )
# using try except to catch all validation msgs and display together
diff --git a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
index e438127..8647bee 100644
--- a/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
@@ -5,16 +5,23 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, unittest
-from frappe.utils import flt, nowdate, nowtime, random_string, add_days
+
+import unittest
+
+import frappe
+from frappe.utils import add_days, flt, nowdate, nowtime, random_string
+
from erpnext.accounts.utils import get_stock_and_account_balance
-from erpnext.stock.stock_ledger import get_previous_sle, update_entries_after
-from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import EmptyStockReconciliationItemsError, get_items
-from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
from erpnext.stock.doctype.item.test_item import create_item
-from erpnext.stock.utils import get_incoming_rate, get_stock_value_on, get_valuation_method
-from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
+from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+from erpnext.stock.doctype.stock_reconciliation.stock_reconciliation import (
+ EmptyStockReconciliationItemsError,
+ get_items,
+)
+from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
+from erpnext.stock.stock_ledger import get_previous_sle, update_entries_after
+from erpnext.stock.utils import get_incoming_rate, get_stock_value_on, get_valuation_method
from erpnext.tests.utils import change_settings
@@ -322,8 +329,8 @@
SR3 | Reco | 0 | 1 (posting date: today-1) [backdated & blocked]
DN2 | DN | -2 | 8(-1) (posting date: today)
"""
- from erpnext.stock.stock_ledger import NegativeStockError
from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
+ from erpnext.stock.stock_ledger import NegativeStockError
item_code = "Backdated-Reco-Item"
warehouse = "_Test Warehouse - _TC"
@@ -363,8 +370,8 @@
SR | Reco | 100 | 100 (posting date: today-1) (shouldn't be cancelled after DN)
DN | DN | 100 | 0 (posting date: today)
"""
- from erpnext.stock.stock_ledger import NegativeStockError
from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
+ from erpnext.stock.stock_ledger import NegativeStockError
frappe.db.commit()
item_code = "Backdated-Reco-Cancellation-Item"
diff --git a/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.py b/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.py
index cc1e19d..227e727 100644
--- a/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.py
+++ b/erpnext/stock/doctype/stock_reconciliation_item/stock_reconciliation_item.py
@@ -2,8 +2,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class StockReconciliationItem(Document):
pass
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.js b/erpnext/stock/doctype/stock_settings/stock_settings.js
index 6167bec..cc0e2cf 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.js
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.js
@@ -15,4 +15,3 @@
frm.set_query("sample_retention_warehouse", filters);
}
});
-
diff --git a/erpnext/stock/doctype/stock_settings/stock_settings.py b/erpnext/stock/doctype/stock_settings/stock_settings.py
index 2dd7c6f..2a634b3 100644
--- a/erpnext/stock/doctype/stock_settings/stock_settings.py
+++ b/erpnext/stock/doctype/stock_settings/stock_settings.py
@@ -4,12 +4,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.model.document import Document
-from frappe.utils.html_utils import clean_html
-from frappe.utils import cint
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
+from frappe.model.document import Document
+from frappe.utils import cint
+from frappe.utils.html_utils import clean_html
+
class StockSettings(Document):
def validate(self):
diff --git a/erpnext/stock/doctype/stock_settings/test_stock_settings.py b/erpnext/stock/doctype/stock_settings/test_stock_settings.py
index 42a78f7..7e80904 100644
--- a/erpnext/stock/doctype/stock_settings/test_stock_settings.py
+++ b/erpnext/stock/doctype/stock_settings/test_stock_settings.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestStockSettings(unittest.TestCase):
def setUp(self):
frappe.db.set_value("Stock Settings", None, "clean_description_html", 0)
diff --git a/erpnext/stock/doctype/uom_category/test_uom_category.py b/erpnext/stock/doctype/uom_category/test_uom_category.py
index 33bd408..dd5510a 100644
--- a/erpnext/stock/doctype/uom_category/test_uom_category.py
+++ b/erpnext/stock/doctype/uom_category/test_uom_category.py
@@ -5,5 +5,6 @@
import unittest
+
class TestUOMCategory(unittest.TestCase):
pass
diff --git a/erpnext/stock/doctype/uom_category/uom_category.py b/erpnext/stock/doctype/uom_category/uom_category.py
index d5c339e..282ebb2 100644
--- a/erpnext/stock/doctype/uom_category/uom_category.py
+++ b/erpnext/stock/doctype/uom_category/uom_category.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class UOMCategory(Document):
pass
diff --git a/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.py b/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.py
index fdead20..9d9d4c6 100644
--- a/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.py
+++ b/erpnext/stock/doctype/uom_conversion_detail/uom_conversion_detail.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class UOMConversionDetail(Document):
pass
diff --git a/erpnext/stock/doctype/variant_field/test_variant_field.py b/erpnext/stock/doctype/variant_field/test_variant_field.py
index 53024bd..408e33b 100644
--- a/erpnext/stock/doctype/variant_field/test_variant_field.py
+++ b/erpnext/stock/doctype/variant_field/test_variant_field.py
@@ -5,5 +5,6 @@
import unittest
+
class TestVariantField(unittest.TestCase):
pass
diff --git a/erpnext/stock/doctype/variant_field/variant_field.py b/erpnext/stock/doctype/variant_field/variant_field.py
index a77301e..abcfdc7 100644
--- a/erpnext/stock/doctype/variant_field/variant_field.py
+++ b/erpnext/stock/doctype/variant_field/variant_field.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class VariantField(Document):
pass
diff --git a/erpnext/stock/doctype/warehouse/test_warehouse.py b/erpnext/stock/doctype/warehouse/test_warehouse.py
index 6e429a2..1ca7181 100644
--- a/erpnext/stock/doctype/warehouse/test_warehouse.py
+++ b/erpnext/stock/doctype/warehouse/test_warehouse.py
@@ -5,13 +5,13 @@
import unittest
import frappe
-from frappe.utils import cint
from frappe.test_runner import make_test_records
+from frappe.utils import cint
import erpnext
-from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
-from erpnext.accounts.doctype.account.test_account import get_inventory_account, create_account
+from erpnext.accounts.doctype.account.test_account import create_account, get_inventory_account
from erpnext.stock.doctype.item.test_item import create_item
+from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
test_records = frappe.get_test_records('Warehouse')
diff --git a/erpnext/stock/doctype/warehouse/warehouse.js b/erpnext/stock/doctype/warehouse/warehouse.js
index 4e1679c4..9243e1e 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.js
+++ b/erpnext/stock/doctype/warehouse/warehouse.js
@@ -86,4 +86,3 @@
})
}
-
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index 3abc139..ecd8707 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -2,13 +2,18 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe.utils import cint, flt
-from frappe import throw, _
+
from collections import defaultdict
-from frappe.utils.nestedset import NestedSet
-from erpnext.stock import get_warehouse_account
+
+import frappe
+from frappe import _, throw
from frappe.contacts.address_and_contact import load_address_and_contact
+from frappe.utils import cint, flt
+from frappe.utils.nestedset import NestedSet
+
+import erpnext
+from erpnext.stock import get_warehouse_account
+
class Warehouse(NestedSet):
nsm_parent_field = 'parent_warehouse'
diff --git a/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py b/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py
index 39f4b23..846e63b 100644
--- a/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py
+++ b/erpnext/stock/doctype/warehouse_type/test_warehouse_type.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestWarehouseType(unittest.TestCase):
pass
diff --git a/erpnext/stock/doctype/warehouse_type/warehouse_type.py b/erpnext/stock/doctype/warehouse_type/warehouse_type.py
index 4b7d8d8..fd83d78 100644
--- a/erpnext/stock/doctype/warehouse_type/warehouse_type.py
+++ b/erpnext/stock/doctype/warehouse_type/warehouse_type.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class WarehouseType(Document):
pass
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index c72073c..d578e6a 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -2,22 +2,27 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
+import json
+
import frappe
from frappe import _, throw
-from frappe.utils import flt, cint, add_days, cstr, add_months, getdate
-import json, copy
-from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricing_rule_for_item, set_transaction_type
-from erpnext.setup.utils import get_exchange_rate
from frappe.model.meta import get_field_precision
-from erpnext.stock.doctype.batch.batch import get_batch_no
-from erpnext import get_company_currency
-from erpnext.stock.doctype.item.item import get_item_defaults, get_uom_conv_factor
-from erpnext.stock.doctype.price_list.price_list import get_price_list_details
-from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults
-from erpnext.setup.doctype.brand.brand import get_brand_defaults
-from erpnext.stock.doctype.item_manufacturer.item_manufacturer import get_item_manufacturer_part_no
+from frappe.utils import add_days, add_months, cint, cstr, flt, getdate
+from six import iteritems, string_types
-from six import string_types, iteritems
+from erpnext import get_company_currency
+from erpnext.accounts.doctype.pricing_rule.pricing_rule import (
+ get_pricing_rule_for_item,
+ set_transaction_type,
+)
+from erpnext.setup.doctype.brand.brand import get_brand_defaults
+from erpnext.setup.doctype.item_group.item_group import get_item_group_defaults
+from erpnext.setup.utils import get_exchange_rate
+from erpnext.stock.doctype.batch.batch import get_batch_no
+from erpnext.stock.doctype.item.item import get_item_defaults, get_uom_conv_factor
+from erpnext.stock.doctype.item_manufacturer.item_manufacturer import get_item_manufacturer_part_no
+from erpnext.stock.doctype.price_list.price_list import get_price_list_details
sales_doctypes = ['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice', 'POS Invoice']
purchase_doctypes = ['Material Request', 'Supplier Quotation', 'Purchase Order', 'Purchase Receipt', 'Purchase Invoice']
diff --git a/erpnext/stock/reorder_item.py b/erpnext/stock/reorder_item.py
index 4c721ac..3cd4cd2 100644
--- a/erpnext/stock/reorder_item.py
+++ b/erpnext/stock/reorder_item.py
@@ -2,11 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-import erpnext
+
import json
-from frappe.utils import flt, nowdate, add_days, cint
+
+import frappe
from frappe import _
+from frappe.utils import add_days, cint, flt, nowdate
+
+import erpnext
+
def reorder_item():
""" Reorder item if stock reaches reorder level"""
@@ -166,7 +170,7 @@
mr.submit()
mr_list.append(mr)
- except:
+ except Exception:
_log_exception()
if mr_list:
diff --git a/erpnext/stock/report/batch_item_expiry_status/batch_item_expiry_status.py b/erpnext/stock/report/batch_item_expiry_status/batch_item_expiry_status.py
index 29689b1..da57bad 100644
--- a/erpnext/stock/report/batch_item_expiry_status/batch_item_expiry_status.py
+++ b/erpnext/stock/report/batch_item_expiry_status/batch_item_expiry_status.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt, cint, getdate
+from frappe.utils import cint, getdate
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/stock/report/bom_search/bom_search.py b/erpnext/stock/report/bom_search/bom_search.py
index e3955c9..8b583f3 100644
--- a/erpnext/stock/report/bom_search/bom_search.py
+++ b/erpnext/stock/report/bom_search/bom_search.py
@@ -2,10 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, json
+import frappe
from six import iteritems
+
def execute(filters=None):
data = []
parents = {
diff --git a/erpnext/stock/report/cogs_by_item_group/cogs_by_item_group.py b/erpnext/stock/report/cogs_by_item_group/cogs_by_item_group.py
index da593a4..5f6184d 100644
--- a/erpnext/stock/report/cogs_by_item_group/cogs_by_item_group.py
+++ b/erpnext/stock/report/cogs_by_item_group/cogs_by_item_group.py
@@ -1,8 +1,8 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-from collections import OrderedDict
import datetime
+from collections import OrderedDict
from typing import Dict, List, Tuple, Union
import frappe
@@ -11,7 +11,6 @@
from erpnext.accounts.report.general_ledger.general_ledger import get_gl_entries
-
Filters = frappe._dict
Row = frappe._dict
Data = List[Row]
@@ -43,13 +42,13 @@
def get_columns() -> Columns:
return [
{
- 'label': 'Item Group',
+ 'label': _('Item Group'),
'fieldname': 'item_group',
'fieldtype': 'Data',
'width': '200'
},
{
- 'label': 'COGS Debit',
+ 'label': _('COGS Debit'),
'fieldname': 'cogs_debit',
'fieldtype': 'Currency',
'width': '200'
diff --git a/erpnext/stock/report/delayed_item_report/delayed_item_report.py b/erpnext/stock/report/delayed_item_report/delayed_item_report.py
index 6130666..1dd0478 100644
--- a/erpnext/stock/report/delayed_item_report/delayed_item_report.py
+++ b/erpnext/stock/report/delayed_item_report/delayed_item_report.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import date_diff
+
def execute(filters=None, consolidated = False):
data, columns = DelayedItemReport(filters).run()
diff --git a/erpnext/stock/report/delayed_order_report/delayed_order_report.py b/erpnext/stock/report/delayed_order_report/delayed_order_report.py
index d915160..677e30c 100644
--- a/erpnext/stock/report/delayed_order_report/delayed_order_report.py
+++ b/erpnext/stock/report/delayed_order_report/delayed_order_report.py
@@ -2,9 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe import _
+
from erpnext.stock.report.delayed_item_report.delayed_item_report import DelayedItemReport
+
def execute(filters=None):
columns, data = [], []
diff --git a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py
index 77fd2ff..6d03ec1 100644
--- a/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py
+++ b/erpnext/stock/report/delivery_note_trends/delivery_note_trends.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe import _
-from erpnext.controllers.trends import get_columns,get_data
+
+from erpnext.controllers.trends import get_columns, get_data
+
def execute(filters=None):
if not filters: filters ={}
diff --git a/erpnext/stock/report/incorrect_balance_qty_after_transaction/incorrect_balance_qty_after_transaction.py b/erpnext/stock/report/incorrect_balance_qty_after_transaction/incorrect_balance_qty_after_transaction.py
index 00125e7..cf27326 100644
--- a/erpnext/stock/report/incorrect_balance_qty_after_transaction/incorrect_balance_qty_after_transaction.py
+++ b/erpnext/stock/report/incorrect_balance_qty_after_transaction/incorrect_balance_qty_after_transaction.py
@@ -3,8 +3,9 @@
import frappe
from frappe import _
-from six import iteritems
from frappe.utils import flt
+from six import iteritems
+
def execute(filters=None):
columns, data = [], []
diff --git a/erpnext/stock/report/incorrect_serial_no_valuation/incorrect_serial_no_valuation.py b/erpnext/stock/report/incorrect_serial_no_valuation/incorrect_serial_no_valuation.py
index b3b7594..5f03c7c 100644
--- a/erpnext/stock/report/incorrect_serial_no_valuation/incorrect_serial_no_valuation.py
+++ b/erpnext/stock/report/incorrect_serial_no_valuation/incorrect_serial_no_valuation.py
@@ -1,12 +1,15 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-import frappe
import copy
+
+import frappe
from frappe import _
from six import iteritems
+
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+
def execute(filters=None):
columns, data = [], []
columns = get_columns()
diff --git a/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py b/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py
index c8f60a1..bc520ae 100644
--- a/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py
+++ b/erpnext/stock/report/incorrect_stock_value_report/incorrect_stock_value_report.py
@@ -2,13 +2,16 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
-import erpnext
from frappe import _
+from frappe.utils import add_days, getdate, today
from six import iteritems
-from frappe.utils import add_days, today, getdate
-from erpnext.stock.utils import get_stock_value_on
+
+import erpnext
from erpnext.accounts.utils import get_stock_and_account_balance
+from erpnext.stock.utils import get_stock_value_on
+
def execute(filters=None):
if not erpnext.is_perpetual_inventory_enabled(filters.company):
diff --git a/erpnext/stock/report/item_price_stock/item_price_stock.py b/erpnext/stock/report/item_price_stock/item_price_stock.py
index db7498b..6ffb5c8 100644
--- a/erpnext/stock/report/item_price_stock/item_price_stock.py
+++ b/erpnext/stock/report/item_price_stock/item_price_stock.py
@@ -1,9 +1,11 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
columns, data = [], []
columns=get_columns()
diff --git a/erpnext/stock/report/item_prices/item_prices.py b/erpnext/stock/report/item_prices/item_prices.py
index 12f3297..aa5ae0e 100644
--- a/erpnext/stock/report/item_prices/item_prices.py
+++ b/erpnext/stock/report/item_prices/item_prices.py
@@ -2,10 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe import msgprint, _
+from frappe import _
from frappe.utils import flt
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/stock/report/item_shortage_report/item_shortage_report.py b/erpnext/stock/report/item_shortage_report/item_shortage_report.py
index c67eed7..1438e6c 100644
--- a/erpnext/stock/report/item_shortage_report/item_shortage_report.py
+++ b/erpnext/stock/report/item_shortage_report/item_shortage_report.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
columns = get_columns()
conditions = get_conditions(filters)
diff --git a/erpnext/stock/report/item_variant_details/item_variant_details.py b/erpnext/stock/report/item_variant_details/item_variant_details.py
index d8563d7..eedda53 100644
--- a/erpnext/stock/report/item_variant_details/item_variant_details.py
+++ b/erpnext/stock/report/item_variant_details/item_variant_details.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
columns = get_columns(filters.item)
data = get_data(filters.item)
diff --git a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
index 2e13aa0..08869af 100644
--- a/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
+++ b/erpnext/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
@@ -4,7 +4,8 @@
import frappe
from frappe import _
-from frappe.utils import getdate, flt
+from frappe.utils import flt, getdate
+
def execute(filters=None):
if not filters: filters = {}
diff --git a/erpnext/stock/report/process_loss_report/process_loss_report.py b/erpnext/stock/report/process_loss_report/process_loss_report.py
index 7494328..499c49f 100644
--- a/erpnext/stock/report/process_loss_report/process_loss_report.py
+++ b/erpnext/stock/report/process_loss_report/process_loss_report.py
@@ -1,9 +1,11 @@
# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
-import frappe
from typing import Dict, List, Tuple
+import frappe
+from frappe import _
+
Filters = frappe._dict
Row = frappe._dict
Data = List[Row]
@@ -24,57 +26,57 @@
def get_columns() -> Columns:
return [
{
- 'label': 'Work Order',
+ 'label': _('Work Order'),
'fieldname': 'name',
'fieldtype': 'Link',
'options': 'Work Order',
'width': '200'
},
{
- 'label': 'Item',
+ 'label': _('Item'),
'fieldname': 'production_item',
'fieldtype': 'Link',
'options': 'Item',
'width': '100'
},
{
- 'label': 'Status',
+ 'label': _('Status'),
'fieldname': 'status',
'fieldtype': 'Data',
'width': '100'
},
{
- 'label': 'Manufactured Qty',
+ 'label': _('Manufactured Qty'),
'fieldname': 'produced_qty',
'fieldtype': 'Float',
'width': '150'
},
{
- 'label': 'Loss Qty',
+ 'label': _('Loss Qty'),
'fieldname': 'process_loss_qty',
'fieldtype': 'Float',
'width': '150'
},
{
- 'label': 'Actual Manufactured Qty',
+ 'label': _('Actual Manufactured Qty'),
'fieldname': 'actual_produced_qty',
'fieldtype': 'Float',
'width': '150'
},
{
- 'label': 'Loss Value',
+ 'label': _('Loss Value'),
'fieldname': 'total_pl_value',
'fieldtype': 'Float',
'width': '150'
},
{
- 'label': 'FG Value',
+ 'label': _('FG Value'),
'fieldname': 'total_fg_value',
'fieldtype': 'Float',
'width': '150'
},
{
- 'label': 'Raw Material Value',
+ 'label': _('Raw Material Value'),
'fieldname': 'total_rm_value',
'fieldtype': 'Float',
'width': '150'
@@ -91,7 +93,7 @@
def run_query(query_args: QueryArgs) -> Data:
return frappe.db.sql("""
- SELECT
+ SELECT
wo.name, wo.status, wo.production_item, wo.qty,
wo.produced_qty, wo.process_loss_qty,
(wo.produced_qty - wo.process_loss_qty) as actual_produced_qty,
@@ -129,4 +131,3 @@
{"work_order_filter": f"AND wo.name='{work_order_name}'"}
)
return filter_conditions
-
diff --git a/erpnext/stock/report/product_bundle_balance/product_bundle_balance.py b/erpnext/stock/report/product_bundle_balance/product_bundle_balance.py
index 8fffbcc..2e298e7 100644
--- a/erpnext/stock/report/product_bundle_balance/product_bundle_balance.py
+++ b/erpnext/stock/report/product_bundle_balance/product_bundle_balance.py
@@ -2,12 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt
-from erpnext.stock.report.stock_ledger.stock_ledger import get_item_group_condition
from six import iteritems
+from erpnext.stock.report.stock_ledger.stock_ledger import get_item_group_condition
+
def execute(filters=None):
if not filters:
diff --git a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
index 0d96ea6..2959532 100644
--- a/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
+++ b/erpnext/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
@@ -2,9 +2,11 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe import _
-from erpnext.controllers.trends import get_columns,get_data
+
+from erpnext.controllers.trends import get_columns, get_data
+
def execute(filters=None):
if not filters: filters ={}
diff --git a/erpnext/stock/report/serial_no_ledger/serial_no_ledger.py b/erpnext/stock/report/serial_no_ledger/serial_no_ledger.py
index cc3aa35..897a130 100644
--- a/erpnext/stock/report/serial_no_ledger/serial_no_ledger.py
+++ b/erpnext/stock/report/serial_no_ledger/serial_no_ledger.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe import _
+
from erpnext.stock.stock_ledger import get_stock_ledger_entries
-from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+
def execute(filters=None):
columns = get_columns(filters)
diff --git a/erpnext/stock/report/stock_ageing/stock_ageing.py b/erpnext/stock/report/stock_ageing/stock_ageing.py
index 623dc2f..b4eca0b 100644
--- a/erpnext/stock/report/stock_ageing/stock_ageing.py
+++ b/erpnext/stock/report/stock_ageing/stock_ageing.py
@@ -2,17 +2,22 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
+from operator import itemgetter
+
import frappe
from frappe import _
-from frappe.utils import date_diff, flt, cint
+from frappe.utils import cint, date_diff, flt
from six import iteritems
+
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+
def execute(filters=None):
columns = get_columns(filters)
item_details = get_fifo_queue(filters)
to_date = filters["to_date"]
- _func = lambda x: x[1]
+ _func = itemgetter(1)
data = []
for item, item_dict in iteritems(item_details):
@@ -26,7 +31,7 @@
average_age = get_average_age(fifo_queue, to_date)
earliest_age = date_diff(to_date, fifo_queue[0][1])
latest_age = date_diff(to_date, fifo_queue[-1][1])
- range1, range2, range3, above_range3 = get_range_age(filters, fifo_queue, to_date)
+ range1, range2, range3, above_range3 = get_range_age(filters, fifo_queue, to_date, item_dict)
row = [details.name, details.item_name,
details.description, details.item_group, details.brand]
@@ -58,19 +63,21 @@
return flt(age_qty / total_qty, 2) if total_qty else 0.0
-def get_range_age(filters, fifo_queue, to_date):
+def get_range_age(filters, fifo_queue, to_date, item_dict):
range1 = range2 = range3 = above_range3 = 0.0
+
for item in fifo_queue:
age = date_diff(to_date, item[1])
+ qty = flt(item[0]) if not item_dict["has_serial_no"] else 1.0
if age <= filters.range1:
- range1 += flt(item[0])
+ range1 += qty
elif age <= filters.range2:
- range2 += flt(item[0])
+ range2 += qty
elif age <= filters.range3:
- range3 += flt(item[0])
+ range3 += qty
else:
- above_range3 += flt(item[0])
+ above_range3 += qty
return range1, range2, range3, above_range3
@@ -197,9 +204,7 @@
fifo_queue.append([d.actual_qty, d.posting_date])
else:
if serial_no_list:
- for serial_no in fifo_queue:
- if serial_no[0] in serial_no_list:
- fifo_queue.remove(serial_no)
+ fifo_queue[:] = [serial_no for serial_no in fifo_queue if serial_no[0] not in serial_no_list]
else:
qty_to_pop = abs(d.actual_qty)
while qty_to_pop:
@@ -222,14 +227,16 @@
else:
item_details[key]["total_qty"] += d.actual_qty
+ item_details[key]["has_serial_no"] = d.has_serial_no
+
return item_details
def get_stock_ledger_entries(filters):
return frappe.db.sql("""select
- item.name, item.item_name, item_group, brand, description, item.stock_uom,
+ item.name, item.item_name, item_group, brand, description, item.stock_uom, item.has_serial_no,
actual_qty, posting_date, voucher_type, voucher_no, serial_no, batch_no, qty_after_transaction, warehouse
from `tabStock Ledger Entry` sle,
- (select name, item_name, description, stock_uom, brand, item_group
+ (select name, item_name, description, stock_uom, brand, item_group, has_serial_no
from `tabItem` {item_conditions}) item
where item_code = item.name and
company = %(company)s and
diff --git a/erpnext/stock/report/stock_analytics/stock_analytics.py b/erpnext/stock/report/stock_analytics/stock_analytics.py
index a1e1e7f..ddc8310 100644
--- a/erpnext/stock/report/stock_analytics/stock_analytics.py
+++ b/erpnext/stock/report/stock_analytics/stock_analytics.py
@@ -4,13 +4,18 @@
import frappe
from frappe import _, scrub
-from frappe.utils import getdate, get_quarter_start, get_first_day_of_week
from frappe.utils import get_first_day as get_first_day_of_month
+from frappe.utils import get_first_day_of_week, get_quarter_start, getdate
-from erpnext.stock.report.stock_balance.stock_balance import (get_items, get_stock_ledger_entries, get_item_details)
from erpnext.accounts.utils import get_fiscal_year
+from erpnext.stock.report.stock_balance.stock_balance import (
+ get_item_details,
+ get_items,
+ get_stock_ledger_entries,
+)
from erpnext.stock.utils import is_reposting_item_valuation_in_progress
+
def execute(filters=None):
is_reposting_item_valuation_in_progress()
filters = frappe._dict(filters or {})
diff --git a/erpnext/stock/report/stock_analytics/test_stock_analytics.py b/erpnext/stock/report/stock_analytics/test_stock_analytics.py
index 00e268b..21e1205 100644
--- a/erpnext/stock/report/stock_analytics/test_stock_analytics.py
+++ b/erpnext/stock/report/stock_analytics/test_stock_analytics.py
@@ -2,8 +2,8 @@
import unittest
from frappe import _dict
-from erpnext.accounts.utils import get_fiscal_year
+from erpnext.accounts.utils import get_fiscal_year
from erpnext.stock.report.stock_analytics.stock_analytics import get_period_date_ranges
diff --git a/erpnext/stock/report/stock_and_account_value_comparison/stock_and_account_value_comparison.py b/erpnext/stock/report/stock_and_account_value_comparison/stock_and_account_value_comparison.py
index 7e0c0e8..f64774a 100644
--- a/erpnext/stock/report/stock_and_account_value_comparison/stock_and_account_value_comparison.py
+++ b/erpnext/stock/report/stock_and_account_value_comparison/stock_and_account_value_comparison.py
@@ -2,12 +2,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+
+import frappe
from frappe import _
-from erpnext.accounts.utils import get_stock_accounts
-from erpnext.accounts.utils import get_currency_precision
+
+import erpnext
+from erpnext.accounts.utils import get_currency_precision, get_stock_accounts
from erpnext.stock.doctype.warehouse.warehouse import get_warehouses_based_on_account
+
def execute(filters=None):
if not erpnext.is_perpetual_inventory_enabled(filters.company):
frappe.throw(_("Perpetual inventory required for the company {0} to view this report.")
diff --git a/erpnext/stock/report/stock_balance/stock_balance.py b/erpnext/stock/report/stock_balance/stock_balance.py
index fc3d719..fc5d5c1 100644
--- a/erpnext/stock/report/stock_balance/stock_balance.py
+++ b/erpnext/stock/report/stock_balance/stock_balance.py
@@ -2,16 +2,20 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe import _
-from frappe.utils import flt, cint, getdate, now, date_diff
-from erpnext.stock.utils import add_additional_uom_columns
-from erpnext.stock.report.stock_ledger.stock_ledger import get_item_group_condition
-from erpnext.stock.utils import is_reposting_item_valuation_in_progress
-from erpnext.stock.report.stock_ageing.stock_ageing import get_fifo_queue, get_average_age
+from operator import itemgetter
+
+import frappe
+from frappe import _
+from frappe.utils import cint, date_diff, flt, getdate
from six import iteritems
+import erpnext
+from erpnext.stock.report.stock_ageing.stock_ageing import get_average_age, get_fifo_queue
+from erpnext.stock.report.stock_ledger.stock_ledger import get_item_group_condition
+from erpnext.stock.utils import add_additional_uom_columns, is_reposting_item_valuation_in_progress
+
+
def execute(filters=None):
is_reposting_item_valuation_in_progress()
if not filters: filters = {}
@@ -44,7 +48,7 @@
data = []
conversion_factors = {}
- _func = lambda x: x[1]
+ _func = itemgetter(1)
for (company, item, warehouse) in sorted(iwb_map):
if item_map.get(item):
diff --git a/erpnext/stock/report/stock_ledger/stock_ledger.py b/erpnext/stock/report/stock_ledger/stock_ledger.py
index b6923e9..1ea58fe 100644
--- a/erpnext/stock/report/stock_ledger/stock_ledger.py
+++ b/erpnext/stock/report/stock_ledger/stock_ledger.py
@@ -4,10 +4,15 @@
from __future__ import unicode_literals
import frappe
-from frappe.utils import cint, flt
-from erpnext.stock.utils import update_included_uom_in_report, is_reposting_item_valuation_in_progress
from frappe import _
+from frappe.utils import cint, flt
+
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+from erpnext.stock.utils import (
+ is_reposting_item_valuation_in_progress,
+ update_included_uom_in_report,
+)
+
def execute(filters=None):
is_reposting_item_valuation_in_progress()
diff --git a/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py b/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py
index 7956f2e..16f7c30 100644
--- a/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py
+++ b/erpnext/stock/report/stock_projected_qty/stock_projected_qty.py
@@ -2,11 +2,17 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt, today
-from erpnext.stock.utils import update_included_uom_in_report, is_reposting_item_valuation_in_progress
+
from erpnext.accounts.doctype.pos_invoice.pos_invoice import get_pos_reserved_qty
+from erpnext.stock.utils import (
+ is_reposting_item_valuation_in_progress,
+ update_included_uom_in_report,
+)
+
def execute(filters=None):
is_reposting_item_valuation_in_progress()
diff --git a/erpnext/stock/report/stock_qty_vs_serial_no_count/stock_qty_vs_serial_no_count.py b/erpnext/stock/report/stock_qty_vs_serial_no_count/stock_qty_vs_serial_no_count.py
index fa19eeb..5580636 100644
--- a/erpnext/stock/report/stock_qty_vs_serial_no_count/stock_qty_vs_serial_no_count.py
+++ b/erpnext/stock/report/stock_qty_vs_serial_no_count/stock_qty_vs_serial_no_count.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
validate_warehouse(filters)
columns = get_columns()
diff --git a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py
index 4108a57..f15557b 100644
--- a/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py
+++ b/erpnext/stock/report/supplier_wise_sales_analytics/supplier_wise_sales_analytics.py
@@ -2,11 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt
from six import iteritems
+
def execute(filters=None):
columns = get_columns(filters)
consumed_details = get_consumed_details(filters)
diff --git a/erpnext/stock/report/total_stock_summary/total_stock_summary.py b/erpnext/stock/report/total_stock_summary/total_stock_summary.py
index 59c253c..779b5aa 100644
--- a/erpnext/stock/report/total_stock_summary/total_stock_summary.py
+++ b/erpnext/stock/report/total_stock_summary/total_stock_summary.py
@@ -2,9 +2,11 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
def execute(filters=None):
if not filters: filters = {}
validate_filters(filters)
diff --git a/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py b/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py
index 04f7d34..6cb3751 100644
--- a/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py
+++ b/erpnext/stock/report/warehouse_wise_item_balance_age_and_value/warehouse_wise_item_balance_age_and_value.py
@@ -5,15 +5,22 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import flt, cint, getdate
-from erpnext.stock.report.stock_balance.stock_balance import (get_item_details,
- get_item_reorder_details, get_item_warehouse_map, get_items, get_stock_ledger_entries)
-from erpnext.stock.report.stock_ageing.stock_ageing import get_fifo_queue, get_average_age
-from erpnext.stock.utils import is_reposting_item_valuation_in_progress
+from frappe.utils import flt
from six import iteritems
+from erpnext.stock.report.stock_ageing.stock_ageing import get_average_age, get_fifo_queue
+from erpnext.stock.report.stock_balance.stock_balance import (
+ get_item_details,
+ get_item_warehouse_map,
+ get_items,
+ get_stock_ledger_entries,
+)
+from erpnext.stock.utils import is_reposting_item_valuation_in_progress
+
+
def execute(filters=None):
is_reposting_item_valuation_in_progress()
if not filters: filters = {}
diff --git a/erpnext/stock/stock_balance.py b/erpnext/stock/stock_balance.py
index 8917bfe..1cb0f0d 100644
--- a/erpnext/stock/stock_balance.py
+++ b/erpnext/stock/stock_balance.py
@@ -2,11 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import print_function, unicode_literals
+
import frappe
-from frappe.utils import flt, cstr, nowdate, nowtime
-from erpnext.stock.utils import update_bin
-from erpnext.stock.stock_ledger import update_entries_after
+from frappe.utils import cstr, flt, nowdate, nowtime
+
from erpnext.controllers.stock_controller import create_repost_item_valuation_entry
+from erpnext.stock.utils import update_bin
+
def repost(only_actual=False, allow_negative_stock=False, allow_zero_rate=False, only_bin=False):
"""
@@ -29,7 +31,7 @@
try:
repost_stock(d[0], d[1], allow_zero_rate, only_actual, only_bin, allow_negative_stock)
frappe.db.commit()
- except:
+ except Exception:
frappe.db.rollback()
if allow_negative_stock:
@@ -247,5 +249,5 @@
sr.via_stock_ledger = True
sr.save()
- except:
+ except Exception:
pass
diff --git a/erpnext/stock/stock_ledger.py b/erpnext/stock/stock_ledger.py
index 48fd7d3..5421242 100644
--- a/erpnext/stock/stock_ledger.py
+++ b/erpnext/stock/stock_ledger.py
@@ -2,17 +2,22 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
-import erpnext
import copy
-from frappe import _
-from frappe.utils import cint, flt, cstr, now, get_link_to_form, getdate
-from frappe.model.meta import get_field_precision
-from erpnext.stock.utils import get_valuation_method, get_incoming_outgoing_rate_for_cancel
-from erpnext.stock.utils import get_bin
import json
+
+import frappe
+from frappe import _
+from frappe.model.meta import get_field_precision
+from frappe.utils import cint, cstr, flt, get_link_to_form, getdate, now
from six import iteritems
+import erpnext
+from erpnext.stock.utils import (
+ get_bin,
+ get_incoming_outgoing_rate_for_cancel,
+ get_valuation_method,
+)
+
# future reposting
class NegativeStockError(frappe.ValidationError): pass
@@ -279,13 +284,15 @@
}
"""
+ self.data.setdefault(args.warehouse, frappe._dict())
+ warehouse_dict = self.data[args.warehouse]
previous_sle = get_previous_sle_of_current_voucher(args)
+ warehouse_dict.previous_sle = previous_sle
- self.data[args.warehouse] = frappe._dict({
- "previous_sle": previous_sle,
- "qty_after_transaction": flt(previous_sle.qty_after_transaction),
- "valuation_rate": flt(previous_sle.valuation_rate),
- "stock_value": flt(previous_sle.stock_value),
+ for key in ("qty_after_transaction", "valuation_rate", "stock_value"):
+ setattr(warehouse_dict, key, flt(previous_sle.get(key)))
+
+ warehouse_dict.update({
"prev_stock_value": previous_sle.stock_value or 0.0,
"stock_queue": json.loads(previous_sle.stock_queue or "[]"),
"stock_value_difference": 0.0
@@ -476,7 +483,9 @@
# Sales and Purchase Return
elif sle.voucher_type in ("Purchase Receipt", "Purchase Invoice", "Delivery Note", "Sales Invoice"):
if frappe.get_cached_value(sle.voucher_type, sle.voucher_no, "is_return"):
- from erpnext.controllers.sales_and_purchase_return import get_rate_for_return # don't move this import to top
+ from erpnext.controllers.sales_and_purchase_return import (
+ get_rate_for_return, # don't move this import to top
+ )
rate = get_rate_for_return(sle.voucher_type, sle.voucher_no, sle.item_code,
voucher_detail_no=sle.voucher_detail_no, sle = sle)
else:
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index 9f6d0a8..aeb06e9 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -2,13 +2,17 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
-from frappe import _
-import json
-from frappe.utils import flt, cstr, nowdate, nowtime, get_link_to_form
+import json
+
+import frappe
+from frappe import _
+from frappe.utils import cstr, flt, get_link_to_form, nowdate, nowtime
from six import string_types
+import erpnext
+
+
class InvalidWarehouseCompany(frappe.ValidationError): pass
def get_stock_value_from_bin(warehouse=None, item_code=None):
diff --git a/erpnext/support/__init__.py b/erpnext/support/__init__.py
index cc26c14..bd1b3f8 100644
--- a/erpnext/support/__init__.py
+++ b/erpnext/support/__init__.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
install_docs = [
{'doctype':'Role', 'role_name':'Support Team', 'name':'Support Team'},
{'doctype':'Role', 'role_name':'Maintenance User', 'name':'Maintenance User'},
diff --git a/erpnext/support/doctype/issue/issue.py b/erpnext/support/doctype/issue/issue.py
index f28976e..7d7399d 100644
--- a/erpnext/support/doctype/issue/issue.py
+++ b/erpnext/support/doctype/issue/issue.py
@@ -2,16 +2,19 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+
import json
-from frappe import _
-from frappe.model.document import Document
-from frappe.utils import now_datetime, time_diff_in_seconds, get_datetime, date_diff
-from frappe.core.utils import get_parent_doc
from datetime import timedelta
-from frappe.model.mapper import get_mapped_doc
-from frappe.utils.user import is_website_user
+
+import frappe
+from frappe import _
+from frappe.core.utils import get_parent_doc
from frappe.email.inbox import link_communication_to_document
+from frappe.model.document import Document
+from frappe.model.mapper import get_mapped_doc
+from frappe.utils import date_diff, get_datetime, now_datetime, time_diff_in_seconds
+from frappe.utils.user import is_website_user
+
class Issue(Document):
def get_feed(self):
diff --git a/erpnext/support/doctype/issue/test_issue.py b/erpnext/support/doctype/issue/test_issue.py
index 4146e48..6f0b8a6 100644
--- a/erpnext/support/doctype/issue/test_issue.py
+++ b/erpnext/support/doctype/issue/test_issue.py
@@ -2,13 +2,17 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
-import unittest
-from erpnext.support.doctype.service_level_agreement.test_service_level_agreement import create_service_level_agreements_for_issues
-from frappe.core.doctype.user_permission.test_user_permission import create_user
-from frappe.utils import get_datetime, flt
import datetime
-from datetime import timedelta
+import unittest
+
+import frappe
+from frappe.core.doctype.user_permission.test_user_permission import create_user
+from frappe.utils import flt, get_datetime
+
+from erpnext.support.doctype.service_level_agreement.test_service_level_agreement import (
+ create_service_level_agreements_for_issues,
+)
+
class TestSetUp(unittest.TestCase):
def setUp(self):
@@ -22,58 +26,58 @@
class TestIssue(TestSetUp):
def test_response_time_and_resolution_time_based_on_different_sla(self):
- creation = datetime.datetime(2019, 3, 4, 12, 0)
+ creation = get_datetime("2019-03-04 12:00")
# make issue with customer specific SLA
customer = create_customer("_Test Customer", "__Test SLA Customer Group", "__Test SLA Territory")
issue = make_issue(creation, "_Test Customer", 1)
- self.assertEqual(issue.response_by, datetime.datetime(2019, 3, 4, 14, 0))
- self.assertEqual(issue.resolution_by, datetime.datetime(2019, 3, 4, 15, 0))
+ self.assertEqual(issue.response_by, get_datetime("2019-03-04 14:00"))
+ self.assertEqual(issue.resolution_by, get_datetime("2019-03-04 15:00"))
# make issue with customer_group specific SLA
customer = create_customer("__Test Customer", "_Test SLA Customer Group", "__Test SLA Territory")
issue = make_issue(creation, "__Test Customer", 2)
- self.assertEqual(issue.response_by, datetime.datetime(2019, 3, 4, 14, 0))
- self.assertEqual(issue.resolution_by, datetime.datetime(2019, 3, 4, 15, 0))
+ self.assertEqual(issue.response_by, get_datetime("2019-03-04 14:00"))
+ self.assertEqual(issue.resolution_by, get_datetime("2019-03-04 15:00"))
# make issue with territory specific SLA
customer = create_customer("___Test Customer", "__Test SLA Customer Group", "_Test SLA Territory")
issue = make_issue(creation, "___Test Customer", 3)
- self.assertEqual(issue.response_by, datetime.datetime(2019, 3, 4, 14, 0))
- self.assertEqual(issue.resolution_by, datetime.datetime(2019, 3, 4, 15, 0))
+ self.assertEqual(issue.response_by, get_datetime("2019-03-04 14:00"))
+ self.assertEqual(issue.resolution_by, get_datetime("2019-03-04 15:00"))
# make issue with default SLA
issue = make_issue(creation=creation, index=4)
- self.assertEqual(issue.response_by, datetime.datetime(2019, 3, 4, 16, 0))
- self.assertEqual(issue.resolution_by, datetime.datetime(2019, 3, 4, 18, 0))
+ self.assertEqual(issue.response_by, get_datetime("2019-03-04 16:00"))
+ self.assertEqual(issue.resolution_by, get_datetime("2019-03-04 18:00"))
# make issue with default SLA before working hours
- creation = datetime.datetime(2019, 3, 4, 7, 0)
+ creation = get_datetime("2019-03-04 7:00")
issue = make_issue(creation=creation, index=5)
- self.assertEqual(issue.response_by, datetime.datetime(2019, 3, 4, 14, 0))
- self.assertEqual(issue.resolution_by, datetime.datetime(2019, 3, 4, 16, 0))
+ self.assertEqual(issue.response_by, get_datetime("2019-03-04 14:00"))
+ self.assertEqual(issue.resolution_by, get_datetime("2019-03-04 16:00"))
# make issue with default SLA after working hours
- creation = datetime.datetime(2019, 3, 4, 20, 0)
+ creation = get_datetime("2019-03-04 20:00")
issue = make_issue(creation, index=6)
- self.assertEqual(issue.response_by, datetime.datetime(2019, 3, 6, 14, 0))
- self.assertEqual(issue.resolution_by, datetime.datetime(2019, 3, 6, 16, 0))
+ self.assertEqual(issue.response_by, get_datetime("2019-03-06 14:00"))
+ self.assertEqual(issue.resolution_by, get_datetime("2019-03-06 16:00"))
# make issue with default SLA next day
- creation = datetime.datetime(2019, 3, 4, 14, 0)
+ creation = get_datetime("2019-03-04 14:00")
issue = make_issue(creation=creation, index=7)
- self.assertEqual(issue.response_by, datetime.datetime(2019, 3, 4, 18, 0))
- self.assertEqual(issue.resolution_by, datetime.datetime(2019, 3, 6, 12, 0))
+ self.assertEqual(issue.response_by, get_datetime("2019-03-04 18:00"))
+ self.assertEqual(issue.resolution_by, get_datetime("2019-03-06 12:00"))
- frappe.flags.current_time = datetime.datetime(2019, 3, 4, 15, 0)
+ frappe.flags.current_time = get_datetime("2019-03-04 15:00")
issue.reload()
issue.status = 'Closed'
issue.save()
@@ -81,21 +85,21 @@
self.assertEqual(issue.agreement_status, 'Fulfilled')
def test_issue_metrics(self):
- creation = datetime.datetime(2020, 3, 4, 4, 0)
+ creation = get_datetime("2020-03-04 4:00")
issue = make_issue(creation, index=1)
create_communication(issue.name, "test@example.com", "Received", creation)
- creation = datetime.datetime(2020, 3, 4, 4, 15)
+ creation = get_datetime("2020-03-04 4:15")
create_communication(issue.name, "test@admin.com", "Sent", creation)
- creation = datetime.datetime(2020, 3, 4, 5, 0)
+ creation = get_datetime("2020-03-04 5:00")
create_communication(issue.name, "test@example.com", "Received", creation)
- creation = datetime.datetime(2020, 3, 4, 5, 5)
+ creation = get_datetime("2020-03-04 5:05")
create_communication(issue.name, "test@admin.com", "Sent", creation)
- frappe.flags.current_time = datetime.datetime(2020, 3, 4, 5, 5)
+ frappe.flags.current_time = get_datetime("2020-03-04 5:05")
issue.reload()
issue.status = 'Closed'
issue.save()
@@ -105,33 +109,33 @@
self.assertEqual(issue.user_resolution_time, 1200)
def test_hold_time_on_replied(self):
- creation = datetime.datetime(2020, 3, 4, 4, 0)
+ creation = get_datetime("2020-03-04 4:00")
issue = make_issue(creation, index=1)
create_communication(issue.name, "test@example.com", "Received", creation)
- creation = datetime.datetime(2020, 3, 4, 4, 15)
+ creation = get_datetime("2020-03-04 4:15")
create_communication(issue.name, "test@admin.com", "Sent", creation)
- frappe.flags.current_time = datetime.datetime(2020, 3, 4, 4, 15)
+ frappe.flags.current_time = get_datetime("2020-03-04 4:15")
issue.reload()
issue.status = 'Replied'
issue.save()
self.assertEqual(issue.on_hold_since, frappe.flags.current_time)
- creation = datetime.datetime(2020, 3, 4, 5, 0)
- frappe.flags.current_time = datetime.datetime(2020, 3, 4, 5, 0)
+ creation = get_datetime("2020-03-04 5:00")
+ frappe.flags.current_time = get_datetime("2020-03-04 5:00")
create_communication(issue.name, "test@example.com", "Received", creation)
issue.reload()
self.assertEqual(flt(issue.total_hold_time, 2), 2700)
- self.assertEqual(issue.resolution_by, datetime.datetime(2020, 3, 4, 16, 45))
+ self.assertEqual(issue.resolution_by, get_datetime("2020-03-04 16:45"))
- creation = datetime.datetime(2020, 3, 4, 5, 5)
+ creation = get_datetime("2020-03-04 5:05")
create_communication(issue.name, "test@admin.com", "Sent", creation)
- frappe.flags.current_time = datetime.datetime(2020, 3, 4, 5, 5)
+ frappe.flags.current_time = get_datetime("2020-03-04 5:05")
issue.reload()
issue.status = 'Closed'
issue.save()
diff --git a/erpnext/support/doctype/issue_priority/issue_priority.py b/erpnext/support/doctype/issue_priority/issue_priority.py
index 514b6cc..1a7daf6 100644
--- a/erpnext/support/doctype/issue_priority/issue_priority.py
+++ b/erpnext/support/doctype/issue_priority/issue_priority.py
@@ -3,9 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe import _
+
from frappe.model.document import Document
+
class IssuePriority(Document):
pass
diff --git a/erpnext/support/doctype/issue_priority/test_issue_priority.py b/erpnext/support/doctype/issue_priority/test_issue_priority.py
index 618c93e..fc9ae68 100644
--- a/erpnext/support/doctype/issue_priority/test_issue_priority.py
+++ b/erpnext/support/doctype/issue_priority/test_issue_priority.py
@@ -3,9 +3,11 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
+
class TestIssuePriority(unittest.TestCase):
def test_priorities(self):
diff --git a/erpnext/support/doctype/issue_type/issue_type.py b/erpnext/support/doctype/issue_type/issue_type.py
index f95d09c..089ae28 100644
--- a/erpnext/support/doctype/issue_type/issue_type.py
+++ b/erpnext/support/doctype/issue_type/issue_type.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class IssueType(Document):
pass
diff --git a/erpnext/support/doctype/issue_type/test_issue_type.py b/erpnext/support/doctype/issue_type/test_issue_type.py
index 4e3b66a..06a2de2 100644
--- a/erpnext/support/doctype/issue_type/test_issue_type.py
+++ b/erpnext/support/doctype/issue_type/test_issue_type.py
@@ -3,8 +3,8 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+
class TestIssueType(unittest.TestCase):
pass
diff --git a/erpnext/support/doctype/pause_sla_on_status/pause_sla_on_status.py b/erpnext/support/doctype/pause_sla_on_status/pause_sla_on_status.py
index a3b547e..37c1f2b 100644
--- a/erpnext/support/doctype/pause_sla_on_status/pause_sla_on_status.py
+++ b/erpnext/support/doctype/pause_sla_on_status/pause_sla_on_status.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class PauseSLAOnStatus(Document):
pass
diff --git a/erpnext/support/doctype/service_day/service_day.py b/erpnext/support/doctype/service_day/service_day.py
index 3805b5a..da96cad 100644
--- a/erpnext/support/doctype/service_day/service_day.py
+++ b/erpnext/support/doctype/service_day/service_day.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ServiceDay(Document):
pass
diff --git a/erpnext/support/doctype/service_level_agreement/service_level_agreement.py b/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
index 8c1c1ef..bd47811 100644
--- a/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
+++ b/erpnext/support/doctype/service_level_agreement/service_level_agreement.py
@@ -4,16 +4,30 @@
from __future__ import unicode_literals
+from datetime import datetime
+
import frappe
-from frappe.model.document import Document
from frappe import _
from frappe.core.utils import get_parent_doc
-from frappe.utils import time_diff_in_seconds, getdate, get_weekdays, add_to_date, get_time, get_datetime, \
- get_time_zone, to_timedelta, get_datetime_str, get_link_to_form, cint, nowdate
-from datetime import datetime
+from frappe.model.document import Document
+from frappe.utils import (
+ add_to_date,
+ cint,
+ get_datetime,
+ get_datetime_str,
+ get_link_to_form,
+ get_time,
+ get_time_zone,
+ get_weekdays,
+ getdate,
+ nowdate,
+ time_diff_in_seconds,
+ to_timedelta,
+)
from frappe.utils.safe_exec import get_safe_globals
+
from erpnext.support.doctype.issue.issue import get_holidays
-from frappe.utils.safe_exec import get_safe_globals
+
class ServiceLevelAgreement(Document):
def validate(self):
@@ -846,7 +860,7 @@
def convert_utc_to_user_timezone(utc_timestamp, user):
- from pytz import timezone, UnknownTimeZoneError
+ from pytz import UnknownTimeZoneError, timezone
user_tz = get_tz(user)
utcnow = timezone('UTC').localize(utc_timestamp)
diff --git a/erpnext/support/doctype/service_level_agreement/service_level_agreement_dashboard.py b/erpnext/support/doctype/service_level_agreement/service_level_agreement_dashboard.py
index 7e7a405..22e2c37 100644
--- a/erpnext/support/doctype/service_level_agreement/service_level_agreement_dashboard.py
+++ b/erpnext/support/doctype/service_level_agreement/service_level_agreement_dashboard.py
@@ -1,5 +1,6 @@
from frappe import _
+
def get_data():
return {
'fieldname': 'service_level_agreement',
diff --git a/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py b/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py
index d9c671e..3a92277 100644
--- a/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py
+++ b/erpnext/support/doctype/service_level_agreement/test_service_level_agreement.py
@@ -3,12 +3,17 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
-import unittest
import datetime
+import unittest
+
+import frappe
from frappe.utils import flt
+
from erpnext.support.doctype.issue_priority.test_issue_priority import make_priorities
-from erpnext.support.doctype.service_level_agreement.service_level_agreement import get_service_level_agreement_fields
+from erpnext.support.doctype.service_level_agreement.service_level_agreement import (
+ get_service_level_agreement_fields,
+)
+
class TestServiceLevelAgreement(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/support/doctype/service_level_priority/service_level_priority.py b/erpnext/support/doctype/service_level_priority/service_level_priority.py
index 0c0fe4a..3b2d124 100644
--- a/erpnext/support/doctype/service_level_priority/service_level_priority.py
+++ b/erpnext/support/doctype/service_level_priority/service_level_priority.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class ServiceLevelPriority(Document):
pass
diff --git a/erpnext/support/doctype/sla_fulfilled_on_status/sla_fulfilled_on_status.py b/erpnext/support/doctype/sla_fulfilled_on_status/sla_fulfilled_on_status.py
index b0b5ffc..dbffcb8 100644
--- a/erpnext/support/doctype/sla_fulfilled_on_status/sla_fulfilled_on_status.py
+++ b/erpnext/support/doctype/sla_fulfilled_on_status/sla_fulfilled_on_status.py
@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
+
class SLAFulfilledOnStatus(Document):
pass
diff --git a/erpnext/support/doctype/support_search_source/support_search_source.py b/erpnext/support/doctype/support_search_source/support_search_source.py
index 93e503a..50f4714 100644
--- a/erpnext/support/doctype/support_search_source/support_search_source.py
+++ b/erpnext/support/doctype/support_search_source/support_search_source.py
@@ -3,7 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
from frappe.model.document import Document
+
class SupportSearchSource(Document):
pass
diff --git a/erpnext/support/doctype/support_settings/support_settings.py b/erpnext/support/doctype/support_settings/support_settings.py
index bb3c53a..73aad9d 100644
--- a/erpnext/support/doctype/support_settings/support_settings.py
+++ b/erpnext/support/doctype/support_settings/support_settings.py
@@ -3,8 +3,9 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
from frappe.model.document import Document
+
class SupportSettings(Document):
pass
diff --git a/erpnext/support/doctype/support_settings/test_support_settings.py b/erpnext/support/doctype/support_settings/test_support_settings.py
index 9c47f96..e9ec070 100644
--- a/erpnext/support/doctype/support_settings/test_support_settings.py
+++ b/erpnext/support/doctype/support_settings/test_support_settings.py
@@ -5,5 +5,6 @@
import unittest
+
class TestSupportSettings(unittest.TestCase):
pass
diff --git a/erpnext/support/doctype/warranty_claim/test_warranty_claim.py b/erpnext/support/doctype/warranty_claim/test_warranty_claim.py
index 909675a..dac8f03 100644
--- a/erpnext/support/doctype/warranty_claim/test_warranty_claim.py
+++ b/erpnext/support/doctype/warranty_claim/test_warranty_claim.py
@@ -2,9 +2,10 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
+import frappe
+
test_records = frappe.get_test_records('Warranty Claim')
class TestWarrantyClaim(unittest.TestCase):
diff --git a/erpnext/support/doctype/warranty_claim/warranty_claim.py b/erpnext/support/doctype/warranty_claim/warranty_claim.py
index a20e7a8..5fb1124 100644
--- a/erpnext/support/doctype/warranty_claim/warranty_claim.py
+++ b/erpnext/support/doctype/warranty_claim/warranty_claim.py
@@ -3,14 +3,14 @@
from __future__ import unicode_literals
+
import frappe
-from frappe import session, _
-from frappe.utils import today, now_datetime
-
-
+from frappe import _, session
+from frappe.utils import now_datetime
from erpnext.utilities.transaction_base import TransactionBase
+
class WarrantyClaim(TransactionBase):
def get_feed(self):
return _("{0}: From {1}").format(self.status, self.customer_name)
diff --git a/erpnext/support/report/first_response_time_for_issues/first_response_time_for_issues.py b/erpnext/support/report/first_response_time_for_issues/first_response_time_for_issues.py
index 69bf273..cb7a8a6 100644
--- a/erpnext/support/report/first_response_time_for_issues/first_response_time_for_issues.py
+++ b/erpnext/support/report/first_response_time_for_issues/first_response_time_for_issues.py
@@ -2,8 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
+
def execute(filters=None):
columns = [
{
diff --git a/erpnext/support/report/issue_analytics/issue_analytics.py b/erpnext/support/report/issue_analytics/issue_analytics.py
index 54fce0b..ac8bce1 100644
--- a/erpnext/support/report/issue_analytics/issue_analytics.py
+++ b/erpnext/support/report/issue_analytics/issue_analytics.py
@@ -2,13 +2,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
-from six import iteritems
+
+import frappe
from frappe import _, scrub
-from frappe.utils import getdate, flt, add_to_date, add_days
+from frappe.utils import add_days, add_to_date, flt, getdate
+from six import iteritems
+
from erpnext.accounts.utils import get_fiscal_year
+
def execute(filters=None):
return IssueAnalytics(filters).run()
@@ -103,7 +107,7 @@
return period
def get_period_date_ranges(self):
- from dateutil.relativedelta import relativedelta, MO
+ from dateutil.relativedelta import MO, relativedelta
from_date, to_date = getdate(self.filters.from_date), getdate(self.filters.to_date)
increment = {
diff --git a/erpnext/support/report/issue_analytics/test_issue_analytics.py b/erpnext/support/report/issue_analytics/test_issue_analytics.py
index a9d961a..1de03ab 100644
--- a/erpnext/support/report/issue_analytics/test_issue_analytics.py
+++ b/erpnext/support/report/issue_analytics/test_issue_analytics.py
@@ -1,11 +1,16 @@
from __future__ import unicode_literals
+
import unittest
+
import frappe
-from frappe.utils import getdate, add_months
-from erpnext.support.report.issue_analytics.issue_analytics import execute
-from erpnext.support.doctype.issue.test_issue import make_issue, create_customer
-from erpnext.support.doctype.service_level_agreement.test_service_level_agreement import create_service_level_agreements_for_issues
from frappe.desk.form.assign_to import add as add_assignment
+from frappe.utils import add_months, getdate
+
+from erpnext.support.doctype.issue.test_issue import create_customer, make_issue
+from erpnext.support.doctype.service_level_agreement.test_service_level_agreement import (
+ create_service_level_agreements_for_issues,
+)
+from erpnext.support.report.issue_analytics.issue_analytics import execute
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
diff --git a/erpnext/support/report/issue_summary/issue_summary.py b/erpnext/support/report/issue_summary/issue_summary.py
index 7c4af39..0481996 100644
--- a/erpnext/support/report/issue_summary/issue_summary.py
+++ b/erpnext/support/report/issue_summary/issue_summary.py
@@ -2,11 +2,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import json
-from six import iteritems
+
+import frappe
from frappe import _, scrub
from frappe.utils import flt
+from six import iteritems
+
def execute(filters=None):
return IssueSummary(filters).run()
diff --git a/erpnext/support/report/support_hour_distribution/support_hour_distribution.py b/erpnext/support/report/support_hour_distribution/support_hour_distribution.py
index 08802b4..c0bec3c 100644
--- a/erpnext/support/report/support_hour_distribution/support_hour_distribution.py
+++ b/erpnext/support/report/support_hour_distribution/support_hour_distribution.py
@@ -2,9 +2,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.utils import add_to_date, getdate, get_datetime
+from frappe.utils import add_to_date, get_datetime, getdate
from six import iteritems
time_slots = {
diff --git a/erpnext/support/web_form/issues/issues.py b/erpnext/support/web_form/issues/issues.py
index 2334f8b..f57de91 100644
--- a/erpnext/support/web_form/issues/issues.py
+++ b/erpnext/support/web_form/issues/issues.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals
-import frappe
def get_context(context):
# do your magic here
diff --git a/erpnext/telephony/doctype/call_log/call_log.py b/erpnext/telephony/doctype/call_log/call_log.py
index 6f8e411..0c1ea16 100644
--- a/erpnext/telephony/doctype/call_log/call_log.py
+++ b/erpnext/telephony/doctype/call_log/call_log.py
@@ -3,14 +3,15 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from frappe.model.document import Document
-from erpnext.crm.doctype.utils import get_scheduled_employees_for_popup, strip_number
from frappe.contacts.doctype.contact.contact import get_contact_with_phone_number
from frappe.core.doctype.dynamic_link.dynamic_link import deduplicate_dynamic_links
+from frappe.model.document import Document
from erpnext.crm.doctype.lead.lead import get_lead_with_phone_number
+from erpnext.crm.doctype.utils import get_scheduled_employees_for_popup, strip_number
END_CALL_STATUSES = ['No Answer', 'Completed', 'Busy', 'Failed']
ONGOING_CALL_STATUSES = ['Ringing', 'In Progress']
diff --git a/erpnext/telephony/doctype/call_log/test_call_log.py b/erpnext/telephony/doctype/call_log/test_call_log.py
index faa6304..f8d458d 100644
--- a/erpnext/telephony/doctype/call_log/test_call_log.py
+++ b/erpnext/telephony/doctype/call_log/test_call_log.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestCallLog(unittest.TestCase):
pass
diff --git a/erpnext/telephony/doctype/incoming_call_handling_schedule/incoming_call_handling_schedule.py b/erpnext/telephony/doctype/incoming_call_handling_schedule/incoming_call_handling_schedule.py
index fcf2974..f48c808 100644
--- a/erpnext/telephony/doctype/incoming_call_handling_schedule/incoming_call_handling_schedule.py
+++ b/erpnext/telephony/doctype/incoming_call_handling_schedule/incoming_call_handling_schedule.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class IncomingCallHandlingSchedule(Document):
pass
diff --git a/erpnext/telephony/doctype/incoming_call_settings/incoming_call_settings.py b/erpnext/telephony/doctype/incoming_call_settings/incoming_call_settings.py
index 2b2008a..faeff90 100644
--- a/erpnext/telephony/doctype/incoming_call_settings/incoming_call_settings.py
+++ b/erpnext/telephony/doctype/incoming_call_settings/incoming_call_settings.py
@@ -3,11 +3,14 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
-from frappe.model.document import Document
+
from datetime import datetime
from typing import Tuple
+
+import frappe
from frappe import _
+from frappe.model.document import Document
+
class IncomingCallSettings(Document):
def validate(self):
diff --git a/erpnext/telephony/doctype/incoming_call_settings/test_incoming_call_settings.py b/erpnext/telephony/doctype/incoming_call_settings/test_incoming_call_settings.py
index c058c11..243e3d9 100644
--- a/erpnext/telephony/doctype/incoming_call_settings/test_incoming_call_settings.py
+++ b/erpnext/telephony/doctype/incoming_call_settings/test_incoming_call_settings.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestIncomingCallSettings(unittest.TestCase):
pass
diff --git a/erpnext/telephony/doctype/voice_call_settings/test_voice_call_settings.py b/erpnext/telephony/doctype/voice_call_settings/test_voice_call_settings.py
index 85d6add..810b717 100644
--- a/erpnext/telephony/doctype/voice_call_settings/test_voice_call_settings.py
+++ b/erpnext/telephony/doctype/voice_call_settings/test_voice_call_settings.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestVoiceCallSettings(unittest.TestCase):
pass
diff --git a/erpnext/telephony/doctype/voice_call_settings/voice_call_settings.py b/erpnext/telephony/doctype/voice_call_settings/voice_call_settings.py
index ad3bbf1..fc0e338 100644
--- a/erpnext/telephony/doctype/voice_call_settings/voice_call_settings.py
+++ b/erpnext/telephony/doctype/voice_call_settings/voice_call_settings.py
@@ -3,8 +3,10 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
# import frappe
from frappe.model.document import Document
+
class VoiceCallSettings(Document):
pass
diff --git a/erpnext/templates/emails/anniversary_reminder.html b/erpnext/templates/emails/anniversary_reminder.html
index ac9f7e4..db338dd 100644
--- a/erpnext/templates/emails/anniversary_reminder.html
+++ b/erpnext/templates/emails/anniversary_reminder.html
@@ -22,4 +22,4 @@
<span>{{ reminder_text }}</span>
<p class="text-muted">{{ message }}</p>
</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/erpnext/templates/pages/cart.py b/erpnext/templates/pages/cart.py
index 30b0357..7c441f7 100644
--- a/erpnext/templates/pages/cart.py
+++ b/erpnext/templates/pages/cart.py
@@ -4,8 +4,9 @@
no_cache = 1
-import frappe
+
from erpnext.shopping_cart.cart import get_cart_quotation
+
def get_context(context):
context.update(get_cart_quotation())
diff --git a/erpnext/templates/pages/courses.py b/erpnext/templates/pages/courses.py
index 92c38f6..7eb0135 100644
--- a/erpnext/templates/pages/courses.py
+++ b/erpnext/templates/pages/courses.py
@@ -2,8 +2,8 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+import frappe
def get_context(context):
diff --git a/erpnext/templates/pages/help.py b/erpnext/templates/pages/help.py
index 4ce2b31..366b283 100644
--- a/erpnext/templates/pages/help.py
+++ b/erpnext/templates/pages/help.py
@@ -1,8 +1,11 @@
from __future__ import unicode_literals
-import frappe, json
+import json
+
+import frappe
import requests
+
def get_context(context):
context.no_cache = 1
settings = frappe.get_doc("Support Settings", "Support Settings")
diff --git a/erpnext/templates/pages/home.py b/erpnext/templates/pages/home.py
index 1c14450..97a66fc 100644
--- a/erpnext/templates/pages/home.py
+++ b/erpnext/templates/pages/home.py
@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
no_cache = 1
diff --git a/erpnext/templates/pages/integrations/gocardless_checkout.py b/erpnext/templates/pages/integrations/gocardless_checkout.py
index bdef79c..2661a96 100644
--- a/erpnext/templates/pages/integrations/gocardless_checkout.py
+++ b/erpnext/templates/pages/integrations/gocardless_checkout.py
@@ -1,12 +1,17 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
+import json
+
import frappe
from frappe import _
-from frappe.utils import flt
-import json
-from erpnext.erpnext_integrations.doctype.gocardless_settings.gocardless_settings import gocardless_initialization, get_gateway_controller
-from frappe.utils import get_url
+from frappe.utils import flt, get_url
+
+from erpnext.erpnext_integrations.doctype.gocardless_settings.gocardless_settings import (
+ get_gateway_controller,
+ gocardless_initialization,
+)
no_cache = 1
diff --git a/erpnext/templates/pages/integrations/gocardless_confirmation.py b/erpnext/templates/pages/integrations/gocardless_confirmation.py
index 0b72e9f..35c8b90 100644
--- a/erpnext/templates/pages/integrations/gocardless_confirmation.py
+++ b/erpnext/templates/pages/integrations/gocardless_confirmation.py
@@ -1,9 +1,14 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-from erpnext.erpnext_integrations.doctype.gocardless_settings.gocardless_settings import gocardless_initialization, get_gateway_controller
+
+from erpnext.erpnext_integrations.doctype.gocardless_settings.gocardless_settings import (
+ get_gateway_controller,
+ gocardless_initialization,
+)
no_cache = 1
diff --git a/erpnext/templates/pages/material_request_info.py b/erpnext/templates/pages/material_request_info.py
index e29860d..c18e201 100644
--- a/erpnext/templates/pages/material_request_info.py
+++ b/erpnext/templates/pages/material_request_info.py
@@ -2,11 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
-
from frappe.utils import flt
+
def get_context(context):
context.no_cache = 1
context.show_sidebar = True
diff --git a/erpnext/templates/pages/non_profit/join_chapter.py b/erpnext/templates/pages/non_profit/join_chapter.py
index aa54a58..a1d1893 100644
--- a/erpnext/templates/pages/non_profit/join_chapter.py
+++ b/erpnext/templates/pages/non_profit/join_chapter.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def get_context(context):
context.no_cache = True
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)
diff --git a/erpnext/templates/pages/non_profit/leave_chapter.py b/erpnext/templates/pages/non_profit/leave_chapter.py
index 21cb722..ebdb664 100644
--- a/erpnext/templates/pages/non_profit/leave_chapter.py
+++ b/erpnext/templates/pages/non_profit/leave_chapter.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def get_context(context):
context.no_cache = True
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)
diff --git a/erpnext/templates/pages/order.py b/erpnext/templates/pages/order.py
index 816a259..d4e81ab 100644
--- a/erpnext/templates/pages/order.py
+++ b/erpnext/templates/pages/order.py
@@ -2,10 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
+import frappe
from frappe import _
-from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import show_attachments
+
+from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import (
+ show_attachments,
+)
+
def get_context(context):
context.no_cache = 1
@@ -36,7 +40,9 @@
# check for the loyalty program of the customer
customer_loyalty_program = frappe.db.get_value("Customer", context.doc.customer, "loyalty_program")
if customer_loyalty_program:
- from erpnext.accounts.doctype.loyalty_program.loyalty_program import get_loyalty_program_details_with_points
+ from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
+ get_loyalty_program_details_with_points,
+ )
loyalty_program_details = get_loyalty_program_details_with_points(context.doc.customer, customer_loyalty_program)
context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points"))
diff --git a/erpnext/templates/pages/partners.py b/erpnext/templates/pages/partners.py
index a7e60e2..b1c668a 100644
--- a/erpnext/templates/pages/partners.py
+++ b/erpnext/templates/pages/partners.py
@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
page_title = "Partners"
diff --git a/erpnext/templates/pages/product_search.py b/erpnext/templates/pages/product_search.py
index 9ab76de..1b9df2b 100644
--- a/erpnext/templates/pages/product_search.py
+++ b/erpnext/templates/pages/product_search.py
@@ -2,8 +2,10 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-from frappe.utils import cstr, nowdate, cint
+from frappe.utils import cint, cstr, nowdate
+
from erpnext.setup.doctype.item_group.item_group import get_item_for_list_in_html
from erpnext.shopping_cart.product_info import set_product_info_for_website
diff --git a/erpnext/templates/pages/projects.py b/erpnext/templates/pages/projects.py
index 7ff4954..cabf37b 100644
--- a/erpnext/templates/pages/projects.py
+++ b/erpnext/templates/pages/projects.py
@@ -2,8 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
-import json
+
def get_context(context):
project_user = frappe.db.get_value("Project User", {"parent": frappe.form_dict.project, "user": frappe.session.user} , ["user", "view_attachments"], as_dict= True)
diff --git a/erpnext/templates/pages/regional/india/update_gstin.py b/erpnext/templates/pages/regional/india/update_gstin.py
index f555db0..a8d03d5 100644
--- a/erpnext/templates/pages/regional/india/update_gstin.py
+++ b/erpnext/templates/pages/regional/india/update_gstin.py
@@ -1,8 +1,9 @@
from __future__ import unicode_literals
+
import frappe
-from frappe import _
from six import iteritems
+
def get_context(context):
context.no_cache = 1
party = frappe.form_dict.party
diff --git a/erpnext/templates/pages/rfq.py b/erpnext/templates/pages/rfq.py
index 67679a1..b9f646b 100644
--- a/erpnext/templates/pages/rfq.py
+++ b/erpnext/templates/pages/rfq.py
@@ -2,11 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import formatdate
+
from erpnext.controllers.website_list_for_contact import get_customers_suppliers
+
def get_context(context):
context.no_cache = 1
context.show_sidebar = True
diff --git a/erpnext/templates/pages/search_help.py b/erpnext/templates/pages/search_help.py
index 887d8f4..4272b94 100644
--- a/erpnext/templates/pages/search_help.py
+++ b/erpnext/templates/pages/search_help.py
@@ -1,11 +1,14 @@
from __future__ import unicode_literals
-import frappe, requests
+
+import frappe
+import requests
from frappe import _
-from jinja2 import utils
-from html2text import html2text
-from six import text_type
from frappe.utils import sanitize_html
from frappe.utils.global_search import search
+from html2text import html2text
+from jinja2 import utils
+from six import text_type
+
def get_context(context):
context.no_cache = 1
diff --git a/erpnext/templates/pages/task_info.py b/erpnext/templates/pages/task_info.py
index 260e278..f219c3d 100644
--- a/erpnext/templates/pages/task_info.py
+++ b/erpnext/templates/pages/task_info.py
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
+
import frappe
-from frappe import _
def get_context(context):
context.no_cache = 1
diff --git a/erpnext/templates/pages/timelog_info.py b/erpnext/templates/pages/timelog_info.py
index ee86483..e0fb60d 100644
--- a/erpnext/templates/pages/timelog_info.py
+++ b/erpnext/templates/pages/timelog_info.py
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
+
import frappe
-from frappe import _
def get_context(context):
context.no_cache = 1
diff --git a/erpnext/tests/test_init.py b/erpnext/tests/test_init.py
index abc04a8..dfba034 100644
--- a/erpnext/tests/test_init.py
+++ b/erpnext/tests/test_init.py
@@ -1,10 +1,12 @@
from __future__ import unicode_literals
+
import unittest
import frappe
-from erpnext import encode_company_abbr
from six.moves import range
+from erpnext import encode_company_abbr
+
test_records = frappe.get_test_records('Company')
class TestInit(unittest.TestCase):
diff --git a/erpnext/tests/test_notifications.py b/erpnext/tests/test_notifications.py
index 1fd90be..5fd9582 100644
--- a/erpnext/tests/test_notifications.py
+++ b/erpnext/tests/test_notifications.py
@@ -2,11 +2,12 @@
# MIT License. See license.txt
from __future__ import unicode_literals
-import frappe
+
import unittest
+import frappe
from frappe.desk import notifications
-from frappe.test_runner import make_test_objects
+
class TestNotifications(unittest.TestCase):
def test_get_notifications_for_targets(self):
diff --git a/erpnext/tests/test_regional.py b/erpnext/tests/test_regional.py
index 5b3f45a..fe848a3 100644
--- a/erpnext/tests/test_regional.py
+++ b/erpnext/tests/test_regional.py
@@ -1,5 +1,11 @@
from __future__ import unicode_literals
-import unittest, frappe, erpnext
+
+import unittest
+
+import frappe
+
+import erpnext
+
@erpnext.allow_regional
def test_method():
diff --git a/erpnext/tests/test_search.py b/erpnext/tests/test_search.py
index f60e5e4..a6619b2 100644
--- a/erpnext/tests/test_search.py
+++ b/erpnext/tests/test_search.py
@@ -1,8 +1,11 @@
from __future__ import unicode_literals
+
import unittest
+
import frappe
from frappe.contacts.address_and_contact import filter_dynamic_link_doctypes
+
class TestSearch(unittest.TestCase):
# Search for the word "cond", part of the word "conduire" (Lead) in french.
def test_contact_search_in_foreign_language(self):
diff --git a/erpnext/tests/test_subcontracting.py b/erpnext/tests/test_subcontracting.py
index f55137b..e45f098 100644
--- a/erpnext/tests/test_subcontracting.py
+++ b/erpnext/tests/test_subcontracting.py
@@ -1,16 +1,24 @@
from __future__ import unicode_literals
-import frappe
-import unittest
+
import copy
-from frappe.utils import cint
+import unittest
from collections import defaultdict
-from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
-from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
-from erpnext.stock.doctype.item.test_item import make_item
-from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom
+
+import frappe
+from frappe.utils import cint
+
+from erpnext.buying.doctype.purchase_order.purchase_order import (
+ get_materials_from_supplier,
+ make_purchase_invoice,
+ make_purchase_receipt,
+ make_rm_stock_entry,
+)
from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order
-from erpnext.buying.doctype.purchase_order.purchase_order import (make_rm_stock_entry,
- make_purchase_receipt, make_purchase_invoice, get_materials_from_supplier)
+from erpnext.manufacturing.doctype.production_plan.test_production_plan import make_bom
+from erpnext.stock.doctype.item.test_item import make_item
+from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
+from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
+
class TestSubcontracting(unittest.TestCase):
def setUp(self):
diff --git a/erpnext/tests/test_woocommerce.py b/erpnext/tests/test_woocommerce.py
index df715ab..881f286 100644
--- a/erpnext/tests/test_woocommerce.py
+++ b/erpnext/tests/test_woocommerce.py
@@ -1,7 +1,15 @@
from __future__ import unicode_literals
-import unittest, frappe, requests, os, time, erpnext
+
+import os
+import time
+import unittest
+
+import frappe
+import requests
+
from erpnext.erpnext_integrations.connectors.woocommerce_connection import order
+
class TestWoocommerce(unittest.TestCase):
def setUp(self):
if not frappe.db.exists('Company', 'Woocommerce'):
diff --git a/erpnext/tests/ui_test_helpers.py b/erpnext/tests/ui_test_helpers.py
index 902fd64..76c7608 100644
--- a/erpnext/tests/ui_test_helpers.py
+++ b/erpnext/tests/ui_test_helpers.py
@@ -1,6 +1,7 @@
import frappe
from frappe.utils import getdate
+
@frappe.whitelist()
def create_employee_records():
create_company()
diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py
index 11eb6af..2156bd5 100644
--- a/erpnext/tests/utils.py
+++ b/erpnext/tests/utils.py
@@ -6,6 +6,7 @@
import frappe
+
def create_test_contact_and_address():
frappe.db.sql('delete from tabContact')
frappe.db.sql('delete from `tabContact Email`')
diff --git a/erpnext/utilities/__init__.py b/erpnext/utilities/__init__.py
index 0a5aa3c..ca8bc19 100644
--- a/erpnext/utilities/__init__.py
+++ b/erpnext/utilities/__init__.py
@@ -1,9 +1,12 @@
## temp utility
from __future__ import print_function, unicode_literals
+
import frappe
-from erpnext.utilities.activation import get_level
from frappe.utils import cstr
+from erpnext.utilities.activation import get_level
+
+
def update_doctypes():
for d in frappe.db.sql("""select df.parent, df.fieldname
from tabDocField df, tabDocType dt where df.fieldname
diff --git a/erpnext/utilities/activation.py b/erpnext/utilities/activation.py
index 0f9f2f8..c21bff0 100644
--- a/erpnext/utilities/activation.py
+++ b/erpnext/utilities/activation.py
@@ -2,11 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe, erpnext
+import frappe
from frappe import _
from six import iteritems
+import erpnext
+
+
def get_level():
activation_level = 0
sales_data = []
diff --git a/erpnext/utilities/bot.py b/erpnext/utilities/bot.py
index 485b0b3..9e830a2 100644
--- a/erpnext/utilities/bot.py
+++ b/erpnext/utilities/bot.py
@@ -3,10 +3,10 @@
from __future__ import unicode_literals
-from frappe.utils.bot import BotParser
-
import frappe
from frappe import _
+from frappe.utils.bot import BotParser
+
class FindItemBot(BotParser):
def get_reply(self):
diff --git a/erpnext/utilities/doctype/rename_tool/rename_tool.py b/erpnext/utilities/doctype/rename_tool/rename_tool.py
index 5e3ac1a..8377cec 100644
--- a/erpnext/utilities/doctype/rename_tool/rename_tool.py
+++ b/erpnext/utilities/doctype/rename_tool/rename_tool.py
@@ -4,11 +4,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+import frappe
from frappe.model.document import Document
from frappe.model.rename_doc import bulk_rename
+
class RenameTool(Document):
pass
diff --git a/erpnext/utilities/doctype/sms_log/sms_log.py b/erpnext/utilities/doctype/sms_log/sms_log.py
index e634f80..ce3cc46 100644
--- a/erpnext/utilities/doctype/sms_log/sms_log.py
+++ b/erpnext/utilities/doctype/sms_log/sms_log.py
@@ -2,9 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-import frappe
from frappe.model.document import Document
+
class SMSLog(Document):
pass
diff --git a/erpnext/utilities/doctype/sms_log/test_sms_log.py b/erpnext/utilities/doctype/sms_log/test_sms_log.py
index 65f52b4..3baeb25 100644
--- a/erpnext/utilities/doctype/sms_log/test_sms_log.py
+++ b/erpnext/utilities/doctype/sms_log/test_sms_log.py
@@ -3,7 +3,6 @@
# See license.txt
from __future__ import unicode_literals
-import frappe
import unittest
# test_records = frappe.get_test_records('SMS Log')
diff --git a/erpnext/utilities/doctype/video/test_video.py b/erpnext/utilities/doctype/video/test_video.py
index 33ea31c..530136c 100644
--- a/erpnext/utilities/doctype/video/test_video.py
+++ b/erpnext/utilities/doctype/video/test_video.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestVideo(unittest.TestCase):
pass
diff --git a/erpnext/utilities/doctype/video/video.py b/erpnext/utilities/doctype/video/video.py
index c2e414e..d9907cf 100644
--- a/erpnext/utilities/doctype/video/video.py
+++ b/erpnext/utilities/doctype/video/video.py
@@ -3,14 +3,17 @@
# For license information, please see license.txt
from __future__ import unicode_literals
-import frappe
+
import re
-import pytz
-from frappe.model.document import Document
-from frappe import _
from datetime import datetime
-from six import string_types
+
+import frappe
+import pytz
+from frappe import _
+from frappe.model.document import Document
from pyyoutube import Api
+from six import string_types
+
class Video(Document):
def validate(self):
diff --git a/erpnext/utilities/doctype/video_settings/test_video_settings.py b/erpnext/utilities/doctype/video_settings/test_video_settings.py
index b217afe..e871435 100644
--- a/erpnext/utilities/doctype/video_settings/test_video_settings.py
+++ b/erpnext/utilities/doctype/video_settings/test_video_settings.py
@@ -6,5 +6,6 @@
# import frappe
import unittest
+
class TestVideoSettings(unittest.TestCase):
pass
diff --git a/erpnext/utilities/doctype/video_settings/video_settings.py b/erpnext/utilities/doctype/video_settings/video_settings.py
index db021b4..7209134 100644
--- a/erpnext/utilities/doctype/video_settings/video_settings.py
+++ b/erpnext/utilities/doctype/video_settings/video_settings.py
@@ -3,10 +3,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
+from apiclient.discovery import build
from frappe import _
from frappe.model.document import Document
-from apiclient.discovery import build
+
class VideoSettings(Document):
def validate(self):
diff --git a/erpnext/utilities/hierarchy_chart.py b/erpnext/utilities/hierarchy_chart.py
index 384d841..0e7f81f 100644
--- a/erpnext/utilities/hierarchy_chart.py
+++ b/erpnext/utilities/hierarchy_chart.py
@@ -2,21 +2,27 @@
# MIT License. See license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
+
@frappe.whitelist()
-def get_all_nodes(parent, parent_name, method, company):
+def get_all_nodes(method, company):
'''Recursively gets all data from nodes'''
method = frappe.get_attr(method)
if method not in frappe.whitelisted:
frappe.throw(_('Not Permitted'), frappe.PermissionError)
- data = method(parent, company)
- result = [dict(parent=parent, parent_name=parent_name, data=data)]
+ root_nodes = method(company=company)
+ result = []
+ nodes_to_expand = []
- nodes_to_expand = [{'id': d.get('id'), 'name': d.get('name')} for d in data if d.get('expandable')]
+ for root in root_nodes:
+ data = method(root.id, company)
+ result.append(dict(parent=root.id, parent_name=root.name, data=data))
+ nodes_to_expand.extend([{'id': d.get('id'), 'name': d.get('name')} for d in data if d.get('expandable')])
while nodes_to_expand:
parent = nodes_to_expand.pop(0)
diff --git a/erpnext/utilities/product.py b/erpnext/utilities/product.py
index 70b4176..e567f77 100644
--- a/erpnext/utilities/product.py
+++ b/erpnext/utilities/product.py
@@ -4,10 +4,12 @@
from __future__ import unicode_literals
import frappe
-from frappe.utils import cint, fmt_money, flt, nowdate, getdate
+from frappe.utils import cint, flt, fmt_money, getdate, nowdate
+
from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricing_rule_for_item
from erpnext.stock.doctype.batch.batch import get_batch_qty
+
def get_qty_in_stock(item_code, item_warehouse_field, warehouse=None):
in_stock, stock_qty = 0, ''
template_item_code, is_stock_item = frappe.db.get_value("Item", item_code, ["variant_of", "is_stock_item"])
@@ -127,7 +129,7 @@
return price_obj
def get_non_stock_item_status(item_code, item_warehouse_field):
-#if item belongs to product bundle, check if bundle items are in stock
+ #if item belongs to product bundle, check if bundle items are in stock
if frappe.db.exists("Product Bundle", item_code):
items = frappe.get_doc("Product Bundle", item_code).get_all_children()
bundle_warehouse = frappe.db.get_value('Item', item_code, item_warehouse_field)
diff --git a/erpnext/utilities/report/youtube_interactions/youtube_interactions.py b/erpnext/utilities/report/youtube_interactions/youtube_interactions.py
index 29a489d..50f3b68 100644
--- a/erpnext/utilities/report/youtube_interactions/youtube_interactions.py
+++ b/erpnext/utilities/report/youtube_interactions/youtube_interactions.py
@@ -2,10 +2,12 @@
# For license information, please see license.txt
from __future__ import unicode_literals
+
import frappe
from frappe import _
from frappe.utils import flt
+
def execute(filters=None):
if not frappe.db.get_single_value("Video Settings", "enable_youtube_tracking") or not filters:
return [], []
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index db99726..5153683 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -2,13 +2,15 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
+
import frappe
import frappe.share
from frappe import _
-from frappe.utils import cstr, now_datetime, cint, flt, get_time, get_datetime, get_link_to_form, date_diff, nowdate
+from frappe.utils import cint, cstr, flt, get_time, now_datetime
+from six import string_types
+
from erpnext.controllers.status_updater import StatusUpdater
-from six import string_types
class UOMMustBeIntegerError(frappe.ValidationError): pass
diff --git a/erpnext/utilities/web_form/addresses/addresses.py b/erpnext/utilities/web_form/addresses/addresses.py
index 3fd1017..4a8d3e1 100644
--- a/erpnext/utilities/web_form/addresses/addresses.py
+++ b/erpnext/utilities/web_form/addresses/addresses.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals
-import frappe
def get_context(context):
# do your magic here
diff --git a/erpnext/www/all-products/index.py b/erpnext/www/all-products/index.py
index fd6400f..335c104 100644
--- a/erpnext/www/all-products/index.py
+++ b/erpnext/www/all-products/index.py
@@ -1,8 +1,8 @@
import frappe
-from erpnext.portal.product_configurator.utils import (get_products_for_website, get_product_settings,
- get_field_filter_data, get_attribute_filter_data)
-from erpnext.shopping_cart.product_query import ProductQuery
+
+from erpnext.portal.product_configurator.utils import get_product_settings
from erpnext.shopping_cart.filters import ProductFiltersBuilder
+from erpnext.shopping_cart.product_query import ProductQuery
sitemap = 1
diff --git a/erpnext/www/book_appointment/index.py b/erpnext/www/book_appointment/index.py
index 4f45561..8cda3c1 100644
--- a/erpnext/www/book_appointment/index.py
+++ b/erpnext/www/book_appointment/index.py
@@ -1,6 +1,7 @@
-import frappe
import datetime
import json
+
+import frappe
import pytz
from frappe import _
diff --git a/erpnext/www/book_appointment/verify/index.py b/erpnext/www/book_appointment/verify/index.py
index bd766c0..dc36f4f 100644
--- a/erpnext/www/book_appointment/verify/index.py
+++ b/erpnext/www/book_appointment/verify/index.py
@@ -1,6 +1,7 @@
import frappe
-
from frappe.utils.verified_command import verify_request
+
+
@frappe.whitelist(allow_guest=True)
def get_context(context):
if not verify_request():
diff --git a/erpnext/www/lms/content.py b/erpnext/www/lms/content.py
index 05cbb16..97f5918 100644
--- a/erpnext/www/lms/content.py
+++ b/erpnext/www/lms/content.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
-import erpnext.education.utils as utils
+
import frappe
+import erpnext.education.utils as utils
+
no_cache = 1
def get_context(context):
diff --git a/erpnext/www/lms/course.py b/erpnext/www/lms/course.py
index c18d64e..1ec097b 100644
--- a/erpnext/www/lms/course.py
+++ b/erpnext/www/lms/course.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
-import erpnext.education.utils as utils
+
import frappe
+import erpnext.education.utils as utils
+
no_cache = 1
def get_context(context):
diff --git a/erpnext/www/lms/index.py b/erpnext/www/lms/index.py
index c14b943..c35fff2 100644
--- a/erpnext/www/lms/index.py
+++ b/erpnext/www/lms/index.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
-import erpnext.education.utils as utils
+
import frappe
+import erpnext.education.utils as utils
+
no_cache = 1
def get_context(context):
diff --git a/erpnext/www/lms/profile.py b/erpnext/www/lms/profile.py
index 7e338e3..d5dcd2b 100644
--- a/erpnext/www/lms/profile.py
+++ b/erpnext/www/lms/profile.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
-import erpnext.education.utils as utils
+
import frappe
+import erpnext.education.utils as utils
+
no_cache = 1
def get_context(context):
diff --git a/erpnext/www/lms/program.py b/erpnext/www/lms/program.py
index a4f588c..9980d88 100644
--- a/erpnext/www/lms/program.py
+++ b/erpnext/www/lms/program.py
@@ -1,8 +1,10 @@
from __future__ import unicode_literals
-import erpnext.education.utils as utils
+
import frappe
from frappe import _
+import erpnext.education.utils as utils
+
no_cache = 1
def get_context(context):
diff --git a/erpnext/www/lms/topic.py b/erpnext/www/lms/topic.py
index 9938280..ebedaf5 100644
--- a/erpnext/www/lms/topic.py
+++ b/erpnext/www/lms/topic.py
@@ -1,7 +1,9 @@
from __future__ import unicode_literals
-import erpnext.education.utils as utils
+
import frappe
+import erpnext.education.utils as utils
+
no_cache = 1
def get_context(context):
diff --git a/erpnext/www/payment_setup_certification.py b/erpnext/www/payment_setup_certification.py
index 6b02e4e..e509083 100644
--- a/erpnext/www/payment_setup_certification.py
+++ b/erpnext/www/payment_setup_certification.py
@@ -1,4 +1,5 @@
from __future__ import unicode_literals
+
import frappe
no_cache = 1
diff --git a/erpnext/www/support/index.py b/erpnext/www/support/index.py
index 70090c7..4857b0d 100644
--- a/erpnext/www/support/index.py
+++ b/erpnext/www/support/index.py
@@ -1,6 +1,8 @@
from __future__ import unicode_literals
+
import frappe
+
def get_context(context):
context.no_cache = 1
context.align_greeting = ''
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..8043dd9
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,11 @@
+[tool.black]
+line-length = 99
+
+[tool.isort]
+line_length = 99
+multi_line_output = 3
+include_trailing_comma = true
+force_grid_wrap = 0
+use_parentheses = true
+ensure_newline_before_comments = true
+indent = "\t"