chore: mass trailing whitespace and EOF fixes

This commit is contained in:
Ankush Menat
2021-08-19 13:41:10 +05:30
parent 869e36c33a
commit 4551d7d602
1190 changed files with 1352 additions and 1604 deletions

View File

@@ -13,4 +13,4 @@ def execute():
where a.gstin = %s and dl.parent = a.name and dl.link_doctype = 'Company'
""", (creds.get('gstin')))
if company_name and len(company_name) > 0:
frappe.db.set_value('E Invoice User', creds.get('name'), 'company', company_name[0][0])
frappe.db.set_value('E Invoice User', creds.get('name'), 'company', company_name[0][0])

View File

@@ -14,6 +14,6 @@ def execute():
for company in frappe.get_all("Company", ["name", "default_selling_terms", "default_buying_terms"]):
if company.default_selling_terms and not company.default_buying_terms:
frappe.db.set_value("Company", company.name, "default_buying_terms", company.default_selling_terms)
frappe.reload_doc("setup", "doctype", "terms_and_conditions")
frappe.db.sql("update `tabTerms and Conditions` set selling=1, buying=1, hr=1")

View File

@@ -15,4 +15,4 @@ def execute():
]
}
create_custom_fields(custom_fields, update=True)
create_custom_fields(custom_fields, update=True)

View File

@@ -13,13 +13,13 @@ def execute():
'Sales Invoice': [
dict(fieldname='einvoice_section', label='E-Invoice Fields', fieldtype='Section Break', insert_after='gst_vehicle_type',
print_hide=1, hidden=1),
dict(fieldname='ack_no', label='Ack. No.', fieldtype='Data', read_only=1, hidden=1, insert_after='einvoice_section',
no_copy=1, print_hide=1),
dict(fieldname='ack_date', label='Ack. Date', fieldtype='Data', read_only=1, hidden=1, insert_after='ack_no', no_copy=1, print_hide=1),
dict(fieldname='irn_cancel_date', label='Cancel Date', fieldtype='Data', read_only=1, hidden=1, insert_after='ack_date',
dict(fieldname='irn_cancel_date', label='Cancel Date', fieldtype='Data', read_only=1, hidden=1, insert_after='ack_date',
no_copy=1, print_hide=1),
dict(fieldname='signed_einvoice', label='Signed E-Invoice', fieldtype='Code', options='JSON', hidden=1, insert_after='irn_cancel_date',
@@ -66,4 +66,4 @@ def execute():
if signed_einvoice:
signed_einvoice = json.loads(signed_einvoice)
frappe.db.set_value('Sales Invoice', inv.get('name'), 'ack_no', signed_einvoice.get('AckNo'), update_modified=False)
frappe.db.set_value('Sales Invoice', inv.get('name'), 'ack_date', signed_einvoice.get('AckDt'), update_modified=False)
frappe.db.set_value('Sales Invoice', inv.get('name'), 'ack_date', signed_einvoice.get('AckDt'), update_modified=False)

View File

@@ -15,4 +15,4 @@ def execute():
dict(role='Accounts User'),
dict(role='Accounts Manager')
]
)).insert()
)).insert()

View File

@@ -16,4 +16,4 @@ def execute():
'insert_after': 'customer_name_in_arabic',
'translatable': 0,
'owner': 'Administrator'
})
})

View File

@@ -13,4 +13,4 @@ def execute():
depends_on='ewaybill', read_only=1, allow_on_submit=1, insert_after='ewaybill')
]
}
create_custom_fields(custom_fields, update=True)
create_custom_fields(custom_fields, update=True)

View File

@@ -38,5 +38,3 @@ def execute():
WHERE fieldname = 'is_inter_state'
AND dt IN ('Sales Taxes and Charges Template', 'Purchase Taxes and Charges Template')
""")

View File

@@ -16,4 +16,4 @@ def execute():
]
}
create_custom_fields(custom_fields, update=True)
create_custom_fields(custom_fields, update=True)

View File

