Openbravo Issue Tracking System - Retail Modules
View Issue Details
0054806Retail ModulesRetail API Discountpublic2024-02-29 14:002024-04-18 15:10
AgatheBertin 
Rajesh_18 
normalmajorhave not tried
closedfixed 
5
 
 
No
0054806: API Discount : Error when importing promotion "Buy X pay Y of different product"
When importing json from discount API whit a promotion type Buy X pay Y of different product, the EDL request is in error with this message :

Error while importing an item: class java.lang.Integer cannot be cast to class java.lang.Long (java.lang.Integer and java.lang.Long are in module java.base of loader 'bootstrap')
Integrate the following json through the Promotion API



{"client":"XXXXX","organization":"*","name":"TESTABEMANTIS","discountAmount":0,"discountPercentage":5,"startingDate":"2024-02-01","includedBusinessPartners":"Y","includedBPCategories":"Y","includedProducts":"Y","includedProductCategories":"Y","includedOrganizations":"Y","includePriceLists":"Y","includedCharacteristics":"Y","includedRoles":"Y","excludedCharacteristics":"A","includedExternalBusinessPartners":"Y","discountType":"Buy X pay Y of different product","applyNextDiscount":true,"priceAdjustmentScope":"A","priceAdjustmentType":"P","priceAdjustmentAmount":0,"priceAdjustmentPercentage":0,"xUnits":10,"yUnits":9,"minX":9,"maxX":10,"distributeBetweenLines":false,"percentage":10,"approvalRequired":false,"allowMultipleInstances":false,"applyAfterAutomaticDiscounts":false,"allowInNegativeLines":false,"allowIncreaseLinePrice":true,"totalReceiptAmount":100,"totalPercentageDiscount":15,"isCoupon":false,"buyXGiftYSubtype":"BUYALLXGIFTALLY","applyOnce":false,"applicationMethod":"discretionary","verifyPriceLimit":true,"isOTFCoupon":false,"otfApplyMinCouponAmount":false,"applyToProductsUpToTheMaxQuantity":false,"applyMinCouponAmount":false,"organizations":[],"priceLists":[],"products":[],"productCategories":[],"incompatibleDiscounts":[],"availability":[],"businessPartnerCategories":[],"businessPartnerSets":[],"characteristics":[],"crmPropertyConditions":[],"freeProducts":[],"comboFamilies":[],"priceScales":[],"loyaltyPrograms":[]}
After first analysis this error seems related to the fields xUnit and yUnit
No tags attached.
depends on backport 0055244RR24Q2 closed Rajesh_18 API Discount : Error when importing promotion "Buy X pay Y of different product" 
Issue History
2024-02-29 14:00AgatheBertinNew Issue
2024-02-29 14:00AgatheBertinAssigned To => Retail
2024-02-29 14:00AgatheBertinTriggers an Emergency Pack => No
2024-03-08 14:02jorgewederagoStatusnew => acknowledged
2024-03-11 12:30Rajesh_18Assigned ToRetail => Rajesh_18
2024-03-11 12:30Rajesh_18Statusacknowledged => scheduled
2024-03-13 06:09hgbotNote Added: 0162043
2024-03-15 13:42hgbotResolutionopen => fixed
2024-03-15 13:42hgbotStatusscheduled => closed
2024-03-15 13:42hgbotNote Added: 0162234
2024-03-15 13:42hgbotNote Added: 0162235
2024-04-11 17:59kchoperenaNote Added: 0163118
2024-04-11 17:59kchoperenaNote Added: 0163119
2024-04-11 17:59kchoperenaStatusclosed => new
2024-04-11 17:59kchoperenaResolutionfixed => open
2024-04-11 17:59kchoperenaNote Deleted: 0163118
2024-04-11 18:00kchoperenaNote Edited: 0163119bug_revision_view_page.php?bugnote_id=0163119#r27801
2024-04-15 10:03hgbotNote Added: 0163188
2024-04-15 13:01jorgewederagoStatusnew => scheduled
2024-04-15 14:27hgbotNote Added: 0163231
2024-04-15 14:27hgbotNote Added: 0163232
2024-04-15 14:28jorgewederagoStatusscheduled => resolved
2024-04-15 14:28jorgewederagoResolutionopen => fixed
2024-04-15 14:28jorgewederagoStatusresolved => closed
2024-04-18 13:25Rajesh_18Statusclosed => new
2024-04-18 13:25Rajesh_18Resolutionfixed => open
2024-04-18 13:25Rajesh_18Statusnew => scheduled
2024-04-18 15:10Rajesh_18Statusscheduled => resolved
2024-04-18 15:10Rajesh_18Resolutionopen => fixed
2024-04-18 15:10Rajesh_18Statusresolved => closed

Notes
(0162043)
hgbot   
2024-03-13 06:09   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.api/-/merge_requests/88 [^]
(0162234)
hgbot   
2024-03-15 13:42   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.api [^]
Changeset: 926bac634210b9101c54407247260c2246c264bc
Author: Rajesh Senthilkumar <rajesh@qualiantech.com>
Date: 15-03-2024 12:42:17
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.api/-/commit/926bac634210b9101c54407247260c2246c264bc [^]

Fixed ISSUE-54806: Refactored Property Mapping class for Promotions

---
M src-db/database/sourcedata/OBEI_PROP_MAP_INSTANCE.xml
---
(0162235)
hgbot   
2024-03-15 13:42   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.api/-/merge_requests/88 [^]
(0163119)
kchoperena   
2024-04-11 17:59   
(edited on: 2024-04-11 18:00)
Still failing

Caused by: java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Long (java.lang.Integer and java.lang.Long are in module java.base of loader 'bootstrap')
    at org.openbravo.model.pricing.priceadjustment.PriceAdjustment.getOBDISCX(PriceAdjustment.java:1635) ~[classes/:?]
    at org.openbravo.retail.discounts.event.MOfferEventHandler.checkXYMandatory(MOfferEventHandler.java:105) ~[classes/:?]
    at org.openbravo.retail.discounts.event.MOfferEventHandler.onUpdate(MOfferEventHandler.java:61) ~[classes/:?]

(0163188)
hgbot   
2024-04-15 10:03   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/merge_requests/256 [^]
(0163231)
hgbot   
2024-04-15 14:27   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.api [^]
Changeset: 93c87c80d4b81b263d5334c483249a4a60888b1a
Author: Rajesh Senthilkumar <rajesh@qualiantech.com>
Date: 15-04-2024 11:39:06
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/commit/93c87c80d4b81b263d5334c483249a4a60888b1a [^]

Related to ISSUE-54806: Removed xUnits as they are present in different module

---
M src-db/database/sourcedata/OBEI_PROP_MAP_INSTANCE.xml
---
(0163232)
hgbot   
2024-04-15 14:27   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.api/-/merge_requests/256 [^]