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
This commit is contained in:
Chillar Anand
2021-09-02 16:44:59 +05:30
committed by GitHub
parent b25d28e023
commit 915b34391c
2060 changed files with 7707 additions and 3083 deletions

View File

@@ -6,6 +6,7 @@ from __future__ import unicode_literals
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'):

View File

@@ -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'})

View File

@@ -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'})

View File

@@ -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'})

View File

@@ -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:

View File

@@ -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:

View File

@@ -1,6 +1,8 @@
import frappe
from erpnext.regional.india import states
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})

View File

@@ -1,6 +1,7 @@
from __future__ import unicode_literals
import frappe
from erpnext.regional.united_states.setup import make_custom_fields

View File

@@ -1,5 +1,6 @@
import frappe
def execute():
frappe.reload_doc('stock', 'doctype', 'item_variant_attribute')
frappe.db.sql('''

View File

@@ -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')

View File

@@ -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()

View File

@@ -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)

View File

@@ -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:

View File

@@ -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:

View File

@@ -1,5 +1,6 @@
import frappe
def execute():
frappe.db.sql("""
DELETE FROM `tabProperty Setter`

View File

@@ -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))

View File

@@ -1,5 +1,6 @@
import frappe
def execute():
# fixes status of quotations which have status 'Expired' despite having valid sales order created

View File

@@ -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 """

View File

@@ -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")

View File

@@ -1,6 +1,8 @@
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc('accounts', 'doctype', 'bank', force=1)

View File

@@ -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")

View File

@@ -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 '''

View File

@@ -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"):

View File

@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe

View File

@@ -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")

View File

@@ -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("""

View File

@@ -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")

View File

@@ -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

View File

@@ -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')

View File

@@ -1,7 +1,9 @@
# Copyright (c) 2019
from __future__ import unicode_literals
import frappe
def execute():
frappe.delete_doc("Page", "medical_record")

View File

@@ -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)

View File

@@ -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"):

View File

@@ -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)

View File

@@ -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:

View File

@@ -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")

View File

@@ -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:

View File

@@ -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"):

View File

@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
doctypes = {

View File

@@ -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")

View File

@@ -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')

View File

@@ -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")

View File

@@ -1,5 +1,6 @@
import frappe
def execute():
frappe.reload_doc('selling', 'doctype', 'sales_order_item', force=True)

View File

@@ -1,6 +1,8 @@
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("accounts", "doctype", "accounts_settings")

View File

@@ -1,4 +1,6 @@
import frappe
def execute():
frappe.reload_doc('hr', 'doctype', 'expense_claim_detail')
frappe.db.sql("""

View File

@@ -1,4 +1,5 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import cint

View File

@@ -1,4 +1,5 @@
import frappe
def execute():
frappe.db.set_value('Homepage', 'Homepage', 'hero_section_based_on', 'Default')

View File

@@ -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")

View File

@@ -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')

View File

@@ -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'})

View File

@@ -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]

View File

@@ -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')

View File

@@ -1,5 +1,6 @@
import frappe
def execute():
frappe.reload_doctype("Payment Entry")
frappe.db.sql("""update `tabPayment Entry` set status = CASE

View File

@@ -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'})

View File

@@ -1,5 +1,6 @@
import frappe
def execute():
frappe.reload_doc("support", "doctype", "issue_priority")
frappe.reload_doc("support", "doctype", "service_level_priority")

View File

@@ -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')

View File

@@ -1,6 +1,8 @@
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("manufacturing", "doctype", "workstation")

View File

@@ -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"):

View File

@@ -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)

View File

@@ -1,6 +1,8 @@
from __future__ import unicode_literals
import frappe
def execute():
frappe.db.sql(""" UPDATE `tabQuotation` set status = 'Open'

View File

@@ -1,6 +1,8 @@
from __future__ import unicode_literals
import frappe
def execute():
purchase_receipts = frappe.db.sql("""
SELECT

View File

@@ -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')

View File

@@ -1,5 +1,6 @@
import frappe
def execute():
frappe.reload_doctype('Task')

View File

@@ -5,6 +5,7 @@ from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("stock", "doctype", "pick_list")
frappe.db.sql("""UPDATE `tabPick List` set purpose = 'Delivery'

View File

@@ -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`

View File

@@ -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()

View File

@@ -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`

View File

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

View File

@@ -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')

View File

@@ -1,5 +1,6 @@
import frappe
def execute():
job = frappe.db.exists('Scheduled Job Type', 'patient_appointment.send_appointment_reminder')
if job:

View File

@@ -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")

View File

@@ -1,6 +1,8 @@
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("accounts", "doctype", "gl_entry")

View File

@@ -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')

View File

@@ -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'})

View File

@@ -1,6 +1,8 @@
from __future__ import unicode_literals
import frappe
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})

View File

@@ -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': [

View File

@@ -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')")

View File

@@ -1,6 +1,8 @@
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc('accounts', 'doctype', 'item_tax_template')

View File

@@ -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

View File

@@ -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")

View File

@@ -1,6 +1,8 @@
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("accounts", "doctype", "pricing_rule")

View File

@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
parentfield = {

View File

@@ -1,6 +1,8 @@
import frappe
from erpnext.regional.india import states
def execute():
company = frappe.get_all('Company', filters = {'country': 'India'})

View File

@@ -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

View File

@@ -1,5 +1,6 @@
import frappe
def execute():
frappe.reload_doc('custom', 'doctype', 'custom_field')
company = frappe.get_all('Company', filters = {'country': 'India'})