On 06 Feb 12:42, Albert Cervera i Areny wrote: > Yesterday we created our own version [1] of OpenLab's party_merge [2] > module. The module allows merging several parties into another one and > we improved it by: > > - Validating records so we ensure related data and the target record > are all consistent > - Moving most of the logic to a MergeMixin > > As it seems a pretty usual need, is there an interest on moving this > mixin somewhere else so it can be easily used to provide similar > functionality to other places such as Products?
I doubt about such functionality to be generalized. But any way, there are some issue with the code: - use SQL query - wrong identification of table_query and also about the real need, I don't think it exists because there are possible cases: - You have a lot of entry generated by many people (usually external user like webshop). In such case you have to accept to have duplicates and live with it. - You don't have a lot of entry but user made a mistake. So you have to manually merge both because valid data is on both sides. Also you don't have to change the referencial all over the place. You just have to deactivate the duplica. For example, on a posted invoice, you can not change the party without breaking the integrity of the history. -- Cédric Krier - B2CK SPRL Email/Jabber: cedric.kr...@b2ck.com Tel: +32 472 54 46 59 Website: http://www.b2ck.com/