[IMP] sales_team: main dashboard alignement&focus

* Adapt LESS rules so that the tables are top aligned and respect
correct margins.
* Set td min height so that toggling between edit mode and readonly
mode does not modify the table cells dimensions.
* Before this commit, clicking on a target to edit while one was
already being edited closed the new editable target immediately.
This commit is contained in:
qsm-odoo
2015-09-21 13:58:15 +02:00
parent 85b1021fc7
commit c673d3250c
2 changed files with 15 additions and 13 deletions
@@ -31,7 +31,7 @@ var SalesTeamDashboardView = KanbanView.extend({
var super_render = this._super;
var self = this;
this.fetch_data().then(function(result){
return this.fetch_data().then(function(result){
self.show_demo = result && result['nb_opportunities'] == 0;
var sales_dashboard = QWeb.render('sales_team.SalesDashboard', {
@@ -86,18 +86,14 @@ var SalesTeamDashboardView = KanbanView.extend({
if(isNaN(target_value)) {
this.do_warn(_t("Wrong value entered!"), _t("Only Integer Value should be valid."));
} else {
this.modify_target(target_name, target_value).then(function() {
self.render();
});
this._updated = new Model('crm.lead')
.call('modify_target_sales_dashboard', [target_name, target_value])
.then(function() {
return self.render();
});
}
},
modify_target: function(target_name, value){
return new Model('crm.lead')
.call('modify_target_sales_dashboard', [target_name, value])
},
on_dashboard_target_clicked: function(ev){
if (this.show_demo) {
// The user is not allowed to modify the targets in demo mode
@@ -122,12 +118,15 @@ var SalesTeamDashboardView = KanbanView.extend({
$input.on('blur', function(e) {
self.on_change_input_target(e);
});
$target.replaceWith($input);
$input.focus().select();
$.when(this._updated).then(function() {
$input.replaceAll(self.$('.o_target_to_set[name=' + target_name + ']')) // the target may have changed (re-rendering)
.focus()
.select();
});
},
render_monetary_field: function(value, currency_id) {
var currency = session.get_currency(currency_id);
var digits_precision = currency && currency.digits;
value = formats.format_value(value || 0, {type: "float", digits: digits_precision});
@@ -37,6 +37,7 @@
> div {
display: inline-block;
vertical-align: top;
@media (min-width: @screen-sm-min) {
width: 50%;
}
@@ -53,6 +54,8 @@
border-top: 1px solid @odoo-view-background-color;
width: 25%;
height: 33px;
span {
display: inline;
}