summaryrefslogtreecommitdiff
path: root/addons/google_docs
diff options
context:
space:
mode:
authorDharti Ratani (Open ERP) <dhr@tinyerp.com>2013-03-11 16:56:49 +0530
committerDharti Ratani (Open ERP) <dhr@tinyerp.com>2013-03-11 16:56:49 +0530
commit4970a21c7f4d757c1b75cc37e04bccece70391bd (patch)
tree9196cbcf52bd713d4894720e5488f3766acd94c7 /addons/google_docs
parent102dffaa80ebf28d59e951d1389d85473f1858be (diff)
[Imp]Removing the virtual item while moving to next record
bzr revid: dhr@tinyerp.com-20130311112649-wzt7n8h718g7cabv
Diffstat (limited to 'addons/google_docs')
-rw-r--r--addons/google_docs/__openerp__.py2
-rw-r--r--addons/google_docs/static/src/js/gdocs.js22
2 files changed, 14 insertions, 10 deletions
diff --git a/addons/google_docs/__openerp__.py b/addons/google_docs/__openerp__.py
index f804ecc99b4..ca51719d185 100644
--- a/addons/google_docs/__openerp__.py
+++ b/addons/google_docs/__openerp__.py
@@ -28,7 +28,7 @@
'installable': True,
'auto_install': False,
'js': ['static/src/js/gdocs.js'],
- 'qweb': ['static/src/xml/gdocs.xml'],
+# 'qweb': ['static/src/xml/gdocs.xml'],
'data': [
'security/ir.model.access.csv',
'res_config_user_view.xml'
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index a0f1cba3b9b..e5461e2c919 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -19,21 +19,25 @@ var _t = instance.web._t,
}
},
- add_gdoc_items: function(view,ids){
- $('.oe_share_gdoc').remove();
+ add_gdoc_items: function(view,ids){
var self = this;
+ var gdoc_item = _.indexOf(_.pluck(self.items.other,'classname'),'oe_share_gdoc');
+ if(gdoc_item !== -1)
+ {
+ self.items.other.splice(gdoc_item,1);
+ }
if( !_.isEmpty(ids) ){
view.sidebar_eval_context().done(function (context) {
var ds = new instance.web.DataSet(this, 'ir.attachment', context);
ds.call('google_doc_get', [view.dataset.model, ids, context]).done(function(r) {
- console.log("thjoid ",self.items['other'])
if(!_.isEmpty(r)){
_.each(r,function(res){
- _.each(self.items['other'],function(others){
- if(others['label'] == res){
- self.items['other'].pop()
- }
- })
+ var g_item = _.indexOf(_.pluck(self.items.other,'label'),res);
+ if(g_item !== -1)
+ {
+ self.items.other.splice(g_item,1);
+ }
+
self.add_items('other', [
{ label: res,
callback: self.on_google_doc,
@@ -46,6 +50,7 @@ var _t = instance.web._t,
}
},
+
on_google_doc: function(r) {
var self = this;
var view = self.getParent();
@@ -54,7 +59,6 @@ var _t = instance.web._t,
view.sidebar_eval_context().done(function (context) {
var ds = new instance.web.DataSet(this, 'ir.attachment', context);
ds.call('get_attachment', [view.dataset.model, r, ids, context]).done(function(res) {
- console.log('resssssss',res)
window.open(res.url,"_blank");
view.reload();
})