Openbravo Issue Tracking System - POS2
View Issue Details
0056718POS2POSpublic2024-10-09 20:092025-01-17 08:24
axelmercado 
prakashmurugesan88 
highmajoralways
closedfixed 
5
 
25Q1 
approved
OBPS
110411
No
0056718: Problem with “Maximum discount per role” functionality, does not work correctly.
When we configure a role to be able to apply a certain maximum discount with the new functionality, it does not work if the action “Apply Higher Discount Than Allowed for Role” is not defined for that role, which is not correct.
In Livebuilds: https://livebuilds.openbravo.com/context/retail_pos2_modules_pgsql [^]
1-Configure a new user and assign him the role of “Cashier Central Mountail”.
2-Navigate to the assigned role and configure the detailed actions and the maximum discount as shown in the userActionsRole.png, also in the “Organizations” tab add the Vall Blanca Store organization.
This is so that the user can log in https://livebuilds.openbravo.com/context/retail_pos2_modules_pgsql/web/pos/?terminal=VBS-2 [^] and use it correctly.
3-In the terminal, add a product and to the line, add a manual discount of variable percentage with a value of 55% (we configured before that the maximum is 50%).
4-Apply the discount and verify that it is applied correctly, then delete the order.

5-Back to the backoffice and in the role, add the user action called “Apply Higher Discount Than Allowed for Role” with “Can Use”.
6-Back in the terminal, ctrl+shift+f5 and perform again step 3. Now we can notice that an error message has been displayed correctly.
The error should be displayed without having defined the action “Apply Higher Discount Than Allowed for Role” since, as its name indicates, it should allow the opposite, it should allow exceeding the amount configured in the role header. This is also mentioned in the updated POS2 guide, where it is also mentioned that this action can be configured with “Approval required” for a supervisor to enable the excess discount.
No tags attached.
related to feature request 0055990 closed jarmendariz Maximum discount can be set per Role 
related to defect 0057671 closed prakashmurugesan88 Problem with “Maximum discount per role” functionality, does not work correctly. 
Issue History
2024-10-09 20:09axelmercadoNew Issue
2024-10-09 20:09axelmercadoAssigned To => Retail
2024-10-09 20:09axelmercadoOBNetwork customer => OBPS
2024-10-09 20:09axelmercadoSupport ticket => 110411
2024-10-09 20:09axelmercadoTriggers an Emergency Pack => No
2024-10-09 20:10axelmercadoRelationship addedrelated to 0055990
2024-10-14 13:57jorgewederagoAssigned ToRetail => fofarril
2024-10-14 15:19ivazquezIssue Monitored: ivazquez
2024-10-15 18:48fofarrilStatusnew => scheduled
2024-10-23 22:34hgbotMerge Request Status => open
2024-10-23 22:34hgbotNote Added: 0170850
2024-10-23 22:35hgbotNote Added: 0170851
2024-10-23 22:47ivazquezIssue End Monitor: ivazquez
2024-11-14 15:07hgbotNote Added: 0171983
2024-11-14 15:07hgbotNote Added: 0171984
2024-11-15 21:13hgbotNote Added: 0172061
2024-11-20 09:57hgbotMerge Request Statusopen => approved
2024-11-20 10:03hgbotResolutionopen => fixed
2024-11-20 10:03hgbotStatusscheduled => closed
2024-11-20 10:03hgbotNote Added: 0172305
2024-11-20 10:03hgbotFixed in Version => 25Q1
2024-11-20 10:03hgbotNote Added: 0172306
2024-11-26 00:15ivazquezNote Added: 0172566
2024-11-26 00:15ivazquezStatusclosed => new
2024-11-26 00:15ivazquezResolutionfixed => open
2024-11-26 00:15ivazquezDescription Updatedbug_revision_view_page.php?rev_id=28823#r28823
2024-11-26 00:15ivazquezIssue Monitored: ivazquez
2024-11-26 10:17guilleaerStatusnew => scheduled
2024-12-19 05:25jorgewederagoAssigned Tofofarril => prakashmurugesan88
2025-01-17 06:34prakashmurugesan88Relationship addedrelated to 0057671
2025-01-17 08:24aaroncaleroStatusscheduled => resolved
2025-01-17 08:24aaroncaleroResolutionopen => fixed
2025-01-17 08:24aaroncaleroStatusresolved => closed

Notes
(0170850)
hgbot   
2024-10-23 22:34   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/1621 [^]
(0170851)
hgbot   
2024-10-23 22:35   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/3022 [^]
(0171983)
hgbot   
2024-11-14 15:07   
Merge request closed: https://gitlab.com/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/1621 [^]
(0171984)
hgbot   
2024-11-14 15:07   
Merge request closed: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/3022 [^]
(0172061)
hgbot   
2024-11-15 21:13   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/3101 [^]
(0172305)
hgbot   
2024-11-20 10:03   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/3101 [^]
(0172306)
hgbot   
2024-11-20 10:03   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2 [^]
Changeset: 65de65ca8986e3342929ef839a2ff72b7cc96798
Author: Francisco Javier Deler O'Farril <francisco.ofarril@doceleguas.com>
Date: 20-11-2024 09:03:06
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/commit/65de65ca8986e3342929ef839a2ff72b7cc96798 [^]

Fixes ISSUE-56718: Problem with “Maximum discount per role” functionality, does not work correctly.

---
M web-jspack/org.openbravo.pos2/src/model/ticket/user-actions/discounts/ApplyHigherDiscountThanAllowedForRole.js
M web-jspack/org.openbravo.pos2/src/model/ticket/user-actions/discounts/CheckRoleMaximumDiscountHook.js
---
(0172566)
ivazquez   
2024-11-26 00:15   
Dear Team,

We apply the changes but there is an error in the way decimals and rounding are handled, resulting in inconsistencies when validating the maximum discounts allowed. This allows the system to accept final prices that are below the calculated limits for both the Unit Price and the List Price:

Initial Context:

Product with List Price: 5.90€.
Product with Unit Price (price already reduced): 4.90€.
Observed Behavior:

The system warns that the maximum discount allowed is 16%, based on the Unit Price.

Calculated discount: 4.90€ × 0.16 = 0.784€ ≈ 0.78€ (rounding).
Expected minimum allowed price: €4.90 - €0.78 = €4.12.
However, the POS allows to apply a price of €4.11, which is below the expected limit of €4.12.

Extended Case:

If the original List Price of €5.90 is considered, a maximum discount of 30% would imply:

Minimum price allowed: €5.90 × 0.70 = €4.13.
But the system allows applying a discount that results in a final price of 4.11€, equivalent to a discount of 30.33%, exceeding the established limit.