|
@@ -348,14 +348,14 @@ class MultipleRef(Reference):
|
348
|
348
|
br_list = list()
|
349
|
349
|
if br_id not in br_list:
|
350
|
350
|
br_list.append(br_id)
|
351
|
|
- logger.info('The referenced object has to be updated')
|
352
|
351
|
return l_value
|
353
|
352
|
|
354
|
353
|
## @brief Checks the backreference, updates it if it is not complete
|
355
|
354
|
# @param emcomponent EmComponent : An EmComponent child class instance
|
356
|
355
|
# @param fname : the field name
|
357
|
356
|
# @param datas dict : dict storing fields values
|
358
|
|
- def make_consistency(self, emcomponent, fname, datas):
|
|
357
|
+ # @note Not done in case of delete
|
|
358
|
+ def make_consistency(self, emcomponent, fname, datas, type_query):
|
359
|
359
|
dh = emcomponent.field(fname)
|
360
|
360
|
|
361
|
361
|
logger.info('Warning : multiple uid capabilities are broken here')
|
|
@@ -364,7 +364,6 @@ class MultipleRef(Reference):
|
364
|
364
|
target_class = self.back_ref[0]
|
365
|
365
|
target_field = self.back_ref[1]
|
366
|
366
|
target_uidfield = target_class.uid_fieldname()[0]
|
367
|
|
-
|
368
|
367
|
l_value = datas[fname]
|
369
|
368
|
|
370
|
369
|
if l_value is not None:
|
|
@@ -382,6 +381,20 @@ class MultipleRef(Reference):
|
382
|
381
|
l_uids_ref.append(uid)
|
383
|
382
|
obj[0].set_data(target_field, l_uids_ref)
|
384
|
383
|
obj[0].update()
|
|
384
|
+
|
|
385
|
+ if type_query == 'update':
|
|
386
|
+ query_filters = list()
|
|
387
|
+ query_filters.append((uid, ' in ', target_field))
|
|
388
|
+ objects = target_class.get(query_filters)
|
|
389
|
+ if l_value is None:
|
|
390
|
+ l_value = list()
|
|
391
|
+ if len(objects) != len(l_value):
|
|
392
|
+ for obj in objects:
|
|
393
|
+ l_uids_ref = obj.data(target_field)
|
|
394
|
+ if obj.data(target_uidfield) not in l_value:
|
|
395
|
+ l_uids_ref.remove(uid)
|
|
396
|
+ obj.set_data(target_field, l_uids_ref)
|
|
397
|
+ obj.update()
|
385
|
398
|
|
386
|
399
|
## @brief Class designed to handle datas access will fieldtypes are constructing datas
|
387
|
400
|
#
|