From e8b9515980997884c2099cbed3e71a5a0120b9d0 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 5 Apr 2017 16:51:54 +0200 Subject: [PATCH] [IMP] account: add write-off alert message in reconciliation --- .../reconciliation/reconciliation_renderer.js | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js index 92e3460fad8..5bc2740fc5b 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js @@ -396,19 +396,21 @@ var LineRenderer = Widget.extend(FieldManagerMixin, { }, { type: 'char', name: 'label', - attrs: {string: ""} }, { type: 'float', name: 'amount', - attrs: {string: ""}, - }]); + }], { + account_id: {string: _t("Account")}, + label: {string: _t("Label")}, + amount: {string: _t("Account")} + }); var record = this.model.get(this.handleCreateRecord); this.fields.account_id = new relational_fields.FieldMany2One(this, 'account_id', record, {mode: 'edit', required: true}); this.fields.journal_id = new relational_fields.FieldMany2One(this, - 'journal_id', record, {mode: 'edit', required: true}); + 'journal_id', record, {mode: 'edit'}); this.fields.tax_id = new relational_fields.FieldMany2One(this, 'tax_id', record, {mode: 'edit'}); @@ -542,6 +544,16 @@ var LineRenderer = Widget.extend(FieldManagerMixin, { */ _onCreateProposition: function () { document.activeElement && document.activeElement.blur(); + var invalid = []; + _.each(this.fields, function (field) { + if (!field.isValid()) { + invalid.push(field.string); + } + }); + if (invalid.length) { + this.do_warn(_("Some fields are undefined"), invalid.join(', ')); + return; + } this.trigger_up('create_proposition'); }, /**