Add 'additive fields' concept to merge diff preview
This commit is contained in:
parent
7dd19c6d87
commit
fe978a9bd2
|
@ -413,6 +413,11 @@ class MasterView(View):
|
|||
return self.merge_coalesce_fields
|
||||
return []
|
||||
|
||||
def get_merge_additive_fields(self):
|
||||
if hasattr(self, 'merge_additive_fields'):
|
||||
return self.merge_additive_fields
|
||||
return []
|
||||
|
||||
def merge(self):
|
||||
"""
|
||||
Preview and execute a merge of two records.
|
||||
|
@ -463,6 +468,11 @@ class MasterView(View):
|
|||
for field in self.get_merge_coalesce_fields():
|
||||
if remove[field] and not keep[field]:
|
||||
result[field] = remove[field]
|
||||
for field in self.get_merge_additive_fields():
|
||||
if isinstance(keep[field], (list, tuple)):
|
||||
result[field] = sorted(set(remove[field] + keep[field]))
|
||||
else:
|
||||
result[field] = remove[field] + keep[field]
|
||||
return result
|
||||
|
||||
def merge_objects(self, removing, keeping):
|
||||
|
|
Loading…
Reference in a new issue