Skip to content

fix: order and time of operations in multilevel BOM work order - #25886

Merged
marination merged 3 commits into
frappe:version-13-hotfixfrom
ankush:work_order_flat_ops
Jun 25, 2021
Merged

fix: order and time of operations in multilevel BOM work order#25886
marination merged 3 commits into
frappe:version-13-hotfixfrom
ankush:work_order_flat_ops

Conversation

@ankush

@ankush ankush commented May 30, 2021

Copy link
Copy Markdown
Member

Problem: When multilevel BOM is ticked, work order tries to fetch all operations in single query and sorts by idx which gives meaningless ordering.

Solution: order by level (reversed) i.e. in a tree representation bottom-most BOM operations are listed first.

Before (meaningless ordering, wrong index, operations time not considering exploded qty):
Screenshot 2021-06-11 at 2 49 04 PM

After (Order of operations = reverse level order traversal, operations time considering exploded qty):
Screenshot 2021-06-11 at 2 49 51 PM

Also added __repr__ for BOMTree that shows complete BOM like this:
Screenshot 2021-06-11 at 2 25 28 PM

TODO:

  • Get BOM as easily parsable tree structure. (recursive dict)
  • Fix orders of operations in Work Order
  • bug with item level ops not getting added to list
  • Better tree repr of BOM
  • Correct operation time for multilevel BOM
  • tests (redo for changes)

WARNING: Ideally, this ordering should not be relied upon and a separate work order should be made for each subassembly. You lose the benefit of parallel traceability and there could be duplication if there's a BOM that's part of two different nodes in the BOM tree. This change is for sake of correctness.

@ankush
ankush force-pushed the work_order_flat_ops branch 4 times, most recently from 9e3e119 to 9565302 Compare May 31, 2021 17:13
@ankush
ankush marked this pull request as ready for review May 31, 2021 17:14
@marination marination self-assigned this Jun 2, 2021
@ankush
ankush marked this pull request as draft June 10, 2021 06:53
@ankush
ankush force-pushed the work_order_flat_ops branch 5 times, most recently from cd75eac to ad2464c Compare June 11, 2021 07:38
@ankush ankush changed the title fix: order of operations in multilevel BOM work order fix: order and time of operations in multilevel BOM work order Jun 11, 2021
@ankush
ankush force-pushed the work_order_flat_ops branch 2 times, most recently from f4e2371 to 68c22b0 Compare June 11, 2021 09:16
@ankush
ankush marked this pull request as ready for review June 11, 2021 09:17
@ankush
ankush force-pushed the work_order_flat_ops branch 2 times, most recently from 1998fa0 to 0cb5723 Compare June 12, 2021 13:19
@marination

Copy link
Copy Markdown
Contributor

@ankush failing test test_pending_and_transferred_qty fixed #26043

@ankush
ankush force-pushed the work_order_flat_ops branch from 0cb5723 to 4a2881e Compare June 14, 2021 11:54
@ankush

ankush commented Jun 14, 2021

Copy link
Copy Markdown
Member Author

@marination rebased branch 👍

@ankush ankush added the backport develop instructs mergify to frontport PR to develop branch label Jun 21, 2021
ankush added 3 commits June 25, 2021 14:43
form_grid_template doesn't exist
- Order of operations was being sorted by idx of individual operations in
BOM table, which made the ordering useless.
- This adds ordering that's sorted from lowest level item to top level
item.
- chore: remove dead functionality. There's no `items` table. Required
  item level operations get overwritten on fetching of items /
  operations e.g. when clicking on multi-level BOM checkbox.
- test: add test for tree representation
- feat: BOMTree class to get complete representation of a tree
@ankush
ankush force-pushed the work_order_flat_ops branch from 4a2881e to 9e43445 Compare June 25, 2021 09:15
@marination
marination merged commit 5474c09 into frappe:version-13-hotfix Jun 25, 2021
@ankush ankush removed the backport develop instructs mergify to frontport PR to develop branch label Jun 25, 2021
@frappe frappe locked as resolved and limited conversation to collaborators Mar 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants