-
-
Notifications
You must be signed in to change notification settings - Fork 101
[19.0][IMP] spreadsheet_dashboard_oca: manage dashboard share links #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
volkantasci
wants to merge
1
commit into
OCA:19.0
Choose a base branch
from
volkantasci:19.0-add-spreadsheet-dashboard-share-oca
base: 19.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| from . import spreadsheet_dashboard | ||
| from . import spreadsheet_dashboard_share |
39 changes: 39 additions & 0 deletions
39
spreadsheet_dashboard_oca/models/spreadsheet_dashboard_share.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Copyright 2026 Volkan Tasci | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from odoo import api, models | ||
|
|
||
|
|
||
| class SpreadsheetDashboardShare(models.Model): | ||
| _inherit = "spreadsheet.dashboard.share" | ||
|
|
||
| @api.model | ||
| def action_get_dashboard_shares(self, dashboard_id): | ||
| """Return the shares of a dashboard the current user can see.""" | ||
| shares = self.search([("dashboard_id", "=", dashboard_id)]) | ||
| return [ | ||
| { | ||
| "id": share.id, | ||
| "full_url": share.full_url, | ||
| "create_date": ( | ||
| share.create_date.isoformat() if share.create_date else False | ||
| ), | ||
| "create_uid": ( | ||
| share.create_uid.display_name if share.create_uid else False | ||
| ), | ||
| "name": share.name, | ||
| } | ||
| for share in shares | ||
| ] | ||
|
|
||
| @api.model | ||
| def action_unshare(self, share_ids): | ||
| """Revoke shares. ir.rule limits the user to the shares they may access.""" | ||
| self.browse(share_ids).unlink() | ||
| return True | ||
|
|
||
| @api.model | ||
| def action_get_share_counts(self): | ||
| """Return {dashboard_id: share_count} for shares visible to the user.""" | ||
| counts = self._read_group([], ["dashboard_id"], ["__count"]) | ||
| return {count[0].id: count[1] for count in counts if count[0]} |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Users can only see and revoke the shares they created. Users in the | ||
| "Dashboards / Admin" group (spreadsheet_dashboard.group_dashboard_manager) | ||
| can see and revoke the shares created by any user. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| This module allows to edit spreadsheet dashboards using OCA Spreadsheet | ||
| editor. | ||
| editor. It also allows to manage the public share links of those | ||
| dashboards: list, copy, and revoke them. Dashboard admins can manage the | ||
| shares created by any user. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| - Open the "Dashboards" app (Rapor Panelleri). | ||
| - Open a dashboard and click on the **Share** button. | ||
| - Click on **Manage shares** to list every share link of the dashboard. | ||
| - Use the copy button to copy a link, or click **Revoke** to make a link | ||
| return a 404 error. | ||
| - A badge next to the dashboard name in the sidebar shows the number of | ||
| active shares. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <odoo> | ||
| <record id="spreadsheet_dashboard_share_manager_rule" model="ir.rule"> | ||
| <field name="name">spreadsheet.dashboard.share: manager sees all</field> | ||
| <field name="model_id" ref="model_spreadsheet_dashboard_share" /> | ||
| <field | ||
| name="groups" | ||
| eval="[(4, ref('spreadsheet_dashboard.group_dashboard_manager'))]" | ||
| /> | ||
| <field name="domain_force">[(1, '=', 1)]</field> | ||
| </record> | ||
| </odoo> |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't change manually the module version. It's done by the bot. This is done for avoiding conflicts if other pull request touch the same module. Anyway, for now there's no conflict.