Openbravo Issue Tracking System - Retail Modules
View Issue Details
0036622Retail ModulesWeb POSpublic2017-08-08 07:222017-10-11 13:22
guillermogil 
ranjith_qualiantech_com 
urgentmajoralways
closedfixed 
5
 
RR17Q4 
marvintm
No
0036622: Add a not needed payment can generate wrong data
If you add a not needed payment (e.g.- add a payment when the total has been paid) if that payment is check as cash it can generate wrong data due to cash change.
It should not be possible to allow that.
- Add this hook to your code:
OB.UTIL.HookManager.registerHook('OBPOS_preAddPayment', function (args, callbacks) {
  if (args.paymentToAdd.get('amount') < 0) {
    args.paymentToAdd.set('paid', args.paymentToAdd.get('amount'));
    args.paymentToAdd.set('origAmount', args.paymentToAdd.get('amount'))
    args.paymentToAdd.set('paymentData', {
      change: 'change payment'
    });
  }
  OB.UTIL.HookManager.callbackExecutor(args, callbacks);
});

- Load WebPOS
- Add an Avalanche transceiver
- Pay totally with card
- Add 5€ as cash

Look the backend, you will see that total payment is wrong,
It should have 2 different solutions:
- It should not be possible to add a payment (first lines of addPayment function) if amount is positive (to grant change) and pending is <= 0
- There should be an additionnal check to ensure that if something has happend with the payments, to not allow it (e.g.- Add a product that cost 10, pay it, then on the same ticket return a product that cost 20) Those cases are not taken into account properly

