Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0053228Openbravo ERP02. Master data managementpublic2023-08-17 13:272023-09-08 14:57
Leyre 
AugustoMauch 
normalmajoralways
closedfixed 
5
 
PR23Q4 
Core
No
0053228: Error when trying to delete a variant with a new column "image BLOB" in m_product table.
Error when trying to delete a variant with a new column "image BLOB" in m_product table.
1. Create a new column in the m_product table that references to an image:
ALTER TABLE public.m_product ADD COLUMN em_pit_sketch_image_id character varying(32);
ALTER TABLE public.m_product
ADD CONSTRAINT em_pit_prod_sketch_imag FOREIGN KEY (em_pit_sketch_image_id)
REFERENCES public.ad_image (ad_image_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION;

2. As 'System Administrator':
  2.1 In the m_product table, add the new column (using the "create columns form DB" button) and set Reference: Image BLOB.
  2.2 In the "Product" window, add a new field -> Column: EM_Pit_Sketch_Image_ID and name: test.
  
3. As 'The White Valley Group Admin - The White Valley Group':
  3.1 Configure a new generic product and add an image in the test section.
  3.2 Add a Characteristic for this product.
  
4. Click on "Create Variants" button and confirm that there are new products-variants.

5. Try to delete one of the new product/variant created and confirm that it is not possible:

Error: This record cannot be deleted because it is associated with other existing elements. Please see Linked Items
Fix: See attached possible .diff
No tags attached.
diff fixEliminarVarianteConImagenes.diff (1,880) 2023-08-17 13:27
https://issues.openbravo.com/file_download.php?file_id=18876&type=bug
Issue History
2023-08-17 13:27LeyreNew Issue
2023-08-17 13:27LeyreAssigned To => Triage Omni OMS
2023-08-17 13:27LeyreFile Added: fixEliminarVarianteConImagenes.diff
2023-08-17 13:27LeyreModules => Core
2023-08-17 13:27LeyreTriggers an Emergency Pack => No
2023-08-17 13:34PracticsIssue Monitored: Practics
2023-08-17 14:07aferrazAssigned ToTriage Omni OMS => Triage Platform Base
2023-09-05 17:28hgbotNote Added: 0154520
2023-09-06 08:21AugustoMauchAssigned ToTriage Platform Base => AugustoMauch
2023-09-06 08:21AugustoMauchStatusnew => scheduled
2023-09-08 14:57hgbotNote Added: 0154644
2023-09-08 14:57hgbotResolutionopen => fixed
2023-09-08 14:57hgbotStatusscheduled => closed
2023-09-08 14:57hgbotFixed in Version => PR23Q4
2023-09-08 14:57hgbotNote Added: 0154645

Notes
(0154520)
hgbot   
2023-09-05 17:28   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/988 [^]
(0154644)
hgbot   
2023-09-08 14:57   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/988 [^]
(0154645)
hgbot   
2023-09-08 14:57   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: b8172c7f81d0bd1ff96f38ff778320df43b003e0
Author: Augusto Mauch <augusto.mauch@openbravo.com>
Date: 08-09-2023 12:57:01
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/b8172c7f81d0bd1ff96f38ff778320df43b003e0 [^]

Fixes ISSUE-53228: Variant product with custom images can be deleted

The problem was that the check being done in RemoveImagesEventHandler to determine if a given image was still
referenced by other records was not done properly. The check was always being done against the product.ad_image_id
column, even though the image property being checked could be another.

As part of this fix, also the hardcoded reference to Product has been updated, to make sure this event handler works
with other entities that contain product images

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/event/RemoveImagesEventHandler.java
---