mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 13:39:18 +00:00
refactor(treewide): formatting and ruff fixes, + manually enabled F401
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import cstr, getdate
|
||||
|
||||
|
||||
|
||||
@@ -30,9 +30,7 @@ def set_default_settings(args):
|
||||
stock_settings = frappe.get_doc("Stock Settings")
|
||||
stock_settings.item_naming_by = "Item Code"
|
||||
stock_settings.valuation_method = "FIFO"
|
||||
stock_settings.default_warehouse = frappe.db.get_value(
|
||||
"Warehouse", {"warehouse_name": _("Stores")}
|
||||
)
|
||||
stock_settings.default_warehouse = frappe.db.get_value("Warehouse", {"warehouse_name": _("Stores")})
|
||||
stock_settings.stock_uom = "Nos"
|
||||
stock_settings.auto_indent = 1
|
||||
stock_settings.auto_insert_price_list_rate_if_missing = 1
|
||||
|
||||
@@ -276,9 +276,7 @@ def install(country=None):
|
||||
records += [{"doctype": doctype, title_field: title} for title in read_lines(filename)]
|
||||
|
||||
base_path = frappe.get_app_path("erpnext", "stock", "doctype")
|
||||
response = frappe.read_file(
|
||||
os.path.join(base_path, "delivery_trip/dispatch_notification_template.html")
|
||||
)
|
||||
response = frappe.read_file(os.path.join(base_path, "delivery_trip/dispatch_notification_template.html"))
|
||||
|
||||
records += [
|
||||
{
|
||||
@@ -471,9 +469,8 @@ def update_stock_settings():
|
||||
stock_settings = frappe.get_doc("Stock Settings")
|
||||
stock_settings.item_naming_by = "Item Code"
|
||||
stock_settings.valuation_method = "FIFO"
|
||||
stock_settings.default_warehouse = frappe.db.get_value(
|
||||
"Warehouse", {"warehouse_name": _("Stores")}
|
||||
)
|
||||
stock_settings.default_warehouse = frappe.db.get_value("Warehouse", {"warehouse_name": _("Stores")})
|
||||
stock_settings.stock_uom = _("Nos")
|
||||
stock_settings.stock_uom = "Nos"
|
||||
stock_settings.auto_indent = 1
|
||||
stock_settings.auto_insert_price_list_rate_if_missing = 1
|
||||
|
||||
@@ -14,7 +14,7 @@ def setup_taxes_and_charges(company_name: str, country: str):
|
||||
frappe.throw(_("Company {} does not exist yet. Taxes setup aborted.").format(company_name))
|
||||
|
||||
file_path = os.path.join(os.path.dirname(__file__), "..", "data", "country_wise_tax.json")
|
||||
with open(file_path, "r") as json_file:
|
||||
with open(file_path) as json_file:
|
||||
tax_data = json.load(json_file)
|
||||
|
||||
country_wise_tax = tax_data.get(country)
|
||||
@@ -54,7 +54,12 @@ def simple_to_detailed(templates):
|
||||
{
|
||||
"title": title,
|
||||
"taxes": [
|
||||
{"tax_type": {"account_name": data.get("account_name"), "tax_rate": data.get("tax_rate")}}
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": data.get("account_name"),
|
||||
"tax_rate": data.get("tax_rate"),
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
for title, data in templates.items()
|
||||
@@ -110,9 +115,7 @@ def update_regional_tax_settings(country, company):
|
||||
path = frappe.get_app_path("erpnext", "regional", frappe.scrub(country))
|
||||
if os.path.exists(path.encode("utf-8")):
|
||||
try:
|
||||
module_name = "erpnext.regional.{0}.setup.update_regional_tax_settings".format(
|
||||
frappe.scrub(country)
|
||||
)
|
||||
module_name = f"erpnext.regional.{frappe.scrub(country)}.setup.update_regional_tax_settings"
|
||||
frappe.get_attr(module_name)(country, company)
|
||||
except (ImportError, AttributeError):
|
||||
pass
|
||||
@@ -141,7 +144,7 @@ def make_taxes_and_charges_template(company_name, doctype, template):
|
||||
|
||||
# if account_head is a dict, search or create the account and get it's name
|
||||
if isinstance(account_data, dict):
|
||||
tax_row_defaults["description"] = "{0} @ {1}".format(
|
||||
tax_row_defaults["description"] = "{} @ {}".format(
|
||||
account_data.get("account_name"), account_data.get("tax_rate")
|
||||
)
|
||||
tax_row_defaults["rate"] = account_data.get("tax_rate")
|
||||
|
||||
Reference in New Issue
Block a user