[fixes] errors caught on flake8 (#10126)

This commit is contained in:
Rushabh Mehta 2017-07-28 11:39:01 +05:30 committed by GitHub
parent 2653825d25
commit d50da78f28
6 changed files with 127 additions and 139 deletions

View File

@ -158,7 +158,6 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, company
return flt(bal) return flt(bal)
def get_count_on(account, fieldname, date): def get_count_on(account, fieldname, date):
cond = [] cond = []
if date: if date:
cond.append("posting_date <= '%s'" % frappe.db.escape(cstr(date))) cond.append("posting_date <= '%s'" % frappe.db.escape(cstr(date)))
@ -195,11 +194,6 @@ def get_count_on(account, fieldname, date):
select name from `tabAccount` ac where ac.name = gle.account select name from `tabAccount` ac where ac.name = gle.account
and ac.lft >= %s and ac.rgt <= %s and ac.lft >= %s and ac.rgt <= %s
)""" % (acc.lft, acc.rgt)) )""" % (acc.lft, acc.rgt))
# If group and currency same as company,
# always return balance based on debit and credit in company currency
if acc.account_currency == frappe.db.get_value("Company", acc.company, "default_currency"):
in_account_currency = False
else: else:
cond.append("""gle.account = "%s" """ % (frappe.db.escape(account, percent=False), )) cond.append("""gle.account = "%s" """ % (frappe.db.escape(account, percent=False), ))
@ -534,7 +528,7 @@ def get_stock_and_account_difference(account_list=None, posting_date=None):
account_balance = get_balance_on(account_data.get('account'), posting_date, in_account_currency=False) account_balance = get_balance_on(account_data.get('account'), posting_date, in_account_currency=False)
stock_value = get_stock_value_on(warehouse, posting_date) stock_value = get_stock_value_on(warehouse, posting_date)
if abs(flt(stock_value) - flt(account_balance)) > 0.005: if abs(flt(stock_value) - flt(account_balance)) > 0.005:
difference.setdefault(account, flt(stock_value) - flt(account_balance)) difference.setdefault(account_data.get('account'), flt(stock_value) - flt(account_balance))
return difference return difference
@ -695,9 +689,6 @@ def get_children():
return acc return acc
def create_payment_gateway_account(gateway):
create_payment_gateway_account(gateway)
def create_payment_gateway_account(gateway): def create_payment_gateway_account(gateway):
from erpnext.setup.setup_wizard.setup_wizard import create_bank_account from erpnext.setup.setup_wizard.setup_wizard import create_bank_account

View File

@ -367,9 +367,6 @@ def run_production_planning_tool(**args):
return ppt return ppt
def create_production_orders(ppt):
raise_production_orders(ppt)
def create_material_requests(ppt): def create_material_requests(ppt):
ppt.raise_material_requests() ppt.raise_material_requests()

View File

@ -6,5 +6,5 @@ import frappe
def execute(): def execute():
return return
country = get_country_info(country="Turkey") # country = get_country_info(country="Turkey")
add_country_and_currency("Turkey", country) # add_country_and_currency("Turkey", country)

View File

@ -3,9 +3,9 @@ import frappe
def execute(): def execute():
return return
frappe.reload_doc('website', 'doctype', 'style_settings') # frappe.reload_doc('website', 'doctype', 'style_settings')
style_settings = frappe.get_doc("Style Settings", "Style Settings") # style_settings = frappe.get_doc("Style Settings", "Style Settings")
if not style_settings.apply_style: # if not style_settings.apply_style:
style_settings.update(default_properties) # style_settings.update(default_properties)
style_settings.apply_style = 1 # style_settings.apply_style = 1
style_settings.save() # style_settings.save()

View File

@ -2,19 +2,19 @@ import frappe
def execute(): def execute():
return return
for party_type in ('Customer', 'Supplier'): # for party_type in ('Customer', 'Supplier'):
frappe.reload_doctype(party_type) # frappe.reload_doctype(party_type)
#
# set all as default status # # set all as default status
frappe.db.sql('update `tab{0}` set status=%s'.format(party_type), default_status[party_type]) # frappe.db.sql('update `tab{0}` set status=%s'.format(party_type), default_status[party_type])
#
for doctype in status_depends_on[party_type]: # for doctype in status_depends_on[party_type]:
filters = get_filters_for(doctype) # filters = get_filters_for(doctype)
parties = frappe.get_all(doctype, fields="{0} as party".format(party_type.lower()), # parties = frappe.get_all(doctype, fields="{0} as party".format(party_type.lower()),
filters=filters, limit_page_length=1) # filters=filters, limit_page_length=1)
#
parties = filter(None, [p.party for p in parties]) # parties = filter(None, [p.party for p in parties])
#
if parties: # if parties:
frappe.db.sql('update `tab{0}` set status="Open" where name in ({1})'.format(party_type, # frappe.db.sql('update `tab{0}` set status="Open" where name in ({1})'.format(party_type,
', '.join(len(parties) * ['%s'])), parties) # ', '.join(len(parties) * ['%s'])), parties)

View File

@ -51,4 +51,4 @@ def check_and_update_auto_email_report(report):
frappe.delete_doc("Auto Email Report", auto_email_report) frappe.delete_doc("Auto Email Report", auto_email_report)
elif report in ["Customer Addresses And Contacts", "Supplier Addresses And Contacts"]: elif report in ["Customer Addresses And Contacts", "Supplier Addresses And Contacts"]:
frapppe.db.set_value("Auto Email Report", auto_email_report, "report", report) frappe.db.set_value("Auto Email Report", auto_email_report, "report", report)