Openbravo Issue Tracking System - Retail Modules
View Issue Details
0032562Retail ModulesWeb POSpublic2016-03-31 09:432016-11-16 17:48
aaroncalero 
ranjith_qualiantech_com 
normalmajoralways
closedfixed 
5
 
 
migueldejuana
No
0032562: Wrong template used for returns under specific circumstances
A ticket in Web POS is considered a return ticket if all of its lines are negative. All these tickets should be printed using the same template. However the return template is used only if the receipt has been flagged for return in web pos (using the Return this receipt menu option).
If the ticket is composed by lines of a verified return (Menu > Verified Returns), or lines returned manually (Select line > EDIT > Return Line) the standard receipt template is used.
It happens both if the receipt is flagged to be invoiced or not.
Look at the if/else block on pointofsale-print.js around line 168 (https://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/file/410127cfc57e/web/org.openbravo.retail.posterminal/js/pointofsale/model/pointofsale-print.js#l168 [^])
The decision to choose the return template is based on the order type. However only the receipts flagged as Return Receipt have their type changed to 1.
------------
Create a new ticket in web pos
Add an avalanche transceiver, select the line, go to the EDIT tab and click on Return line.
Verify that the Invoice this receipt flag is NOT checked.
Click on the total amount button and complete the receipt
Verify that on the following piece of code:
          if (receipt.get('orderType') === 1) {
            args.template = me.templatereturn;
          } else if (receipt.get('orderType') === 2 || receipt.get('isLayaway') || receipt.get('orderType') === 3) {
            args.template = me.templatelayaway;
          } else if (receipt.get('isQuotation')) {
            args.template = me.templatequotation;
          } else {
            args.template = me.templatereceipt;
          }
The selected template is me.templatereceipt (even if the ticket is a return ticket).

Repeat the above steps with a ticket where its only line is a line from a verified return. The result is the same, the templatereceipt is selected.

Repeat the above steps marking the receipt as Return This Receipt (instead of returning the line manually). This time the templatereturn is used.
The decision to pick the template return should be based on the receipt lines, not on the order type.
The standard receipt even does that[1][2] to trick the users when the application selects the wrong template

[1]
negativeLines = _.filter(order.get('lines').models, function (line) {
  return line.get('qty') < 0;
}).length;
if (negativeLines === 0) {
  title = OB.UTIL.encodeXMLComponent(OB.I18N.getLabel('OBPOS_ReceiptRpt_Title'));
} else {
  title = OB.UTIL.encodeXMLComponent(OB.I18N.getLabel('OBPOS_ReceiptWithReturnRpt_Title'))
}

[2]
<% if (order.getGross() < 0){ %>
  <text align="center" length="42"><%= OB.UTIL.encodeXMLComponent(OB.I18N.getLabel('OBPOS_paidReturn')) %></text>
<% } else { %>
  <text align="center" length="42"><%= OB.UTIL.encodeXMLComponent(OB.I18N.getLabel('OBPOS_tckfooter_line1')) %></text>
<% } %>
No tags attached.
has duplicate defect 0035562 closed ranjith_qualiantech_com Wrong Receipt Template doing verifying returns 
Issue History
2016-03-31 09:43aaroncaleroNew Issue
2016-03-31 09:43aaroncaleroAssigned To => Retail
2016-03-31 09:43aaroncaleroTriggers an Emergency Pack => No
2016-04-12 13:13ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2016-04-12 13:28ranjith_qualiantech_comStatusnew => scheduled
2016-04-19 10:57hgbotCheckin
2016-04-19 10:57hgbotNote Added: 0085740
2016-04-19 10:57hgbotStatusscheduled => resolved
2016-04-19 10:57hgbotResolutionopen => fixed
2016-04-19 10:57hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/a7ece2260214dc89aeeecd39e1aa8b98130930af [^]
2016-04-20 14:33migueldejuanaReview Assigned To => migueldejuana
2016-04-20 14:33migueldejuanaNote Added: 0085778
2016-04-20 14:33migueldejuanaStatusresolved => closed
2016-10-14 11:53marvintmNote Added: 0090585
2016-10-14 11:53marvintmStatusclosed => new
2016-10-14 11:53marvintmResolutionfixed => open
2016-10-14 11:53marvintmStatusnew => scheduled
2016-10-17 06:37hgbotCheckin
2016-10-17 06:37hgbotNote Added: 0090600
2016-10-17 06:37hgbotStatusscheduled => resolved
2016-10-17 06:37hgbotResolutionopen => fixed
2016-10-17 06:37hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/a7ece2260214dc89aeeecd39e1aa8b98130930af [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/b3a31c7166d14a898f592b68c5f6e81cf03c3383 [^]
2016-11-16 17:48migueldejuanaNote Added: 0091611
2016-11-16 17:48migueldejuanaStatusresolved => closed
2017-03-21 10:58marvintmRelationship addedhas duplicate 0035562

Notes
(0085740)
hgbot   
2016-04-19 10:57   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: a7ece2260214dc89aeeecd39e1aa8b98130930af
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Tue Apr 19 14:25:59 2016 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/a7ece2260214dc89aeeecd39e1aa8b98130930af [^]

Fixes issue 32562 : Changes in Print template based on receipt lines

Receipt print template should be loaded based on receipt line negative qty count

---
M web/org.openbravo.retail.posterminal/js/pointofsale/model/pointofsale-print.js
---
(0085778)
migueldejuana   
2016-04-20 14:33   
Tested and reviewed
(0090585)
marvintm   
2016-10-14 11:53   
There is a problem with this part of the code:

.length === receipt.get('lines').models

It should compare the length of the filtered collection to the length of the full collection, instead of comparing it to the array itself, so it should be like this:

.length === receipt.get('lines').size()
(0090600)
hgbot   
2016-10-17 06:37   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: b3a31c7166d14a898f592b68c5f6e81cf03c3383
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Sat Oct 15 12:50:03 2016 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/b3a31c7166d14a898f592b68c5f6e81cf03c3383 [^]

Fixes issue 32562 : Changes in Print template based on receipt lines

- Check Receipt negative line length with receipt all line length

---
M web/org.openbravo.retail.posterminal/js/pointofsale/model/pointofsale-print.js
---
(0091611)
migueldejuana   
2016-11-16 17:48   
Tested and reviewed in 795a217b6a23