From e66cd93c2c875bb163c2d983a15e2f62661be4a1 Mon Sep 17 00:00:00 2001 From: William Braeckman Date: Thu, 2 Jan 2025 12:05:09 +0100 Subject: [PATCH] [REF] runbot: deduplicate res_users.py Duplicate model inheritance for res.users --- runbot/models/__init__.py | 1 - runbot/models/res_users.py | 4 ++++ runbot/models/user.py | 10 ---------- 3 files changed, 4 insertions(+), 11 deletions(-) delete mode 100644 runbot/models/user.py diff --git a/runbot/models/__init__.py b/runbot/models/__init__.py index 60601d60..0b3f4322 100644 --- a/runbot/models/__init__.py +++ b/runbot/models/__init__.py @@ -25,7 +25,6 @@ from . import res_users from . import runbot from . import team from . import upgrade -from . import user from . import version # those imports have to be at the end otherwise the sql view cannot be initialised diff --git a/runbot/models/res_users.py b/runbot/models/res_users.py index a74e2b62..25a1a18d 100644 --- a/runbot/models/res_users.py +++ b/runbot/models/res_users.py @@ -10,6 +10,10 @@ class ResUsers(models.Model): runbot_team_ids = fields.Many2many('runbot.team', string="Runbot Teams") github_login = fields.Char('Github account') + # Add default action_id + action_id = fields.Many2one('ir.actions.actions', + default=lambda self: self.env.ref('runbot.open_view_warning_tree', raise_if_not_found=False)) + _sql_constraints = [ ( "github_login_unique", diff --git a/runbot/models/user.py b/runbot/models/user.py deleted file mode 100644 index 1c14c773..00000000 --- a/runbot/models/user.py +++ /dev/null @@ -1,10 +0,0 @@ - -from odoo import models, fields - - -class User(models.Model): - _inherit = 'res.users' - - # Add default action_id - action_id = fields.Many2one('ir.actions.actions', - default=lambda self: self.env.ref('runbot.open_view_warning_tree', raise_if_not_found=False))