Openbravo Issue Tracking System - Retail Modules
View Issue Details
0046267Retail ModulesWeb POSpublic2021-04-14 15:222021-04-15 14:52
dmiguelez 
Retail 
normalminoralways
closedfixed 
5
 
RR21Q3 
No
0046267: Reject Quotations State Action should be complete
The implementation of Reject Quotation Action as a State Action is not complete:
https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/a03f9f24187c745ab8c0806a30d4967595a5eaf8 [^]

The action is executed from order.js
    rejectQuotation: function(rejectReasonId, scope, callback) {
      OB.App.State.Global.rejectQuotation({ rejectReasonId }).then(() => {
        if (callback) {
          callback.call(scope, true);
        }
      });
    },

After the action is executed, in pointofsale.js, the action deleteCurrentOrder is executed (this action is defined in order.js):
  rejectQuotation: function(inSender, inEvent) {
    this.model
      .get('order')
      .rejectQuotation(inEvent.rejectReason, this, function(success) {
        if (success) {
          this.deleteCurrentOrder(inSender, inEvent);
        }
      });
    return true;
  },

The action to delete the Current Order updates the state of the TicketList to remove the Quotation that has been rejected.

This logic should be implemented in the RejectQuotation State Action and also, in general, State Actions should not be called from within State Actions in order to ensure the proper behavior as pure functions.
In the POS, log in as Vallblanca.

From the Menu click on Create Sales Quotation.
Add a product to the Ticket and complete the Quotation by clicking on Checkout
From the Menu click on Reject Quotation, select a Reject Reason and Confirm
The UI Changes to a new Ticket
diff --git a/web/org.openbravo.retail.posterminal/app/model/business-object/ticket/actions/RejectQuotation.js b/web/org.openbravo.retail.posterminal/app/model/business-object/ticket/actions/RejectQuotation.js
index c30273bb2..78be40f1a 100644
--- a/web/org.openbravo.retail.posterminal/app/model/business-object/ticket/actions/RejectQuotation.js
+++ b/web/org.openbravo.retail.posterminal/app/model/business-object/ticket/actions/RejectQuotation.js
@@ -11,6 +11,8 @@
     rejectQuotation(state, payload) {
       const newState = { ...state };
       const { rejectReasonId } = payload;
+ let newTicketList = [...newState.TicketList];
+ let newTicket = { ...newState.Ticket };
 
       const rejectQuotationMessage = OB.App.State.Messages.Utils.createNewMessage(
         'OBPOS_Order',
@@ -26,6 +28,19 @@
         }
       );
       newState.Messages = [...newState.Messages, rejectQuotationMessage];
+
+ // TicketList update
+ ({
+ ticketList: newTicketList,
+ ticket: newTicket
+ } = OB.App.State.TicketList.Utils.removeTicket(
+ newTicketList,
+ newTicket,
+ payload
+ ));
+
+ newState.TicketList = newTicketList;
+ newState.Ticket = newTicket;
       return newState;
     }
   });
No tags attached.
Issue History
2021-04-14 15:22dmiguelezNew Issue
2021-04-14 15:22dmiguelezAssigned To => Retail
2021-04-14 15:22dmiguelezTriggers an Emergency Pack => No
2021-04-14 18:39hgbotNote Added: 0127276
2021-04-15 14:52hgbotResolutionopen => fixed
2021-04-15 14:52hgbotStatusnew => closed
2021-04-15 14:52hgbotNote Added: 0127293
2021-04-15 14:52hgbotFixed in Version => RR21Q3
2021-04-15 14:52hgbotNote Added: 0127294
2021-04-15 14:52hgbotNote Added: 0127295

Notes
(0127276)
hgbot   
2021-04-14 18:39   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/379 [^]
(0127293)
hgbot   
2021-04-15 14:52   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/379 [^]
(0127294)
hgbot   
2021-04-15 14:52   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal [^]
Changeset: e7e2ba11520a85ca186b14cfcfa25f6a61a6b2f4
Author: David Miguelez <david.miguelez@openbravo.com>
Date: 2021-04-14T18:33:17+02:00
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/e7e2ba11520a85ca186b14cfcfa25f6a61a6b2f4 [^]

Fixes ISSUE-46267. Completes Reject Quotation State Action

All the related logic should be executed within this State Action.
This includes closing the current Ticket and opening a new one in
the UI

---
M web/org.openbravo.retail.posterminal/app/model/business-object/ticket/actions/RejectQuotation.js
M web/org.openbravo.retail.posterminal/js/model/order.js
M web/org.openbravo.retail.posterminal/js/pointofsale/view/pointofsale.js
---
(0127295)
hgbot   
2021-04-15 14:52   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal [^]
Changeset: 23136ac23a3a633812f11b2568b120dd4fdf62ca
Author: David Miguelez <david.miguelez@openbravo.com>
Date: 2021-04-15T11:39:24+02:00
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/23136ac23a3a633812f11b2568b120dd4fdf62ca [^]

Related to ISSUE-46267: Code Review Changes
* Send the rejectReasonId directly to the method that creates the payload
* Change the tab of the new ticket to scan

---
M web/org.openbravo.retail.posterminal/js/model/order.js
---