Openbravo Issue Tracking System - Retail Modules
View Issue Details
0052647Retail ModulesRetail APIpublic2023-06-01 18:112023-06-22 08:02
alfonso_alcalde 
ranjith_qualiantech_com 
highmajoralways
closedfixed 
523Q3
 
 
approved
OBPS
No
0052647: API ImportService PriceList ERROR
When trying to import a PriceList via API, and the Default Price List Schema created in the first execution does not exist (it can be deleted from BO) and remains cached in the server, the following error occurs:

ERROR: insert or update on table "m_pricelist_version" violates foreign key constraint "m_pricelist_version_m_discount"
  Detail: Key (m_discountschema_id)=(18C8CB845836403A95275AB61B4636C6) is not present in table "m_discountschema".

If the schema does not exist, in the first execution it is created and cached from the following method:

org.openbravo.api.mappings.pricelist/PriceListVersionOBObjectInitializer/getPriceListSchema.

Attached is json from "sampledata" to reproduce the error.
Delete the price list schema called "Default Price List Schema", if it exists, from BO.

Execute the following API POST method:

/ws/org.openbravo.api.ImportService/PriceList

No products or exceptions are needed.

Attached json with example "sampledata".
No tags attached.
? PriceList.json (430) 2023-06-01 18:11
https://issues.openbravo.com/file_download.php?file_id=18616&type=bug
Issue History
2023-06-01 18:11alfonso_alcaldeNew Issue
2023-06-01 18:11alfonso_alcaldeAssigned To => Triage Platform Conn
2023-06-01 18:11alfonso_alcaldeFile Added: PriceList.json
2023-06-01 18:11alfonso_alcaldeOBNetwork customer => OBPS
2023-06-01 18:11alfonso_alcaldeTriggers an Emergency Pack => No
2023-06-01 18:17marvintmAssigned ToTriage Platform Conn => Retail
2023-06-12 14:20ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2023-06-13 08:22ranjith_qualiantech_comStatusnew => scheduled
2023-06-14 07:51hgbotMerge Request Status => open
2023-06-14 07:51hgbotNote Added: 0151130
2023-06-22 08:02hgbotMerge Request Statusopen => approved
2023-06-22 08:02hgbotResolutionopen => fixed
2023-06-22 08:02hgbotStatusscheduled => closed
2023-06-22 08:02hgbotNote Added: 0151472
2023-06-22 08:02hgbotNote Added: 0151473

Notes
(0151130)
hgbot   
2023-06-14 07:51   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/merge_requests/155 [^]
(0151472)
hgbot   
2023-06-22 08:02   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.api [^]
Changeset: 4f68445023e3fa6661e5fb5c0aaf4bc7a5176302
Author: Ranjith S R <ranjith@qualiantech.com>
Date: 22-06-2023 05:32:20
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/commit/4f68445023e3fa6661e5fb5c0aaf4bc7a5176302 [^]

Fixed ISSUE-52647: PriceListSchema should be always fetched from database
* When importing pricelist, default price list should be fetched from database
  instead of ConcurrentHashMap cache

---
M src/org/openbravo/api/mappings/pricelist/PriceListVersionOBObjectInitializer.java
---
(0151473)
hgbot   
2023-06-22 08:02   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/merge_requests/155 [^]