Openbravo Issue Tracking System - Retail Modules
View Issue Details
0055222Retail ModulesRetail APIpublic2024-04-17 14:302024-09-18 07:25
azzeddine_meftoh 
alostale 
highmajorhave not tried
closedfixed 
5
main 
 
No
0055222: Price API - importing price for deactivated product
When importing a price for a deativated product we get the error :
ERROR: duplicate key value violates unique constraint "m_productprice_pricelist_ve_un"
Import a price for a product with the API
Deactivate the product
Import against a price for this product with the API for the same pricelist version
Remove filters for active products
No tags attached.
related to defect 0053912 closed SABARINATH P Retail Modules API PriceList ERROR updating inactive product 
related to defect 0056207 closed alostale Modules Pricelist API : The product price active flag is not updated 
? issue55222-lb.mkv (1,904,785) 2024-09-03 13:36
https://issues.openbravo.com/file_download.php?file_id=20124&type=bug
? request.json (1,802) 2024-09-03 15:37
https://issues.openbravo.com/file_download.php?file_id=20126&type=bug
Issue History
2024-04-17 14:30azzeddine_meftohNew Issue
2024-04-17 14:30azzeddine_meftohAssigned To => Triage Platform Conn
2024-04-17 14:30azzeddine_meftohTriggers an Emergency Pack => No
2024-04-17 14:49victor_perezSeverityminor => major
2024-04-18 10:29jorgewederagoAssigned ToTriage Platform Conn => Retail
2024-04-18 10:29jorgewederagoStatusnew => acknowledged
2024-04-18 10:37adrianromeroNote Added: 0163352
2024-04-18 10:37adrianromeroStatusacknowledged => closed
2024-04-18 10:37adrianromeroResolutionopen => no change required
2024-06-27 09:39marvintmAssigned ToRetail => Triage Platform Conn
2024-06-27 09:39marvintmNote Added: 0166405
2024-06-27 09:39marvintmStatusclosed => new
2024-06-27 09:39marvintmResolutionno change required => open
2024-06-28 10:19caristuNote Added: 0166459
2024-06-28 10:19caristuAssigned ToTriage Platform Conn => azzeddine_meftoh
2024-06-28 10:19caristuStatusnew => feedback
2024-08-12 12:08marvintmStatusfeedback => closed
2024-08-12 12:08marvintmResolutionopen => unable to reproduce
2024-09-03 13:30martinsdanAssigned Toazzeddine_meftoh => Triage Platform Conn
2024-09-03 13:30martinsdanStatusclosed => new
2024-09-03 13:30martinsdanResolutionunable to reproduce => open
2024-09-03 13:34martinsdanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=28402#r28402
2024-09-03 13:34martinsdanProposed Solution updated
2024-09-03 13:36martinsdanFile Added: issue55222-lb.mkv
2024-09-03 13:36martinsdanNote Added: 0168700
2024-09-03 13:43adrianromeroNote Added: 0168702
2024-09-03 15:37martinsdanFile Added: request.json
2024-09-03 15:39martinsdanNote Added: 0168708
2024-09-06 10:48rafarodaPrioritynormal => high
2024-09-09 10:28alostaleNote Added: 0168919
2024-09-09 10:29alostaleRelationship addedrelated to 0053912
2024-09-09 10:29alostaleAssigned ToTriage Platform Conn => alostale
2024-09-09 11:15hgbotNote Added: 0168923
2024-09-09 11:18alostaleStatusnew => scheduled
2024-09-09 14:19Rick1212Note Added: 0168955
2024-09-10 10:28shuehnerNote Deleted: 0168955
2024-09-12 11:36alostaleRelationship addedrelated to 0056207
2024-09-18 07:25hgbotResolutionopen => fixed
2024-09-18 07:25hgbotStatusscheduled => closed
2024-09-18 07:25hgbotNote Added: 0169298
2024-09-18 07:25hgbotNote Added: 0169299

Notes
(0163352)
adrianromero   
2024-04-18 10:37   
This is the expected behaviour when trying to import any Openbravo entity with the same keys as another existing deactivated entity.

Deactivated entities are maintanined in the database for reference and reporting purposes but cannot be used in new processes or selected, etc... and as consequence:

* Deactivated records cannot be updated by the import API and kept deactivated
* Deactivated records cannot be reactivated and updated as a result of an import API request
* Openbravo cannot create a new activated record due the database constraints that can end in an inconsistent database with two records with the same keys, one activated and the other deactivated.
(0166405)
marvintm   
2024-06-27 09:39   
After further discussion, it is clear that this is a problem when trying to use the API to maintain masterdata entities so that the POS can correctly consume them. So we need to fix it somehow.

The final approach that will be used to handle this case is still to be decided by platform team. They will review it and then propose changes to handle this case.
(0166459)
caristu   
2024-06-28 10:19   
We are not able to reproduce the issue with the provided steps. In this type of cases a request example usually helps.
(0168700)
martinsdan   
2024-09-03 13:36   
I reopened the issue, updated the steps to reproduce and added a video.
(0168702)
adrianromero   
2024-09-03 13:43   
This issue is registered as RM-16449 [NOZ] Being able to activate/deactivate a price in a pricelist version by API

That is candidate for October Sprint.
(0168708)
martinsdan   
2024-09-03 15:39   
I added the json used to reproduce the problem in livebuilds.
(0168919)
alostale   
2024-09-09 10:28   
This is happening if org.openbravo.commercialoperations.api module is installed.
(0168923)
hgbot   
2024-09-09 11:15   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.commercialoperations.api/-/merge_requests/18 [^]
(0169298)
hgbot   
2024-09-18 07:25   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.commercialoperations.api [^]
Changeset: 40fb25ff9e2a1baf179da0f41d377833c6074f8d
Author: Asier Lostalé <a.lostale@orisha.com>
Date: 09-09-2024 11:12:11
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.commercialoperations.api/-/commit/40fb25ff9e2a1baf179da0f41d377833c6074f8d [^]

fixes BUG-55222: error updating price for inactive products

If a product was inactive and its price was tried to be updated through API, a
unique constraint error was thrown. The problem was caused because that product
was not found so a new product price row was tried to be inserted.

Fixed by obtaining products even if they are inactive.

---
M src/org/openbravo/commercialoperations/api/hook/productPriceException/ProductPriceBaseOBObjectFetcher.java
---
(0169299)
hgbot   
2024-09-18 07:25   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.commercialoperations.api/-/merge_requests/18 [^]