@@ -11,4 +11,4 @@ def execute():
SET
wo.item_name = item.item_name
""")
frappe.db.commit()
frappe.db.commit()

View File

@@ -10,4 +10,4 @@ def execute():
add_permission('Lower Deduction Certificate', 'Accounts Manager', 0)
update_permission_property('Lower Deduction Certificate', 'Accounts Manager', 0, 'write', 1)
update_permission_property('Lower Deduction Certificate', 'Accounts Manager', 0, 'create', 1)
update_permission_property('Lower Deduction Certificate', 'Accounts Manager', 0, 'create', 1)

View File

@@ -39,4 +39,4 @@ def execute():
create_custom_field(doctype, df)
frappe.clear_cache(doctype=doctype)
count += 1
count += 1

View File

@@ -3,4 +3,4 @@ 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()
create_default_energy_point_rules()

View File

@@ -13,4 +13,4 @@ def execute():
if not company:
return
make_custom_fields()
make_custom_fields()

View File

@@ -112,4 +112,4 @@ def execute():
'itc_central_tax': values.get('itc_central_tax'),
'itc_state_tax': values['itc_state_tax'],
'itc_cess_amount': values['itc_cess_amount'],
})
})

View File

@@ -15,4 +15,4 @@ def execute():
]
}
create_custom_fields(custom_fields, update=True)
create_custom_fields(custom_fields, update=True)

View File

@@ -6,4 +6,4 @@ def execute():
WHERE `tabProperty Setter`.doc_type='Issue'
AND `tabProperty Setter`.field_name='priority'
AND `tabProperty Setter`.property='options'
""")
""")

View File

@@ -6,23 +6,23 @@ def execute():
# filter out submitted expired quotations which has sales order created
cond = "qo.docstatus = 1 and qo.status = 'Expired'"
invalid_so_against_quo = """
SELECT
SELECT
so.name FROM `tabSales Order` so, `tabSales Order Item` so_item
WHERE
WHERE
so_item.docstatus = 1 and so.docstatus = 1
and so_item.parent = so.name
and so_item.prevdoc_docname = qo.name
and qo.valid_till < so.transaction_date""" # check if SO was created after quotation expired
frappe.db.sql(
"""UPDATE `tabQuotation` qo SET qo.status = 'Expired' WHERE {cond} and exists({invalid_so_against_quo})"""
.format(cond=cond, invalid_so_against_quo=invalid_so_against_quo)
)
valid_so_against_quo = """
SELECT
SELECT
so.name FROM `tabSales Order` so, `tabSales Order Item` so_item
WHERE
WHERE
so_item.docstatus = 1 and so.docstatus = 1
and so_item.parent = so.name
and so_item.prevdoc_docname = qo.name

View File

@@ -19,4 +19,4 @@ def execute():
frappe.delete_doc("Report", "Sales Partner-wise Transaction Summary")
frappe.delete_doc("Report", "Sales Person Target Variance Item Group-Wise")
frappe.delete_doc("Report", "Territory Target Variance Item Group-Wise")
frappe.delete_doc("Report", "Territory Target Variance Item Group-Wise")

View File

@@ -10,4 +10,4 @@ def execute():
for entry in bin_details:
update_bin_qty(entry.get("item_code"), entry.get("warehouse"), {
"indented_qty": get_indented_qty(entry.get("item_code"), entry.get("warehouse"))
})
})

View File

@@ -11,4 +11,4 @@ def execute():
if frappe.db.exists("Custom Field", "Company-bank_remittance_section"):
deprecated_fields = ['bank_remittance_section', 'client_code', 'remittance_column_break', 'product_code']
for i in range(len(deprecated_fields)):
frappe.delete_doc("Custom Field", 'Company-'+deprecated_fields[i])
frappe.delete_doc("Custom Field", 'Company-'+deprecated_fields[i])

View File

