Skip to content

[18.0][IMP] operating_unit: Add linked users stat button and bulk unit synchronization#834

Open
BhaveshHeliconia wants to merge 1 commit intoOCA:18.0from
HeliconiaIO:18.0-imp-operating_unit
Open

[18.0][IMP] operating_unit: Add linked users stat button and bulk unit synchronization#834
BhaveshHeliconia wants to merge 1 commit intoOCA:18.0from
HeliconiaIO:18.0-imp-operating_unit

Conversation

@BhaveshHeliconia
Copy link
Copy Markdown
Contributor

This pull request introduces two key improvements to the operating_unit module to enhance user management and visibility.

Key Improvements:

  • Users Stat Button on Operating Units: Provides quick access to all users linked to an OU (including managers) via a Stat Button on the form view.
  • Bulk Operating Unit Synchronization: A new server action on the Users list view to automatically assign OUs based on the user's allowed companies.

@AaronHForgeFlow
Copy link
Copy Markdown
Contributor

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.

@BhaveshHeliconia BhaveshHeliconia force-pushed the 18.0-imp-operating_unit branch from 342e60e to 2b43e2a Compare April 9, 2026 05:11
@BhaveshHeliconia
Copy link
Copy Markdown
Contributor Author

@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:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. I've improved the method accordingly.

@BhaveshHeliconia BhaveshHeliconia force-pushed the 18.0-imp-operating_unit branch from 2b43e2a to 399106c Compare April 9, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants