mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 09:54:47 +00:00
refactor(treewide): formatting and ruff fixes, + manually enabled F401
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
@@ -36,9 +36,7 @@ def get_context(context):
|
||||
context.available_loyalty_points = 0.0
|
||||
if context.doc.get("customer"):
|
||||
# check for the loyalty program of the customer
|
||||
customer_loyalty_program = frappe.db.get_value(
|
||||
"Customer", context.doc.customer, "loyalty_program"
|
||||
)
|
||||
customer_loyalty_program = frappe.db.get_value("Customer", context.doc.customer, "loyalty_program")
|
||||
|
||||
if customer_loyalty_program:
|
||||
from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
|
||||
@@ -67,9 +65,12 @@ def get_attachments(dt, dn):
|
||||
|
||||
def get_payment_details(doc):
|
||||
show_pay_button, amount = (
|
||||
"payments" in frappe.get_installed_apps()
|
||||
and frappe.db.get_single_value("Buying Settings", "show_pay_button")
|
||||
), 0
|
||||
(
|
||||
"payments" in frappe.get_installed_apps()
|
||||
and frappe.db.get_single_value("Buying Settings", "show_pay_button")
|
||||
),
|
||||
0,
|
||||
)
|
||||
if not show_pay_button:
|
||||
return show_pay_button, amount
|
||||
amount = get_amount(doc)
|
||||
|
||||
@@ -12,9 +12,7 @@ def get_context(context):
|
||||
["user", "view_attachments"],
|
||||
as_dict=True,
|
||||
)
|
||||
if frappe.session.user != "Administrator" and (
|
||||
not project_user or frappe.session.user == "Guest"
|
||||
):
|
||||
if frappe.session.user != "Administrator" and (not project_user or frappe.session.user == "Guest"):
|
||||
raise frappe.PermissionError
|
||||
|
||||
context.no_cache = 1
|
||||
@@ -38,7 +36,7 @@ def get_context(context):
|
||||
def get_tasks(project, start=0, search=None, item_status=None):
|
||||
filters = {"project": project}
|
||||
if search:
|
||||
filters["subject"] = ("like", "%{0}%".format(search))
|
||||
filters["subject"] = ("like", f"%{search}%")
|
||||
tasks = frappe.get_all(
|
||||
"Task",
|
||||
filters=filters,
|
||||
@@ -83,7 +81,7 @@ def get_task_html(project, start=0, item_status=None):
|
||||
def get_timesheets(project, start=0, search=None):
|
||||
filters = {"project": project}
|
||||
if search:
|
||||
filters["activity_type"] = ("like", "%{0}%".format(search))
|
||||
filters["activity_type"] = ("like", f"%{search}%")
|
||||
|
||||
timesheets = frappe.get_all(
|
||||
"Timesheet Detail",
|
||||
|
||||
@@ -23,9 +23,7 @@ def get_context(context):
|
||||
|
||||
def get_supplier():
|
||||
doctype = frappe.form_dict.doctype
|
||||
parties_doctype = (
|
||||
"Request for Quotation Supplier" if doctype == "Request for Quotation" else doctype
|
||||
)
|
||||
parties_doctype = "Request for Quotation Supplier" if doctype == "Request for Quotation" else doctype
|
||||
customers, suppliers = get_customers_suppliers(parties_doctype, frappe.session.user)
|
||||
|
||||
return suppliers[0] if suppliers else ""
|
||||
@@ -44,7 +42,7 @@ def check_supplier_has_docname_access(supplier):
|
||||
|
||||
def unauthorized_user(supplier):
|
||||
status = check_supplier_has_docname_access(supplier) or False
|
||||
if status == False:
|
||||
if status is False:
|
||||
frappe.throw(_("Not Permitted"), frappe.PermissionError)
|
||||
|
||||
|
||||
@@ -53,9 +51,7 @@ def update_supplier_details(context):
|
||||
context.doc.currency = supplier_doc.default_currency or frappe.get_cached_value(
|
||||
"Company", context.doc.company, "default_currency"
|
||||
)
|
||||
context.doc.currency_symbol = frappe.db.get_value(
|
||||
"Currency", context.doc.currency, "symbol", cache=True
|
||||
)
|
||||
context.doc.currency_symbol = frappe.db.get_value("Currency", context.doc.currency, "symbol", cache=True)
|
||||
context.doc.number_format = frappe.db.get_value(
|
||||
"Currency", context.doc.currency, "number_format", cache=True
|
||||
)
|
||||
|
||||
@@ -47,9 +47,7 @@ def get_help_results_sections(text):
|
||||
|
||||
|
||||
def get_response(api, text):
|
||||
response = requests.get(
|
||||
api.base_url + "/" + api.query_route, data={api.search_term_param_name: text}
|
||||
)
|
||||
response = requests.get(api.base_url + "/" + api.query_route, data={api.search_term_param_name: text})
|
||||
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
|
||||
Reference in New Issue
Block a user