Openbravo Issue Tracking System - Retail Modules
View Issue Details
0047398Retail ModulesWeb POSpublic2021-07-15 11:122021-08-24 11:40
sebastien_liron 
ranjith_qualiantech_com 
urgentmajorrandom
closedfixed 
5
RR20Q3.4 
RR20Q3.4 
marvintm
No
0047398: Error while importing : taxes field is wrong
After some investigation the problem is that the code in Web POS is failing and not calculating the taxes when the ticket is DELETED and synchronized to the backend (it happens randomly and we don’t know exactly why)

Due to this problem, the taxes property in the order are arriving as an array instead of JSON:
Taxes: [] <— wrong
Taxes: {} <— right
As it is random we cannot ensure the steps
It just happens on standard ticket deletion
WE made this as a quick patch, but this is not the source issue fix :

OB.UTIL.HookManager.registerHook(
    'OBPOS_PreSyncReceipt',
    (args, callbacks) => {
      const order = args.receipt;
      if (
        (order.get('obposIsDeleted') &&
          OB.UTIL.isNullOrUndefined(order.get('taxes'))) ||
        order.get('taxes') instanceof Array
      ) {
        order.set('taxes', {});
        order.get('lines').models.forEach(line => {
          if (OB.UTIL.isNullOrUndefined(order.get('net'))) {
            line.set('net', 0);
          }
        });
      }

      OB.UTIL.HookManager.callbackExecutor(args, callbacks);
    }
  );
No tags attached.
diff 20Q3_TaxArray_ForceCashup.diff (1,306) 2021-08-24 11:40
https://issues.openbravo.com/file_download.php?file_id=16145&type=bug
Issue History
2021-07-15 11:12sebastien_lironNew Issue
2021-07-15 11:12sebastien_lironAssigned To => Retail
2021-07-15 11:12sebastien_lironResolution time => 1630274400
2021-07-15 11:12sebastien_lironTriggers an Emergency Pack => No
2021-07-15 11:38egoitzNote Added: 0130502
2021-07-15 11:38egoitzIssue Monitored: egoitz
2021-07-19 22:53rqueraltaAssigned ToRetail => rqueralta
2021-07-19 22:53rqueraltaStatusnew => scheduled
2021-08-24 11:40marvintmFile Added: 20Q3_TaxArray_ForceCashup.diff
2021-08-24 11:40marvintmNote Added: 0131289
2021-08-24 11:40marvintmStatusscheduled => resolved
2021-08-24 11:40marvintmResolutionopen => fixed
2021-08-24 11:40marvintmAssigned Torqueralta => ranjith_qualiantech_com
2021-08-24 11:40marvintmReview Assigned To => marvintm
2021-08-24 11:40marvintmStatusresolved => closed

Notes
(0130502)
egoitz   
2021-07-15 11:38   
Together with that problem, there are cases in which the net is set to null instead of 0. Both problems happen together.
(0131289)
marvintm   
2021-08-24 11:40   
This issue should be resolved by the patch attached.