refactor(treewide): formatting and ruff fixes, + manually enabled F401

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang
2024-03-27 11:37:26 +05:30
parent c28d19cf7f
commit 4d34b1ead7
618 changed files with 4188 additions and 6384 deletions

View File

@@ -57,9 +57,7 @@ def get_web_item_qty_in_stock(item_code, item_warehouse_field, warehouse=None):
in_stock = int(total_stock > 0)
return frappe._dict(
{"in_stock": in_stock, "stock_qty": total_stock, "is_stock_item": is_stock_item}
)
return frappe._dict({"in_stock": in_stock, "stock_qty": total_stock, "is_stock_item": is_stock_item})
def adjust_qty_for_expired_items(item_code, stock_qty, warehouse):
@@ -150,7 +148,9 @@ def get_price(item_code, price_list, customer_group, company, qty=1):
if pricing_rule.pricing_rule_for == "Rate":
rate_discount = flt(mrp) - flt(pricing_rule.price_list_rate)
if rate_discount > 0:
price_obj.formatted_discount_rate = fmt_money(rate_discount, currency=price_obj["currency"])
price_obj.formatted_discount_rate = fmt_money(
rate_discount, currency=price_obj["currency"]
)
price_obj.price_list_rate = pricing_rule.price_list_rate or 0
if price_obj:
@@ -198,9 +198,7 @@ def get_non_stock_item_status(item_code, item_warehouse_field):
# if item is a product bundle, check if its bundle items are in stock
if frappe.db.exists("Product Bundle", item_code):
items = frappe.get_doc("Product Bundle", item_code).get_all_children()
bundle_warehouse = frappe.db.get_value(
"Website Item", {"item_code": item_code}, item_warehouse_field
)
bundle_warehouse = frappe.db.get_value("Website Item", {"item_code": item_code}, item_warehouse_field)
return all(
get_web_item_qty_in_stock(d.item_code, item_warehouse_field, bundle_warehouse).in_stock
for d in items