Skip to Content
Menu
This question has been flagged
2 Replies
3969 Views

I have setted a lot on POS screen with some criteria, while setting a lot i need to check whether the lot is available for the product with quantity.

when given quantity is exceed the stock limit, i need to throw popup like 'quantity limit is exceed'. So for that i have customized the "set_quantity" method.

when quantity is exceed i set the orderline quantity to 0(Zero), and also remove lot. It is perfectly working for me..

But my issue is, after setted zero in orderline, if i want to add quantity by clicking numpad it will set the number like old quantity + current quantity

Example:

While set lot i'll give quantity like 1

then, give 5 using numpad, it shows popup message (Quantity limit exceed) and set quantity to 0(zero) -- this is fine

and then i'll give 1 by numpad it will set quantity like 51

so this was my problem after set quantity to (zero) 0, it will not clearing the buffer instead of that it will set "old quantity + current quantity".

To rectify this issue, i would like to call a "resetValue" method by extending the OrderWidget.

set_quantity method:

                  if (lot_quantity < quant)

                   {

                           self.pos.gui.show_popup('alert',{

                             'title': _t('Warning !!!!'),

                             'body': _t(lot_name + ' : Quantity limit is exceed / Lot Not Available '),

                             cancel: function(){

                             var lot_lines = self.pack_lot_lines.sortBy('lot_name').slice(0, 1);

                             self.pack_lot_lines.remove(lot_lines);

                             quant = parseFloat(0);

                             self.quantity = quant;

                             self.quantityStr = '' + self.quantity;

                             if(unit){

                                     if (unit.rounding) {

                                             self.quantity = round_pr(quant, unit.rounding);

                                             var decimals = self.pos.dp['Product Unit of Measure'];

                                             self.quantityStr = formats.format_value(round_di(self.quantity, decimals), { type: 'float', digits: [69,                                                                                                                                                                                         decimals]});

                                         }

                             else {

                                         self.quantity = round_pr(quant, 1);

                                         self.quantityStr = self.quantity.toFixed(0);

                                     }

                         }

                    else{

                             self.quantity = quant;

                             self.quantityStr = '' + self.quantity;

                         }

                    self.trigger('change',self);

                   this.order_widget = new OrderWidget(this,{

                   numpad_state: this.numpad.state,

                 });

         },

      });

  }

Used like this in set_quantity method,

* this.numpad_state.resetValue();

* this.numpad_state.reset();

* this.order_widget.numpad_state.bind('set_value',this.order_widget.set_value , this);

but these are not working..

Can anyone help me how to reset the numpad in POS..

Avatar
Discard

Hello Silviaa , I'm working in the same issue raise Warning when quantity exceedd lot quantiy , can i ask you how did you get lot_name ? thank in advance

Best Answer

what the solution you found ?

Avatar
Discard
Author Best Answer

i found the solution for this issue..

Avatar
Discard
Related Posts Replies Views Activity
1
Jul 19
9723
3
Jul 25
16995
0
Dec 18
2856
1
Oct 18
6201
1
Dec 17
4782