Repository navigation
[18.0][IMP] operating_unit: Add linked users stat button and bulk unit synchronization - #834
BhaveshHeliconia wants to merge 1 commit into
Conversation
|
the stat button could be something useful, the server action I think it is not a generic enough feature to be included in the core module. |
342e60e to
2b43e2a
Compare
|
@AaronHForgeFlow, thanks for the feedback. I've removed the bulk synchronization feature and kept only the Stat Button. Documentation and tests have been updated accordingly. |
| self.env.registry.clear_cache() | ||
| return super().write(vals) | ||
|
|
||
| def button_open_linked_users(self) -> dict: |
There was a problem hiding this comment.
Can you explain why you need all this code for an action? why don't simply create the action in xml and do smth like this (haven't tested the code, just an idea):
def button_open_linked_users(self):
action = self.env.ref("operating_unit.action_res_users_operating_unit").read()[0]
if len(self.user_ids) == 1:
action.update({
"view_mode": "form",
"res_id": self.user_ids.id,
})
else:
action["domain"] = [("id", "in", self.user_ids.ids)]
return action
There was a problem hiding this comment.
Thanks for the suggestion. I've improved the method accordingly.
2b43e2a to
399106c
Compare
399106c to
6db2307
Compare
|
ping @AaronHForgeFlow |
| action = self.env.ref( | ||
| "base.action_res_users", | ||
| raise_if_not_found=False, | ||
| ) | ||
| if not action: | ||
| return False | ||
| action_vals = action.read()[0] |
There was a problem hiding this comment.
The usual pattern to get an action as dict is:
| action = self.env.ref( | |
| "base.action_res_users", | |
| raise_if_not_found=False, | |
| ) | |
| if not action: | |
| return False | |
| action_vals = action.read()[0] | |
| action = self.env['ir.actions.actions']._for_xml_id("base.action_res_users") | |
| # update `action`... | |
| return action |
| @@ -1,4 +1,9 @@ | |||
| An operating unit (OU) is an organizational entity part of a company, | |||
| AnThis module maintains the administrative units (Operating Units) to which | |||
There was a problem hiding this comment.
| AnThis module maintains the administrative units (Operating Units) to which | |
| This module maintains the administrative units (Operating Units) to which |
Still, do we need to update the description here?
There was a problem hiding this comment.
Agreed. Reverted to keep the original description clean.
| **Improvements in this version:** | ||
| - Added a Stat Button on Operating Units to easily view and manage linked users. |
There was a problem hiding this comment.
Not sure we should include such changelog in the DESCRIPTION.md file.
There was a problem hiding this comment.
Reverted it back to its original state.
| This module defines the operating unit entity and the user's security | ||
| rules. Other modules extend the standard Odoo apps with the OU. | ||
|
|
||
| **Stat Button for Linked Users** |
There was a problem hiding this comment.
IMO there is no need to document such basic feature (it's a common UX helper in Odoo) in USAGE.md.
Is all of this generated by AI? :) If so, it deserves an Assisted-by: entry in the commit, see https://github.com/OCA/.github/blob/master/AI_POLICY.md .
There was a problem hiding this comment.
I have reverted USAGE.md back to its original state.
6db2307 to
f9226cf
Compare
|
@sebalix Thanks for the review! I've addressed all your suggestions and reworked in this improvements PR. |
This pull request introduces two key improvements to the operating_unit module to enhance user management and visibility.
Key Improvements: