Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Reference Error: Model is not defined for pos_multi_session #282

Merged
merged 11 commits into from
Apr 20, 2017
Prev Previous commit
Next Next commit
[FIX] Fixes travis errors
  • Loading branch information
GabbasovDinar committed Apr 20, 2017
commit 27527a287751c4f26d843351a9633694e704a624
14 changes: 9 additions & 5 deletions pos_multi_session/static/src/js/pos_multi_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ odoo.define('pos_multi_session', function(require){
},
ms_do_update: function(order, data){
var pos = this;
var order = order;
this.pos_session.order_ID = data.sequence_number;
if (!order){
var create_new_order = pos.config.multi_session_accept_incoming_orders || !(data.ms_info && data.ms_info.created.user.id !== pos.ms_my_info().user.id);
Expand Down Expand Up @@ -193,7 +194,7 @@ odoo.define('pos_multi_session', function(require){
if(data.partner_id !== false) {
var client = order.pos.db.get_partner_by_id(data.partner_id);
if(!client) {
$.when(this.load_new_partners_by_id(data.partner_id)).then(function(client){
$.when(this.load_new_partners_by_id(data.partner_id)).then(function(res){
client = order.pos.db.get_partner_by_id(data.partner_id);
order.set_client(client);
},function(){
Expand All @@ -205,7 +206,7 @@ odoo.define('pos_multi_session', function(require){
order.set_client(null);
}
_.each(data.lines, function(dline){
dline = dline[2];
var dline = dline[2];
var line = order.orderlines.find(function(r){
return dline.uid === r.uid;
});
Expand Down Expand Up @@ -262,6 +263,9 @@ odoo.define('pos_multi_session', function(require){
def.reject();
}
}, function(err, event){
if (err) {
console.error(err.stack);
}
event.preventDefault();
def.reject();
});
Expand All @@ -285,7 +289,6 @@ odoo.define('pos_multi_session', function(require){
models.Order = models.Order.extend({
initialize: function(attributes, options){
var self = this;
options = options || {};

if (!options.json || !('new_order' in options.json)) {
this.new_order = true;
Expand Down Expand Up @@ -402,7 +405,7 @@ odoo.define('pos_multi_session', function(require){
self.revision_ID = server_revision_ID;
}
}
})
});
};
this.enquied = true;
this.pos.multi_session.enque(f);
Expand Down Expand Up @@ -430,7 +433,8 @@ odoo.define('pos_multi_session', function(require){
line.ms_info.changed = line.order.pos.ms_my_info();
line.order.ms_info.changed = line.order.pos.ms_my_info();
var order_lines = line.order.orderlines;
order_lines.trigger('change', order_lines); // to rerender line
// to rerender line
order_lines.trigger('change', order_lines);
line.order.trigger('change:sync');
}
});
Expand Down