diff --git a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js
index 3887bb1e737..8ef33b52788 100644
--- a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js
+++ b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js
@@ -195,6 +195,8 @@ var LineRenderer = Widget.extend(FieldManagerMixin, {
'click .o_reconcile_models button': '_onQuickCreateProposition',
'click .create .add_line': '_onCreateProposition',
'click .accounting_view .cell_right .line_info_button': '_onTogglePartialReconcile',
+ 'click .reconcile_model_create': '_onCreateReconcileModel',
+ 'click .reconcile_model_edit': '_onEditReconcileModel',
},
custom_events: _.extend({}, FieldManagerMixin.custom_events, {
'field_changed': '_onFieldChanged',
@@ -421,6 +423,34 @@ var LineRenderer = Widget.extend(FieldManagerMixin, {
// Handlers
//--------------------------------------------------------------------------
+ /**
+ * @private
+ * @param {MouseEvent} event
+ */
+ _onCreateReconcileModel: function (event) {
+ event.preventDefault();
+ this.do_action({
+ type: 'ir.actions.act_window',
+ res_model: 'account.reconcile.model',
+ views: [[false, 'form']],
+ target: 'current'
+ });
+ },
+ /**
+ * @private
+ * @param {MouseEvent} event
+ */
+ _onEditReconcileModel: function (event) {
+ event.preventDefault();
+ this.do_action({
+ type: 'ir.actions.act_window',
+ res_model: 'account.reconcile.model',
+ views: [[false, 'list'], [false, 'form']],
+ view_type: "list",
+ view_mode: "list",
+ target: 'current'
+ });
+ },
/**
* @private
* @param {OdooEvent} event
diff --git a/addons/account/static/src/xml/account_reconciliation.xml b/addons/account/static/src/xml/account_reconciliation.xml
index 7949bb7fde5..07a9bbfea9d 100644
--- a/addons/account/static/src/xml/account_reconciliation.xml
+++ b/addons/account/static/src/xml/account_reconciliation.xml
@@ -143,12 +143,13 @@
You did not configure any reconcile model yet, you can do it there.
diff --git a/addons/account/static/test/reconciliation_tests.js b/addons/account/static/test/reconciliation_tests.js index ecd0686e676..a43916e9fba 100644 --- a/addons/account/static/test/reconciliation_tests.js +++ b/addons/account/static/test/reconciliation_tests.js @@ -624,7 +624,7 @@ QUnit.module('account', { QUnit.test('Reconciliation create line', function (assert) { - assert.expect(21); + assert.expect(23); var clientAction = new ReconciliationClientAction.StatementAction(null, this.options); @@ -650,6 +650,20 @@ QUnit.module('account', { "the new line should have the selected account, name and amout"); assert.ok(widget.$('caption button.btn-primary:visible').length, "should display the 'Reconcile' button"); + testUtils.intercept(clientAction, 'do_action', function (event) { + assert.strictEqual(JSON.stringify(event.data.action), + '{"type":"ir.actions.act_window","res_model":"account.reconcile.model","views":[[false,"form"]],"target":"current"}', + "should open the reconcile model form view"); + }); + widget.$('.create .reconcile_model_create').trigger('click'); + + testUtils.intercept(clientAction, 'do_action', function (event) { + assert.strictEqual(JSON.stringify(event.data.action), + '{"type":"ir.actions.act_window","res_model":"account.reconcile.model","views":[[false,"list"],[false,"form"]],"view_type":"list","view_mode":"list","target":"current"}', + "should open the reconcile model list view"); + }); + widget.$('.create .reconcile_model_edit').trigger('click'); + widget.$('.create .create_amount input').val('1100.00').trigger('input'); assert.strictEqual(widget.$('.accounting_view tbody .cell_right').text(), "1100.00", "should display the value 1100.00 in right column");