[FIX]account: reconciliation widget, some usability features
authorCedric Snauwaert <csn@openerp.com>
Tue, 17 Jun 2014 09:29:27 +0000 (11:29 +0200)
committerqdp-odoo <qdp@openerp.com>
Fri, 20 Jun 2014 07:58:25 +0000 (09:58 +0200)
addons/account/static/src/css/account_bank_statement_reconciliation.css
addons/account/static/src/css/account_bank_statement_reconciliation.scss
addons/account/static/src/js/account_widgets.js
addons/account/static/src/xml/account_bank_statement_reconciliation.xml

index 626d1f3..05caeab 100644 (file)
         cursor: pointer; }
     .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_match:not(.no_partner) .toggle_match {
       visibility: hidden !important; }
-    .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_partner .partner_name, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_partner .line_open_balance {
-      display: none !important; }
     .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line > table > tbody > tr:nth-child(1) > td table {
       margin-bottom: 10px; }
     .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line table.details td:first-child {
         cursor: pointer; }
     .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td:nth-child(6) {
       border-left: 1px solid black; }
-    .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr.initial_line > td:nth-child(5) {
-      border-top: 1px solid black; }
-    .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr.initial_line > td:nth-child(6) {
-      border-top: 1px solid black; }
     .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 {
index 3b98689..248536b 100644 (file)
@@ -194,12 +194,6 @@ $initialLineBackground: #f0f0f0;
             }
         }
 
-        &.no_partner {
-            .partner_name, .line_open_balance {
-                display: none !important;
-            }
-        }
-
         /* gap between accounting_view and action view */
         > table > tbody > tr:nth-child(1) > td table {
             margin-bottom: 10px;
@@ -341,10 +335,6 @@ $initialLineBackground: #f0f0f0;
 
             // accounting "T"
             td:nth-child(6) { border-left: $accountingBorder; }
-            tr.initial_line > td {
-                &:nth-child(5) { border-top: $accountingBorder; }
-                &:nth-child(6) { border-top: $accountingBorder; }
-            }
         }
 
 
index 56fdaaf..294c2b2 100644 (file)
@@ -245,7 +245,7 @@ openerp.account = function (instance) {
     
         keyboardShortcutsHandler: function(e) {
             var self = this;
-            if (e.which === 13 && (e.ctrlKey || e.metaKey)) {
+            if ((e.which === 13 || e.which === 10) && (e.ctrlKey || e.metaKey)) {
                 $.each(self.getChildren(), function(i, o){
                     if (o.is_valid && o.persistAndDestroy()) {
                         self.lines_reconciled_with_ctrl_enter++;
@@ -981,6 +981,7 @@ openerp.account = function (instance) {
         lineOpenBalanceClickHandler: function() {
             var self = this;
             if (self.get("mode") === "create") {
+                self.addLineBeingEdited();
                 self.set("mode", "match");
             } else {
                 self.set("mode", "create");
@@ -1075,7 +1076,7 @@ openerp.account = function (instance) {
         balanceChanged: function() {
             var self = this;
             var balance = self.get("balance");
-    
+            self.$(".tbody_open_balance").empty();
             // Special case hack : no identified partner
             if (self.st_line.has_no_partner) {
                 if (Math.abs(balance).toFixed(3) === "0.000") {
@@ -1088,11 +1089,15 @@ openerp.account = function (instance) {
                     self.$(".button_ok").attr("disabled", "disabled");
                     self.$(".button_ok").text("OK");
                     self.is_valid = false;
+                    var debit = (balance > 0 ? self.formatCurrency(balance, self.st_line.currency_id) : "");
+                    var credit = (balance < 0 ? self.formatCurrency(-1*balance, self.st_line.currency_id) : "");
+                    var $line = $(QWeb.render("bank_statement_reconciliation_line_open_balance", {debit: debit, credit: credit, account_code: self.map_account_id_code[self.st_line.open_balance_account_id]}));
+                    $line.find('.js_open_balance')[0].innerHTML = "Choose counterpart";
+                    self.$(".tbody_open_balance").append($line);
                 }
                 return;
             }
     
-            self.$(".tbody_open_balance").empty();
             if (Math.abs(balance).toFixed(3) === "0.000") {
                 self.$(".button_ok").addClass("oe_highlight");
                 self.$(".button_ok").text("OK");
@@ -1111,21 +1116,15 @@ openerp.account = function (instance) {
     
             self.$(".action_pane.active").removeClass("active");
     
-            // Special case hack : if no_partner, either inactive or create
+            // Special case hack : if no_partner and mode == inactive
             if (self.st_line.has_no_partner) {
                 if (self.get("mode") === "inactive") {
                     self.$(".match").slideUp(self.animation_speed);
                     self.$(".create").slideUp(self.animation_speed);
                     self.$(".toggle_match").removeClass("visible_toggle");
                     self.el.dataset.mode = "inactive";
-                } else {
-                    self.initializeCreateForm();
-                    self.$(".match").slideUp(self.animation_speed);
-                    self.$(".create").slideDown(self.animation_speed);
-                    self.$(".toggle_match").addClass("visible_toggle");
-                    self.el.dataset.mode = "create";
-                }
-                return;
+                    return;
+                } 
             }
     
             if (self.get("mode") === "inactive") {
index 4ea6761..b14cc93 100644 (file)
             <td><span class="toggle_create glyphicon glyphicon-play"></span></td>
             <td><t t-esc="account_code"/></td>
             <td></td>
-            <td>Open balance</td>
+            <td class="js_open_balance">Open balance</td>
             <td><t t-esc="debit"/></td>
             <td><t t-esc="credit"/></td>
             <td></td>