duplicating a user duplicates all employee data

Bug #1256437 reported by Dan Mendes
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Committed
Medium
OpenERP R&D Addons Team 1

Bug Description

On a fresh installation of OpenERP nightly -latest.exe

I installed Employee Directory module.

After creating an additional user and employee data, where user1 is user2 manager, if user1 is duplicated so will user2 in the human resources module. Is this intended? I want to duplicate a user because of access rights, but I don't want to duplicate any employee data.

1) Steps to reproduce the issue you have observed
1.1) Install Employee Directory module
1.2) Create a user1 under settings users
1.3) Create an employee under human resources employee
1.3.1) Related user is user1, manager is administrator.
1.4) In settings/users create a duplicate user of administrator

Note: Duplicating the administrator again will create 2 more copies of everything... so it's 2, 4, 8, 16, 32, etc... if there are 2 levels (that is if we create a user2, that has manager user1) with just 5 copies of administrator we have over 200 employees created.

2) The result you observed
A user is created in human resources employee and also all users that have administrator as manager are duplicated.

3) The result you expected
Create a user and not affect the Human Resources Employee data

4) The platform you are using (and browser version, if relevant)
Windows, Chrome

5) The OpenERP version you are using (e.g. 6.1.1-20120910-233309), if possible including the specific revision (e.g. r.2824) if you use the source repositories.
Version 7.0-20131129-002434

Note: After uninstalling the Employee module it can't be installed again, it outputs error regarding hr.job duplication.

Revision history for this message
Dan Mendes (daniel-d-mendes) wrote :

Forgot to mention if you then go to settings and delete user, in Human Resources Employee users are not deleted.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Thanks for the detailed bug report, Dan!

I have confirmed this on the latest 7.0 source code. Basically the `hr` module defines several one2many relationships that do not represent a regular parent-child relation, and does not correctly take care of discarding those relationships during copy/duplicate operations.

These 2 relationship must be explicitly discarded during copy():
- res.users.employee_ids
- hr.employee.child_ids

affects: openobject-server → openobject-addons
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 1 (openerp-dev-addons1)
importance: Undecided → Medium
milestone: none → 7.0
status: New → Confirmed
Revision history for this message
Amit Vora(OpenERP) (amit.vora-openerp) wrote :

Hello,
              I have fixed in https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1256437-avo.
              Revision ID:<email address hidden>
              Revision No:9146

Thanks,
avo.

Changed in openobject-addons:
status: Confirmed → In Progress
status: In Progress → Fix Committed
Revision history for this message
Amit Vora(OpenERP) (amit.vora-openerp) wrote :

Hello,
              I have fixed in https://code.launchpad.net/~openerp-dev/openobject-addons/7.0-bug-1256437-avo
              Revision ID:<email address hidden>
              Revision No:9855

Thanks,
avo.

Changed in openobject-addons:
status: Fix Committed → In Progress
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.