@@ -106,18 +106,25 @@ public void insert(Product product, int index, int quantity) {
106106 public void insert (Product product , int index , int quantity , ScannableCode scannedCode , boolean isZeroAmountProduct ) {
107107 Entry e = getEntryBySku (product .getSku ());
108108
109- if (e == null || scannedCode .hasUnitData ()
110- || scannedCode .hasPriceData ()
111- || product .getType () == Product .Type .UserWeighed
112- || product .getType () == Product .Type .PreWeighed ) {
113- if (quantity > 0 ) {
114- Entry entry = new Entry (product , quantity );
115- setScannedCodeForEntry (entry , scannedCode );
116- entry .isZeroAmountProduct = isZeroAmountProduct ;
117- addEntry (entry , index );
118- }
119- } else {
120- setEntryQuantity (e , e .quantity + quantity );
109+ // if (e == null || scannedCode.hasUnitData()
110+ // || scannedCode.hasPriceData()
111+ // || product.getType() == Product.Type.UserWeighed
112+ // || product.getType() == Product.Type.PreWeighed) {
113+ // if (quantity > 0) {
114+ // Entry entry = new Entry(product, quantity);
115+ // setScannedCodeForEntry(entry, scannedCode);
116+ // entry.isZeroAmountProduct = isZeroAmountProduct;
117+ // addEntry(entry, index);
118+ // }
119+ // } else {
120+ // setEntryQuantity(e, e.quantity + quantity);
121+ // }
122+
123+ if (quantity > 0 ) {
124+ Entry entry = new Entry (product , quantity );
125+ setScannedCodeForEntry (entry , scannedCode );
126+ entry .isZeroAmountProduct = isZeroAmountProduct ;
127+ addEntry (entry , index );
121128 }
122129 }
123130
@@ -149,7 +156,7 @@ public void setQuantity(Product product, int quantity, ScannableCode scannedCode
149156 if (product .getType () == Product .Type .Article ) {
150157 Entry e = getEntryBySku (product .getSku ());
151158
152- if (e != null ) {
159+ if (e != null && product . getReferenceUnit () != Unit . PIECE ) {
153160 // update product for changing prices
154161 e .product = product ;
155162
@@ -472,7 +479,8 @@ public int getTotalQuantity() {
472479 for (Entry e : items ) {
473480 Product product = e .product ;
474481 if (product .getType () == Product .Type .UserWeighed
475- || product .getType () == Product .Type .PreWeighed ) {
482+ || product .getType () == Product .Type .PreWeighed
483+ || product .getReferenceUnit () == Unit .PIECE ) {
476484 sum += 1 ;
477485 } else {
478486 sum += e .quantity ;
0 commit comments