Skip to content

Commit

Permalink
[FIX] hr: allow to copy employee linked to user
Browse files Browse the repository at this point in the history
Before this commit, It was not possible to copy An employee which is already linked to User due `user_uniq` constraints.

Now we add `copy=False` on `user_id` field, so Employee will be copied without linked User.

closes odoo#49805

Signed-off-by: Yannick Tivisse (yti) <[email protected]>
  • Loading branch information
sswapnesh committed Apr 21, 2020
1 parent 56bef0f commit 2a63df0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions addons/hr/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
from . import res_partner
from . import res_users
from . import res_company
from . import resource
10 changes: 10 additions & 0 deletions addons/hr/models/resource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import fields, models


class ResourceResource(models.Model):
_inherit = "resource.resource"

user_id = fields.Many2one(copy=False)

0 comments on commit 2a63df0

Please sign in to comment.