@@ -25,4 +25,4 @@ def delete_denied_leaves_from_leave_ledger_entry(leave_application_list):
WHERE
transaction_type = 'Leave Application'
AND transaction_name in (%s) ''' % (', '.join(['%s'] * len(leave_application_list))), #nosec
tuple(leave_application_list))
tuple(leave_application_list))

View File

@@ -43,4 +43,4 @@ def delete_duplicate_ledger_entries(duplicate_records_list):
AND is_carry_forward = %s
AND from_date = %s
AND to_date = %s
''', tuple(d))
''', tuple(d))

View File

@@ -4,4 +4,4 @@ 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)
frappe.reload_doc('accounts', 'doctype', 'bank_account')
frappe.reload_doc('accounts', 'doctype', 'bank_account')

View File

@@ -14,4 +14,4 @@ def execute():
def update_journal_entry_account_fieldname():
''' maps data from old field to the new field '''
if frappe.db.has_column('Journal Entry Account', 'bank_account_no'):
rename_field("Journal Entry Account", "bank_account_no", "bank_account")
rename_field("Journal Entry Account", "bank_account_no", "bank_account")

View File

@@ -15,4 +15,4 @@ def execute():
SELECT o.`name`, o.`creation`, o.`modified`, o.`modified_by`, o.`owner`, o.`docstatus`, o.`parent`, o.`parentfield`, o.`parenttype`, o.`idx`, o.`_comments`, o.`_assign`, o.`_user_tags`, o.`_liked_by`, o.`lost_reason`
FROM `tabOpportunity Lost Reason` o LEFT JOIN `tabQuotation Lost Reason` q ON q.name = o.name WHERE q.name IS NULL""")
frappe.delete_doc("DocType", "Lost Reason Detail")
frappe.delete_doc("DocType", "Lost Reason Detail")

View File

@@ -7,10 +7,10 @@ def execute():
if frappe.db.table_exists("POS Closing Voucher"):
if not frappe.db.exists("DocType", "POS Closing Entry"):
frappe.rename_doc('DocType', 'POS Closing Voucher', 'POS Closing Entry', force=True)
if not frappe.db.exists('DocType', 'POS Closing Entry Taxes'):
frappe.rename_doc('DocType', 'POS Closing Voucher Taxes', 'POS Closing Entry Taxes', force=True)
if not frappe.db.exists('DocType', 'POS Closing Voucher Details'):
frappe.rename_doc('DocType', 'POS Closing Voucher Details', 'POS Closing Entry Detail', force=True)
@@ -22,4 +22,4 @@ def execute():
frappe.delete_doc("DocType", "POS Closing Voucher")
frappe.delete_doc("DocType", "POS Closing Voucher Taxes")
frappe.delete_doc("DocType", "POS Closing Voucher Details")
frappe.delete_doc("DocType", "POS Closing Voucher Invoices")
frappe.delete_doc("DocType", "POS Closing Voucher Invoices")

View File

@@ -12,4 +12,4 @@ def execute():
qty_allowance = frappe.db.get_single_value("Stock Settings", "over_delivery_receipt_allowance")
frappe.db.set_value("Accounts Settings", None, "over_delivery_receipt_allowance", qty_allowance)
frappe.db.sql("update tabItem set over_billing_allowance=over_delivery_receipt_allowance")
frappe.db.sql("update tabItem set over_billing_allowance=over_delivery_receipt_allowance")

View File

@@ -2,4 +2,4 @@ import frappe
def execute():
frappe.db.sql("""UPDATE `tabUser` SET `home_settings` = REPLACE(`home_settings`, 'Accounting', 'Accounts')""")
frappe.cache().delete_key('home_settings')
frappe.cache().delete_key('home_settings')

View File

@@ -66,6 +66,3 @@ def execute():
frappe.db.sql(""" UPDATE `tabPacked Item` set target_warehouse = null
WHERE creation > '2020-04-16' and docstatus < 2 and parenttype = 'Sales Order' """)

View File

@@ -4,4 +4,4 @@ import frappe
def execute():
frappe.reload_doc("accounts", "doctype", "accounts_settings")
frappe.db.set_value("Accounts Settings", None, "automatically_process_deferred_accounting_entry", 1)
frappe.db.set_value("Accounts Settings", None, "automatically_process_deferred_accounting_entry", 1)

View File

@@ -5,4 +5,4 @@ def execute():
UPDATE `tabExpense Claim Detail` child, `tabExpense Claim` par
SET child.cost_center = par.cost_center
WHERE child.parent = par.name
""")
""")

View File

@@ -10,8 +10,8 @@ def execute():
if frappe.db.exists("DocType", "Asset Settings"):
frappe.reload_doctype("Asset Category")
cwip_value = frappe.db.get_single_value("Asset Settings", "disable_cwip_accounting")
frappe.db.sql("""UPDATE `tabAsset Category` SET enable_cwip_accounting = %s""", cint(cwip_value))
frappe.db.sql("""DELETE FROM `tabSingles` where doctype = 'Asset Settings'""")
frappe.delete_doc_if_exists("DocType", "Asset Settings")
frappe.delete_doc_if_exists("DocType", "Asset Settings")

View File

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

View File

@@ -3,4 +3,4 @@ import frappe
def execute():
frappe.reload_doc("hr", "doctype", "hr_settings")
frappe.db.set_value("HR Settings", None, "payroll_based_on", "Leave")
frappe.db.set_value("HR Settings", None, "payroll_based_on", "Leave")

View File

@@ -30,4 +30,4 @@ def execute():
s.docstatus = 1
AND s.company = %s
AND t.parent = s.name
""", (account, company))
""", (account, company))

View File

@@ -48,5 +48,3 @@ def execute():
frappe.db.sql(""" UPDATE `tab{doctype}` t1, `tabAddress` t2, `tabDynamic Link` t3 SET t1.gst_category = "Overseas"
where t3.link_name = t1.name and t3.parent = t2.name and t2.country != 'India' """.format(doctype=doctype)) #nosec

View File

@@ -9,4 +9,4 @@ def execute():
countries = frappe.get_all("Company", fields="country")
countries = [country["country"] for country in countries]
if "Italy" in countries:
add_permissions()
add_permissions()

View File

@@ -13,4 +13,4 @@ def execute():
SET
stock_uom = uom,
conversion_factor = 1,
stock_qty = qty""")
stock_qty = qty""")

View File

@@ -6,4 +6,4 @@ def execute():
WHEN docstatus = 1 THEN 'Submitted'
WHEN docstatus = 2 THEN 'Cancelled'
ELSE 'Draft'
END;""")
END;""")

View File

@@ -81,4 +81,4 @@ def set_priorities_service_level_agreement():
doc.flags.ignore_validate = True
doc.save(ignore_permissions=True)
except frappe.db.TableMissingError:
frappe.reload_doc("support", "doctype", "service_level_agreement")
frappe.reload_doc("support", "doctype", "service_level_agreement")

View File

@@ -11,4 +11,4 @@ def execute():
filters={'sales_order': ('!=', ''), 'sales_order_item': ('!=', '')}):
# update produced qty in sales order
update_produced_qty_in_so_item(d.sales_order, d.sales_order_item)
update_produced_qty_in_so_item(d.sales_order, d.sales_order_item)

View File

@@ -5,4 +5,4 @@ def execute():
frappe.reload_doc("manufacturing", "doctype", "workstation")
frappe.db.sql(""" UPDATE `tabWorkstation`
SET production_capacity = 1 """)
SET production_capacity = 1 """)

View File

@@ -4,4 +4,4 @@ import frappe
def execute():
frappe.db.sql(""" UPDATE `tabQuotation` set status = 'Open'
where docstatus = 1 and status = 'Submitted' """)
where docstatus = 1 and status = 'Submitted' """)

View File

@@ -8,4 +8,4 @@ import frappe
def execute():
frappe.reload_doc("stock", "doctype", "pick_list")
frappe.db.sql("""UPDATE `tabPick List` set purpose = 'Delivery'
WHERE docstatus = 1 and purpose = 'Delivery against Sales Order' """)
WHERE docstatus = 1 and purpose = 'Delivery against Sales Order' """)

View File

@@ -14,9 +14,9 @@ def execute():
'Sales Invoice': [
dict(fieldname='irn', label='IRN', fieldtype='Data', read_only=1, insert_after='customer', no_copy=1, print_hide=1,
depends_on='eval:in_list(["Registered Regular", "SEZ", "Overseas", "Deemed Export"], doc.gst_category) && doc.irn_cancelled === 0'),
dict(fieldname='ack_no', label='Ack. No.', fieldtype='Data', read_only=1, hidden=1, insert_after='irn', no_copy=1, print_hide=1),
dict(fieldname='ack_date', label='Ack. Date', fieldtype='Data', read_only=1, hidden=1, insert_after='ack_no', no_copy=1, print_hide=1),
dict(fieldname='irn_cancelled', label='IRN Cancelled', fieldtype='Check', no_copy=1, print_hide=1,

View File

@@ -49,4 +49,4 @@ def add_gst_hsn_code_field():
`tabStock Entry Detail`.gst_hsn_code = `tabItem`.gst_hsn_code
Where
`tabItem`.name = `tabStock Entry Detail`.item_code and `tabItem`.gst_hsn_code is not null
""")
""")

View File

@@ -10,4 +10,4 @@ def execute():
WHERE doc_type in ('Sales Invoice', 'Purchase Invoice', 'Payment Entry')
AND field_name = 'cost_center'
AND property = 'hidden'
""")
""")

View File

@@ -4,4 +4,4 @@ def execute():
job = frappe.db.exists('Scheduled Job Type', 'patient_appointment.send_appointment_reminder')
if job:
method = 'erpnext.healthcare.doctype.patient_appointment.patient_appointment.send_appointment_reminder'
frappe.db.set_value('Scheduled Job Type', job, 'method', method)
frappe.db.set_value('Scheduled Job Type', job, 'method', method)

View File

@@ -16,4 +16,4 @@ def execute():
WHERE
child_doc.item_code = item.name and child_doc.docstatus < 2
and item.default_bom is not null and item.default_bom != '' {cond}
""".format(doc = doctype, cond = condition))
""".format(doc = doctype, cond = condition))

View File

@@ -21,4 +21,4 @@ def execute():
elif end_date >= today_date:
doc.db_set("status", "In Progress")
elif end_date < today_date:
doc.db_set("status", "Completed")
doc.db_set("status", "Completed")

View File

@@ -25,4 +25,4 @@ def execute():
'translatable': 0
})
ewaybill_field.save()
ewaybill_field.save()

View File

@@ -16,4 +16,4 @@ def execute():
frappe.db.sql(""" UPDATE `tabPurchase Invoice` set gst_category = 'Unregistered'
where gst_category = 'Registered Regular'
and ifnull(supplier_gstin, '')=''
""")
""")

View File

@@ -134,4 +134,4 @@ def execute():
status = (CASE WHEN visited >= max_visits THEN 'Completed'
ELSE 'Pending'
END)
""")
""")

View File

@@ -12,4 +12,4 @@ def execute():
frappe.reload_doc("stock", "doctype", "stock_ledger_entry")
frappe.reload_doc("stock", "doctype", "serial_no")
except:
pass
pass

View File

@@ -10,4 +10,4 @@ def execute():
for tax in doc.taxes:
doc.company = frappe.get_value('Account', tax.tax_type, 'company')
break
doc.save()
doc.save()

View File

@@ -14,4 +14,4 @@ def execute():
SET owner = 'Administrator'
WHERE fieldname = %s
AND dt IN (%s)""" % #nosec
('%s', ', '.join(['%s']* len(doclist))), tuple([dimension.fieldname] + doclist))
('%s', ', '.join(['%s']* len(doclist))), tuple([dimension.fieldname] + doclist))

View File

@@ -28,4 +28,4 @@ def execute():
plc_conversion_rate = get_exchange_rate(d.currency,
d.company_currency, getdate(d.creation), "for_buying")
frappe.db.set_value("BOM", d.name, "plc_conversion_rate", plc_conversion_rate)
frappe.db.set_value("BOM", d.name, "plc_conversion_rate", plc_conversion_rate)

View File

@@ -19,4 +19,4 @@ def execute():
gst_state = 'Dadra and Nagar Haveli and Daman and Diu',
gst_state_number = 26
WHERE gst_state = 'Daman and Diu'
""")
""")

View File

@@ -8,4 +8,4 @@ def execute():
frappe.reload_doc("setup", "doctype", "UOM")
frappe.reload_doc("stock", "doctype", "UOM Category")
add_uom_data()
add_uom_data()