openerp-expert-framework team mailing list archive
-
openerp-expert-framework team
-
Mailing list archive
-
Message #00243
RFC: ORM, support for merging records
Taking a second look at the "account_merge_invoice" I somehow realize now that
there might be a generic need for merging of records in OpenERP.
That is, let ORM have a merge(cr, uid, src=[id1, id2,...], dest=id, ..) [1,2]
function.
The tricky part is to update referencing records. Example, when 2 partners are
merged, all purchase orders should be updated to point to the merged id.
However, this would be quite easy to standardize into the ORM API.
Such a generic implementation should solve the problem of knowing which
modules need to be updated when a merge occurs (what if my custom module also
references partners and I have to update my tables? ). ORM /does/ know all the
table relations.
Of course, the implementation should have hooks, in order to customize the
behaviour at such an update (like, compute totals again or re-position
information, warnings or anything).
What do you think? Has there ever been some thought on this subject, before?
If that's ok with everybody, I think I could start a draft implementation of
the feature at ORM level and ask you again about your opinion.
[1] perhaps name the function "records_merge" or something more unique,
because "merge" is used in some places already.
[2] also, some wizards that implement merging functionality could be ported to
the API.
Follow ups