summaryrefslogtreecommitdiff
path: root/addons/google_docs/static
diff options
context:
space:
mode:
authorRajesh Prajapati (OpenERP) <rpr@tinyerp.com>2013-04-01 13:33:23 +0530
committerRajesh Prajapati (OpenERP) <rpr@tinyerp.com>2013-04-01 13:33:23 +0530
commitdeb23a62b75e332e0b6a6f24df8b8c5d704ffc98 (patch)
tree60ef0f64fa07fd3a56399ce7854158683147ff7e /addons/google_docs/static
parentf3d3de20de66a798d928ee31afd462266a79ef46 (diff)
[IMP] google_docs : changes for code and rpa review 28 march
bzr revid: rpr@tinyerp.com-20130401080323-vdw9rgdvzi0qyqrf
Diffstat (limited to 'addons/google_docs/static')
-rw-r--r--addons/google_docs/static/src/js/gdocs.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index e5461e2c919..5b179f41ee6 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -14,32 +14,33 @@ var _t = instance.web._t,
ids = []
view.on("load_record", self, function(r){
ids = [r.id]
- self.add_gdoc_items(view,ids)
+ self.add_gdoc_items(view, r.id)
});
}
},
- add_gdoc_items: function(view,ids){
+ add_gdoc_items: function(view, res_id){
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) ){
+ if( res_id ){
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) {
+ ds.call('get_google_docs_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);
+ var g_item = _.indexOf(_.pluck(self.items.other,'label'),res.name);
if(g_item !== -1)
{
self.items.other.splice(g_item,1);
}
self.add_items('other', [
- { label: res,
+ { label: res.name,
+ config_id: res.id,
callback: self.on_google_doc,
classname: 'oe_share_gdoc' },
]);
@@ -51,14 +52,14 @@ var _t = instance.web._t,
},
- on_google_doc: function(r) {
+ on_google_doc: function(doc_item) {
var self = this;
var view = self.getParent();
var ids = ( view.fields_view.type != "form" )? view.groups.get_selection().ids : [ view.datarecord.id ];
if( !_.isEmpty(ids) ){
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) {
+ ds.call('get_google_attachment', [doc_item.config_id, view.datarecord.id, context]).done(function(res) {
window.open(res.url,"_blank");
view.reload();
})