[FIX]google_drive: add in more menu duplicate when clicking on form switch button
bzr revid: dle@openerp.com-20130723133055-evcyunmih9uma3k4
This commit is contained in:
parent
9ae6b18ded
commit
d69046f327
|
@ -29,19 +29,24 @@ openerp.google_drive = function (instance, m) {
|
|||
ds.call('get_google_drive_config', [view.dataset.model, res_id, context]).done(function (r) {
|
||||
if (!_.isEmpty(r)) {
|
||||
_.each(r, function (res) {
|
||||
var g_item = _.indexOf(_.pluck(self.items.other, 'label'), res.name);
|
||||
if (g_item !== -1) {
|
||||
self.items.other.splice(g_item, 1);
|
||||
var already_there = false;
|
||||
for (var i = 0;i < self.items.other.length;i++){
|
||||
if (self.items.other[i].classname === "oe_share_gdoc" && self.items.other[i].label.indexOf(res.name) > -1){
|
||||
already_there = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!already_there){
|
||||
self.add_items('other', [{
|
||||
label: res.name+ '<img style="position:absolute;right:5px;height:20px;width:20px;" title="Google Drive" src="google_drive/static/src/img/drive_icon.png"/>',
|
||||
config_id: res.id,
|
||||
res_id: res_id,
|
||||
res_model: view.dataset.model,
|
||||
callback: self.on_google_doc,
|
||||
classname: 'oe_share_gdoc'
|
||||
},
|
||||
]);
|
||||
}
|
||||
self.add_items('other', [{
|
||||
label: res.name+ '<img style="position:absolute;right:5px;height:20px;width:20px;" title="Google Drive" src="google_drive/static/src/img/drive_icon.png"/>',
|
||||
config_id: res.id,
|
||||
res_id: res_id,
|
||||
res_model: view.dataset.model,
|
||||
callback: self.on_google_doc,
|
||||
classname: 'oe_share_gdoc'
|
||||
},
|
||||
]);
|
||||
})
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue