Openbravo Issue Tracking System - Retail Modules | |||||||||||||||||||
View Issue Details | |||||||||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||||||||
0045016 | Retail Modules | Web POS | public | 2020-09-09 16:12 | 2020-09-21 11:44 | ||||||||||||||
Reporter | alostale | ||||||||||||||||||
Assigned To | Retail | ||||||||||||||||||
Priority | normal | Severity | major | Reproducibility | have not tried | ||||||||||||||
Status | closed | Resolution | fixed | ||||||||||||||||
Platform | OS | 5 | OS Version | ||||||||||||||||
Product Version | |||||||||||||||||||
Target Version | Fixed in Version | RR20Q4 | |||||||||||||||||
Merge Request Status | |||||||||||||||||||
Review Assigned To | |||||||||||||||||||
OBNetwork customer | |||||||||||||||||||
Support ticket | |||||||||||||||||||
Regression level | |||||||||||||||||||
Regression date | |||||||||||||||||||
Regression introduced in release | |||||||||||||||||||
Regression introduced by commit | |||||||||||||||||||
Triggers an Emergency Pack | No | ||||||||||||||||||
Summary | 0045016: state actions mutate objects | ||||||||||||||||||
Description | Some state actions perform mutations in objects that should be immutable. | ||||||||||||||||||
Steps To Reproduce | Some cases are detected by current tests if they are run in strict mode which does not allow to reassign frozen objects [1]. $ node --use_strict node_modules/.bin/jest ... Summary of all failing tests FAIL modules/org.openbravo.retail.posterminal/web-test/model/business-object/cashup/Cashup-updateCashupFunction-afterTicketDone.test.js ● Cashup - updateCashup function › updateCashup in ticket done TypeError: Cannot assign to read only property 'amount' of object '#<Object>' 332 | })[0]; 333 | if (cashupTax) { > 334 | cashupTax.amount = OB.DEC.add( | ^ 335 | cashupTax.amount, 336 | newCashupTax.taxAmount 337 | ); at forEach (modules/org.openbravo.retail.posterminal/web/org.openbravo.retail.posterminal/app/model/business-object/cashup/CashupUtils.js:334:11) at Array.forEach (<anonymous>) at Object.countTicketInCashup (modules/org.openbravo.retail.posterminal/web/org.openbravo.retail.posterminal/app/model/business-object/cashup/CashupUtils.js:324:22) at Object.updateCashupFromTicket (modules/org.openbravo.retail.posterminal/web/org.openbravo.retail.posterminal/app/model/business-object/cashup/CashupUtils.js:401:51) at Object.<anonymous> (modules/org.openbravo.retail.posterminal/web-test/model/business-object/cashup/Cashup-updateCashupFunction-afterTicketDone.test.js:34:46) FAIL modules/org.openbravo.retail.posterminal/web-test/model/business-object/ticket/actions/CompleteCreditTicket.test.js ● Complete Credit ticket action › should complete ticket with credit, print it and synchronize it TypeError: Cannot assign to read only property 'creditUsed' of object '#<Object>' 27 | // Set complete ticket properties 28 | newTicket.payOnCredit = true; > 29 | newTicket.businessPartner.creditUsed += OB.DEC.mul( | ^ 30 | OB.DEC.abs( 31 | OB.DEC.sub(newTicket.grossAmount, newTicket.paymentWithSign) 32 | ), at Object.completeCreditTicket (modules/org.openbravo.retail.posterminal/web/org.openbravo.retail.posterminal/app/model/business-object/ticket/actions/CompleteCreditTicket.js:29:7) at Object.<anonymous> (modules/org.openbravo.retail.posterminal/web-test/model/business-object/ticket/actions/CompleteCreditTicket.test.js:72:45) FAIL modules/org.openbravo.retail.posterminal/web-test/model/business-object/cashup/Cashup-initCashup-StateAction-fromLocal.test.js ● Cashup - init cashup State Action - from local › initialize cashup from local - new Payment TypeError: Cannot assign to read only property 'cashPaymentMethodInfo' of object '#<Object>' 58 | const cashupWithoutCard = { ...cleanCashup }; 59 | deepfreeze(cashupWithoutCard); > 60 | cashupWithoutCard.cashPaymentMethodInfo = cashupWithoutCard.cashPaymentMethodInfo.filter( | ^ 61 | payment => payment.name !== 'Card' 62 | ); 63 | const initialState = { Cashup: cashupWithoutCard }; at Object.<anonymous> (modules/org.openbravo.retail.posterminal/web-test/model/business-object/cashup/Cashup-initCashup-StateAction-fromLocal.test.js:60:5) ● Cashup - init cashup State Action - from local › initialize cashup from local - payment name changed TypeError: Cannot assign to read only property 'terminalPayments' of object '#<Object>' 90 | const payloadPaymentNameChanged = { ...payloadInitFromLocal }; 91 | deepfreeze(payloadPaymentNameChanged); > 92 | payloadPaymentNameChanged.terminalPayments = [ | ^ 93 | ...payloadInitFromLocal.terminalPayments 94 | ]; 95 | payloadPaymentNameChanged.terminalPayments[0].paymentMethod = { at Object.<anonymous> (modules/org.openbravo.retail.posterminal/web-test/model/business-object/cashup/Cashup-initCashup-StateAction-fromLocal.test.js:92:5) FAIL modules/org.openbravo.retail.posterminal/web-test/model/business-object/cashup/Cashup-initCashup-StateAction-fromBackend.test.js ● Cashup - init cashup State Action - from backend › initialize cashup from backend TypeError: Cannot assign to read only property 'totalStartings' of object '#<Object>' 143 | ); 144 | paymentMethods.push(paymentFromBackend); > 145 | currentCashupFromBackend.totalStartings = OB.DEC.add( | ^ 146 | currentCashupFromBackend.totalStartings, 147 | paymentFromBackend.startingCash 148 | ); at forEach (modules/org.openbravo.retail.posterminal/web/org.openbravo.retail.posterminal/app/model/business-object/cashup/PaymentMethodUtils.js:145:13) at Array.forEach (<anonymous>) at Object.addPaymentsFromBackendCashup (modules/org.openbravo.retail.posterminal/web/org.openbravo.retail.posterminal/app/model/business-object/cashup/PaymentMethodUtils.js:119:54) at initCashup (modules/org.openbravo.retail.posterminal/web/org.openbravo.retail.posterminal/app/model/business-object/cashup/actions/InitCashup.js:61:71) at Object.<anonymous> (modules/org.openbravo.retail.posterminal/web-test/model/business-object/cashup/Cashup-initCashup-StateAction-fromBackend.test.js:66:20) FAIL modules/org.openbravo.retail.posterminal/web-test/model/business-object/ticket/CompleteTicketUtils-GenerateInvoice.test.js ● Ticket Utils generateInvoice function › should generate invoice when completing an immediate ticket with generateInvoice flag TypeError: Cannot add property ignorePromotions, object is not extensible 292 | invoiceLine.qty = qtyToInvoice; 293 | invoiceLine.orderLineId = line.id; > 294 | invoiceLine.product.ignorePromotions = true; | ^ 295 | invoiceLine.product.img = undefined; 296 | 297 | if (OB.DEC.abs(qtyAlreadyInvoiced) > 0) { at flatMap (modules/org.openbravo.retail.posterminal/web/org.openbravo.retail.posterminal/app/model/business-object/ticket/CompleteTicketUtils.js:294:7) at Array.flatMap (<anonymous>) at Object.generateInvoice (modules/org.openbravo.retail.posterminal/web/org.openbravo.retail.posterminal/app/model/business-object/ticket/CompleteTicketUtils.js:267:39) at Object.<anonymous> (modules/org.openbravo.retail.posterminal/web-test/model/business-object/ticket/CompleteTicketUtils-GenerateInvoice.test.js:25:49) Test Suites: 5 failed, 99 passed, 104 total Tests: 6 failed, 1072 passed, 1078 total --- [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Read-only [^] | ||||||||||||||||||
Proposed Solution | |||||||||||||||||||
Additional Information | |||||||||||||||||||
Tags | No tags attached. | ||||||||||||||||||
Relationships |
| ||||||||||||||||||
Attached Files | |||||||||||||||||||
Issue History | |||||||||||||||||||
Date Modified | Username | Field | Change | ||||||||||||||||
2020-09-09 16:12 | alostale | New Issue | |||||||||||||||||
2020-09-09 16:12 | alostale | Assigned To | => Retail | ||||||||||||||||
2020-09-09 16:12 | alostale | Triggers an Emergency Pack | => No | ||||||||||||||||
2020-09-09 16:19 | alostale | Relationship added | related to 0045019 | ||||||||||||||||
2020-09-17 22:23 | hgbot | Note Added: 0123195 | |||||||||||||||||
2020-09-21 11:28 | marvintm | Relationship added | related to 0045098 | ||||||||||||||||
2020-09-21 11:44 | hgbot | Resolution | open => fixed | ||||||||||||||||
2020-09-21 11:44 | hgbot | Status | new => closed | ||||||||||||||||
2020-09-21 11:44 | hgbot | Fixed in Version | => RR20Q4 | ||||||||||||||||
2020-09-21 11:44 | hgbot | Note Added: 0123259 | |||||||||||||||||
2020-09-21 11:44 | hgbot | Note Added: 0123261 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|