[MERGE] forward port branch saas-11 up to 8bab7aebd6

This commit is contained in:
Christophe Simonis
2017-03-28 16:17:09 +02:00
3 changed files with 11 additions and 4 deletions
+5 -1
View File
@@ -564,6 +564,7 @@ class StockMove(models.Model):
moves_to_assign = self.env['stock.move']
moves_to_do = self.env['stock.move']
operations = self.env['stock.pack.operation']
ancestors_list = {}
# work only on in progress moves
moves = self.filtered(lambda move: move.state in ['confirmed', 'waiting', 'assigned'])
@@ -586,6 +587,7 @@ class StockMove(models.Model):
# we always search for yet unassigned quants
main_domain[move.id] = [('reservation_id', '=', False), ('qty', '>', 0)]
ancestors_list[move.id] = True if ancestors else False
if move.state == 'waiting' and not ancestors:
# if the waiting move hasn't yet any ancestor (PO/MO not confirmed yet), don't find any quant available in stock
main_domain[move.id] += [('id', '=', False)]
@@ -629,7 +631,9 @@ class StockMove(models.Model):
lot_qty[lot] -= qty
move_qty -= qty
for move in moves_to_do:
# Sort moves to reserve first the ones with ancestors, in case the same product is listed in
# different stock moves.
for move in sorted(moves_to_do, key=lambda x: -1 if ancestors_list.get(x.id) else 0):
# then if the move isn't totally assigned, try to find quants without any specific domain
if move.state != 'assigned' and not self.env.context.get('reserve_only_ops'):
qty_already_assigned = move.reserved_availability
@@ -852,6 +852,7 @@ function eval_domains (domains, evaluation_context) {
var result_domain = [];
// Normalize only if the first domain is the array ["|"] or ["!"]
var need_normalization = (
domains &&
domains.length > 0 &&
domains[0].length === 1 &&
(domains[0][0] === "|" || domains[0][0] === "!")
+5 -3
View File
@@ -939,9 +939,11 @@ ListView.List = Class.extend({
$row = self.$current.children(
'[data-id=' + record.get('id') + ']');
}
var $newRow = $(self.render_record(record));
$newRow.find('.o_list_record_selector input').prop('checked', !!$row.find('.o_list_record_selector input').prop('checked'));
$row.replaceWith($newRow);
if ($row.length) {
var $newRow = $(self.render_record(record));
$newRow.find('.o_list_record_selector input').prop('checked', !!$row.find('.o_list_record_selector input').prop('checked'));
$row.replaceWith($newRow);
}
},
'add': function (ev, records, record, index) {
var $new_row = $(self.render_record(record));