Skip to content

Add "Fetch Locks" action on lock.vendor (plain-text listing) - #99

Merged
jesusVMayor merged 3 commits into
16.0from
feat/smartlock-list-locks
Jun 19, 2026
Merged

jesusVMayor merged 3 commits into
16.0from
feat/smartlock-list-locks

Conversation

@jesusVMayor

Copy link
Copy Markdown
Member

What

A header button "Fetch Locks" on the lock.vendor form connects to the vendor and shows its locks as plain text — name and device id, one per line — in a small transient dialog (lock.list.wizard). Lets an operator read the device ids needed to configure rooms without digging through the vendor backend.

The action always calls the same connector.list_locks() (the Odoo layer stays vendor-agnostic) and catches NotImplementedError to show a friendly UserError for vendors that don't expose a listing.

Dependency

Depends on the library PR commitsun/roomdoo-smartlocks#23, which adds list_locks() to the provider contract (default raises NotImplementedError; TESA/TTLock/Omnitec/Salto implement it). Merge that first so list_locks() exists on the lib's main.

Notes

  • New transient lock.list.wizard (vendor_id + lock_listing Text), security entry for the smartlock admin group, view + manifest wiring.
  • Module upgrades cleanly (verified with a one-shot -u on the test DB).

A header button on the vendor form connects to the vendor and shows its
locks as plain text — name and device id, one per line — in a small
transient dialog (lock.list.wizard), so an operator can read the device
ids needed to configure rooms without digging through the vendor backend.

The action calls connector.list_locks() and formats the result; the
per-vendor implementation of list_locks() (returning [{"id","name"}])
lands next in each lock library. Vendors without it get a clear
UserError instead of a traceback.
_sync_remove was updated to pass pin=self.pin to revoke_access (for
vendors that re-resolve live state), but the happy-path test still
expected the call without it. Assert the pin kwarg too.
@github-actions

github-actions Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

Diff Coverage

Diff: origin/16.0...HEAD, staged and unstaged changes

  • pms_smartlock_base/models/lock_vendor.py (100%)
  • pms_smartlock_base/wizards/lock_list_wizard.py (100%)

Summary

  • Total: 16 lines
  • Missing: 0 lines
  • Coverage: 100%

Cover the listing action that had no coverage: happy path (renders
name<TAB>id per line into the wizard), empty result placeholder, and
the NotImplementedError -> UserError path for vendors that can't list.
@jesusVMayor
jesusVMayor merged commit be76fe7 into 16.0 Jun 19, 2026
1 check passed
@jesusVMayor
jesusVMayor deleted the feat/smartlock-list-locks branch June 19, 2026 20:48
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.

1 participant