forked from Techsystech/web
[ADD] hide the widget if the user has right on only one company. (following Arthru's remark)
parent
abc811e1c8
commit
50220e6cb2
|
@ -40,16 +40,22 @@ openerp.web_easy_switch_company = function (instance) {
|
||||||
renderElement: function() {
|
renderElement: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
this._super();
|
this._super();
|
||||||
this.$el.find('.easy_switch_company_company_item').on('click', function(ev) {
|
if (this.companies.length === 1) {
|
||||||
var company_id = $(ev.target).data("company-id");
|
this.$el.hide();
|
||||||
if (company_id != self.current_company_id){
|
}
|
||||||
var func = '/web_easy_switch_company/switch/change_current_company';
|
else{
|
||||||
var param = {'company_id': company_id}
|
this.$el.show();
|
||||||
self.rpc(func, param).done(function(res) {
|
this.$el.find('.easy_switch_company_company_item').on('click', function(ev) {
|
||||||
window.location.reload()
|
var company_id = $(ev.target).data("company-id");
|
||||||
});
|
if (company_id != self.current_company_id){
|
||||||
}
|
var func = '/web_easy_switch_company/switch/change_current_company';
|
||||||
});
|
var param = {'company_id': company_id}
|
||||||
|
self.rpc(func, param).done(function(res) {
|
||||||
|
window.location.reload()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
Loading…
Reference in New Issue