[FIX] account: reconciliation widget: empty line should open write off
In manual reconciliation, have an accound with no direct proposal. An empty line should be present Click on it Before this commit, there was a traceback After this commit, a write-off creation appears
This commit is contained in:
@@ -406,7 +406,8 @@ var LineRenderer = Widget.extend(FieldManagerMixin, {
|
||||
|
||||
// mv_lines
|
||||
var $mv_lines = this.$('.match table tbody').empty();
|
||||
_.each(state.mv_lines.slice(0, state.limitMoveLines), function (line) {
|
||||
var stateMvLines = state.mv_lines || [];
|
||||
_.each(stateMvLines.slice(0, state.limitMoveLines), function (line) {
|
||||
var $line = $(qweb.render("reconciliation.line.mv_line", {'line': line, 'state': state}));
|
||||
if (!isNaN(line.id)) {
|
||||
$('<span class="line_info_button fa fa-info-circle"/>')
|
||||
@@ -415,9 +416,9 @@ var LineRenderer = Widget.extend(FieldManagerMixin, {
|
||||
}
|
||||
$mv_lines.append($line);
|
||||
});
|
||||
this.$('.match .fa-chevron-right').toggleClass('disabled', state.mv_lines.length <= state.limitMoveLines);
|
||||
this.$('.match .fa-chevron-right').toggleClass('disabled', stateMvLines.length <= state.limitMoveLines);
|
||||
this.$('.match .fa-chevron-left').toggleClass('disabled', !state.offset);
|
||||
this.$('.match').css('max-height', !state.mv_lines.length && !state.filter.length ? '0px' : '');
|
||||
this.$('.match').css('max-height', !stateMvLines.length && !state.filter.length ? '0px' : '');
|
||||
|
||||
// balance
|
||||
this.$('.popover').remove();
|
||||
|
||||
@@ -1760,5 +1760,43 @@ QUnit.module('account', {
|
||||
|
||||
clientAction.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('Manual Reconciliation: No lines for account', function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var clientAction = new ReconciliationClientAction.ManualAction(null, this.params.options);
|
||||
testUtils.addMockEnvironment(clientAction, {
|
||||
data: this.params.data,
|
||||
session: {
|
||||
currencies: {
|
||||
3: {
|
||||
digits: [69, 2],
|
||||
position: "before",
|
||||
symbol: "$"
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
clientAction.appendTo($('#qunit-fixture'));
|
||||
|
||||
// The second reconciliation "line" is where it happens
|
||||
var widget = clientAction.widgets[1];
|
||||
|
||||
var emptyLine = widget.$('tr.mv_line');
|
||||
|
||||
assert.notOk('data-line-id' in emptyLine.getAttributes(),
|
||||
'Empty line should be empty');
|
||||
|
||||
emptyLine.find('td:first').click();
|
||||
|
||||
// Check that a create form is here
|
||||
var writeOffCreate = widget.$('div.create .create_account_id');
|
||||
|
||||
assert.equal(writeOffCreate.length, 1,
|
||||
'A write-off creation should be present');
|
||||
|
||||
clientAction.destroy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user