Browse Source

Merge PR #467 into 12.0

Signed-off-by pedrobaeza
pull/486/head
OCA-git-bot 5 years ago
parent
commit
ce8b8302d1
  1. 1
      pos_order_mgmt/models/pos_order.py
  2. 20
      pos_order_mgmt/static/src/js/widgets.js

1
pos_order_mgmt/models/pos_order.py

@ -136,6 +136,7 @@ class PosOrder(models.Model):
'qty': order_line.qty, 'qty': order_line.qty,
'price_unit': order_line.price_unit, 'price_unit': order_line.price_unit,
'discount': order_line.discount, 'discount': order_line.discount,
'pack_lot_names': order_line.pack_lot_ids.mapped('lot_name'),
} }
@api.multi @api.multi

20
pos_order_mgmt/static/src/js/widgets.js

@ -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;
@ -215,7 +215,7 @@ odoo.define('pos_order_mgmt.widgets', function (require) {
_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,
}); });
@ -312,6 +312,18 @@ odoo.define('pos_order_mgmt.widgets', function (require) {
order.add_product(product, order.add_product(product,
self._prepare_product_options_from_orderline_data( self._prepare_product_options_from_orderline_data(
order, line, action)); order, line, action));
// Restore lot information.
if (['return'].indexOf(action) !== -1) {
var orderline = order.get_selected_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}
));
})
orderline.trigger('change', orderline);
}
}
} }
}); });
}, },
@ -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,
},
} }
}, },

Loading…
Cancel
Save