Openbravo Issue Tracking System - Retail Modules
View Issue Details
0046266Retail ModulesWeb POSpublic2021-04-14 15:212021-04-14 15:21
dmiguelez 
Retail 
normalminoralways
newopen 
5
 
 
No
0046266: 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:21dmiguelezNew Issue
2021-04-14 15:21dmiguelezAssigned To => Retail
2021-04-14 15:21dmiguelezTriggers an Emergency Pack => No

There are no notes attached to this issue.