Update: another case should also be taken into account: if a payment was added to a positive receipt, and then the receipt total changes to a negative amount (because negative lines are added, or a positive line is changed into a negative line), then the payment should also be considered invalid, and the user should also not be able to complete the ticket.
No tags attached.
related to defect 0037264 closed ranjith_qualiantech_com Returning change in a payment method with payment data generates a wrong payment plan 
causes defect 0037224 closed ranjith_qualiantech_com It is not possible to finish a refund with multiple means of payment 
causes defect 0037809 closed ranjith_qualiantech_com [RR18q1] "Unneeded Payments" Error message is not taking conversion rate into account 
patch issue 36622 17Q2 source posterminal 8064.patch (10,907) 2017-10-11 13:22
https://issues.openbravo.com/file_download.php?file_id=11169&type=bug
Issue History
2017-08-08 07:22guillermogilNew Issue
2017-08-08 07:22guillermogilAssigned To => Retail
2017-08-08 07:22guillermogilResolution time => 1503957600
2017-08-08 07:22guillermogilTriggers an Emergency Pack => No
2017-08-10 13:12ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2017-08-10 13:12ranjith_qualiantech_comStatusnew => scheduled
2017-08-23 12:29hgbotCheckin
2017-08-23 12:29hgbotNote Added: 0098610
2017-08-23 12:29hgbotCheckin
2017-08-23 12:29hgbotNote Added: 0098611
2017-08-30 14:33jorge-garciaAssigned Toranjith_qualiantech_com => jorge-garcia
2017-08-31 08:17hgbotCheckin
2017-08-31 08:17hgbotNote Added: 0098741
2017-08-31 08:17hgbotStatusscheduled => resolved
2017-08-31 08:17hgbotResolutionopen => fixed
2017-08-31 08:17hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/2254e99d8586af60e5de058547a90637a4381cec [^]
2017-08-31 14:26hgbotCheckin
2017-08-31 14:26hgbotNote Added: 0098757
2017-08-31 14:26jorge-garciaNote Added: 0098758
2017-08-31 14:26jorge-garciaStatusresolved => new
2017-08-31 14:26jorge-garciaResolutionfixed => open
2017-09-04 17:19marvintmNote Added: 0098818
2017-09-04 17:19marvintmProposed Solution updated
2017-09-07 07:37hgbotCheckin
2017-09-07 07:37hgbotNote Added: 0098876
2017-09-07 08:07hgbotCheckin
2017-09-07 08:07hgbotNote Added: 0098879
2017-09-08 15:22hgbotCheckin
2017-09-08 15:22hgbotNote Added: 0098920
2017-09-08 15:22hgbotStatusnew => resolved
2017-09-08 15:22hgbotResolutionopen => fixed
2017-09-08 15:22hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/2254e99d8586af60e5de058547a90637a4381cec [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/57d9b039b05973d2c55d261800073125f05f35d6 [^]
2017-09-08 15:22hgbotCheckin
2017-09-08 15:22hgbotNote Added: 0098921
2017-09-11 09:36jorge-garciaAssigned Tojorge-garcia => ranjith_qualiantech_com
2017-09-11 11:32marvintmReview Assigned To => marvintm
2017-09-11 11:32marvintmStatusresolved => closed
2017-09-11 11:32marvintmFixed in Version => RR17Q4
2017-10-11 13:22ranjith_qualiantech_comFile Added: issue 36622 17Q2 source posterminal 8064.patch
2017-11-06 07:47guillermogilRelationship addedcauses 0037224
2017-11-08 15:28aaroncaleroRelationship addedrelated to 0037264
2018-02-05 09:02ranjith_qualiantech_comRelationship addedcauses 0037809

Notes
(0098610)
hgbot   
2017-08-23 12:29   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 6252cd13b09ae8f893c339503045e88debdea0a5
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Wed Aug 23 15:58:31 2017 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/6252cd13b09ae8f893c339503045e88debdea0a5 [^]

Related to issue 36622 : Additional Payment should not be allowed if exact amount is paid

---
M web/org.openbravo.retail.posterminal/js/model/order.js
---
(0098611)
hgbot   
2017-08-23 12:29   
Repository: tools/automation/pi-mobile
Changeset: 521702944e3290b2a46edffcfa37d03dec865e24
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Wed Aug 23 15:59:00 2017 +0530
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/521702944e3290b2a46edffcfa37d03dec865e24 [^]

Verifies issue 36622 : Added automated test 'I36622_VerifyReceiptExactPayment'

---
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/reversepayments/ReversePaymentTests.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/system/I32826_VerifyOverpaymentByCashCardII.java
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I36622_VerifyReceiptExactPayment.java
---
(0098741)
hgbot   
2017-08-31 08:17   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 2254e99d8586af60e5de058547a90637a4381cec
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Wed Aug 30 14:27:36 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/2254e99d8586af60e5de058547a90637a4381cec [^]

Fixed issue 36622: Add a not needed payment can generate wrong data

An additional check has been added when done button is clicked.

The check has been also added to multiorders addPayment function.

For reverse payment, it has been added to set in client side the
attribute is ReversePayment for those payment lines loaded from the
backend.

---
M web/org.openbravo.retail.posterminal/js/model/order.js
M web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js
---
(0098757)
hgbot   
2017-08-31 14:26   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: e8a58b4ee7c80e45e5f532b8fca4632fd7283dca
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Thu Aug 31 14:25:44 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/e8a58b4ee7c80e45e5f532b8fca4632fd7283dca [^]

Related to issue 36622: Add a not needed payment can generate wrong data

Backed out changeset 2254e99d8586

---
M web/org.openbravo.retail.posterminal/js/model/order.js
M web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js
---
(0098758)
jorge-garcia   
2017-08-31 14:26   
The last change breaks the cancel and replace functionality
(0098818)
marvintm   
2017-09-04 17:19   
Update: another case should also be taken into account: if a payment was added to a positive receipt, and then the receipt total changes to a negative amount (because negative lines are added, or a positive line is changed into a negative line), then the payment should also be considered invalid, and the user should also not be able to complete the ticket.
(0098876)
hgbot   
2017-09-07 07:37   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 45d7ea5660a207217a0530424598adc422edd4cd
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Wed Sep 06 17:56:48 2017 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/45d7ea5660a207217a0530424598adc422edd4cd [^]

Related to issue 36622: Add a not needed payment can generate wrong data

An additional check has been added when done button is clicked.

The check has been also added to multiorders addPayment function.

For reverse payment, it has been added to set in client side the
attribute is ReversePayment for those payment lines loaded from the
backend.

---
M src-db/database/sourcedata/AD_MESSAGE.xml
M web/org.openbravo.retail.posterminal/js/model/order.js
M web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js
---
(0098879)
hgbot   
2017-09-07 08:07   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 540d54be7475372ed50da85190839550b80180e4
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Thu Sep 07 11:37:18 2017 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/540d54be7475372ed50da85190839550b80180e4 [^]

Related to issue 36622: Add a not needed payment can generate wrong data

Backed out changeset: 45d7ea5660a2

Tests failed in try

---
M src-db/database/sourcedata/AD_MESSAGE.xml
M web/org.openbravo.retail.posterminal/js/model/order.js
M web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js
---
(0098920)
hgbot   
2017-09-08 15:22   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 57d9b039b05973d2c55d261800073125f05f35d6
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Fri Sep 08 18:51:41 2017 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/57d9b039b05973d2c55d261800073125f05f35d6 [^]

Fixed issue 36622: Add a not needed payment can generate wrong data

An additional check has been added when done button is clicked.

The check has been also added to multiorders addPayment function.

For reverse payment, it has been added to set in client side the
attribute is ReversePayment for those payment lines loaded from the
backend.

---
M src-db/database/sourcedata/AD_MESSAGE.xml
M web/org.openbravo.retail.posterminal/js/model/order.js
M web/org.openbravo.retail.posterminal/js/pointofsale/view/payment.js
---
(0098921)
hgbot   
2017-09-08 15:22   
Repository: tools/automation/pi-mobile
Changeset: b207e1da409b029f6e3f2fd4e69a5d5864e24a6a
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Fri Sep 08 18:51:05 2017 +0530
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/b207e1da409b029f6e3f2fd4e69a5d5864e24a6a [^]

Verifies issue 36622 : Modified automated test 'CancelAndRplcPartiallyReduced'

Modified automated test 'I36622_VerifyReceiptExactPayment'

---
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cancelandreplace/CancelAndRplcPartiallyReduced.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cancelandreplace/I35279_CancelAndRplcLayawayII.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I36622_VerifyReceiptExactPayment.java
---