Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ repos:
additional_dependencies: ['flake8-bugbear']

- repo: https://github.com/agritheory/test_utils
rev: v1.20.2
rev: v1.20.3
hooks:
- id: update_pre_commit_config
- id: validate_frappe_project
Expand Down
15 changes: 7 additions & 8 deletions inventory_tools/inventory_tools/overrides/pick_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
from frappe.utils.data import nowdate
import numpy as np

from erpnext.stock.doctype.pick_list.pick_list import PickList
from erpnext.stock.doctype.pick_list_item.pick_list_item import PickListItem

from inventory_tools.inventory_tools.doctype.warehouse_plan.warehouse_plan import Grid_TSP


Expand Down Expand Up @@ -160,7 +157,7 @@ def optimize_route_picklist(item_whs: list, root_warehouse: str) -> list:


@frappe.whitelist()
def optimize_path(doc: PickList, strategy: str) -> list[PickListItem]:
def optimize_path(doc: str | dict, strategy: str) -> list[dict]:
"""Optimize the picklist route based on the specified strategy.

Parameters:
Expand All @@ -187,17 +184,19 @@ def optimize_path(doc: PickList, strategy: str) -> list[PickListItem]:
indicating an inconsistency in the warehouse plan.
"""
if isinstance(doc, str):
doc = frappe.get_doc("Pick List", doc).as_dict()
doc_dict: dict = frappe.get_doc("Pick List", doc).as_dict()
else:
doc_dict = doc
itemdict: dict[str, dict[str, float]] = {}
for loc in doc["locations"]:
for loc in doc_dict["locations"]:
code = loc["item_code"]
qty = loc["qty"]
if code in itemdict:
itemdict[code]["qty"] += qty
else:
itemdict[code] = {"qty": qty}
company = doc["company"]
root_warehouses = [get_root_warehouse(loc["warehouse"]) for loc in doc["locations"]]
company = doc_dict["company"]
root_warehouses = [get_root_warehouse(loc["warehouse"]) for loc in doc_dict["locations"]]

if not all(wh == root_warehouses[0] for wh in root_warehouses):
raise frappe.ValidationError("All items in pick list do not share a common warehouse plan")
Expand Down
4 changes: 2 additions & 2 deletions inventory_tools/inventory_tools/overrides/work_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def create_job_card(self):

def update_work_order_qty(self):
"""
HASH: a139cd4b5e0733c5bc08d100dd0722b5abc92ce0
HASH: 1ffd814f928a0805877b89dc76e0dd4c7eb19148
REPO: https://github.com/frappe/erpnext/
PATH: erpnext/manufacturing/doctype/work_order/work_order.py
METHOD: update_work_order_qty
Expand Down Expand Up @@ -151,7 +151,7 @@ def update_work_order_qty(self):

from erpnext.selling.doctype.sales_order.sales_order import update_produced_qty_in_so_item

if self.sales_order and self.sales_order_item:
if self.sales_order and self.sales_order_item and not self.production_plan_sub_assembly_item:
update_produced_qty_in_so_item(self.sales_order, self.sales_order_item)

if self.production_plan:
Expand Down
Loading