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>
21 lines
608 B
Python
21 lines
608 B
Python
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
|