return self.fetch('res.partner', ['name','ean13'], [['ean13', '!=', false]]);
}).then(function(partners){
self.set('partner_list',partners);
- console.log('Loaded partners:',partners);
return self.fetch('account.tax', ['amount', 'price_include', 'type']);
}).then(function(taxes){
// saves the order locally and try to send it to the backend. 'record' is a bizzarely defined JSON version of the Order
push_order: function(record) {
- console.log('PUSHING NEW ORDER:',record);
this.db.add_order(record);
this.flush();
},
// it has been confirmed that they have been sent correctly.
flush: function() {
//TODO make the mutex work
- console.log('FLUSH');
//this makes sure only one _int_flush is called at the same time
/*
return this.flush_mutex.exec(_.bind(function() {
var self = this;
var orders = this.db.get_orders();
self.set('nbr_pending_operations',orders.length);
- console.log('TRYING TO FLUSH ORDER:',index,'Of',orders.length);
var order = orders[index];
if(!order){
})
.done(function(){
//remove from db if success
- console.log('Order successfully sent');
self.db.remove_order(order.id);
self._flush(index);
});