[MERGE] forward port branch 9.0 up to e876becada
This commit is contained in:
@@ -565,6 +565,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'])
|
||||
@@ -587,6 +588,7 @@ class StockMove(models.Model):
|
||||
|
||||
# if the move is preceeded, restrict the choice of quants in the ones moved previously in original move
|
||||
ancestors = move.find_move_ancestors()
|
||||
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)]
|
||||
@@ -630,7 +632,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] === "!")
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user