diff --git a/addons/account/static/src/css/account_bank_statement_reconciliation.css b/addons/account/static/src/css/account_bank_statement_reconciliation.css index 040e55eb45f..63b71ade4a5 100644 --- a/addons/account/static/src/css/account_bank_statement_reconciliation.css +++ b/addons/account/static/src/css/account_bank_statement_reconciliation.css @@ -18,12 +18,21 @@ border-top: 0; border-bottom: 0; height: 100%; } + .openerp .oe_bank_statement_reconciliation h1 input, .openerp .oe_bank_statement_reconciliation h2 input { + height: auto !important; } .openerp .oe_bank_statement_reconciliation h1 { width: 48%; padding: 0 0 0 15px; margin: 0 0 25px 0; float: left; font-size: 2em; } + .openerp .oe_bank_statement_reconciliation .change_statement_name_container { + display: none; } + .openerp .oe_bank_statement_reconciliation .change_statement_name_container td:first-child, .openerp .oe_bank_statement_reconciliation .change_statement_name_container td:first-child > input { + width: 99%; } + .openerp .oe_bank_statement_reconciliation .change_statement_name_container td:last-child { + width: 1%; + padding-left: 5px; } .openerp .oe_bank_statement_reconciliation h2 { font-size: 1.8em; } .openerp .oe_bank_statement_reconciliation .progress { @@ -182,7 +191,7 @@ color: #555; padding-right: 5px; } .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view .initial_line > td { - border-top: 1px solid #bbbbbb; + border-top: 1px solid #bbb; padding-top: 4px; padding-bottom: 5px; background-color: #f0f0f0; @@ -217,7 +226,7 @@ font-weight: bold; cursor: pointer; } .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td.cell_credit { - border-left: 1px solid black; } + border-left: 1px solid #000; } .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls { padding: 0 0 5px 18px; } .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls .filter { diff --git a/addons/account/static/src/css/account_bank_statement_reconciliation.scss b/addons/account/static/src/css/account_bank_statement_reconciliation.scss index 92788e3bb51..b35d416addc 100644 --- a/addons/account/static/src/css/account_bank_statement_reconciliation.scss +++ b/addons/account/static/src/css/account_bank_statement_reconciliation.scss @@ -31,6 +31,10 @@ $aestetic_animation_speed: 300ms; } } + h1 input, h2 input { + height: auto !important; + } + h1 { width: 48%; padding: 0 0 0 $actionColWidth; @@ -39,6 +43,18 @@ $aestetic_animation_speed: 300ms; font-size: 2em; } + .change_statement_name_container { + display: none; + + td:first-child, td:first-child > input { + width: 99%; + } + td:last-child { + width: 1%; + padding-left: 5px; + } + } + h2 { font-size: 1.8em; } diff --git a/addons/account/static/src/js/account_widgets.js b/addons/account/static/src/js/account_widgets.js index 593211832db..d92b46c3ef8 100644 --- a/addons/account/static/src/js/account_widgets.js +++ b/addons/account/static/src/js/account_widgets.js @@ -9,12 +9,19 @@ openerp.account = function (instance) { instance.web.client_actions.add('bank_statement_reconciliation_view', 'instance.web.account.bankStatementReconciliation'); instance.web.account.bankStatementReconciliation = instance.web.Widget.extend({ className: 'oe_bank_statement_reconciliation', + + events: { + "click .statement_name span": "statementNameClickHandler", + "keyup .change_statement_name_field": "changeStatementNameFieldHandler", + "click .change_statement_name_button": "changeStatementButtonClickHandler", + }, init: function(parent, context) { this._super(parent); this.max_reconciliations_displayed = 10; if (context.context.statement_id) this.statement_ids = [context.context.statement_id]; if (context.context.statement_ids) this.statement_ids = context.context.statement_ids; + this.is_single_statement = this.statement_ids !== undefined && this.statement_ids.length === 1; this.title = context.context.title || _t("Reconciliation"); this.st_lines = []; this.last_displayed_reconciliation_index = undefined; // Flow control @@ -127,8 +134,8 @@ openerp.account = function (instance) { if (self.statement_ids && self.statement_ids.length > 0) { lines_filter.push(['statement_id', 'in', self.statement_ids]); - // If only one statement, retreive its name - if (self.statement_ids.length === 1) { + // If only one statement, display its name as title and allow to modify it + if (self.is_single_statement) { deferred_promises.push(self.model_bank_statement .query(["name"]) .filter([['id', '=', self.statement_ids[0]]]) @@ -211,7 +218,11 @@ openerp.account = function (instance) { }); // Render and display - self.$el.prepend(QWeb.render("bank_statement_reconciliation", {title: self.title, total_lines: self.already_reconciled_lines+self.st_lines.length})); + self.$el.prepend(QWeb.render("bank_statement_reconciliation", { + title: self.title, + is_single_statement: self.is_single_statement, + total_lines: self.already_reconciled_lines+self.st_lines.length + })); self.updateProgressbar(); var reconciliations_to_show = self.st_lines.slice(0, self.max_reconciliations_displayed); self.last_displayed_reconciliation_index = reconciliations_to_show.length; @@ -233,6 +244,34 @@ openerp.account = function (instance) { }); }); }, + + statementNameClickHandler: function() { + if (! this.is_single_statement) return; + this.$(".statement_name span").hide(); + this.$(".change_statement_name_field").attr("value", this.title); + this.$(".change_statement_name_container").show(); + }, + + changeStatementNameFieldHandler: function(e) { + var name = this.$(".change_statement_name_field").val(); + if (name === "") this.$(".change_statement_name_button").attr("disabled", "disabled"); + else this.$(".change_statement_name_button").removeAttr("disabled"); + if (name !== "" && e.which === 13) this.$(".change_statement_name_button").trigger("click"); + }, + + changeStatementButtonClickHandler: function() { + var self = this; + if (! self.is_single_statement) return; + var name = self.$(".change_statement_name_field").val(); + if (name === "") return; + return self.model_bank_statement + .call("write", [[self.statement_ids[0]], {'name': name}]) + .then(function () { + self.title = name; + self.$(".statement_name span").text(name).show(); + self.$(".change_statement_name_container").hide(); + }); + }, keyboardShortcutsHandler: function(e) { var self = this; @@ -345,7 +384,6 @@ openerp.account = function (instance) { displayDoneMessage: function() { var self = this; - var is_single_statement = self.statement_ids !== undefined && self.statement_ids.length === 1; var sec_taken = Math.round((Date.now()-self.time_widget_loaded)/1000); var sec_per_item = Math.round(sec_taken/self.reconciled_lines); var achievements = []; @@ -381,7 +419,7 @@ openerp.account = function (instance) { transactions_done: self.reconciled_lines, done_with_ctrl_enter: self.lines_reconciled_with_ctrl_enter, achievements: achievements, - has_statement_id: is_single_statement, + has_statement_id: self.is_single_statement, })); // Animate it @@ -400,7 +438,7 @@ openerp.account = function (instance) { }); }); - if (is_single_statement && self.$(".button_close_statement").length !== 0) { + if (self.is_single_statement && self.$(".button_close_statement").length !== 0) { self.$(".button_close_statement").hide(); self.model_bank_statement .query(["balance_end_real", "balance_end"]) diff --git a/addons/account/static/src/xml/account_bank_statement_reconciliation.xml b/addons/account/static/src/xml/account_bank_statement_reconciliation.xml index 4e32d97eceb..c86414a99ba 100644 --- a/addons/account/static/src/xml/account_bank_statement_reconciliation.xml +++ b/addons/account/static/src/xml/account_bank_statement_reconciliation.xml @@ -13,7 +13,18 @@
-

+ +

+ + + + +
+

+
+ +

+
0 /