[MERGE] forward port branch 8.0 up to 5fc3979262

This commit is contained in:
Christophe Simonis
2017-03-28 15:22:58 +02:00
3 changed files with 11 additions and 2 deletions
+6
View File
@@ -2349,6 +2349,7 @@ class stock_move(osv.osv):
main_domain = {}
todo_moves = []
operations = set()
ancestors_list = {}
for move in self.browse(cr, uid, ids, context=context):
if move.state not in ('confirmed', 'waiting', 'assigned'):
continue
@@ -2368,6 +2369,7 @@ class stock_move(osv.osv):
#if the move is preceeded, restrict the choice of quants in the ones moved previously in original move
ancestors = self.find_move_ancestors(cr, uid, move, context=context)
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)]
@@ -2392,6 +2394,10 @@ class stock_move(osv.osv):
if qty:
quants = quant_obj.quants_get_prefered_domain(cr, uid, ops.location_id, move.product_id, qty, domain=domain, prefered_domain_list=[], restrict_lot_id=move.restrict_lot_id.id, restrict_partner_id=move.restrict_partner_id.id, context=context)
quant_obj.quants_reserve(cr, uid, quants, move, record, context=context)
# Sort moves to reserve first the ones with ancestors, in case the same product is listed in
# different stock moves.
todo_moves.sort(key=lambda x: -1 if ancestors_list.get(x.id) else 0)
for move in todo_moves:
#then if the move isn't totally assigned, try to find quants without any specific domain
if move.state != 'assigned':
+2 -1
View File
@@ -854,7 +854,8 @@
var result_domain = [];
// Normalize only if the first domain is the array ["|"] or ["!"]
var need_normalization = (
domains.length > 0
domains
&& domains.length > 0
&& domains[0].length === 1
&& (domains[0][0] === "|" || domains[0][0] === "!")
);
+3 -1
View File
@@ -976,7 +976,9 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web.
$row = self.$current.children(
'[data-id=' + record.get('id') + ']');
}
$row.replaceWith(self.render_record(record));
if ($row.length) {
$row.replaceWith(self.render_record(record));
}
},
'add': function (ev, records, record, index) {
var $new_row = $(self.render_record(record));