Skip to content

Conversation

@SamBachmann
Copy link
Contributor

In this PR I redirected the home page (that were accessed either with clicking on compassion logo or logging out) to

  • my2/dashboard if the user is logged in
  • web/login if there's no logged in user

Implementation :

I added a python controller to achieve that.
I first tried to achieve this using xml template inheritance. After spending quite some time on it I found python controller solution very convenient. Let me know if it's a good practice or whether it has to be done through xml :)

@SamBachmann SamBachmann self-assigned this Nov 11, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @SamBachmann, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request aims to modify the default home page behavior, ensuring that users are directed to the appropriate page based on their authentication status. Specifically, it introduces a new Python controller to intercept requests to the root URL, with the immediate effect of redirecting all such requests to the login page. The ultimate goal is to send logged-in users to their dashboard and unauthenticated users to the login page, with this PR laying the groundwork for the latter.

Highlights

  • New Home Page Redirection Logic: Introduced a new Python controller, my2_home_redirect.py, to manage the home page (/) redirection behavior, aiming to direct users based on their login status.
  • Initial Redirection to Login: The new controller currently redirects all requests to the root URL (/) to /web/login. The description indicates that further logic in my2_login.py is expected to handle the final destination for logged-in users (dashboard).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new controller to redirect users from the home page, which is a good approach for this kind of logic in Odoo. However, the current implementation is inefficient for logged-in users as it causes a double redirect. I've left a comment with a suggestion to implement the redirection logic directly in the new controller, which will resolve the inefficiency and make the code cleaner. Regarding your question in the PR description, using a Python controller is definitely the right approach and good practice in Odoo for this kind of logic, much more so than using XML templates.

@SamBachmann
Copy link
Contributor Author

Uuups I forgot to run the pre-commit. Now it's done and it's ready for a review 😄

Copy link
Contributor

@NoeBerdoz NoeBerdoz left a comment

Choose a reason for hiding this comment

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

Your solution is valid, but aggressive, I would prefer

Apply suggestion from @NoeBerdoz

Co-authored-by: NoeBerdoz <44669187+NoeBerdoz@users.noreply.github.com>
@SamBachmann
Copy link
Contributor Author

Got it ! I applied your suggestion.

@SamBachmann
Copy link
Contributor Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly implements the redirection from the home page. For logged-in users, it redirects to the dashboard, and for anonymous users, to the login page. Using a Python controller for this logic is a good and standard practice in Odoo, as it keeps the redirection logic cleanly on the server-side. I have a couple of suggestions for improvement regarding URL consistency and code organization. Overall, this is a good solution.

SamBachmann and others added 3 commits January 14, 2026 13:41
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@SamBachmann SamBachmann requested a review from ecino January 14, 2026 12:49
@SamBachmann
Copy link
Contributor Author

After a careful review of the suggestion of Noé and Ema, I found that the code was now not correctly working.
With these commits, I applied the suggestion of @ecino and got something that is running properly.

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.

4 participants