[fix] problem with "orders", showed multiple ones when closing and reopening pos
authorniv-openerp <nicolas.vanhoren@openerp.com>
Mon, 7 Nov 2011 17:34:17 +0000 (18:34 +0100)
committerniv-openerp <nicolas.vanhoren@openerp.com>
Mon, 7 Nov 2011 17:34:17 +0000 (18:34 +0100)
bzr revid: nicolas.vanhoren@openerp.com-20111107173417-6fqs4ddsnp1wn0gp

addons/point_of_sale/static/src/js/pos.js

index 5835f1e..59c13e0 100644 (file)
@@ -421,12 +421,12 @@ openerp.point_of_sale = function(db) {
             Shop.__super__.constructor.apply(this, arguments);
         }
 
-        Shop.prototype.defaults = {
-            orders: new OrderCollection,
-            products: new ProductCollection
-        };
         Shop.prototype.initialize = function() {
             this.set({
+                orders: new OrderCollection(),
+                products: new ProductCollection()
+            });
+            this.set({
                 cashRegisters: new CashRegisterCollection(pos.store.get('account.bank.statement')),
             });
             return (this.get('orders')).bind('remove', __bind( function(removedOrder) {
@@ -1201,7 +1201,7 @@ openerp.point_of_sale = function(db) {
             });
 
             if (pos)
-                throw "It is not possible to instantiate multiple instances"+
+                throw "It is not possible to instantiate multiple instances "+
                     "of the point of sale at the same time.";
             pos = new Pos(this.session);