Repository navigation
Conversation
…ad-only
Each employee gets a folder on an external file system (fs_folder, e.g. a
Google Drive Shared Drive served over WebDAV by rclone):
<id> - <name>/ HR only
Shared/ HR and the employee, read only
- HR officers see the whole folder in the HR Documents tab of the employee.
- Employees see their own Shared folder in Employees > My Documents. It is on
its own model with a record rule: employees cannot read hr.employee, and
every employee can read every hr.employee.public and res.users.
- Folders are created by a queue job with the employee (when a storage is
configured) or with an action on existing employees, and renamed with the
employee.
- The fs_folder widget hides the actions that change the folder when the field
is read only.
Assisted-by: claude-opus-5-5, medium, claude-code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
HR wants documents for each employee in Google Drive, and each employee must be able to read the documents meant for them (salary certificate, payslips…) and only those.
What it does
New module
hr_employee_fs_folder(depends onhr, OCAfs_folder,queue_job; nothing from the Swiss repositories, so any office can install it):Shared/included).Shared/folder, read only (list, preview, download).fs_folderroots each folder, so..cannot reach the HR folder.hr.employee.shared.folder):fs_folderchecks access on the record carrying the field. Employees cannot readhr.employee(HR only), and every employee can read everyhr.employee.publicand everyres.users, so none of them can carry a folder only its employee may see. The new model has a record rule: own folder for employees, allowed companies for HR officers (multi-company: CH / PL).fs_folderworkaround aspartner_fs_folder([ADD] partner_fs_folder: documents folder on partners (Google Drive via fs_folder) #2223): folder creation checks write access on the record, then uses sudo, becausefs_folderreadsfs.storage(credentials) with the user's rights.fs_folderwidget ignoresreadonly. A small patch hides the buttons that change the folder (add, upload, drop, rename, delete, unlink) when the field is read only; the server refuses them anyway (employees have read-only access). Candidate for OCA.Google Drive
Separate Shared Drive "HR", service account
odoo-hr-*as Content manager, only HR as members (Contributor): employees access their documents through Odoo only. Separaterclone serve webdav(another port and password) and anhr_docsstorage linked to both fields (seereadme/CONFIGURE.md).Tests
..), My Documents action, renaming, action on existing employees, widget button, HR officer of another company refused.Staging
To be put on
stagewith the usual process, after the Drive / rclone setup for HR.🤖 Generated with Claude Code