mirror of
https://github.com/frappe/erpnext.git
synced 2026-11-02 23:28:05 +00:00
fix(stock): add type hints to whitelisted stock read methods
This commit is contained in:
@@ -905,7 +905,7 @@ def get_requested_item_qty(sales_order):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_material_request(source_name, target_doc=None):
|
||||
def make_material_request(source_name: str, target_doc: str | dict | Document | None = None):
|
||||
requested_item_qty = get_requested_item_qty(source_name)
|
||||
|
||||
def postprocess(source, target):
|
||||
@@ -1871,7 +1871,7 @@ def make_inter_company_purchase_order(source_name, target_doc=None):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_pick_list(source_name, target_doc=None):
|
||||
def create_pick_list(source_name: str, target_doc: str | dict | Document | None = None):
|
||||
from erpnext.stock.doctype.packed_item.packed_item import is_product_bundle
|
||||
|
||||
def validate_sales_order():
|
||||
|
||||
@@ -1550,7 +1550,7 @@ def get_conversion_factor(item_code, uom):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_projected_qty(item_code, warehouse):
|
||||
def get_projected_qty(item_code: str, warehouse: str):
|
||||
# record-level read on the item, matching what get_item_details() in this file already does.
|
||||
# Nothing in the tree calls this, so there is no caller whose roles constrain the choice.
|
||||
frappe.has_permission("Item", doc=item_code, throw=True)
|
||||
@@ -1564,7 +1564,9 @@ def get_projected_qty(item_code, warehouse):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_bin_details(item_code, warehouse, company=None, include_child_warehouses=False):
|
||||
def get_bin_details(
|
||||
item_code: str, warehouse: str | None, company: str | None = None, include_child_warehouses: bool = False
|
||||
):
|
||||
# `select`, not `read`: the selling/buying rows reach this with no Item read row
|
||||
frappe.has_permission("Item", ptype="select", throw=True)
|
||||
if warehouse:
|
||||
@@ -1617,7 +1619,7 @@ def get_company_total_stock(item_code, company):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_batch_qty(batch_no, warehouse, item_code):
|
||||
def get_batch_qty(batch_no: str, warehouse: str, item_code: str):
|
||||
from erpnext.stock.doctype.batch import batch
|
||||
|
||||
erpnext.require_user_permission("Warehouse", warehouse)
|
||||
|
||||
@@ -201,7 +201,7 @@ def get_serial_nos_data(serial_nos):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_latest_stock_qty(item_code, warehouse=None):
|
||||
def get_latest_stock_qty(item_code: str, warehouse: str | None = None):
|
||||
if warehouse:
|
||||
erpnext.require_user_permission("Warehouse", warehouse)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user