-
-
Notifications
You must be signed in to change notification settings - Fork 209
[16.0][IMP] dms_field: Propagate groups from field template #441
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
[16.0][IMP] dms_field: Propagate groups from field template #441
Conversation
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.
Code review OK
By default, the value inherit_group_ids is True, so until now, it was always set to True in child directories. Changing this IMO has no side effects and allows for more flexibility in more complex cases (where a subdirectory of a template has different permissions than others).
dms_field/tests/test_dms_field.py
Outdated
| new_child_dir = partner.dms_directory_ids.child_directory_ids.filtered_domain( | ||
| [ | ||
| ("name", "=", child_dir.name), | ||
| ] | ||
| ) | ||
| self.assertRecordValues( | ||
| new_child_dir, | ||
| [ | ||
| { | ||
| "inherit_group_ids": child_dir.inherit_group_ids, | ||
| "group_ids": child_dir.group_ids.ids, | ||
| } | ||
| ], | ||
| ) |
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.
| new_child_dir = partner.dms_directory_ids.child_directory_ids.filtered_domain( | |
| [ | |
| ("name", "=", child_dir.name), | |
| ] | |
| ) | |
| self.assertRecordValues( | |
| new_child_dir, | |
| [ | |
| { | |
| "inherit_group_ids": child_dir.inherit_group_ids, | |
| "group_ids": child_dir.group_ids.ids, | |
| } | |
| ], | |
| ) | |
| subdirectory_1 = partner.dms_directory_ids.child_directory_ids.filtered( | |
| lambda x: x.name == self.subdirectory_1.name | |
| ) | |
| self.assertFalse(subdirectory_1.inherit_group_ids) | |
| self.assertEqual(subdirectory_1.group_ids, access_group) | |
| subdirectory_2 = partner.dms_directory_ids.child_directory_ids.filtered( | |
| lambda x: x.name == self.subdirectory_2.name | |
| ) | |
| self.assertTrue(subdirectory_2.inherit_group_ids) | |
| self.assertIn(self.group, subdirectory_2.group_ids) |
IMO this is more readable and checks that both subdirectories have the right data.
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.
Thanks for the quick review!
This needed some tweaking, but I accepted your suggestion overall, please check
|
I think all these changes can be combined into a single commit: [IMP] dms_field: Propagate groups from field template The title of the PR should be changed to something like: [16.0][IMP] dms_field: Propagate groups from field template |
0b3a905 to
df49a7f
Compare
I prefer to highlight which commits do not change the behavior (
Right, added more details in the PR title, I'm not a fan of including the version in the PR title though. |
|
@SirPyTech the version has to be in the PR title, not in the commit message. |
Why does it "have to be" there? |
|
Current convention is for seeing in a glance which is the target branch from the pull request list or the received notification mails, without having to navigate to the PR itself to see it. Please make reviewers' life easier. |
I am a reviewer too and I have never needed the version in the title because I'm using the Could you please propose this convention to the Guidelines in https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst? When this new convention is in the guidelines, maybe the OCA bot could help enforcing it 🤖 and you wouldn't need to ask all the contributors to edit their PR's title. |
|
There's no section in guidelines for that, and I'm not going to lose more time in that bureaucracy given the result in other attempts, but if someone asks you for that, and that would ease the review, please do it as I do. If not, then we will be reluctant to review your PRs. It's that simple. |
|
My comment is still pending #441 (comment) I think all these changes can be combined into a single commit: [IMP] dms_field: Propagate groups from field template IMO, all changes can be combined in a single commit; having several in this case adds nothing. |
Why is this case special?
It happens to have different opinions 🤷 I think having different commits makes more sense and is more aligned with the guidelines:
Rewriting a method to allow override is a logical change set, and that deserves a commit on its own. Would you agree with a compromise solution of having one |
aleuffre
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 and functional review, LGTM, we've successfully built an implementation based on this.
Regarding the more formal disputes: the separate [REF] commits seem cleaner to me, and also make reviewing and future forward porting easier.
On the other hand, if there's strong maintainer preference for a single commit, I think in this specific case the changes are small enough that I wouldn't want to block the PR over this disagreement.
|
This PR has the |
|
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. |
df49a7f to
b69584e
Compare
|
@OCA/document-maintainers can someone have a look? |
dms_field/models/dms_access_group.py
Outdated
| [ | ||
| item._get_domain_for_item_from_dms_field_ref(item.dms_field_ref), | ||
| [ | ||
| ("id", "!=", item.id), |
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.
Remove the trailing comma for having these 3 lines into 1.
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.
Thanks for having a look!
I usually have every item in the domain in their own line so that changes to each item do not highlight the whole domain as changed in diffs, but in this domain that only has one item it probably makes little sense 😅
P.S.: Thanks for merging too!
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.
Yeah, but at the end, diff viewers like the one in GitHub are already highlighting the specific part of the line that is changed, and the probability that this will be changed is very low.
b69584e to
6c2fe17
Compare
pedrobaeza
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.
/ocabot merge patch
|
On my way to merge this fine PR! |
|
Congratulations, your PR was merged at 56dbca7. Thanks a lot for contributing to OCA. ❤️ |
With this PR, the groups declared in child directories of the field template are propagated to the directories created in the target record.
I have also included a couple of small refactorings, in their own commit.
Let me know what you think!