mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 23:52:57 +00:00
📝 Add docstrings to fix/warehouse-source-reference
Docstrings generation was requested by @matteoarosti. * https://github.com/frappe/erpnext/pull/50058#issuecomment-3399282664 The following files were modified: * `erpnext/manufacturing/report/production_planning_report/production_planning_report.py`
This commit is contained in:
committed by
GitHub
parent
6cacead726
commit
b7ae191478
@@ -31,6 +31,16 @@ class ProductionPlanReport:
|
|||||||
return self.columns, self.data
|
return self.columns, self.data
|
||||||
|
|
||||||
def get_open_orders(self):
|
def get_open_orders(self):
|
||||||
|
"""
|
||||||
|
Load open orders into self.orders according to the report filters.
|
||||||
|
|
||||||
|
Builds and executes a query determined by self.filters.based_on and self.filters.order_by:
|
||||||
|
- For "Work Order": selects production fields for active work orders and optionally orders by planned start date or filters by docnames.
|
||||||
|
- For other doctypes: joins with the corresponding "<Doctype> Item" child table to select BOM/item-based production lines; includes special handling for "Sales Order" (filters undelivered/open orders, optional ordering by delivery date or total amount) and "Material Request" (filters manufacture-type requests with outstanding quantity, optional ordering by required date).
|
||||||
|
The query always restricts to submitted documents (docstatus == 1) and applies a company filter when provided.
|
||||||
|
|
||||||
|
After execution, assigns the query result (list of dicts) to self.orders.
|
||||||
|
"""
|
||||||
doctype, order_by = self.filters.based_on, self.filters.order_by
|
doctype, order_by = self.filters.based_on, self.filters.order_by
|
||||||
|
|
||||||
parent = frappe.qb.DocType(doctype)
|
parent = frappe.qb.DocType(doctype)
|
||||||
@@ -113,6 +123,13 @@ class ProductionPlanReport:
|
|||||||
self.orders = query.run(as_dict=True)
|
self.orders = query.run(as_dict=True)
|
||||||
|
|
||||||
def get_raw_materials(self):
|
def get_raw_materials(self):
|
||||||
|
"""Retrieve raw materials and source warehouses for production orders.
|
||||||
|
|
||||||
|
This method collects BOM or Work Order items depending on the selected
|
||||||
|
filter and updates `self.raw_materials_dict`, `self.warehouses`,
|
||||||
|
and `self.item_codes` accordingly.
|
||||||
|
"""
|
||||||
|
|
||||||
if not self.orders:
|
if not self.orders:
|
||||||
return
|
return
|
||||||
self.warehouses = [d.warehouse for d in self.orders]
|
self.warehouses = [d.warehouse for d in self.orders]
|
||||||
@@ -135,7 +152,7 @@ class ProductionPlanReport:
|
|||||||
)
|
)
|
||||||
or []
|
or []
|
||||||
)
|
)
|
||||||
self.warehouses.extend([d.source_warehouse for d in raw_materials])
|
self.warehouses.extend([d.warehouse for d in raw_materials])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
bom_nos = []
|
bom_nos = []
|
||||||
|
|||||||
Reference in New Issue
Block a user