Openbravo Issue Tracking System - Retail Modules
View Issue Details
0053615Retail ModulesWeb POSpublic2023-10-06 21:562023-10-20 07:18
axelmercado 
Rajesh_18 
urgentmajoralways
closedfixed 
5
 
RR24Q1 
No
0053615: Errors when migrating brands to product characteristics when upgrading to 23Q3
When you want to migrate to the latest version of OB 23Q3, the Retail module script "ConvertBrandIntoCharacteristic.java" fails, because if you have 2 different clients each with their respective brands, it tries to insert 2 times the "Product Characteristic tree" showing the following error:
"[java] 142138 [main] ERROR org.openbravo.retail.posterminal.modulescript.ConvertBrandIntoCharacteristicData - SQL error in query: insert into ad_tree(ad_tree_id, ad_client_id, ad_org_id, createdby, updatedby, name, description, treetype, isallnodes, ad_table_id) values ('899D83A7B7E24F57911A91AE82DCA496', ?, '0', '100', '100', 'Product Characteristic tree', null, 'CH', 'Y', 'E913D17C9B3847CF92235082DBE2EC44') :org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "ad_tree_key"
[java] Detail: Key (ad_tree_id)=(899D83A7B7E24F57911A91AE82DCA496) already exists.
[java] 142138 [main] ERROR org.openbravo.retail.posterminal.modulescript.ConvertBrandIntoCharacteristic - Errors converting brand into characteristic
[java] 142138 [main] ERROR org.openbravo.base.ExecutionLimitBaseProcess - Error executing moduleScript org.openbravo.retail.posterminal.modulescript.ConvertBrandIntoCharacteristic: @CODE=0@ERROR: duplicate key value violates unique constraint "ad_tree_key"
[java] Detail: Key (ad_tree_id)=(899D83A7B7E24F57911A91AE82DCA496) already exists.
[java] javax.servlet.ServletException: @CODE=0@ERROR: duplicate key value violates unique constraint "ad_tree_key"
[java] Detail: Key (ad_tree_id)=(899D83A7B7E24F57911A91AE82DCA496) already exists.".


This is because the (ad_tree_id)=899D83A7B7E24F57911A91AE82DCA496) is inserted in the database for each existing customer that uses the product characteristic tree (See attached screenshots).

<SqlMethod name="insertCharacteristicsTree" type="preparedStatement" connection="true" return="rowCount">
    <SqlMethodComment></SqlMethodComment>
    <Sql>
      <![CDATA[
      insert into ad_tree(ad_tree_id, ad_client_id, ad_org_id, createdby, updatedby, name, description, treetype, isallnodes, ad_table_id) values ('899D83A7B7E24F57911A91AE82DCA496', ?, '0', '100', '100', 'Product Characteristic tree', null, 'CH', 'Y', 'E913D17C9B3847CF92235082DBE2EC44')
      ]]>
    </Sql>
    <Parameter name="adClientId"/>
N/A
No tags attached.
related to defect 0045935 closed ranjith_qualiantech_com Openbravo ERP Errors when migrating brands to product characteristics when upgrading to 20Q4.1 
png cap1.png (176,269) 2023-10-06 21:56
https://issues.openbravo.com/file_download.php?file_id=19022&type=bug
png
Issue History
2023-10-06 21:56axelmercadoNew Issue
2023-10-06 21:56axelmercadoAssigned To => Retail
2023-10-06 21:56axelmercadoFile Added: cap1.png
2023-10-06 21:56axelmercadoTriggers an Emergency Pack => No
2023-10-06 22:11axelmercadoRelationship addedrelated to 0045935
2023-10-06 23:07PracticsIssue Monitored: Practics
2023-10-09 08:51Rajesh_18Assigned ToRetail => Rajesh_18
2023-10-09 08:51Rajesh_18Statusnew => scheduled
2023-10-09 16:34axelmercadoDescription Updatedbug_revision_view_page.php?rev_id=26952#r26952
2023-10-12 07:03hgbotNote Added: 0155796
2023-10-20 07:18hgbotResolutionopen => fixed
2023-10-20 07:18hgbotStatusscheduled => closed
2023-10-20 07:18hgbotFixed in Version => RR24Q1
2023-10-20 07:18hgbotNote Added: 0156102
2023-10-20 07:18hgbotNote Added: 0156103

Notes
(0155796)
hgbot   
2023-10-12 07:03   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/1382 [^]
(0156102)
hgbot   
2023-10-20 07:18   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal [^]
Changeset: 2c11a040917df500019da98d8f1b784390219752
Author: Rajesh Senthilkumar <rajesh@qualiantech.com>
Date: 20-10-2023 05:18:33
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/2c11a040917df500019da98d8f1b784390219752 [^]

Fixes ISSUE-53615: Added Client condition while migrating brands to product characteristics

---
M build/classes/org/openbravo/retail/posterminal/modulescript/ConvertBrandIntoCharacteristic.class
M build/classes/org/openbravo/retail/posterminal/modulescript/ConvertBrandIntoCharacteristicData.class
M src-util/modulescript/src/org/openbravo/retail/posterminal/modulescript/ConvertBrandIntoCharacteristic.java
M src-util/modulescript/src/org/openbravo/retail/posterminal/modulescript/ConvertBrandIntoCharacteristic_data.xsql
---
(0156103)
hgbot   
2023-10-20 07:18   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/1382 [^]