[MERGE] forward port of branch 7.0 up to 7307227

This commit is contained in:
Denis Ledoux 2014-09-03 18:26:53 +02:00
commit ff0f92acfa
3 changed files with 30 additions and 4 deletions

View File

@ -51,7 +51,7 @@ class account_move_line(osv.osv):
if bank.state in bank_type:
line2bank[line.id] = bank.id
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
else:
raise osv.except_osv(_('Error!'), _('There is no partner defined on the entry line.'))

View File

@ -156,9 +156,11 @@ class StockPicking(osv.osv):
def action_explode(self, cr, uid, move_ids, *args):
"""Explodes moves by expanding kit components"""
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):
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))

View File

@ -405,14 +405,35 @@ instance.web.ActionManager = instance.web.Widget.extend({
}
var widget = executor.widget();
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()) {
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 = new instance.web.Dialog(this, {
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;
if (widget instanceof instance.web.ViewManager) {
_.extend(widget.flags, {
@ -426,6 +447,9 @@ instance.web.ActionManager = instance.web.Widget.extend({
this.dialog.open();
return initialized;
} 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.inner_action = executor.action;
this.inner_widget = widget;