From b1e9363b6629d1f11a60f414dba0df105a21485f Mon Sep 17 00:00:00 2001
From: Arthur Maniet
Date: Tue, 18 Nov 2014 11:41:44 +0100
Subject: [PATCH] [FIX] account: adapted reconciliation widget to bootstrap
buttons and web client API changes
---
.../css/account_bank_statement_reconciliation.css | 15 ++++----
.../css/account_bank_statement_reconciliation.scss | 15 +++++---
addons/account/static/src/js/account_widgets.js | 37 +++++++++-----------
.../xml/account_bank_statement_reconciliation.xml | 8 ++---
4 files changed, 39 insertions(+), 36 deletions(-)
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 fb7de38..818e3e5 100644
--- a/addons/account/static/src/css/account_bank_statement_reconciliation.css
+++ b/addons/account/static/src/css/account_bank_statement_reconciliation.css
@@ -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 {
@@ -229,7 +230,9 @@
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 {
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 f8fcc7c..938965a 100644
--- a/addons/account/static/src/css/account_bank_statement_reconciliation.scss
+++ b/addons/account/static/src/css/account_bank_statement_reconciliation.scss
@@ -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;
diff --git a/addons/account/static/src/js/account_widgets.js b/addons/account/static/src/js/account_widgets.js
index 2656545..16ee236 100644
--- a/addons/account/static/src/js/account_widgets.js
+++ b/addons/account/static/src/js/account_widgets.js
@@ -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) : "");
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 a85a8f1..c0ad724 100644
--- a/addons/account/static/src/xml/account_bank_statement_reconciliation.xml
+++ b/addons/account/static/src/xml/account_bank_statement_reconciliation.xml
@@ -18,7 +18,7 @@
@@ -50,8 +50,8 @@
-
-
+
+
@@ -63,7 +63,7 @@
|