Skip to content

[mobile] Add photo#295

Open
lauty95 wants to merge 31 commits into
mobile_v15from
issue-175-photo
Open

[mobile] Add photo#295
lauty95 wants to merge 31 commits into
mobile_v15from
issue-175-photo

Conversation

@lauty95

@lauty95 lauty95 commented Nov 17, 2025

Copy link
Copy Markdown
Collaborator

Resolves

#175

Dependencies

No external library was used. This implementation uses the native navigator.mediaDevices.getUserMedia API.

How to test

To access the device camera, the app must be served over HTTPS. For this reason, I used ngrok like here #294

Demo

Screen_Recording_20251117_100803_Chrome.mp4
Screen.Recording.2025-11-17.at.10.08.47.AM.mov

@lauty95 lauty95 requested a review from agritheory November 17, 2025 13:17
@lauty95 lauty95 self-assigned this Nov 17, 2025
@github-actions

github-actions Bot commented Nov 17, 2025

Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
__init__.py10100% 
beam
   barcodes.py1073963%21, 30, 36–37, 43, 46, 58, 80–81, 83–84, 90–92, 94–96, 103–105, 111, 121, 129, 136, 139–140, 146–147, 153, 159, 165, 171, 183, 186–189, 191–192
   handling_unit.py813655%32, 64–66, 84, 95–96, 102–103, 105–106, 108–109, 111–112, 114, 116–119, 121–123, 125, 127, 129–130, 135, 137, 141, 143–144, 147, 149–150, 158
   printing.py935540%18–19, 48, 50–53, 62–66, 70–71, 83–87, 91, 97, 106–112, 114–115, 117, 122, 124–125, 140–145, 147–153, 160–163, 165–168
   zpl_layout.py2442440%12–15, 17, 20, 36, 47–48, 51–52, 54–55, 58, 61, 64–67, 69–71, 77, 81–83, 86–87, 90–91, 93–94, 99, 101, 110–111, 113, 115, 118–120, 122–125, 128–129, 132, 140–141, 144–146, 154, 157, 161, 164, 167, 177–183, 185, 188, 193–196, 198, 201–206, 209–215, 217, 219, 222, 224–227, 231–233, 235–239, 241–245, 249–253, 258, 260, 263–269, 278–282, 285–292, 295–308, 311–313, 316–328, 331, 334–336, 339–353, 356–361, 364, 366, 369, 384, 386–387, 390–391, 393, 395, 397–399, 402, 411, 418–420, 423–424, 427, 429–433, 436, 439–442, 445–448, 451–453, 469, 471, 474–475, 496–501, 505, 507–508, 516–521
beam/demand
   demand.py3383290%51, 66, 243, 463–464, 493, 543, 621, 625, 662, 667, 674, 695–696, 707, 713–729
   receiving.py1362184%76, 128, 151–154, 181, 222, 252, 257–268
   sqlite.py60198%41
   utils.py59689%56, 67, 73–75, 83
beam/doctype/beam_mobile_route
   beam_mobile_route.py30100% 
beam/doctype/beam_settings
   beam_settings.py341750%35–37, 40–41, 43, 50, 55–58, 66–68, 72–74
beam/doctype/handling_unit
   __init__.py9366%12–14
   handling_unit.py17194%27
beam/doctype/warehouse_types
   warehouse_types.py30100% 
beam/overrides
   network_printer_settings.py403220%14–18, 24–34, 42–46, 49, 52–55, 57–62
   sales_order.py10640%11–16
   stock_entry.py911682%115–116, 121–128, 134–135, 151, 183, 186–187
   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__.py1912785%24, 34, 161–162, 172, 174–175, 179, 183–184, 187, 193, 204–205, 209, 230, 234, 263, 265, 284–285, 291, 294, 297, 406, 414, 421
   config.py28280%4, 6, 9–17, 19–21, 23–26, 28–30, 32–35, 38–39, 41
   user_login.py31310%4–6, 8, 11–13, 17–19, 21–22, 24–25, 27–29, 31–33, 35–38, 40–45, 47
www/beam
   __init__.py14140%4–7, 10–19
   index.py770%4, 6, 9–13
TOTAL168669758% 

@agritheory

Copy link
Copy Markdown
Owner

@lauty95 Nice! Let's add a very basic test.

@lauty95

lauty95 commented Dec 10, 2025

Copy link
Copy Markdown
Collaborator Author

@agritheory

I added the following tests:

  • test_camera.py
    • test_camera_button_visible
      Mocks a camera, so the button should be visible
    • test_camera_component_hidden_without_support
      Mocks no camera support, so the component should not be rendered
    • test_camera_opens_and_closes
      Tests the button actions: open should render the camera video, and close should hide the camera
  • test_attach_file.py
    • test_upload_photo_to_purchase_receipt
      Tests the complete workflow: navigates to a receive item, takes a photo, scans a barcode to add an item, saves the Purchase Receipt, and verifies (using Frappe) that the photo is attached to the created document.
      This test was funny, the photo that Playwright takes is a complete blue canvas haha.
Screenshot 2025-12-10 at 11 54 33 AM Screenshot 2025-12-10 at 11 54 29 AM

@lauty95

lauty95 commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator Author

@agritheory

I added the setup_beam_mobile_user_permissions() function in install.py. This grants the required permissions for the BEAM Mobile User role and prevents some 403 errors we were seeing.

issue

@lauty95

lauty95 commented Feb 12, 2026

Copy link
Copy Markdown
Collaborator Author

@agritheory
this is ready!

@lauty95 lauty95 linked an issue Jun 9, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Draft Changelog Entry

Changelog Entry

The mobile app now includes camera functionality that allows photos to be captured directly from the device and attached to purchase receipts. The camera feature uses the device's native camera capabilities and requires user permission to access the camera. Photos can be submitted or discarded after capture, with the app redirecting to the appropriate screen after submission. The implementation includes comprehensive testing for camera operations and photo attachment workflows.

This changelog entry was automatically generated by the Changelog Generator Action.

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.

[mobile] Add photo / scan process of receiving document

2 participants