-
-
Notifications
You must be signed in to change notification settings - Fork 59
[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
base: 18.0
Are you sure you want to change the base?
Conversation
|
Hi @etobella, |
|
@dnplkndll Hi guys, I need you to review this new feature, with which user can observe each sign request update in the status bar without needing to reload the page. Observe that event is sent only to scoped users and not for everybody. |
|
You should explain the new feature on the commit message and PR description, and if it makes sense in this module or in a separate one. |
@pedrobaeza The new one is to show sign requests to customers in the portal and to enable them to sign there. For this PR feature, it is syncing changes instantly to backend users who are asked to sign and not everybody to save our servers from unnecessarily load. |
|
OK, that explanation is the one it should go in the commit message. Adding 2 new contributors seems too much for this change, isn't it? Then, there are weird changes in .po files that are not coming from your improvement and should be avoided. |
thanks, let me improve it all |
29164fe to
c4d315d
Compare
c4d315d to
06f1a05
Compare
|
I have just added the 3 improvements that you requested from me, I can see the code in the PR is more clean and descriptive. |
|
One thing is clear: a total reload of the single-page app shouldn't be done in any case. |
|
@victoralmau with me chrome was not listening to bus events, don't know why |
scenario is not to reload the page at all. |
are there any other projects working with this concept of pushing the events to the clients over polling for changes? I was hoping to prove it out then move to a more generic approach as you would then be able to push render update events on much more expensive areas to re-render. or areas with a lot of subscribers |
|
Can we figure out whether or no OCA boat is using workers > 0, if they are 0 nobody can use OCA boat for reviewing this PR and will be reviewed locally with --workers=1 |
|
@sbidoul should know if runboat can be run with multiple workers activating the bus. |
https://github.com/sbidoul/runboat/blob/main/src/runboat/kubefiles/runboat-start.sh#L39 |
|
runboat runs in multithread mode (the default, --workers=0). Why is that a problem for this PR? |
|
I think the bus doesn't work with multi-threaded mode. |
workers should be 1 or more to be effective with this PR or any similar case. |
|
I don't know what is special in this PR, but I tried chatting between two sessions on the same runboat database and it works, so I would assume the bus is functional on runboat. I would say that if we have features that requires multi worker, this would need a big warning and/or something that prevent installing the module in multithread mode. |
|
since: odoo/odoo#191222 |
|
Perhaps the way it is used in |
In fact method used in the link is based on the method I used here, no lower level than what I provided. I guess chatter is using bus as both methods should use bus module. |
sign_oca/models/sign_oca_request.py
Outdated
| partner_list_ids = partner_recs.mapped("id") | ||
| for partner_id in partner_list_ids: | ||
| self.env["bus.bus"]._sendone( | ||
| "broadcast", | ||
| f"sign_oca_request_updates_{partner_id}", | ||
| {"message": "Sign OCA Requests Model updated"}, | ||
| ) |
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.
| partner_list_ids = partner_recs.mapped("id") | |
| for partner_id in partner_list_ids: | |
| self.env["bus.bus"]._sendone( | |
| "broadcast", | |
| f"sign_oca_request_updates_{partner_id}", | |
| {"message": "Sign OCA Requests Model updated"}, | |
| ) | |
| partner_recs._bus_send( | |
| "sign.oca.request/insert", | |
| {} | |
| ) |
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.
- better not send to broadcast channel or all users will receive a notification
- you can use higher-level method
_bus_send()method on partners (see here) - maybe
sign.oca.requestitself could implementbus.listener.mixinto cover more events type?
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.
What I am doing here is a uniqe notification sent to it related partner and not everybody.
Only partners related to the created request are in scope.
If you find something else in review, refer to me, please?
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.
- by sending your notification to the
broadcastchannel, all clients will receive it - if you're not convinced, you can inspect messages received by the websocket worker here:
chrome://inspect/#workers - of course you are filtering client-side, but server-side would be better (by using the already existing partner channel)
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.
ok, it sounds interesting to check
| partner_recs = record.signer_ids.mapped("partner_id") | ||
| self.notify_changes(partner_recs) |
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.
| partner_recs = record.signer_ids.mapped("partner_id") | |
| self.notify_changes(partner_recs) | |
| partner_recs = records.signer_ids.mapped("partner_id") | |
| self.notify_changes(partner_recs) |
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.request that 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.
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.
victoralmau
left a comment
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.
Functionally testing this one does not work. Example of another module that does something similar and works correctly: https://github.com/OCA/server-ux/blob/59205647d92f9c6c6ee955f1ae23d5f7b8b0409d/base_tier_validation/models/tier_validation.py#L784 + https://github.com/OCA/server-ux/blob/59205647d92f9c6c6ee955f1ae23d5f7b8b0409d/base_tier_validation/static/src/js/services/tier_review_service.esm.js#L14
|
@victoralmau It is not related to creating requests, but it can not be reviewed using OCA boat so better to have a solution of sending notifications without workers app. @nilshamerlinck gave me suggestion but I need a suggestion to use same port 8069 instead of 8073 of workers, by the way only important notificatios are sent via 8069 but ordinary ones use 8073 port. |
Sorry, but I don't understand the reason for having to configure what you indicate, in the previous examples (https://github.com/OCA/server-ux/blob/59205647d92f9c6c6ee955f1ae23d5f7b8b0409d/base_tier_validation/models/tier_validation.py#L784 + https://github.com/OCA/server-ux/blob/59205647d92f9c6c6ee955f1ae23d5f7b8b0409d/base_tier_validation/static/src/js/services/tier_review_service.esm.js#L14) it is not necessary to configure anything and it works correctly in oca boat for example. |
this also looks interesting, and I must check |
|
your suggestions were useful to reduce code, it is ok to use one single common channel to send notification as the update will apply on the partners who should sign because large workers need large processors. I can run the module when workers=1 but not less although I use the same method that you suggest it did not apply with workers=0 |
victoralmau
left a comment
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.
Did you test it on run boat? It will not work on run boat unless there is a value for workers > 0. I applied your suggestion although it needs a value for workers similar to the low level method I used before. |
|
Yes, it may work in runboat. You can check |
|
@kobros-tech did this feature with event update over refresh prove valuable? can is be used in other place or in a more general way? |
if you plan to use same feature we can think to make a base module, but it needs smart implementation. not sure but all what I have done I was not sure about before I start. |
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |





In this new feature, web client user can observe each sign request update in the status bar without needing to reload the page or even clicking on the pen icon.
Observe that event is sent only to scoped users who should sign on the new created sign request. and not for everybody.