-
-
Notifications
You must be signed in to change notification settings - Fork 65
[18.0][IMP] sign_oca: adding events for bus synchronization #76
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /** @odoo-module **/ | ||
| /* global */ | ||
| /* Copyright 2025 Kencove - Mohamed Alkobrosli | ||
| * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ | ||
|
|
||
| import {Reactive} from "@web/core/utils/reactive"; | ||
| import {reactive} from "@odoo/owl"; | ||
| import {registry} from "@web/core/registry"; | ||
|
|
||
| export class WatchSignRequestsService extends Reactive { | ||
| static modelToLoad = []; | ||
| static serviceDependencies = ["bus_service", "orm", "notification"]; | ||
|
|
||
| constructor() { | ||
| super(); | ||
| this.ready = this.setup(...arguments).then(() => this); | ||
| } | ||
|
|
||
| async setup(env, {bus_service, orm, notification}) { | ||
| this.env = env; | ||
| this.bus_service = bus_service; | ||
| this.orm = orm; | ||
| this.notification = notification; | ||
| this.sign_requests = reactive({signerCounter: 0, signerGroups: []}); | ||
|
|
||
| this.bus_service.subscribe("sign_oca_request_updates", async ({message}) => { | ||
| if (message) { | ||
| await this.fetchSystraySigner(); | ||
| } | ||
| }); | ||
| } | ||
| async fetchSystraySigner() { | ||
| const groups = await this.orm.call("res.users", "sign_oca_request_user_count"); | ||
| let total = 0; | ||
| for (const group of groups) { | ||
| total += group.total_records || 0; | ||
| } | ||
| this.sign_requests.signerGroups = groups; | ||
| this.sign_requests.signerCounter = total; | ||
| return {groups, total}; | ||
| } | ||
| getTotalSignRequests() { | ||
| return this.sign_requests.signerCounter; | ||
| } | ||
| } | ||
|
|
||
| export const watchSignRequestsService = { | ||
| dependencies: WatchSignRequestsService.serviceDependencies, | ||
| async start(env, services) { | ||
| return new WatchSignRequestsService(env, services).ready; | ||
| }, | ||
| }; | ||
|
|
||
| registry.category("services").add("watchSignRequests", watchSignRequestsService); |
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
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
@ nilshamerlinck
thanks, but there will be no change in code functionality or syntax.
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.
if you create 2
sign.oca.requestthat involve same signers, isn't it better to send only one notification to each signer?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.
creating two requests does not make sense.
only one is needed to be fully signed but better if some partner is not there we send him an email again.
we made a PR on that.
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.
@nilshamerlinck
#89
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.
Currently it is possible to create multiple requests at the same time, for example, through
maintenance_sign_oca(although it can be done without this module).