[IMP] account: usability of bank statement reconciliation widget
* add a link to create bank reconciliation model if none is defined yet
This commit is contained in:
committed by
Aaron Bohy
parent
09731b7860
commit
ed9f34018a
@@ -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
|
||||
|
||||
@@ -143,12 +143,13 @@
|
||||
<t t-foreach="state.reconcileModels" t-as="reconcileModel">
|
||||
<button class="btn btn-default" t-att-data-reconcile-model-id="reconcileModel.id"><t t-esc="reconcileModel.name"/></button>
|
||||
</t>
|
||||
<p t-if="!state.reconcileModels.length" style="color: #bbb;">You did not configure any reconcile model yet, you can do it <a style="cursor: pointer;" class="reconcile_model_create">there</a>.</p>
|
||||
</div>
|
||||
<div class="dropdown pull-right">
|
||||
<a data-toggle="dropdown" href="#"><span class="fa fa-cog"/></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="Presets config">
|
||||
<li><a class="presets_config_create" href="#">Create model</a></li>
|
||||
<li><a class="presets_config_edit" href="#">Modify models</a></li>
|
||||
<li><a class="reconcile_model_create" href="#">Create model</a></li>
|
||||
<li><a class="reconcile_model_edit" href="#">Modify models</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user