[MERGE] forward port of branch 7.0 up to 7307227
This commit is contained in:
commit
ff0f92acfa
|
@ -51,7 +51,7 @@ class account_move_line(osv.osv):
|
||||||
if bank.state in bank_type:
|
if bank.state in bank_type:
|
||||||
line2bank[line.id] = bank.id
|
line2bank[line.id] = bank.id
|
||||||
break
|
break
|
||||||
if line.id not in line2bank and line.partner_id.bank_ids:
|
if not line2bank.get(line.id) and line.partner_id.bank_ids:
|
||||||
line2bank[line.id] = line.partner_id.bank_ids[0].id
|
line2bank[line.id] = line.partner_id.bank_ids[0].id
|
||||||
else:
|
else:
|
||||||
raise osv.except_osv(_('Error!'), _('There is no partner defined on the entry line.'))
|
raise osv.except_osv(_('Error!'), _('There is no partner defined on the entry line.'))
|
||||||
|
|
|
@ -156,9 +156,11 @@ class StockPicking(osv.osv):
|
||||||
def action_explode(self, cr, uid, move_ids, *args):
|
def action_explode(self, cr, uid, move_ids, *args):
|
||||||
"""Explodes moves by expanding kit components"""
|
"""Explodes moves by expanding kit components"""
|
||||||
move_obj = self.pool.get('stock.move')
|
move_obj = self.pool.get('stock.move')
|
||||||
todo = move_ids[:]
|
todo = list(super(StockPicking, self).action_explode(cr, uid, move_ids, *args))
|
||||||
for move in move_obj.browse(cr, uid, move_ids):
|
for move in move_obj.browse(cr, uid, move_ids):
|
||||||
todo.extend(move_obj._action_explode(cr, uid, move))
|
result = move_obj._action_explode(cr, uid, move)
|
||||||
|
moves = move_obj.browse(cr, uid, result)
|
||||||
|
todo.extend(move.id for move in moves if move.state not in ['confirmed', 'assigned', 'done'])
|
||||||
return list(set(todo))
|
return list(set(todo))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -405,14 +405,35 @@ instance.web.ActionManager = instance.web.Widget.extend({
|
||||||
}
|
}
|
||||||
var widget = executor.widget();
|
var widget = executor.widget();
|
||||||
if (executor.action.target === 'new') {
|
if (executor.action.target === 'new') {
|
||||||
|
var pre_dialog = this.dialog;
|
||||||
|
if (pre_dialog){
|
||||||
|
// prevent previous dialog to consider itself closed,
|
||||||
|
// right now, as we're opening a new one (prevents
|
||||||
|
// reload of original form view)
|
||||||
|
pre_dialog.off('closing', null, pre_dialog.on_close);
|
||||||
|
}
|
||||||
if (this.dialog_widget && !this.dialog_widget.isDestroyed()) {
|
if (this.dialog_widget && !this.dialog_widget.isDestroyed()) {
|
||||||
this.dialog_widget.destroy();
|
this.dialog_widget.destroy();
|
||||||
}
|
}
|
||||||
|
// explicitly passing a closing action to dialog_stop() prevents
|
||||||
|
// it from reloading the original form view
|
||||||
this.dialog_stop(executor.action);
|
this.dialog_stop(executor.action);
|
||||||
this.dialog = new instance.web.Dialog(this, {
|
this.dialog = new instance.web.Dialog(this, {
|
||||||
dialogClass: executor.klass,
|
dialogClass: executor.klass,
|
||||||
});
|
});
|
||||||
this.dialog.on("closing", null, options.on_close);
|
|
||||||
|
// chain on_close triggers with previous dialog, if any
|
||||||
|
this.dialog.on_close = function(){
|
||||||
|
options.on_close.apply(null, arguments);
|
||||||
|
if (pre_dialog && pre_dialog.on_close){
|
||||||
|
// no parameter passed to on_close as this will
|
||||||
|
// only be called when the last dialog is truly
|
||||||
|
// closing, and *should* trigger a reload of the
|
||||||
|
// underlying form view (see comments above)
|
||||||
|
pre_dialog.on_close();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.dialog.on("closing", null, this.dialog.on_close);
|
||||||
this.dialog.dialog_title = executor.action.name;
|
this.dialog.dialog_title = executor.action.name;
|
||||||
if (widget instanceof instance.web.ViewManager) {
|
if (widget instanceof instance.web.ViewManager) {
|
||||||
_.extend(widget.flags, {
|
_.extend(widget.flags, {
|
||||||
|
@ -426,6 +447,9 @@ instance.web.ActionManager = instance.web.Widget.extend({
|
||||||
this.dialog.open();
|
this.dialog.open();
|
||||||
return initialized;
|
return initialized;
|
||||||
} else {
|
} else {
|
||||||
|
// explicitly passing a closing action to dialog_stop() prevents
|
||||||
|
// it from reloading the original form view - we're opening a
|
||||||
|
// completely new action anyway
|
||||||
this.dialog_stop(executor.action);
|
this.dialog_stop(executor.action);
|
||||||
this.inner_action = executor.action;
|
this.inner_action = executor.action;
|
||||||
this.inner_widget = widget;
|
this.inner_widget = widget;
|
||||||
|
|
Loading…
Reference in New Issue