Browse Source

chore: Clean up imports (#27302)

* chore: Added isort to pre-commit config

* chore: Sort imports with isort

* chore: Clean up imports with pycln

* chore: Sort imports with isort

* chore: Fix import issues

* chore: Clean up sider issues

* chore: Remove import errors from flake8 ignore list

* chore: Clean up lint issues
develop
Chillar Anand 3 years ago
committed by GitHub
parent
commit
915b34391c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/helper/.flake8_strict
  2. 2
      .github/helper/semgrep_rules/frappe_correctness.py
  3. 2
      .github/workflows/linters.yml
  4. 6
      .pre-commit-config.yaml
  5. 4
      erpnext/__init__.py
  6. 8
      erpnext/accounts/custom/address.py
  7. 7
      erpnext/accounts/dashboard_chart_source/account_balance_timeline/account_balance_timeline.py
  8. 23
      erpnext/accounts/deferred_revenue.py
  9. 4
      erpnext/accounts/doctype/account/account.py
  10. 18
      erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
  11. 7
      erpnext/accounts/doctype/account/chart_of_accounts/import_from_openerp.py
  12. 2
      erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py
  13. 2
      erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py
  14. 8
      erpnext/accounts/doctype/account/test_account.py
  15. 13
      erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py
  16. 6
      erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py
  17. 2
      erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.py
  18. 2
      erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py
  19. 9
      erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py
  20. 4
      erpnext/accounts/doctype/accounting_period/accounting_period.py
  21. 8
      erpnext/accounts/doctype/accounting_period/test_accounting_period.py
  22. 5
      erpnext/accounts/doctype/accounts_settings/accounts_settings.py
  23. 1
      erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py
  24. 2
      erpnext/accounts/doctype/advance_taxes_and_charges/advance_taxes_and_charges.py
  25. 2
      erpnext/accounts/doctype/allowed_dimension/allowed_dimension.py
  26. 2
      erpnext/accounts/doctype/allowed_to_transact_with/allowed_to_transact_with.py
  27. 2
      erpnext/accounts/doctype/applicable_on_account/applicable_on_account.py
  28. 8
      erpnext/accounts/doctype/bank/bank.py
  29. 2
      erpnext/accounts/doctype/bank/test_bank.py
  30. 7
      erpnext/accounts/doctype/bank_account/bank_account.py
  31. 6
      erpnext/accounts/doctype/bank_account/test_bank_account.py
  32. 2
      erpnext/accounts/doctype/bank_account_subtype/bank_account_subtype.py
  33. 1
      erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py
  34. 2
      erpnext/accounts/doctype/bank_account_type/bank_account_type.py
  35. 1
      erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py
  36. 5
      erpnext/accounts/doctype/bank_clearance/bank_clearance.py
  37. 1
      erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py
  38. 3
      erpnext/accounts/doctype/bank_clearance_detail/bank_clearance_detail.py
  39. 8
      erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py
  40. 2
      erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py
  41. 10
      erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py
  42. 1
      erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py
  43. 14
      erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py
  44. 1
      erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py
  45. 6
      erpnext/accounts/doctype/bank_transaction/bank_transaction.py
  46. 5
      erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py
  47. 15
      erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py
  48. 2
      erpnext/accounts/doctype/bank_transaction_mapping/bank_transaction_mapping.py
  49. 2
      erpnext/accounts/doctype/bank_transaction_payments/bank_transaction_payments.py
  50. 13
      erpnext/accounts/doctype/budget/budget.py
  51. 10
      erpnext/accounts/doctype/budget/test_budget.py
  52. 3
      erpnext/accounts/doctype/budget_account/budget_account.py
  53. 4
      erpnext/accounts/doctype/c_form/c_form.py
  54. 1
      erpnext/accounts/doctype/c_form/test_c_form.py
  55. 3
      erpnext/accounts/doctype/c_form_invoice_detail/c_form_invoice_detail.py
  56. 1
      erpnext/accounts/doctype/campaign_item/campaign_item.py
  57. 1
      erpnext/accounts/doctype/cash_flow_mapper/cash_flow_mapper.py
  58. 1
      erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py
  59. 3
      erpnext/accounts/doctype/cash_flow_mapping/test_cash_flow_mapping.py
  60. 1
      erpnext/accounts/doctype/cash_flow_mapping_accounts/cash_flow_mapping_accounts.py
  61. 1
      erpnext/accounts/doctype/cash_flow_mapping_template/cash_flow_mapping_template.py
  62. 1
      erpnext/accounts/doctype/cash_flow_mapping_template_details/cash_flow_mapping_template_details.py
  63. 6
      erpnext/accounts/doctype/cashier_closing/cashier_closing.py
  64. 2
      erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py
  65. 3
      erpnext/accounts/doctype/cashier_closing_payments/cashier_closing_payments.py
  66. 20
      erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py
  67. 2
      erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py
  68. 4
      erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py
  69. 1
      erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py
  70. 3
      erpnext/accounts/doctype/closed_document/closed_document.py
  71. 4
      erpnext/accounts/doctype/cost_center/cost_center.py
  72. 2
      erpnext/accounts/doctype/cost_center/test_cost_center.py
  73. 5
      erpnext/accounts/doctype/coupon_code/coupon_code.py
  74. 6
      erpnext/accounts/doctype/coupon_code/test_coupon_code.py
  75. 1
      erpnext/accounts/doctype/customer_group_item/customer_group_item.py
  76. 1
      erpnext/accounts/doctype/customer_item/customer_item.py
  77. 2
      erpnext/accounts/doctype/discounted_invoice/discounted_invoice.py
  78. 2
      erpnext/accounts/doctype/distributed_cost_center/distributed_cost_center.py
  79. 12
      erpnext/accounts/doctype/dunning/dunning.py
  80. 2
      erpnext/accounts/doctype/dunning/dunning_dashboard.py
  81. 14
      erpnext/accounts/doctype/dunning/test_dunning.py
  82. 2
      erpnext/accounts/doctype/dunning_letter_text/dunning_letter_text.py
  83. 2
      erpnext/accounts/doctype/dunning_type/dunning_type.py
  84. 1
      erpnext/accounts/doctype/dunning_type/test_dunning_type.py
  85. 10
      erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py
  86. 1
      erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation_dashboard.py
  87. 2
      erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py
  88. 3
      erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.py
  89. 3
      erpnext/accounts/doctype/finance_book/finance_book.py
  90. 6
      erpnext/accounts/doctype/finance_book/test_finance_book.py
  91. 7
      erpnext/accounts/doctype/fiscal_year/fiscal_year.py
  92. 4
      erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py
  93. 3
      erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.py
  94. 28
      erpnext/accounts/doctype/gl_entry/gl_entry.py
  95. 9
      erpnext/accounts/doctype/gl_entry/test_gl_entry.py
  96. 3
      erpnext/accounts/doctype/gst_account/gst_account.py
  97. 16
      erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py
  98. 2
      erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py
  99. 12
      erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py
  100. 4
      erpnext/accounts/doctype/item_tax_template/item_tax_template.py

2
.github/helper/.flake8_strict

@ -44,7 +44,6 @@ ignore =
E303, E303,
E305, E305,
E306, E306,
E401,
E402, E402,
E501, E501,
E502, E502,
@ -52,7 +51,6 @@ ignore =
E702, E702,
E703, E703,
E741, E741,
F401,
F403, F403,
W191, W191,
W291, W291,

2
.github/helper/semgrep_rules/frappe_correctness.py

@ -1,5 +1,5 @@
import frappe import frappe
from frappe import _, flt from frappe import _
from frappe.model.document import Document from frappe.model.document import Document

2
.github/workflows/linters.yml

@ -24,4 +24,4 @@ jobs:
python-version: 3.8 python-version: 3.8
- name: Install and Run Pre-commit - name: Install and Run Pre-commit
uses: pre-commit/action@v2.0.0 uses: pre-commit/action@v2.0.3

6
.pre-commit-config.yaml

@ -23,6 +23,12 @@ repos:
args: ['--config', '.github/helper/.flake8_strict'] args: ['--config', '.github/helper/.flake8_strict']
exclude: ".*setup.py$" exclude: ".*setup.py$"
- repo: https://github.com/timothycrosley/isort
rev: 5.9.1
hooks:
- id: isort
exclude: ".*setup.py$"
ci: ci:
autoupdate_schedule: weekly autoupdate_schedule: weekly
skip: [] skip: []

4
erpnext/__init__.py

@ -1,9 +1,11 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
import inspect import inspect
import frappe import frappe
from erpnext.hooks import regional_overrides from erpnext.hooks import regional_overrides
from frappe.utils import getdate
__version__ = '13.9.0' __version__ = '13.9.0'

8
erpnext/accounts/custom/address.py

@ -1,7 +1,11 @@
import frappe import frappe
from frappe import _ from frappe import _
from frappe.contacts.doctype.address.address import Address from frappe.contacts.doctype.address.address import (
from frappe.contacts.doctype.address.address import get_address_templates, get_address_display Address,
get_address_display,
get_address_templates,
)
class ERPNextAddress(Address): class ERPNextAddress(Address):
def validate(self): def validate(self):

7
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 # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, json
import frappe
from frappe import _ from frappe import _
from frappe.utils import add_to_date, date_diff, getdate, nowdate, get_last_day, formatdate, get_link_to_form from frappe.utils import add_to_date, formatdate, get_link_to_form, getdate, nowdate
from erpnext.accounts.report.general_ledger.general_ledger import execute
from frappe.utils.dashboard import cache_source from frappe.utils.dashboard import cache_source
from frappe.utils.dateutils import get_from_date_from_timespan, get_period_ending from frappe.utils.dateutils import get_from_date_from_timespan, get_period_ending
from frappe.utils.nestedset import get_descendants_of from frappe.utils.nestedset import get_descendants_of
@frappe.whitelist() @frappe.whitelist()
@cache_source @cache_source
def get(chart_name = None, chart = None, no_cache = None, filters = None, from_date = None, def get(chart_name = None, chart = None, no_cache = None, filters = None, from_date = None,

23
erpnext/accounts/deferred_revenue.py

@ -2,11 +2,26 @@ from __future__ import unicode_literals
import frappe import frappe
from frappe import _ 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.email import sendmail_to_system_managers
from frappe.utils.background_jobs import enqueue from frappe.utils import (
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions 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): def validate_service_stop_date(doc):
''' Validates service_stop_date for Purchase Invoice and Sales Invoice ''' ''' Validates service_stop_date for Purchase Invoice and Sales Invoice '''

4
erpnext/accounts/doctype/account/account.py

@ -2,11 +2,13 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _, throw
from frappe.utils import cint, cstr from frappe.utils import cint, cstr
from frappe import throw, _
from frappe.utils.nestedset import NestedSet, get_ancestors_of, get_descendants_of from frappe.utils.nestedset import NestedSet, get_ancestors_of, get_descendants_of
class RootNotEditable(frappe.ValidationError): pass class RootNotEditable(frappe.ValidationError): pass
class BalanceMismatchError(frappe.ValidationError): pass class BalanceMismatchError(frappe.ValidationError): pass

18
erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py

@ -2,12 +2,15 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import json
import os
import frappe, os, json import frappe
from frappe.utils import cstr from frappe.utils import cstr
from unidecode import unidecode
from six import iteritems
from frappe.utils.nestedset import rebuild_tree 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): def create_charts(company, chart_template=None, existing_company=None, custom_chart=None):
chart = custom_chart or get_chart(chart_template, existing_company) chart = custom_chart or get_chart(chart_template, existing_company)
@ -91,11 +94,14 @@ def get_chart(chart_template, existing_company=None):
return get_account_tree_from_existing_company(existing_company) return get_account_tree_from_existing_company(existing_company)
elif chart_template == "Standard": 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() return standard_chart_of_accounts.get()
elif chart_template == "Standard with Numbers": elif chart_template == "Standard with Numbers":
from erpnext.accounts.doctype.account.chart_of_accounts.verified \ from erpnext.accounts.doctype.account.chart_of_accounts.verified import (
import standard_chart_of_accounts_with_account_number standard_chart_of_accounts_with_account_number,
)
return standard_chart_of_accounts_with_account_number.get() return standard_chart_of_accounts_with_account_number.get()
else: else:
folders = ("verified",) folders = ("verified",)

7
erpnext/accounts/doctype/account/chart_of_accounts/import_from_openerp.py

@ -6,12 +6,13 @@ Import chart of accounts from OpenERP sources
""" """
from __future__ import print_function, unicode_literals from __future__ import print_function, unicode_literals
import os, json
import ast import ast
import json
import os
from xml.etree import ElementTree as ET 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 from six import iteritems
path = "/Users/nabinhait/projects/odoo/addons" path = "/Users/nabinhait/projects/odoo/addons"

2
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 # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
from frappe import _ from frappe import _
def get(): def get():
return { return {
_("Application of Funds (Assets)"): { _("Application of Funds (Assets)"): {

2
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 # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
from frappe import _ from frappe import _
def get(): def get():
return { return {
_("Application of Funds (Assets)"): { _("Application of Funds (Assets)"): {

8
erpnext/accounts/doctype/account/test_account.py

@ -2,10 +2,14 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import unittest import unittest
import frappe 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): class TestAccount(unittest.TestCase):
def test_rename_account(self): def test_rename_account(self):

13
erpnext/accounts/doctype/accounting_dimension/accounting_dimension.py

@ -3,15 +3,16 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe import _
import json 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.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 import core_doctypes_list
from frappe.model.document import Document
from frappe.utils import cstr
class AccountingDimension(Document): class AccountingDimension(Document):
def before_insert(self): def before_insert(self):

6
erpnext/accounts/doctype/accounting_dimension/test_accounting_dimension.py

@ -3,10 +3,12 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest 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.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'] test_dependencies = ['Cost Center', 'Location', 'Warehouse', 'Department']

2
erpnext/accounts/doctype/accounting_dimension_detail/accounting_dimension_detail.py

@ -3,8 +3,10 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class AccountingDimensionDetail(Document): class AccountingDimensionDetail(Document):
pass pass

2
erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py

@ -3,10 +3,12 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _, scrub from frappe import _, scrub
from frappe.model.document import Document from frappe.model.document import Document
class AccountingDimensionFilter(Document): class AccountingDimensionFilter(Document):
def validate(self): def validate(self):
self.validate_applicable_accounts() self.validate_applicable_accounts()

9
erpnext/accounts/doctype/accounting_dimension_filter/test_accounting_dimension_filter.py

@ -3,10 +3,15 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest 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.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 from erpnext.exceptions import InvalidAccountDimensionError, MandatoryAccountDimensionError
test_dependencies = ['Location', 'Cost Center', 'Department'] test_dependencies = ['Location', 'Cost Center', 'Department']

4
erpnext/accounts/doctype/accounting_period/accounting_period.py

@ -3,9 +3,11 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.model.document import Document
from frappe import _ from frappe import _
from frappe.model.document import Document
class OverlapError(frappe.ValidationError): pass class OverlapError(frappe.ValidationError): pass

8
erpnext/accounts/doctype/accounting_period/test_accounting_period.py

@ -3,12 +3,14 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest 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.accounting_period.accounting_period import OverlapError
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
from erpnext.accounts.general_ledger import ClosedAccountingPeriod
test_dependencies = ['Item'] test_dependencies = ['Item']

5
erpnext/accounts/doctype/accounts_settings/accounts_settings.py

@ -4,11 +4,12 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _ 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.custom.doctype.property_setter.property_setter import make_property_setter
from frappe.model.document import Document
from frappe.utils import cint
class AccountsSettings(Document): class AccountsSettings(Document):

1
erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py

@ -1,4 +1,5 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import unittest import unittest
import frappe import frappe

2
erpnext/accounts/doctype/advance_taxes_and_charges/advance_taxes_and_charges.py

@ -3,8 +3,10 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class AdvanceTaxesandCharges(Document): class AdvanceTaxesandCharges(Document):
pass pass

2
erpnext/accounts/doctype/allowed_dimension/allowed_dimension.py

@ -3,8 +3,10 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class AllowedDimension(Document): class AllowedDimension(Document):
pass pass

2
erpnext/accounts/doctype/allowed_to_transact_with/allowed_to_transact_with.py

@ -3,7 +3,9 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
from frappe.model.document import Document from frappe.model.document import Document
class AllowedToTransactWith(Document): class AllowedToTransactWith(Document):
pass pass

2
erpnext/accounts/doctype/applicable_on_account/applicable_on_account.py

@ -3,8 +3,10 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class ApplicableOnAccount(Document): class ApplicableOnAccount(Document):
pass pass

8
erpnext/accounts/doctype/bank/bank.py

@ -3,9 +3,13 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals 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.model.document import Document
from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
class Bank(Document): class Bank(Document):
def onload(self): def onload(self):

2
erpnext/accounts/doctype/bank/test_bank.py

@ -3,8 +3,8 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
class TestBank(unittest.TestCase): class TestBank(unittest.TestCase):
pass pass

7
erpnext/accounts/doctype/bank_account/bank_account.py

@ -3,10 +3,15 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _ 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.model.document import Document
from frappe.contacts.address_and_contact import load_address_and_contact, delete_contact_and_address
class BankAccount(Document): class BankAccount(Document):
def onload(self): def onload(self):

6
erpnext/accounts/doctype/bank_account/test_bank_account.py

@ -3,11 +3,11 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe import _
from frappe import ValidationError
import unittest import unittest
import frappe
from frappe import ValidationError
# test_records = frappe.get_test_records('Bank Account') # test_records = frappe.get_test_records('Bank Account')
class TestBankAccount(unittest.TestCase): class TestBankAccount(unittest.TestCase):

2
erpnext/accounts/doctype/bank_account_subtype/bank_account_subtype.py

@ -3,7 +3,9 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
from frappe.model.document import Document from frappe.model.document import Document
class BankAccountSubtype(Document): class BankAccountSubtype(Document):
pass pass

1
erpnext/accounts/doctype/bank_account_subtype/test_bank_account_subtype.py

@ -5,5 +5,6 @@ from __future__ import unicode_literals
import unittest import unittest
class TestBankAccountSubtype(unittest.TestCase): class TestBankAccountSubtype(unittest.TestCase):
pass pass

2
erpnext/accounts/doctype/bank_account_type/bank_account_type.py

@ -3,8 +3,10 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class BankAccountType(Document): class BankAccountType(Document):
pass pass

1
erpnext/accounts/doctype/bank_account_type/test_bank_account_type.py

@ -6,5 +6,6 @@ from __future__ import unicode_literals
# import frappe # import frappe
import unittest import unittest
class TestBankAccountType(unittest.TestCase): class TestBankAccountType(unittest.TestCase):
pass pass

5
erpnext/accounts/doctype/bank_clearance/bank_clearance.py

@ -2,10 +2,11 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe 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.model.document import Document
from frappe.utils import flt, fmt_money, getdate, nowdate
form_grid_templates = { form_grid_templates = {
"journal_entries": "templates/form_grid/bank_reconciliation_grid.html" "journal_entries": "templates/form_grid/bank_reconciliation_grid.html"

1
erpnext/accounts/doctype/bank_clearance/test_bank_clearance.py

@ -6,5 +6,6 @@ from __future__ import unicode_literals
# import frappe # import frappe
import unittest import unittest
class TestBankClearance(unittest.TestCase): class TestBankClearance(unittest.TestCase):
pass pass

3
erpnext/accounts/doctype/bank_clearance_detail/bank_clearance_detail.py

@ -2,8 +2,9 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class BankClearanceDetail(Document): class BankClearanceDetail(Document):
pass pass

8
erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py

@ -3,10 +3,14 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, json
from frappe.model.document import Document import json
import frappe
from frappe import _ from frappe import _
from frappe.desk.search import sanitize_searchfield from frappe.desk.search import sanitize_searchfield
from frappe.model.document import Document
class BankGuarantee(Document): class BankGuarantee(Document):
def validate(self): def validate(self):

2
erpnext/accounts/doctype/bank_guarantee/test_bank_guarantee.py

@ -3,8 +3,8 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
class TestBankGuarantee(unittest.TestCase): class TestBankGuarantee(unittest.TestCase):
pass pass

10
erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py

@ -3,17 +3,21 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import json import json
import frappe import frappe
from frappe.model.document import Document
from frappe import _ from frappe import _
from frappe.model.document import Document
from frappe.utils import flt from frappe.utils import flt
from erpnext import get_company_currency 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.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): class BankReconciliationTool(Document):

1
erpnext/accounts/doctype/bank_reconciliation_tool/test_bank_reconciliation_tool.py

@ -6,5 +6,6 @@ from __future__ import unicode_literals
# import frappe # import frappe
import unittest import unittest
class TestBankReconciliationTool(unittest.TestCase): class TestBankReconciliationTool(unittest.TestCase):
pass pass

14
erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py

@ -3,22 +3,22 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import csv import csv
import json import json
import re import re
import frappe
import openpyxl 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.styles import Font
from openpyxl.utils import get_column_letter from openpyxl.utils import get_column_letter
from six import string_types 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): class BankStatementImport(DataImport):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

1
erpnext/accounts/doctype/bank_statement_import/test_bank_statement_import.py

@ -6,5 +6,6 @@ from __future__ import unicode_literals
# import frappe # import frappe
import unittest import unittest
class TestBankStatementImport(unittest.TestCase): class TestBankStatementImport(unittest.TestCase):
pass pass

6
erpnext/accounts/doctype/bank_transaction/bank_transaction.py

@ -3,11 +3,13 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from erpnext.controllers.status_updater import StatusUpdater
from frappe.utils import flt from frappe.utils import flt
from six.moves import reduce from six.moves import reduce
from frappe import _
from erpnext.controllers.status_updater import StatusUpdater
class BankTransaction(StatusUpdater): class BankTransaction(StatusUpdater):
def after_insert(self): def after_insert(self):

5
erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py

@ -3,12 +3,15 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import json import json
import frappe
from frappe.utils import getdate from frappe.utils import getdate
from frappe.utils.dateutils import parse_date from frappe.utils.dateutils import parse_date
from six import iteritems from six import iteritems
@frappe.whitelist() @frappe.whitelist()
def upload_bank_statement(): def upload_bank_statement():
if getattr(frappe, "uploaded_file", None): if getattr(frappe, "uploaded_file", None):

15
erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py

@ -3,14 +3,19 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest
import json import json
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice import unittest
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
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.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.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"] test_dependencies = ["Item", "Cost Center"]

2
erpnext/accounts/doctype/bank_transaction_mapping/bank_transaction_mapping.py

@ -3,7 +3,9 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
from frappe.model.document import Document from frappe.model.document import Document
class BankTransactionMapping(Document): class BankTransactionMapping(Document):
pass pass

2
erpnext/accounts/doctype/bank_transaction_payments/bank_transaction_payments.py

@ -3,7 +3,9 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
from frappe.model.document import Document from frappe.model.document import Document
class BankTransactionPayments(Document): class BankTransactionPayments(Document):
pass pass

13
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 # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import flt, getdate, add_months, get_last_day, fmt_money, nowdate from frappe.model.document import Document
from frappe.model.naming import make_autoname 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 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
class BudgetError(frappe.ValidationError): pass class BudgetError(frappe.ValidationError): pass
class DuplicateBudgetError(frappe.ValidationError): pass class DuplicateBudgetError(frappe.ValidationError): pass

10
erpnext/accounts/doctype/budget/test_budget.py

@ -3,13 +3,15 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest 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.accounts.utils import get_fiscal_year
from erpnext.buying.doctype.purchase_order.test_purchase_order import create_purchase_order 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'] test_dependencies = ['Monthly Distribution']

3
erpnext/accounts/doctype/budget_account/budget_account.py

@ -3,8 +3,9 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class BudgetAccount(Document): class BudgetAccount(Document):
pass pass

4
erpnext/accounts/doctype/c_form/c_form.py

@ -2,10 +2,12 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.utils import flt
from frappe import _ from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import flt
class CForm(Document): class CForm(Document):
def validate(self): def validate(self):

1
erpnext/accounts/doctype/c_form/test_c_form.py

@ -3,7 +3,6 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
# test_records = frappe.get_test_records('C-Form') # test_records = frappe.get_test_records('C-Form')

3
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 # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class CFormInvoiceDetail(Document): class CFormInvoiceDetail(Document):
pass pass

1
erpnext/accounts/doctype/campaign_item/campaign_item.py

@ -4,5 +4,6 @@
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class CampaignItem(Document): class CampaignItem(Document):
pass pass

1
erpnext/accounts/doctype/cash_flow_mapper/cash_flow_mapper.py

@ -3,6 +3,7 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
from frappe.model.document import Document from frappe.model.document import Document

1
erpnext/accounts/doctype/cash_flow_mapping/cash_flow_mapping.py

@ -3,6 +3,7 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.model.document import Document from frappe.model.document import Document

3
erpnext/accounts/doctype/cash_flow_mapping/test_cash_flow_mapping.py

@ -3,9 +3,10 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
import frappe
class TestCashFlowMapping(unittest.TestCase): class TestCashFlowMapping(unittest.TestCase):
def setUp(self): def setUp(self):

1
erpnext/accounts/doctype/cash_flow_mapping_accounts/cash_flow_mapping_accounts.py

@ -3,6 +3,7 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
from frappe.model.document import Document from frappe.model.document import Document

1
erpnext/accounts/doctype/cash_flow_mapping_template/cash_flow_mapping_template.py

@ -3,6 +3,7 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
from frappe.model.document import Document from frappe.model.document import Document

1
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 # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
from frappe.model.document import Document from frappe.model.document import Document

6
erpnext/accounts/doctype/cashier_closing/cashier_closing.py

@ -3,10 +3,12 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import cint, flt, cstr from frappe.utils import flt
from frappe import _, msgprint, throw
class CashierClosing(Document): class CashierClosing(Document):
def validate(self): def validate(self):

2
erpnext/accounts/doctype/cashier_closing/test_cashier_closing.py

@ -3,8 +3,8 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
class TestCashierClosing(unittest.TestCase): class TestCashierClosing(unittest.TestCase):
pass pass

3
erpnext/accounts/doctype/cashier_closing_payments/cashier_closing_payments.py

@ -3,8 +3,9 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class CashierClosingPayments(Document): class CashierClosingPayments(Document):
pass pass

20
erpnext/accounts/doctype/chart_of_accounts_importer/chart_of_accounts_importer.py

@ -3,14 +3,26 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import csv
import os
from functools import reduce from functools import reduce
import frappe, csv, os
import frappe
from frappe import _ from frappe import _
from frappe.utils import cstr, cint
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import cint, cstr
from frappe.utils.csvutils import UnicodeWriter 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 (
from frappe.utils.xlsxutils import read_xlsx_file_from_attached_file, read_xls_file_from_attached_file 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): class ChartofAccountsImporter(Document):
def validate(self): def validate(self):

2
erpnext/accounts/doctype/chart_of_accounts_importer/test_chart_of_accounts_importer.py

@ -3,8 +3,8 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
class TestChartofAccountsImporter(unittest.TestCase): class TestChartofAccountsImporter(unittest.TestCase):
pass pass

4
erpnext/accounts/doctype/cheque_print_template/cheque_print_template.py

@ -3,9 +3,11 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.model.document import Document
from frappe import _ from frappe import _
from frappe.model.document import Document
class ChequePrintTemplate(Document): class ChequePrintTemplate(Document):
pass pass

1
erpnext/accounts/doctype/cheque_print_template/test_cheque_print_template.py

@ -3,7 +3,6 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
# test_records = frappe.get_test_records('Cheque Print Template') # test_records = frappe.get_test_records('Cheque Print Template')

3
erpnext/accounts/doctype/closed_document/closed_document.py

@ -3,8 +3,9 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class ClosedDocument(Document): class ClosedDocument(Document):
pass pass

4
erpnext/accounts/doctype/cost_center/cost_center.py

@ -2,10 +2,12 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import cint, cstr from frappe.utils import cint
from frappe.utils.nestedset import NestedSet from frappe.utils.nestedset import NestedSet
from erpnext.accounts.utils import validate_field_number from erpnext.accounts.utils import validate_field_number

2
erpnext/accounts/doctype/cost_center/test_cost_center.py

@ -1,7 +1,9 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import unittest import unittest
import frappe import frappe
test_records = frappe.get_test_records('Cost Center') test_records = frappe.get_test_records('Cost Center')

5
erpnext/accounts/doctype/coupon_code/coupon_code.py

@ -3,10 +3,13 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import (strip) from frappe.utils import strip
class CouponCode(Document): class CouponCode(Document):
def autoname(self): def autoname(self):
self.coupon_name = strip(self.coupon_name) self.coupon_name = strip(self.coupon_name)

6
erpnext/accounts/doctype/coupon_code/test_coupon_code.py

@ -3,11 +3,11 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
import frappe
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order 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'] test_dependencies = ['Item']

1
erpnext/accounts/doctype/customer_group_item/customer_group_item.py

@ -4,5 +4,6 @@
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class CustomerGroupItem(Document): class CustomerGroupItem(Document):
pass pass

1
erpnext/accounts/doctype/customer_item/customer_item.py

@ -4,5 +4,6 @@
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class CustomerItem(Document): class CustomerItem(Document):
pass pass

2
erpnext/accounts/doctype/discounted_invoice/discounted_invoice.py

@ -3,8 +3,10 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class DiscountedInvoice(Document): class DiscountedInvoice(Document):
pass pass

2
erpnext/accounts/doctype/distributed_cost_center/distributed_cost_center.py

@ -3,8 +3,10 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class DistributedCostCenter(Document): class DistributedCostCenter(Document):
pass pass

12
erpnext/accounts/doctype/dunning/dunning.py

@ -3,13 +3,17 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import json import json
import frappe
from frappe.utils import cint, flt, getdate
from six import string_types 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.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 from erpnext.controllers.accounts_controller import AccountsController

2
erpnext/accounts/doctype/dunning/dunning_dashboard.py

@ -1,6 +1,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from frappe import _ from frappe import _
def get_data(): def get_data():
return { return {
'fieldname': 'dunning', 'fieldname': 'dunning',

14
erpnext/accounts/doctype/dunning/test_dunning.py

@ -3,13 +3,19 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest 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 import frappe
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice_against_cost_center from frappe.utils import add_days, nowdate, today
from erpnext.accounts.doctype.dunning.dunning import calculate_interest_and_amount 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.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): class TestDunning(unittest.TestCase):

2
erpnext/accounts/doctype/dunning_letter_text/dunning_letter_text.py

@ -3,8 +3,10 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class DunningLetterText(Document): class DunningLetterText(Document):
pass pass

2
erpnext/accounts/doctype/dunning_type/dunning_type.py

@ -3,8 +3,10 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
# import frappe # import frappe
from frappe.model.document import Document from frappe.model.document import Document
class DunningType(Document): class DunningType(Document):
pass pass

1
erpnext/accounts/doctype/dunning_type/test_dunning_type.py

@ -6,5 +6,6 @@ from __future__ import unicode_literals
# import frappe # import frappe
import unittest import unittest
class TestDunningType(unittest.TestCase): class TestDunningType(unittest.TestCase):
pass pass

10
erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation.py

@ -3,13 +3,17 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, erpnext
import frappe
from frappe import _ from frappe import _
from frappe.utils import flt
from frappe.model.document import Document from frappe.model.document import Document
from frappe.model.meta import get_field_precision 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.accounts.doctype.journal_entry.journal_entry import get_balance_on
from erpnext.setup.utils import get_exchange_rate
class ExchangeRateRevaluation(Document): class ExchangeRateRevaluation(Document):
def validate(self): def validate(self):

1
erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation_dashboard.py

@ -1,5 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
def get_data(): def get_data():
return { return {
'fieldname': 'reference_name', 'fieldname': 'reference_name',

2
erpnext/accounts/doctype/exchange_rate_revaluation/test_exchange_rate_revaluation.py

@ -3,8 +3,8 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
import unittest import unittest
class TestExchangeRateRevaluation(unittest.TestCase): class TestExchangeRateRevaluation(unittest.TestCase):
pass pass

3
erpnext/accounts/doctype/exchange_rate_revaluation_account/exchange_rate_revaluation_account.py

@ -3,8 +3,9 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class ExchangeRateRevaluationAccount(Document): class ExchangeRateRevaluationAccount(Document):
pass pass

3
erpnext/accounts/doctype/finance_book/finance_book.py

@ -3,8 +3,9 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class FinanceBook(Document): class FinanceBook(Document):
pass pass

6
erpnext/accounts/doctype/finance_book/test_finance_book.py

@ -2,11 +2,13 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
import unittest
import frappe import frappe
import unittest
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
class TestFinanceBook(unittest.TestCase): class TestFinanceBook(unittest.TestCase):
def test_finance_book(self): def test_finance_book(self):

7
erpnext/accounts/doctype/fiscal_year/fiscal_year.py

@ -2,12 +2,13 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import msgprint, _
from frappe.utils import getdate, add_days, add_years, cstr
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
from frappe import _, msgprint
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import add_days, add_years, cstr, getdate
class FiscalYearIncorrectDate(frappe.ValidationError): pass class FiscalYearIncorrectDate(frappe.ValidationError): pass

4
erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py

@ -3,7 +3,9 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, unittest import unittest
import frappe
from erpnext.accounts.doctype.fiscal_year.fiscal_year import FiscalYearIncorrectDate from erpnext.accounts.doctype.fiscal_year.fiscal_year import FiscalYearIncorrectDate

3
erpnext/accounts/doctype/fiscal_year_company/fiscal_year_company.py

@ -2,8 +2,9 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class FiscalYearCompany(Document): class FiscalYearCompany(Document):
pass pass

28
erpnext/accounts/doctype/gl_entry/gl_entry.py

@ -2,20 +2,30 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, erpnext
import frappe
from frappe import _ from frappe import _
from frappe.utils import flt, fmt_money, getdate, formatdate, cint
from frappe.model.document import Document 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 frappe.model.meta import get_field_precision
from erpnext.accounts.party import validate_party_gle_currency, validate_party_frozen_disabled from frappe.model.naming import set_name_from_naming_options
from erpnext.accounts.utils import get_account_currency from frappe.utils import flt, fmt_money
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 six import iteritems 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 exclude_from_linked_with = True
class GLEntry(Document): class GLEntry(Document):
def autoname(self): def autoname(self):

9
erpnext/accounts/doctype/gl_entry/test_gl_entry.py

@ -2,10 +2,15 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, unittest
import unittest
import frappe
from frappe.model.naming import parse_naming_series 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.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): class TestGLEntry(unittest.TestCase):
def test_round_off_entry(self): def test_round_off_entry(self):

3
erpnext/accounts/doctype/gst_account/gst_account.py

@ -3,8 +3,9 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.model.document import Document from frappe.model.document import Document
class GSTAccount(Document): class GSTAccount(Document):
pass pass

16
erpnext/accounts/doctype/invoice_discounting/invoice_discounting.py

@ -3,12 +3,20 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe, json, erpnext
import json
import frappe
from frappe import _ from frappe import _
from frappe.utils import flt, getdate, nowdate, add_days from frappe.utils import add_days, flt, getdate, nowdate
from erpnext.controllers.accounts_controller import AccountsController
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.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): class InvoiceDiscounting(AccountsController):
def validate(self): def validate(self):

2
erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py

@ -1,6 +1,8 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from frappe import _ from frappe import _
def get_data(): def get_data():
return { return {
'fieldname': 'reference_name', 'fieldname': 'reference_name',

12
erpnext/accounts/doctype/invoice_discounting/test_invoice_discounting.py

@ -3,13 +3,17 @@
# See license.txt # See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe
from frappe.utils import nowdate, add_days, flt
import unittest 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.account.test_account import create_account
from erpnext.accounts.doctype.journal_entry.journal_entry import get_payment_entry_against_invoice 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): class TestInvoiceDiscounting(unittest.TestCase):
def setUp(self): def setUp(self):
self.ar_credit = create_account(account_name="_Test Accounts Receivable Credit", parent_account = "Accounts Receivable - _TC", company="_Test Company") self.ar_credit = create_account(account_name="_Test Accounts Receivable Credit", parent_account = "Accounts Receivable - _TC", company="_Test Company")

4
erpnext/accounts/doctype/item_tax_template/item_tax_template.py

@ -3,9 +3,11 @@
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.model.document import Document
from frappe import _ from frappe import _
from frappe.model.document import Document
class ItemTaxTemplate(Document): class ItemTaxTemplate(Document):
def validate(self): def validate(self):

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save