Openbravo Issue Tracking System - Retail Modules
View Issue Details
0030925Retail ModulesWeb POSpublic2015-09-24 17:232015-10-19 17:23
guillermogil 
mario_castello 
normalmajoralways
closedfixed 
5
 
RR16Q1 
marvintm
No
0030925: PreAddProductToOrder Hook and AddProductToOrder Hook shows the property qtyToAdd as undefined
PreAddProductToOrder Hook and AddProductToOrder Hook shows the property qtyToAdd as undefined.
On the wiki it is defined as the QTY of the product to add:
http://wiki.openbravo.com/wiki/List_of_Hooks_in_Web_POS [^]
Open the developer tools.
Add a breakpoint in the callback of PreAddProductToOrder Hook.
Go to Browse tab and select a product.
Notice that args.qtyToAdd is undefined
No tags attached.
Issue History
2015-09-24 17:23guillermogilNew Issue
2015-09-24 17:23guillermogilAssigned To => Retail
2015-09-24 17:23guillermogilResolution time => 1444168800
2015-09-24 17:23guillermogilTriggers an Emergency Pack => No
2015-09-30 17:58mario_castelloAssigned ToRetail => mario_castello
2015-10-05 12:09OrekariaStatusnew => scheduled
2015-10-06 18:17hgbotCheckin
2015-10-06 18:17hgbotNote Added: 0080847
2015-10-06 18:17hgbotStatusscheduled => resolved
2015-10-06 18:17hgbotResolutionopen => fixed
2015-10-06 18:17hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/5c5d1f2807a67b49f5540527deba7d466f85fa22 [^]
2015-10-07 07:27guillermogilNote Added: 0080849
2015-10-08 10:03OrekariaReview Assigned To => guilleaer
2015-10-19 13:15marvintmNote Added: 0081080
2015-10-19 13:15marvintmStatusresolved => new
2015-10-19 13:15marvintmResolutionfixed => open
2015-10-19 17:23marvintmNote Added: 0081098
2015-10-19 17:23marvintmStatusnew => scheduled
2015-10-19 17:23marvintmStatusscheduled => resolved
2015-10-19 17:23marvintmResolutionopen => fixed
2015-10-19 17:23marvintmReview Assigned Toguilleaer => marvintm
2015-10-19 17:23marvintmStatusresolved => closed
2015-10-19 17:23marvintmFixed in Version => RR16Q1

Notes
(0080847)
hgbot   
2015-10-06 18:17   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 5c5d1f2807a67b49f5540527deba7d466f85fa22
Author: Mario Castello <mario.castello <at> peoplewalking.com>
Date: Tue Oct 06 10:16:15 2015 -0600
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/5c5d1f2807a67b49f5540527deba7d466f85fa22 [^]

Fixed issue 30925: Set qtyToAdd in PreAddProductToOrder Hook

---
M web/org.openbravo.retail.posterminal/js/pointofsale/view/pointofsale.js
---
(0080849)
guillermogil   
2015-10-07 07:27   
Are you also taking into account negative values?
e.g.- when you add a negative line while returning a receipt
(0081080)
marvintm   
2015-10-19 13:15   
As discussed, a new property should be added to the hook, so that the code which is being executed inside the hook can know whether the line is negative or not.
(0081098)
marvintm   
2015-10-19 17:23   
Finally, after analyzing the hooks and where they are located, it was deemed that it's not possible to add the property to the PreAddProductToOrder or AddProductToOrder hooks, because the logic to select and modify the lines is executed after the hooks, so if somebody needs to know whether the line is negative or positive it should use the PostAddProductToOrder, which receives the order line as a parameter.