summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ledoux <dle@odoo.com>2014-09-03 18:26:53 +0200
committerDenis Ledoux <dle@odoo.com>2014-09-03 18:26:53 +0200
commitff0f92acfa0dda7d5407b8d8bb097ae273ef376a (patch)
treeb35de306542809a73210cc893a3eadd1995534a0
parent00ea919699d0927604a21fdd5bc3974defad8317 (diff)
parent73072272de8ab32b0fe199d54a90986dc02d1dbc (diff)
[MERGE] forward port of branch 7.0 up to 7307227
-rw-r--r--addons/account_payment/account_move_line.py2
-rw-r--r--addons/mrp/stock.py6
-rw-r--r--addons/web/static/src/js/views.js26
3 files changed, 30 insertions, 4 deletions
diff --git a/addons/account_payment/account_move_line.py b/addons/account_payment/account_move_line.py
index 266876db95f..c0d670d72e9 100644
--- a/addons/account_payment/account_move_line.py
+++ b/addons/account_payment/account_move_line.py
@@ -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.'))
diff --git a/addons/mrp/stock.py b/addons/mrp/stock.py
index 0ebc7bd199d..c76b54d3394 100644
--- a/addons/mrp/stock.py
+++ b/addons/mrp/stock.py
@@ -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))
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js
index 76fa67231be..2a82ef0664c 100644
--- a/addons/web/static/src/js/views.js
+++ b/addons/web/static/src/js/views.js
@@ -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;