[FIX] account: adapted reconciliation widget to bootstrap buttons and web client...
authorArthur Maniet <me@whisno.be>
Tue, 18 Nov 2014 10:41:44 +0000 (11:41 +0100)
committerArthur Maniet <me@whisno.be>
Thu, 4 Dec 2014 10:11:24 +0000 (11:11 +0100)
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 fb7de38..818e3e5 100644 (file)
@@ -7,16 +7,14 @@
   user-select: none;
   cursor: default;
   height: 100%;
+  overflow: auto;
   /* icons */ }
   .openerp .oe_bank_statement_reconciliation .oe_form_sheetbg {
-    border-bottom: 0;
-    padding: 0;
-    height: 100%; }
+    padding-top: 0; }
     .openerp .oe_bank_statement_reconciliation .oe_form_sheetbg .oe_form_sheet {
       position: relative;
-      padding: 20px 15px 30px 15px;
+      padding: 20px 15px 20px 15px;
       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; }
@@ -38,6 +36,9 @@
     .openerp .oe_bank_statement_reconciliation .change_statement_name_container td:last-child {
       width: 1%;
       padding-left: 3px; }
+      .openerp .oe_bank_statement_reconciliation .change_statement_name_container td:last-child button {
+        height: 100%;
+        box-sizing: content-box; }
   .openerp .oe_bank_statement_reconciliation h2 {
     font-size: 1.8em; }
   .openerp .oe_bank_statement_reconciliation .progress {
         height: 26px;
         margin: 0 15px 4px 15px; }
         .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view caption button {
-          float: right; }
+          float: right;
+          position: relative;
+          top: -4px; }
           .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view caption button:disabled {
             opacity: 0.5; }
         .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view caption > span, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view caption > input {
index f8fcc7c..938965a 100644 (file)
@@ -16,17 +16,15 @@ $aestetic_animation_speed: 300ms;
     user-select: none;
     cursor: default;
     height: 100%;
+    overflow: auto;
 
     .oe_form_sheetbg {
-        border-bottom: 0;
-        padding: 0;
-        height: 100%;
+        padding-top: 0;
 
         .oe_form_sheet {
             position: relative;
-            padding: 20px 15px 30px 15px;
+            padding: 20px 15px 20px 15px;
             border-top: 0;
-            border-bottom: 0;
             height: 100%;
         }
     }
@@ -59,6 +57,11 @@ $aestetic_animation_speed: 300ms;
         td:last-child {
             width: 1%;
             padding-left: 3px;
+
+            button {
+                height: 100%;
+                box-sizing: content-box;
+            }
         }
     }
 
@@ -377,6 +380,8 @@ $aestetic_animation_speed: 300ms;
 
                 button {
                     float: right;
+                    position: relative;
+                    top: -4px;
 
                     &:disabled {
                         opacity: 0.5;
index 2656545..16ee236 100644 (file)
@@ -32,7 +32,8 @@ openerp.account = function (instance) {
             this.model_bank_statement_line = new instance.web.Model("account.bank.statement.line");
             this.reconciliation_menu_id = false; // Used to update the needaction badge
             this.formatCurrency; // Method that formats the currency ; loaded from the server
-    
+            this.action_manager = this.findAncestor(function(ancestor){ return ancestor instanceof instance.web.ActionManager });
+
             // Only for statistical purposes
             this.lines_reconciled_with_ctrl_enter = 0;
             this.time_widget_loaded = Date.now();
@@ -479,23 +480,17 @@ openerp.account = function (instance) {
                 .call("get_object_reference", ['account', 'action_bank_statement_tree'])
                 .then(function (result) {
                     var action_id = result[1];
-                    // Warning : altough I don't see why this widget wouldn't be directly instanciated by the
-                    // action manager, if it wasn't, this code wouldn't work. You'd have to do something like :
-                    // var action_manager = self;
-                    // while (! action_manager instanceof ActionManager)
-                    //    action_manager = action_manager.getParent();
-                    var action_manager = self.getParent();
-                    var breadcrumbs = action_manager.breadcrumbs;
-                    var found = false;
-                    for (var i=breadcrumbs.length-1; i>=0; i--) {
-                        if (breadcrumbs[i].action && breadcrumbs[i].action.id === action_id) {
-                            var title = breadcrumbs[i].get_title();
-                            action_manager.select_breadcrumb(i, _.isArray(title) ? i : undefined);
-                            found = true;
-                        }
+                    var breadcrumbs = self.action_manager.get_widgets();
+                    var widget = _.find(breadcrumbs, function(widget){
+                        return widget.action && widget.action.id === action_id;
+                    });
+                    if (widget) {
+                        self.action_manager.select_widget(widget, 0);
+                    } else {
+                        self.action_manager.do_action(action_id, {
+                            clear_breadcrumbs: true
+                        });
                     }
-                    if (!found)
-                        instance.web.Home(self);
                 });
         },
     
@@ -1254,12 +1249,12 @@ openerp.account = function (instance) {
             // Special case hack : no identified partner
             if (self.st_line.has_no_partner) {
                 if (Math.abs(balance).toFixed(3) === "0.000") {
-                    self.$(".button_ok").addClass("oe_highlight");
+                    self.$(".button_ok").addClass("btn-primary");
                     self.$(".button_ok").removeAttr("disabled");
                     self.$(".button_ok").text("OK");
                     self.is_valid = true;
                 } else {
-                    self.$(".button_ok").removeClass("oe_highlight");
+                    self.$(".button_ok").removeClass("btn-primary");
                     self.$(".button_ok").attr("disabled", "disabled");
                     self.$(".button_ok").text("OK");
                     self.is_valid = false;
@@ -1277,10 +1272,10 @@ openerp.account = function (instance) {
             }
     
             if (Math.abs(balance).toFixed(3) === "0.000") {
-                self.$(".button_ok").addClass("oe_highlight");
+                self.$(".button_ok").addClass("btn-primary");
                 self.$(".button_ok").text("OK");
             } else {
-                self.$(".button_ok").removeClass("oe_highlight");
+                self.$(".button_ok").removeClass("btn-primary");
                 self.$(".button_ok").text("Keep open");
                 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) : "");
index a85a8f1..c0ad724 100644 (file)
@@ -18,7 +18,7 @@
                     <span><t t-esc="title"/></span>
                     <table class="change_statement_name_container oe_form"><tr>
                         <td><input class="change_statement_name_field" type="text"/></td>
-                        <td><button class="change_statement_name_button oe_highlight">OK</button></td>
+                        <td><button class="change_statement_name_button btn btn-primary btn-sm">OK</button></td>
                     </tr></table>
                 </h1>
             </t>
@@ -50,8 +50,8 @@
             </p>
             <p class="action_buttons">
                 <t t-if="single_statement or multiple_statements">
-                    <button class="button_back_to_statement">Back to statements list</button>
-                    <button class="button_close_statement">Close the statement<t t-if="multiple_statements">s</t></button>
+                    <button class="button_back_to_statement btn btn-default btn-sm">Back to statements list</button>
+                    <button class="button_close_statement btn btn-primary btn-sm">Close the statement<t t-if="multiple_statements">s</t></button>
                 </t>
             </p>
         </div>
@@ -63,7 +63,7 @@
                 <td>
                     <table class="accounting_view">
                         <caption>
-                            <button class="button_ok"></button>
+                            <button class="button_ok btn btn-default btn-sm"></button>
                             <span t-if="! line.has_no_partner" class="partner_name">
                                 <t t-esc="line.partner_name"/>
                                 <span class="change_partner glyphicon glyphicon-pencil"></span>