Skip to content

Feat: Add PMS User settings doctype and API - #2124

Open
saranshsinhaa wants to merge 9 commits into
version-16-hotfixfrom
feat/issue-2101
Open

Feat: Add PMS User settings doctype and API#2124
saranshsinhaa wants to merge 9 commits into
version-16-hotfixfrom
feat/issue-2101

Conversation

@saranshsinhaa

@saranshsinhaa saranshsinhaa commented Sep 1, 2026

Copy link
Copy Markdown
Member

Description

  • Adds a PMS User setting doctype to keep track of the configurable settings throughout PMS for individual users
  • Adds API to get, create and update the documents for Employees
  • Adds a field as system default expanded view in Timesheet Settings doctype

Relevant Technical Choices

  • Adds a get_or_create endpoint which create a new document for an employee on the first get request and on subsequent requests simply returns the fields
  • Added a update endpoint which update the fields for that employee

Checklist

  • I have carefully reviewed the code before submitting it for review.
  • This code is adequately covered by unit tests to validate its functionality.
  • I have conducted thorough testing to ensure it functions as intended.
  • A member of the QA team has reviewed and tested this PR (To be checked by QA or code reviewer)

Part of: #2101 , #1776

Required for: #2125

@saranshsinhaa saranshsinhaa self-assigned this Sep 1, 2026
Copilot AI balanced review requested due to automatic review settings September 1, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds per-user PMS settings storage and APIs for retrieving and updating employee preferences.

Changes:

  • Introduces the PMS User Setting DocType.
  • Adds get-or-create and update endpoints with input validation.
  • Adds placeholder controller and integration-test files.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pms_user_setting/__init__.py Initializes the DocType package.
pms_user_setting/pms_user_setting.json Defines fields and permissions.
pms_user_setting/pms_user_setting.py Implements settings APIs and validation.
pms_user_setting/pms_user_setting.js Adds the generated client controller scaffold.
pms_user_setting/test_pms_user_setting.py Adds an empty integration-test scaffold.
Suppressed comments (1)

next_pms/next_pms/doctype/pms_user_setting/pms_user_setting.json:23

  • read_only only protects the Desk UI; it does not make this identity field immutable on the server. Because Employees have owner-scoped write access at permlevel 0, an owner can update user through the generic resource API and reserve another user's unique value, causing that user's get-or-create flow to fail. Protect user with a higher permlevel granted only to System Manager, or reject changes to it in the controller.
   "read_only": 1,
   "reqd": 1,
   "unique": 1

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread next_pms/next_pms/doctype/pms_user_setting/pms_user_setting.json Outdated
Comment thread next_pms/next_pms/doctype/pms_user_setting/pms_user_setting.py Outdated
Comment thread next_pms/next_pms/doctype/pms_user_setting/test_pms_user_setting.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Suppressed comments (1)

next_pms/next_pms/doctype/pms_user_setting/test_pms_user_setting.py:20

  • This test class is empty despite introducing stateful GET/POST endpoints with permission checks, first-read creation, fallback behavior, and input validation. Add integration tests for those paths, including unauthorized users and rejected negative/non-integer or unsupported values, so regressions in per-user isolation are detected.
    pass

Comment thread next_pms/next_pms/doctype/pms_user_setting/pms_user_setting.py
Comment thread next_pms/next_pms/doctype/pms_user_setting/pms_user_setting.json Outdated
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