fix: incorrect type hint

This commit is contained in:
khushi8112
2026-02-20 15:20:47 +05:30
parent 7100d61f3c
commit 021aa63e24
4 changed files with 27 additions and 12 deletions

View File

@@ -3139,7 +3139,7 @@ def get_default_taxes_and_charges(
@frappe.whitelist()
def get_taxes_and_charges(master_doctype: str, master_name: str):
def get_taxes_and_charges(master_doctype: str, master_name: str | None = None):
if not master_name:
return
from frappe.model import child_table_fields, default_fields
@@ -3564,6 +3564,7 @@ def get_payment_terms(
schedule = []
for d in terms_doc.get("terms"):
d = frappe._dict(d.as_dict())
term_details = get_payment_term_details(d, posting_date, grand_total, base_grand_total, bill_date)
schedule.append(term_details)
@@ -3612,7 +3613,7 @@ def get_payment_term_details(
term_details.due_date = get_due_date(term, posting_date)
term_details.discount_date = get_discount_date(term, posting_date)
if getdate(term_details.due_date) < getdate(posting_date):
if posting_date and getdate(term_details.due_date) < getdate(posting_date):
term_details.due_date = posting_date
return term_details

View File

@@ -27,7 +27,7 @@ def employee_query(
searchfield: str,
start: int,
page_len: int,
filters: dict,
filters: dict | str | None = None,
reference_doctype: str | None = None,
ignore_user_permissions: bool = False,
):
@@ -91,7 +91,9 @@ def has_ignored_field(reference_doctype, doctype):
# searches for leads which are not converted
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def lead_query(doctype: str, txt: str, searchfield: str, start: int, page_len: int, filters: dict):
def lead_query(
doctype: str, txt: str, searchfield: str, start: int, page_len: int, filters: dict | None = None
):
doctype = "Lead"
fields = get_fields(doctype, ["name", "lead_name", "company_name"])
@@ -175,7 +177,13 @@ def tax_account_query(doctype: str, txt: str, searchfield: str, start: int, page
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def item_query(
doctype: str, txt: str, searchfield: str, start: int, page_len: int, filters: dict, as_dict: bool = False
doctype: str,
txt: str,
searchfield: str,
start: int,
page_len: int,
filters: dict | str | None = None,
as_dict: bool = False,
):
doctype = "Item"
conditions = []
@@ -282,7 +290,9 @@ def item_query(
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def bom(doctype: str, txt: str, searchfield: str, start: int, page_len: int, filters: dict):
def bom(
doctype: str, txt: str, searchfield: str, start: int, page_len: int, filters: dict | str | None = None
):
doctype = "BOM"
conditions = []
fields = get_fields(doctype, ["name", "item"])
@@ -314,7 +324,9 @@ def bom(doctype: str, txt: str, searchfield: str, start: int, page_len: int, fil
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_project_name(doctype: str, txt: str, searchfield: str, start: int, page_len: int, filters: dict):
def get_project_name(
doctype: str, txt: str, searchfield: str, start: int, page_len: int, filters: dict | None = None
):
proj = qb.DocType("Project")
qb_filter_and_conditions = []
qb_filter_or_conditions = []
@@ -563,7 +575,9 @@ def get_batches_from_serial_and_batch_bundle(searchfields, txt, filters, start=0
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def get_account_list(doctype: str, txt: str, searchfield: str, start: int, page_len: int, filters: dict):
def get_account_list(
doctype: str, txt: str, searchfield: str, start: int, page_len: int, filters: dict | list
):
doctype = "Account"
filter_list = []
@@ -740,7 +754,7 @@ def get_expense_account(doctype: str, txt: str, searchfield: str, start: int, pa
@frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs
def warehouse_query(doctype: str, txt: str, searchfield: str, start: int, page_len: int, filters: dict):
def warehouse_query(doctype: str, txt: str, searchfield: str, start: int, page_len: int, filters: list):
# Should be used when item code is passed in filters.
doctype = "Warehouse"
conditions, bin_conditions = [], []

View File

@@ -2087,7 +2087,7 @@ def check_item_quality_inspection(doctype: str, items: str | list[dict]):
@frappe.whitelist()
def make_quality_inspections(doctype: str, docname: str, items: str | list[dict], inspection_type: str):
def make_quality_inspections(doctype: str, docname: str, items: str | list, inspection_type: str):
if isinstance(items, str):
items = json.loads(items)

View File

@@ -1369,7 +1369,7 @@ def get_pending_subcontracted_quantity(doctype, name):
@frappe.whitelist()
def make_rm_stock_entry(
subcontract_order: str,
rm_items: str | list[dict],
rm_items: str | list | None = None,
order_doctype: str = "Subcontracting Order",
target_doc: dict | None = None,
):
@@ -1559,7 +1559,7 @@ def make_return_stock_entry_for_subcontract(
@frappe.whitelist()
def get_materials_from_supplier(
subcontract_order: str, rm_details: str | list[dict], order_doctype: str = "Subcontracting Order"
subcontract_order: str, rm_details: str | list, order_doctype: str = "Subcontracting Order"
):
if isinstance(rm_details, str):
rm_details = json.loads(rm_details)