This question has been flagged
3 Replies
11959 Views

Anyone know what "Duplicate" does?

Inbetween delete & backup under "Manage Your Organizations"

Update:  From the answers received it seems that duplicate would be a good way to create multiple records for similar products with a little editing afterwards?

The single most useful function I thought of is to duplicate an Ecommerce site (which I actually want to do)

Would that work?

Avatar
Discard

You'll find the duplicate button about everywhere on Odoo. Its used to create a duplicate from a record. See it as a really fast way to create an exact copy from a current record.

Its make copy of existing database to new database.

Best Answer

The duplicate Menu calls the OpenERP copy method, which by default is implemented as a shallow copy, with the exception of one2many relationships.

Shallow copy means that a new copy of the record is created, with all field values copied as reference as much as possible. For example if you duplicate an Employee, the Department of the duplicated employee will simply be set to the same department as the one being copied, the system will not create a copy of the Department.

For one2many relationships (which is typically the relationship that connects a parent record with its child records, like the relationship between an Invoice and its lines), the child records are also duplicated, because the original ones cannot be ripped off their original parent.

This default behavior may cause unforeseen side-effects when a one2many relationship connects a record to mere "related records" that are not really its children: for example a one2many relation could link an Employee to her timesheet entries, but those entries should definitely not be duplicated when the employee is duplicated.

For this reason the various object models of OpenERP can implement extra logic during the copy operation, and explicitly turn off the duplication for one2many relationships that do not contain real "children", as well as alter any copied values (like appending "(copy)" in the record name).

If you're seeing incorrect behavior when duplicating records using only standard OpenERP modules, it may be a bug that should be reported on the official bugtracker. And if you are using extra modules, make sure they're not adding one2many fields on some models without overriding the copy method accordingly.

PS: If you're duplicating a record in the "Employee Directory" you're actually duplicating an employee (HR Resource), not a user (User Account with login access). Those are separate concepts in OpenERP, as some employees may not need to login (no user account), and some users may not be employees (contractors or system accounts for example).

Update: a bug exists currently in OpenERP 7.0 that causes invalid duplication of related employees when duplicating a user, and similar duplication of subordinates when duplicating an employee. This bug is an illustration of what happens when modules fail to correctly handle the duplication of the one2many relationship they define.

Avatar
Discard

Please, vote if you got a plus in the answer :)

Good Answer @ Drees Far

Author

Thank you for the very definative answer Drees. Very helpful.

Nicely describes all the details about duplicate, I've accepted this answer. Good job :)