-
-
Notifications
You must be signed in to change notification settings - Fork 304
[16.0][IMP] base_geoengine: Include edit button in Popup #409
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
Conversation
cparadis-impressfoods
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.
LGTM!
3df97af to
fd809d6
Compare
fd809d6 to
fae81fc
Compare
| <div | ||
| t-if="isGeoengineAdmin" | ||
| id="popup-editor" | ||
| class="ol-popup-editor text-primary" | ||
| t-on-click="onEditButtonClicked" | ||
| /> |
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.
I have some observations about this:
- Is really GeoenginAdmin check needed? I think is more correct that the check should be done on the work order itself (user could be GeoengineAdmin but not allowed to edit a specific WO, how is this situation managed?);
- When moving the cursor over the button, it doesn't give me the impression that it's clickable. Please could you improve this by adding a
clickableattribute or changing thedivinto abuttonor something similar? - When clicking on
editbutton, the form view just opened is "full screen", hiding the upper navigation bar, and when going back, map view is reset; - suggestion: clicking the "open" button, i see the same form that I have by clicking on "edit" button. What if the open button opens form view in edit mode (depending of access rules of course)? In that case, "edit" button would become obsolete, but the interface should become more clear;
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.
Re: the first point, this is a generic geoengine module, it could be used with any object, not just fieldservice. But in general, I agree with checking permissions on the object itself if possible and not requiring admin rights on the Geoengine app.
If it's too complicated, Odoo probably already checks permissions in other ways so I'd rather leave both buttons for everyone, at least as a first implementation.
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.
- Regarding edit button, icon is shown as clickable attribute when hovered around it. Edit button opens url in new tab with navigation bar and also restores history in geoengine view.
- Regarding permission on object level:
a. Tried to hide the editbutton using ormservice and reading permission for record from backend during onwillstart() in geoengineRenderer. However, each record related information is attached in geoengineRenderer only when displayPopupRecord() method is called and geoenginerecord is mounted based on information passed from recordPanel template. Component is getting destroyed while trying to fetch specific record from geoengineRenderer setup. So, could not hide the button completely. This would be best option for this case but could not achieved.
b. Currently, if a model has a field named "can_write", if passed in info_box template from geoengine view definition, record is validated based on can_write field and allows user to edit the record. If not, user is notified that sufficient permissions are not available to edit the record. If info_box template does not have "can_write" field, all users is allowed to edit the record.(default behaviour).
Note: Without approach "b", by default even when user is allowed to edit the record, permissions are validated in backend and user is blocked in case the user does not have sufficient permissions.
IMO, I would like to stick not using approach "b" as already backend permissions are validated even without exposing new field in model for this purpose which seems to be overhead.
Please let me know your views.
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.
Changes on the edit button now are ok.
About permissions, since now the form opens in a new tab, is ok for me to remove new checks added in this PR and stay with the "default" ones when opening the new tab.
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.
Removed checking permission based on "can_write" field introduced from model and preserved default behaviour for permission check of geoengine views for edit button.
67c79d9 to
801c2f6
Compare
|
This PR has the |
HekkiMelody
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.
Small code cleanup suggestion, otherwise seems ok.
| var web_base_url = window.origin; | ||
| var web_url = window.location.href; | ||
| var searchParams = new URLSearchParams(web_url.split("#")[1]); | ||
| var action_url = | ||
| web_base_url + | ||
| "/web#id=" + | ||
| String(resId) + | ||
| "&view_type=form&model=" + | ||
| resModel + | ||
| "&menu_id=" + | ||
| searchParams.get("menu_id"); | ||
| this.actionService.doAction({ | ||
| type: "ir.actions.act_url", | ||
| target: "_blank", | ||
| url: action_url, | ||
| }); |
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.
chore: not at all a fan of building the URL manually, but if there's no other easy way to do it, that's fine.
I would suggest building the action_url in a less "manual" way, like in this module https://github.com/OCA/web/blob/16.0/web_widget_open_tab/static/src/js/open_tab_widget.esm.js#L12-L25
Also, please use const and let instead of var.
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.
Updated as suggested
Added edit button in popup of record shown in geoengine view which allows user to edit values of record from geoengine view.
801c2f6 to
6eeb3f9
Compare
HekkiMelody
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.
Code review, LGTM
|
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. |
|
@OCA/geospatial-maintainers We've been using this successfully for a few months now. I would be grateful if you could review this. Thanks |
|
No review, but as it is validated by 3 people. merging. /ocabot merge minor thanks for your contribution. |
|
This PR looks fantastic, let's merge it! |
|
@legalsylvain your merge command was aborted due to failed check(s), which you can inspect on this commit of 16.0-ocabot-merge-pr-409-by-legalsylvain-bump-minor. After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red. |
|
I see that the error is due to we may be hitting openstreetmaps a bit too often? We may have to refactor the tests to not call OSM, or skip some tests in case of |
Will check on the issue |
f0b0368 to
6fc3314
Compare
…tMap Avoiding direct call to openstreetmap which results in Access denied (403) due to resource usage limits and hence mocking data for openstreetmap url as part of geoengine partner testcases.
6fc3314 to
d125f93
Compare
quirino95
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.
LGTM
Thank you for the fix!
HekkiMelody
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.
Code review, LGTM for the test mock too.
Thank you!
|
@OCA/geospatial-maintainers we've fixed the issue with the flaky tests (even though they were out of scope for this PR) could you try the merge again? Thank you We can forward port both changes to the newest versions too |
|
thanks for the contribution ! /ocabot merge minor |
|
This PR looks fantastic, let's merge it! |
|
Congratulations, your PR was merged at ba5121e. Thanks a lot for contributing to OCA. ❤️ |
|
Thank you @legalsylvain ! |
Added edit button in popup of record shown in geoengine view which allows user to edit records by opening new tab in browser window.