|
@ -12,7 +12,7 @@ odoo.define('pos_order_mgmt.widgets', function (require) { |
|
|
var screens = require('point_of_sale.screens'); |
|
|
var screens = require('point_of_sale.screens'); |
|
|
var gui = require('point_of_sale.gui'); |
|
|
var gui = require('point_of_sale.gui'); |
|
|
var chrome = require('point_of_sale.chrome'); |
|
|
var chrome = require('point_of_sale.chrome'); |
|
|
var pos = require('point_of_sale.models'); |
|
|
|
|
|
|
|
|
var models = require('point_of_sale.models'); |
|
|
|
|
|
|
|
|
var QWeb = core.qweb; |
|
|
var QWeb = core.qweb; |
|
|
var ScreenWidget = screens.ScreenWidget; |
|
|
var ScreenWidget = screens.ScreenWidget; |
|
@ -210,12 +210,24 @@ odoo.define('pos_order_mgmt.widgets', function (require) { |
|
|
order.trigger('change'); |
|
|
order.trigger('change'); |
|
|
this.pos.get('orders').add(order); |
|
|
this.pos.get('orders').add(order); |
|
|
this.pos.set('selectedOrder', order); |
|
|
this.pos.set('selectedOrder', order); |
|
|
|
|
|
order.get_orderlines().forEach(function (orderline) { |
|
|
|
|
|
if (orderline.pack_lot_lines) |
|
|
|
|
|
{ |
|
|
|
|
|
_.each(orderline.return_pack_lot_names, function(lot_name) { |
|
|
|
|
|
orderline.pack_lot_lines.add(new models.Packlotline( |
|
|
|
|
|
{'lot_name': lot_name}, {'order_line': orderline} |
|
|
|
|
|
)); |
|
|
|
|
|
}) |
|
|
|
|
|
order.save_to_db(); |
|
|
|
|
|
orderline.trigger('change', orderline); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
return order; |
|
|
return order; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
_prepare_order_from_order_data: function (order_data, action) { |
|
|
_prepare_order_from_order_data: function (order_data, action) { |
|
|
var self = this; |
|
|
var self = this; |
|
|
var order = new pos.Order({}, { |
|
|
|
|
|
|
|
|
var order = new models.Order({}, { |
|
|
pos: this.pos, |
|
|
pos: this.pos, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -324,12 +336,14 @@ odoo.define('pos_order_mgmt.widgets', function (require) { |
|
|
// Invert line quantities
|
|
|
// Invert line quantities
|
|
|
qty *= -1; |
|
|
qty *= -1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return { |
|
|
return { |
|
|
price: line.price_unit, |
|
|
price: line.price_unit, |
|
|
quantity: qty, |
|
|
quantity: qty, |
|
|
discount: line.discount, |
|
|
discount: line.discount, |
|
|
merge: false, |
|
|
merge: false, |
|
|
|
|
|
extras: { |
|
|
|
|
|
return_pack_lot_names: line.pack_lot_names, |
|
|
|
|
|
}, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|