Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0041444Openbravo ERPA. Platformpublic2019-07-24 14:042023-09-05 09:52
Triage Platform Base 
normalminorhave not tried
0041444: Delete AD_Preference linked to a property that is deleted
In Preference window (AD_Preference) you can define preferences linked to a property list (AD_Preference.Property). In this case the list is populated with any value from the "Property Configuration" Reference list (AD_REF_LIST.value).

Example, I have a property configuration reference called "My preference" with value "MYPREF". When this property is included into a Preference, the AD_Preference.Property will be "MYPREF".

If the reference list property is deleted from the Reference | List Reference tab (AD_REF_LIST), the Preference is not deleted and the Property field in the Preference window shows "*** Not found *" in form view (in grid view you can still see the old name).

Ideally any preference linked to a property list reference that was been deleted should be deleted too, as it has no sense and might be confusing. This is however not possible through a standard "FK on delete cascade", because there is not a unique constraint defined in AD_REF_LIST.value column.
As system admin.
Go to Module window and set as indevelopment the following modules: Core and Advanced Payables and Receivables Mngmt
Go to Preference window and search for preference with property "Implements Payment Monitor management". Keep it open
Go to Reference window and search for "Property Configuration".
Go to List Reference Tab and search for "PaymentMonitor". Delete it.
Go back to Preference window and refresh the record originally linked to the "Implements Payment Monitor management" property. Check the property now shows "*** Not found *" in form view (in grid view you can still see the old name)
Try to create a mechanism to automatically delete any preference linked to a property value that doesn't exist anymore in the AD_REF_LIST for the "Property Configuration" reference.
No tags attached.
blocks defect 0041445 new Triage Omni OMS Delete "Implements Payment Monitor management" Property Configuration List reference 
png notFoundProperty.png (24,864) 2019-07-24 14:05
Issue History
2019-07-24 14:04vmromanosNew Issue
2019-07-24 14:04vmromanosAssigned To => platform
2019-07-24 14:04vmromanosModules => Core
2019-07-24 14:04vmromanosTriggers an Emergency Pack => No
2019-07-24 14:05vmromanosFile Added: notFoundProperty.png
2019-07-24 14:10vmromanosRelationship addedblocks 0041445
2019-08-26 08:46AugustoMauchNote Added: 0114264
2019-08-26 08:46AugustoMauchTypedefect => design defect
2022-02-01 08:07alostaleAssigned Toplatform => Triage Platform Base
2023-09-05 09:52sharabNote Added: 0154439
2023-09-05 10:46priyamNote Deleted: 0154439

2019-08-26 08:46   
dbsourcemanager does something similar for foreign keys, when the referenced AD record is removed, all entries referencing it are automatically removed.

This cannot be done for List reference, since foreign keys cannot be defined because the referencing column stores the search key of the ad_ref_list table, not its primary key.

An alternative would be to define a modulescript that automatically removes references to removed preferences, but for the time being it is not done because:
- It would have to be executed on each update.database (as opposed to most modulescripts that are executed only once)
- It is a partial solution that would require a modulescript per table that references an ad_ref_list bound to be removed.