Skip to content

[ADD] partner_fs_folder: documents folder on partners (Google Drive via fs_folder) - #2223

Open
davidwul wants to merge 2 commits into
18.0from
18.0-partner-fs-folder
Open

davidwul wants to merge 2 commits into
18.0from
18.0-partner-fs-folder

Conversation

@davidwul

Copy link
Copy Markdown
Contributor

Purpose

Fundraising needs a place to keep any kind of document about donors and sponsors (contracts, notes, pictures…), shared with the team in Google Drive and reachable from the partner in Odoo.

What it does

  • New module partner_fs_folder (depends on OCA fs_folder and queue_job).
  • Documents tab on the partner, with a Create Documents Folder button: folders are created on demand, not for all 20k partners.
  • Folder layout:
    <salesperson>/<ref> - <name>                        company or individual
    <salesperson>/<ref> - <company>/<ref> - <contact>   contact of a company
    _Unassigned/...                                     no salesperson
    
    The salesperson of the company is used for its contacts. The company folder is created when needed.
  • When the salesperson, the company or the company flag of a partner changes, a queue job moves the folder (with its content) and updates the links, including the links of the contact folders inside a moved company folder. The job is idempotent; a missing folder only logs a warning; an existing target folder fails the job without overwriting anything.
  • Access follows the partner: reading the folder needs read access on the partner, changing it needs write access.
  • Works around an fs_folder bug: folder creation reads fs.storage with the user's rights, so non-admin users get an AccessError (only over HTTP, from the second request on). Users must not get read access on fs.storage (it holds the credentials), so the action checks write access on the partner and then uses sudo. Candidate for an OCA fix.

Google Drive

There is no Google Drive backend in OCA storage. Drive is reached through rclone serve webdav on localhost (protocol webdav). Setup with a service account and a Shared Drive is in readme/CONFIGURE.md.

Known limits:

  • Files added in Drive show in Odoo after the rclone cache delay (~30 s).
  • Folders must not be moved or deleted in Drive (the link is the path). Users should be Contributor on the Shared Drive. If a folder is moved in Drive, uploads from Odoo may land in the old (trashed) folder during the cache delay.
  • Renaming a partner does not rename its folder.

Tests

  • 18 unit tests on a local storage: creation, unassigned, idempotence, moves with content, company/contact subfolders, contact attached/detached/changing company, missing or existing target folder, job deduplication, access rights.
  • Tested over HTTP with a non-admin user against a Google Drive test folder (rclone + OAuth): creation, upload, moves (~2 s per move).

Staging test plan

  1. Service account + Shared Drive "Partners" (service account Content manager, users Contributor).
  2. rclone remote with service_account_file and team_drive, rclone serve webdav as a systemd service on 127.0.0.1.
  3. fs.storage webdav, check method List File, options with timeout: 60, linked to the field Documents Folder.
  4. Check: creation by a fundraiser, upload from Odoo and from Drive, salesperson change on a company with contacts, queue jobs done.

🤖 Generated with Claude Code

Adds a Documents tab on partners with a folder of an external file system
(fs_storage, e.g. a Google Drive Shared Drive served over WebDAV by rclone).

- Folders are created on demand and filed by salesperson:
  <salesperson>/<ref> - <name> (_Unassigned without salesperson).
- Contacts of a company get a subfolder of the company folder.
- A queue job moves the folders when the salesperson or the company changes.
- Works around fs_folder reading fs.storage without sudo on folder creation.

Assisted-by: claude-opus-5-5, medium, claude-code
@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous finding is addressed and no new actionable issues were found.

Reviews (2) · Last reviewed commit: "[FIX] partner_fs_folder: update the link..." · Reviewed by Greptile

Comment thread partner_fs_folder/models/res_partner.py Resolved
… folder

The links of the subfolders were found through the company of the contacts.
A contact detached from the company (or moved to another one) before the job
moving the company folder ran kept a link to the old path: its folder was
moved with the company folder, and its own job then found nothing to move.

Assisted-by: claude-opus-5-5, medium, claude-code
@davidwul

Copy link
Copy Markdown
Contributor Author

@Danielgergely
this is a pr that aim at having gdrive as backend for storing document on partner (proposal for major/middle donor) or any other document and having a storage for employee document. The purpose would be to have the stage as a poc, so I can show this to Philippe, Sarah and Désriée. Could you merge this in stage after having a review that it's not introducing any unwanted behavior?

2 similar comments
@davidwul

Copy link
Copy Markdown
Contributor Author

@Danielgergely
this is a pr that aim at having gdrive as backend for storing document on partner (proposal for major/middle donor) or any other document and having a storage for employee document. The purpose would be to have the stage as a poc, so I can show this to Philippe, Sarah and Désriée. Could you merge this in stage after having a review that it's not introducing any unwanted behavior?

@davidwul

Copy link
Copy Markdown
Contributor Author

@Danielgergely
this is a pr that aim at having gdrive as backend for storing document on partner (proposal for major/middle donor) or any other document and having a storage for employee document. The purpose would be to have the stage as a poc, so I can show this to Philippe, Sarah and Désriée. Could you merge this in stage after having a review that it's not introducing any unwanted behavior?

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