Skip to content

[6788][ADD] maintenance_equipment_inventory - #8

Draft
kanda999 wants to merge 3 commits into
18.0from
18.0-add-maintnance_equipment_inventory
Draft

[6788][ADD] maintenance_equipment_inventory#8
kanda999 wants to merge 3 commits into
18.0from
18.0-add-maintnance_equipment_inventory

Conversation

@kanda999

Copy link
Copy Markdown

@smorita7749

Copy link
Copy Markdown
Contributor

Pushed f074ed1 to 18.0-add-maintnance_equipment_inventory (fixup, to be squashed).

Addresses review findings on the approval workflow and menu placement:

  • Harden the approved-record lock. APPROVED_WRITABLE_FIELDS previously included state/approved_by_id/approved_date, which let any user with write access unlock an approved record via a raw write({"state": "draft"}) and then edit it freely — bypassing both the button groups and the action-method guard. The whitelist is now limited to message_main_attachment_id (the only field the mail framework writes without our allow_approved_write context). Workflow fields change only through the action methods, which set that context.
  • Reset-to-draft permissions. A plain user can now pull a not-yet-approved (to_approve) record back to draft, while resetting an approved record stays manager-only. Implemented in both the method guard (action_reset_to_draft) and the form buttons (split into a non-restricted to_approve button and a manager-only approved button); the list-header button now relies on the method guard.
  • Menu placement. The menu was parented under maintenance.menu_m_reports, a normally-hidden "Reporting" menu, which surfaced it and produced a duplicate "Reporting" top menu. Moved to maintenance.menu_maintenance_title (next to Equipment) — inventory records are operational data entry, not a report.
  • Tests. Added regression tests: raw write cannot reset an approved record, a plain user may reset a to_approve record, and the approved-reset manager restriction.

Files:

models/maintenance_equipment_inventory_record.py      | 22 +++++++++++++-----
tests/test_maintenance_equipment_inventory_record.py  | 26 ++++++++++++++++++++++
views/maintenance_equipment_inventory_record_views.xml| 14 ++++++++----

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