4 Commits

Author SHA1 Message Date
1285a1048e Merge git.faryad.top main into origin main 2026-09-19 14:00:29 +03:30
Diaco Soltanpour
76e0f803a3 Set Odoo login landing to Projects instead of Discuss
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
## Summary

Odoo 19 removed the **Home Action** field from user Preferences, so logins fall through to Discuss (`/odoo/discuss`). This PR adds a small addon that:

1. **Restores Home Action** on Settings → Users → Preferences and on My Preferences
2. **Defaults internal users** to `project.open_view_project_all` (Projects) on module install and when new internal users are created

## Apply

See **Odoo startup page (Projects instead of Discuss)** in [`README.md`](README.md): restart Odoo, Update Apps List, install **Project as Home Action** (`project_home_action`), then log out/in.

## Files

- [`odoo/addons/project_home_action/`](odoo/addons/project_home_action/) — new module (views + create override + post-init hook)
- [`README.md`](README.md) — install/apply steps

## Testing

- Validated Python/XML syntax and manifest structure
- Full Odoo runtime install was not available in this cloud agent environment (no running `odoo` container)
<!-- CURSOR_AGENT_PR_BODY_END -->

<div><a href="https://cursor.com/agents/bc-75c774b3-4d77-4418-b0e8-799ccb6c5c0b?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-75c774b3-4d77-4418-b0e8-799ccb6c5c0b&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>
2026-08-26 09:39:39 +00:00
Cursor Agent
19db9c58dd Document how to install project_home_action in README
Add Odoo startup-page steps under the existing Odoo section so
operators know how to enable Projects as the post-login landing.

Co-authored-by: dyaco8464 <dyaco8464@yahoo.com>
2026-08-26 09:38:28 +00:00
Cursor Agent
7776b7f10d Add project_home_action addon for Project login landing
Restores Home Action on user Preferences (removed in Odoo 19) and
defaults internal users to project.open_view_project_all on install
and create, so login opens Projects instead of Discuss.

Co-authored-by: dyaco8464 <dyaco8464@yahoo.com>
2026-08-26 09:28:48 +00:00
7 changed files with 104 additions and 0 deletions

View File

@@ -422,6 +422,25 @@ done
This ensures Odoo can create attachments, logs, and configuration files without permission errors. This ensures Odoo can create attachments, logs, and configuration files without permission errors.
#### Odoo startup page (Projects instead of Discuss)
By default, Odoo 19 opens **Discuss** after login. The custom addon [`odoo/addons/project_home_action`](odoo/addons/project_home_action) restores the **Home Action** field on user Preferences and sets it to **Projects** for internal users.
`./odoo/addons` is already mounted into the container at `/mnt/extra-addons` via [`odoo/odoo.yml`](odoo/odoo.yml). After deploying a revision that includes this addon:
1. Restart Odoo if the container was already running, so it picks up the new module files:
```bash
docker compose restart odoo
```
2. In Odoo, open **Settings → Apps**.
3. Remove the **Apps** filter (and enable **developer mode** if the Apps menu is limited), then **Update Apps List**.
4. Search for **Project as Home Action** (`project_home_action`) and **Install** it.
5. Log out and log back in. You should land on Projects (`/odoo/project`) instead of Discuss.
On install, existing internal users with an empty Home Action are updated automatically. New internal users get the same default. You can still change Home Action per user under **Settings → Users → Preferences** (or **My Preferences**).
Requires the **Project** app to be installed (`depends: project`).
### Compose File Structure ### Compose File Structure
This repository uses a modular approach with multiple compose files: This repository uses a modular approach with multiple compose files:

View File

@@ -0,0 +1,2 @@
from . import models
from .hooks import post_init_hook

View File

@@ -0,0 +1,19 @@
{
"name": "Project as Home Action",
"version": "1.0.0",
"summary": "Open Projects after login instead of Discuss",
"description": (
"Restores the Home Action field on user Preferences (removed in Odoo 19) "
"and sets it to Projects for internal users on install and for new users."
),
"category": "Project",
"author": "Automated",
"license": "LGPL-3",
"depends": ["base", "project", "web"],
"data": [
"views/res_users_views.xml",
],
"post_init_hook": "post_init_hook",
"installable": True,
"application": False,
}

View File

@@ -0,0 +1,13 @@
def post_init_hook(env):
"""Set Home Action to Projects for internal users that have none."""
action = env.ref("project.open_view_project_all", raise_if_not_found=False)
if not action:
return
users = env["res.users"].search(
[
("share", "=", False),
("action_id", "=", False),
]
)
if users:
users.write({"action_id": action.id})

View File

@@ -0,0 +1 @@
from . import res_users

View File

@@ -0,0 +1,20 @@
from odoo import api, models
class ResUsers(models.Model):
_inherit = "res.users"
@api.model
def _project_home_action(self):
return self.env.ref("project.open_view_project_all", raise_if_not_found=False)
@api.model_create_multi
def create(self, vals_list):
users = super().create(vals_list)
action = self._project_home_action()
if not action:
return users
to_update = users.filtered(lambda user: not user.share and not user.action_id)
if to_update:
to_update.write({"action_id": action.id})
return users

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Admin user form: Preferences → Home Action -->
<record id="view_users_form_home_action" model="ir.ui.view">
<field name="name">res.users.form.home.action</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='preferences']//group[@name='other_preferences']" position="inside">
<group string="Menus Customization" invisible="share">
<field name="action_id" options="{'no_create': True}"/>
</group>
</xpath>
</field>
</record>
<!-- My Preferences dialog -->
<record id="view_users_form_simple_modif_home_action" model="ir.ui.view">
<field name="name">res.users.preferences.form.home.action</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='preferences_page']//group[@name='other_preferences']" position="inside">
<group string="Menus Customization">
<field name="action_id" options="{'no_create': True}" readonly="0"/>
</group>
</xpath>
</field>
</record>
</odoo>