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 {
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;
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 {
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
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]]])
});
// 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;
});
});
},
+
+ 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;
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 = [];
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
});
});
- 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"])