Skip to content

feat: allow re-routing after scan input#246

Merged
Alchez merged 3 commits intomobile_v15from
mobile_v15_scan_reroute
Jan 28, 2025
Merged

feat: allow re-routing after scan input#246
Alchez merged 3 commits intomobile_v15from
mobile_v15_scan_reroute

Conversation

@Alchez
Copy link
Copy Markdown
Collaborator

@Alchez Alchez commented Jan 24, 2025

Feature changes:

  • Add API for routing after scan input in existing Beam hook
    • I've added an additional route key in the hook definition that will leave the responsibility of defining the target route to the app itself, considering they have the context on the built routes.
    • @agritheory Currently the hook is setup to combine route actions across multiple apps, but ultimately they need to resolve to a single target route. Currently the client receives a list of route actions back and I'm picking the first hook in that list, but I'm not sure if it should instead be a single object that's updated by every app?

Additional changes:

  • Update Stonecrop dependencies to latest
  • Update test setup to exclude account numbers from account name
  • @agritheory it seems like creating production plans is failing during test setup (on frappe 15.53.0 and erpnext 15.49.3). I'm not sure how to fix it, but here's the traceback:
Traceback
Traceback (most recent call last):
  File "/frappe/frappe/commands/utils.py", line 269, in execute
    ret = frappe.get_attr(method)(*args, **kwargs)
  File "/beam/beam/tests/setup.py", line 59, in before_test
    create_test_data()
  File "/beam/beam/tests/setup.py", line 106, in create_test_data
    create_production_plan(settings, prod_plan_from_doc)
  File "/beam/beam/tests/setup.py", line 613, in create_production_plan
    raw_materials = get_items_for_material_requests(
  File "/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "/erpnext/erpnext/manufacturing/doctype/production_plan/production_plan.py", line 1513, in get_items_for_material_requests
    frappe.throw(
  File "/frappe/frappe/__init__.py", line 603, in throw
    msgprint(
  File "/frappe/frappe/__init__.py", line 568, in msgprint
    _raise_exception()
  File "/frappe/frappe/__init__.py", line 519, in _raise_exception
    raise exc
frappe.exceptions.ValidationError: Items to Manufacture are required to pull the Raw Materials associated with it.

@Alchez Alchez requested a review from agritheory January 24, 2025 08:37
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 24, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
__init__.py10100% 
beam
   barcodes.py311358%18, 27, 29, 32, 43–44, 46–47, 52–54, 58–59
   handling_unit.py813754%25, 31, 63–65, 83, 94–95, 101–102, 104–105, 107–108, 110–111, 113, 115–118, 120–122, 124, 126, 128–129, 134, 136, 140, 142–143, 146, 148–149, 157
   printing.py61610%4–6, 8, 11–12, 15–16, 18–21, 24–25, 34–45, 47–54, 58–59, 61–62, 71–75, 78–79, 85–87, 90–91, 94–95, 97–99, 101–102, 104, 109, 111–112
beam/demand
   demand.py3227776%51, 66, 123, 209, 243, 290, 293, 425–426, 428–429, 432–433, 435, 439–444, 446, 448–449, 452, 457, 459–464, 466, 468, 471, 474, 479, 483–485, 490–491, 493, 495–497, 499, 505, 507–510, 512–515, 517, 519, 522–523, 525–526, 529, 543, 560–561, 563–565, 621, 625, 662, 667, 674, 695–696, 708, 837
   receiving.py111496%79, 131, 173, 214
   sqlite.py59198%40
   utils.py59788%56, 67, 72–75, 83
beam/doctype/beam_mobile_route
   beam_mobile_route.py30100% 
beam/doctype/beam_settings
   beam_settings.py281739%31–33, 36–37, 39, 46, 51–54, 62–64, 68–70
beam/doctype/handling_unit
   __init__.py9366%12–14
   handling_unit.py150100% 
beam/doctype/warehouse_types
   warehouse_types.py30100% 
beam/overrides
   sales_order.py10640%11–16
   stock_entry.py671774%61–62, 67–74, 80–81, 97, 112, 129, 132–133
   work_order.py10280%14, 16
beam/report/demand_map
   demand_map.py35350%4–5, 7–8, 11–12, 15–16, 103–111, 127, 129–143, 146–147
beam/report/handling_unit_traceability
   handling_unit_traceability.py44440%4–6, 9–11, 30–32, 34–35, 37–38, 41–42, 45–46, 48–49, 51–52, 54–55, 57, 63–65, 67–69, 71, 74–77, 79–81, 83–86, 89–90
beam/scan
   __init__.py1322283%21, 25, 30, 38, 70, 117–118, 128, 130–131, 135, 139–140, 143, 154–155, 159, 180, 209, 211, 229, 232
   config.py26260%4, 6, 9–17, 19–21, 23–26, 28–30, 32–35, 37
www/beam
   __init__.py14140%4–7, 10–19
   index.py770%4, 6, 9–13
TOTAL112839365% 

@agritheory
Copy link
Copy Markdown
Owner

Currently the hook is setup to combine route actions across multiple apps, but ultimately they need to resolve to a single target route. Currently the client receives a list of route actions back and I'm picking the first hook in that list, but I'm not sure if it should instead be a single object that's updated by every app?

Yes, this needs to be refactored (in both the app context and the mobile context) - I've had that comment in there for more than a year now, let's fix it.

@agritheory
Copy link
Copy Markdown
Owner

agritheory commented Jan 24, 2025

No issues with multiple reinstalls on this branch

erpnext 15.49.3
frappe 15.53.0
hrms 15.38.2

Comment thread beam/www/beam/stores/scan.ts Outdated
@Alchez Alchez marked this pull request as ready for review January 28, 2025 06:39
@Alchez Alchez merged commit a8c630c into mobile_v15 Jan 28, 2025
@Alchez Alchez deleted the mobile_v15_scan_reroute branch January 28, 2025 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants