Skip to content

Commit

Permalink
[IMP] account: bank reconciliation widget: making it harder to remove…
Browse files Browse the repository at this point in the history
… a statement line's partner ; improved change statement name usability
  • Loading branch information
Whisno committed Sep 10, 2014
1 parent 9277cc9 commit 24cf401
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,24 @@
padding: 0 0 0 15px;
margin: 0 0 25px 0;
float: left;
font-size: 2em; }
font-size: 2em;
height: 1.5em; }
.openerp .oe_bank_statement_reconciliation .statement_name span {
line-height: 1.5em;
cursor: pointer; }
.openerp .oe_bank_statement_reconciliation .change_statement_name_container {
display: none; }
display: none;
width: 95%; }
.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; }
padding-left: 3px; }
.openerp .oe_bank_statement_reconciliation h2 {
font-size: 1.8em; }
.openerp .oe_bank_statement_reconciliation .progress {
width: 49%;
margin: 4px 15px 0 0;
margin: 10px 15px 0 0;
float: right;
position: relative;
display: inline-block; }
Expand Down Expand Up @@ -130,6 +135,13 @@
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: rotate(90deg); }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .partner_name .remove_partner {
display: none;
cursor: pointer; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .partner_name .remove_partner .glyphicon {
margin: 0 5px; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .partner_name:hover .remove_partner {
display: inline; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .change_partner_container {
width: 200px;
display: none;
Expand Down Expand Up @@ -223,8 +235,7 @@
position: relative;
top: 7px;
/* meh */
font-weight: bold;
cursor: pointer; }
font-weight: bold; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td.cell_credit {
border-left: 1px solid #000; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,24 @@ $aestetic_animation_speed: 300ms;
margin: 0 0 25px 0;
float: left;
font-size: 2em;
height: 1.5em;
}

.statement_name span {
line-height: 1.5em;
cursor: pointer;
}

.change_statement_name_container {
display: none;
width: 95%;

td:first-child, td:first-child > input {
width: 99%;
}
td:last-child {
width: 1%;
padding-left: 5px;
padding-left: 3px;
}
}

Expand All @@ -61,7 +68,7 @@ $aestetic_animation_speed: 300ms;

.progress {
width: 49%;
margin: 4px $actionColWidth 0 0;
margin: 10px $actionColWidth 0 0;
float: right;
position: relative;
display: inline-block;
Expand Down Expand Up @@ -189,6 +196,20 @@ $aestetic_animation_speed: 300ms;
transform: rotate(90deg);
}

.partner_name {
.remove_partner {
display: none;
cursor: pointer;

.glyphicon {
margin: 0 5px;
}
}
&:hover .remove_partner {
display: inline;
}
}

.change_partner_container {
width: 200px;
display: none;
Expand Down Expand Up @@ -367,7 +388,6 @@ $aestetic_animation_speed: 300ms;
> span, > input {
position: relative; top: 7px; /* meh */
font-weight: bold;
cursor: pointer;
}
}

Expand Down
23 changes: 14 additions & 9 deletions addons/account/static/src/js/account_widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,20 @@ openerp.account = function (instance) {
this.$(".statement_name span").hide();
this.$(".change_statement_name_field").attr("value", this.title);
this.$(".change_statement_name_container").show();
this.$(".change_statement_name_field").focus();
},

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");

if (name !== "" && e.which === 13) // Enter
this.$(".change_statement_name_button").trigger("click");
if (e.which === 27) { // Escape
this.$(".statement_name span").show();
this.$(".change_statement_name_container").hide();
}
},

changeStatementButtonClickHandler: function() {
Expand Down Expand Up @@ -493,7 +500,7 @@ openerp.account = function (instance) {
className: 'oe_bank_statement_reconciliation_line',

events: {
"click .partner_name": "partnerNameClickHandler",
"click .remove_partner": "removePartnerClickHandler",
"click .button_ok": "persistAndDestroy",
"click .mv_line": "moveLineClickHandler",
"click .initial_line": "initialLineClickHandler",
Expand Down Expand Up @@ -1064,15 +1071,13 @@ openerp.account = function (instance) {
}
},

partnerNameClickHandler: function() {
removePartnerClickHandler: function() {
var self = this;
// Delete statement line's partner
if (window.confirm(_t("Reset the statement line's partner ?"))) {
return self.changePartner('', function() {
self.$(".partner_name").hide();
self.$(".change_partner_container").show();
});
}
return self.changePartner('', function() {
self.$(".partner_name").hide();
self.$(".change_partner_container").show();
});
},


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@
<table class="accounting_view">
<caption>
<button class="button_ok"></button>
<span t-if="! line.has_no_partner" class="partner_name"><t t-esc="line.partner_name"/></span>
<span t-if="! line.has_no_partner" class="partner_name">
<t t-esc="line.partner_name"/>
<span class="remove_partner"><span class="glyphicon glyphicon-remove"></span></span>
</span>
<div class="change_partner_container oe_form"></div>
</caption>
<tbody class="tbody_initial_line">
Expand Down

0 comments on commit 24cf401

Please sign in to comment.