[FIX] account: reconciliation: loose the current view when reload

Todo in master: change action and add information in params
This commit is contained in:
Christophe Matthieu
2017-10-16 15:37:40 +02:00
parent a18a3fd31a
commit 2d0c3abd5c
@@ -38,7 +38,9 @@ var StatementAction = Widget.extend(ControlPanelMixin, {
// used to instanciate the action interface
ActionRenderer: ReconciliationRenderer.StatementRenderer,
// used to instanciate each widget line
LineRenderer: ReconciliationRenderer.LineRenderer
LineRenderer: ReconciliationRenderer.LineRenderer,
// used context params
params: ['statement_ids'],
},
/**
@@ -56,6 +58,17 @@ var StatementAction = Widget.extend(ControlPanelMixin, {
if (!this.action_manager) {
this.set_cp_bus(new Widget());
}
// Adding values from the context ​​is necessary to put this information in the url via the action manager so that
// you can retrieve it if the person shares his url or presses f5
_.each(params.params, function (value, name) {
params.context[name] = name.indexOf('_ids') !== -1 ? _.map((value+'').split(), parseFloat) : value;
});
params.params = {};
_.each(this.config.params, function (name) {
if (params.context[name]) {
params.params[name] = name.indexOf('_ids') !== -1 && _.isArray(params.context[name]) ? params.context[name].join() : params.context[name];
}
});
},
/**
@@ -305,8 +318,14 @@ var ManualAction = StatementAction.extend({
config: {
Model: ReconciliationModel.ManualModel,
ActionRenderer: ReconciliationRenderer.ManualRenderer,
LineRenderer: ReconciliationRenderer.ManualLineRenderer
LineRenderer: ReconciliationRenderer.ManualLineRenderer,
params: ['company_ids', 'mode', 'partner_ids', 'account_ids'],
},
//--------------------------------------------------------------------------
// Handlers
//--------------------------------------------------------------------------
/**
* call 'validate' or 'autoReconciliation' model method then destroy the
* reconcilied lines, update the not reconcilied and update the action