From 0b508d66fe8b4b0fb70f22a1f3fee5887913ad06 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Fri, 12 Oct 2012 19:23:42 +0530
Subject: [IMP] imporve code + usability
bzr revid: rgaopenerp-20121012135342-hjj8slov7yvfwal0
---
addons/google_docs/__openerp__.py | 1 +
addons/google_docs/static/src/js/gdocs.js | 30 +++++++++++++----------------
addons/google_docs/static/src/xml/gdocs.xml | 8 ++++++++
3 files changed, 22 insertions(+), 17 deletions(-)
create mode 100644 addons/google_docs/static/src/xml/gdocs.xml
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/__openerp__.py b/addons/google_docs/__openerp__.py
index 8b9a4123aa9..716a603043d 100644
--- a/addons/google_docs/__openerp__.py
+++ b/addons/google_docs/__openerp__.py
@@ -28,6 +28,7 @@
'installable': True,
'auto_install': False,
'js': ['static/src/js/gdocs.js'],
+ '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 bcfd24f8c0d..c2c0ded407b 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -1,28 +1,22 @@
openerp.google_docs = function(instance, m) {
-var _t = instance.web._t;
+var QWeb = instance.web.qweb,
+ _t = instance.web._t;
instance.web.Sidebar = instance.web.Sidebar.extend({
- on_attachments_loaded: function(attachments) {
- var self = this;
- self._super(attachments);
- // if attachment contains a google doc url do nothing
- // else display a button to create a google doc
- var flag = false;
- _.each(attachments, function(i) {
- if (i.url && i.url.match('/docs.google.com/')) { flag = true; }
+ redraw: function() {
+ var self = this;
+ this._super.apply(this, arguments);
+ self.$el.find('.oe_sidebar_add_attachment').after(QWeb.render('Google_doc', {widget: self}))
+ self.$el.find('.oe_sidebar_add_google_doc').on('click', function (e) {
+ self.on_google_doc();
});
- if (! flag) {
- this.add_items('files', [
- { label: _t('Add Google Doc...'), callback: self.on_google_doc },
- ]);
- }
},
on_google_doc: function() {
var self = this;
var form = self.getParent();
form.sidebar_context().then(function (context) {
var ds = new instance.web.DataSet(this, 'ir.attachment', context);
- ds.call('google_doc_get', [form.dataset.model, [form.datarecord.id], context], function(r) {
+ def = ds.call('google_doc_get', [form.dataset.model, [form.datarecord.id], context], function(r) {
if (r == 'False') {
var params = {
error: response,
@@ -33,8 +27,10 @@ var _t = instance.web._t;
modal: true,
});
}
- form.reload();
- });
+
+ }).done(function(){
+ form.reload();
+ });
})
}
})
diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml
new file mode 100644
index 00000000000..85a3b3f8be0
--- /dev/null
+++ b/addons/google_docs/static/src/xml/gdocs.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
\ No newline at end of file
--
cgit v1.2.3
From 2c6281b4fb1c1512c4bdeb5e70c7e17fd73c5a67 Mon Sep 17 00:00:00 2001
From: Vijaykumar Baladaniya
Date: Mon, 15 Oct 2012 11:41:28 +0530
Subject: Improve field size and make required field.
bzr revid: vba@tinyerp.com-20121015061128-in7l3ncrld2yc7kf
---
addons/google_docs/google_docs.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index f1477f9c7f2..76530c1290c 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -135,7 +135,7 @@ class config(osv.osv):
_columns = {
'model_id': fields.many2one('ir.model', 'Model', required=True),
- 'gdocs_resource_id': fields.char('Google Resource ID to Use as Template', size=64,help='''
+ 'gdocs_resource_id': fields.char('Google Resource ID to Use as Template', size=256, help='''
This is the id of the template document, on google side. You can find it thanks to its URL:
*for a text document with url like `https://docs.google.com/a/openerp.com/document/d/123456789/edit`, the ID is `document:123456789`
*for a spreadsheet document with url like `https://docs.google.com/a/openerp.com/spreadsheet/ccc?key=123456789#gid=0`, the ID is `spreadsheet:123456789`
@@ -143,7 +143,7 @@ This is the id of the template document, on google side. You can find it thanks
*for a drawing document with url like `https://docs.google.com/a/openerp.com/drawings/d/123456789/edit`, the ID is `drawings:123456789`
...
'''),
- 'name_template': fields.char('Google Doc Name Pattern', size=64, help='Choose how the new google docs will be named, on google side'),
+ 'name_template': fields.char('Google Doc Name Pattern', size=64, help='Choose how the new google docs will be named, on google side', required=True),
}
_defaults = {
--
cgit v1.2.3
From ec017acc0787793610e419472fefbc93c05cd46e Mon Sep 17 00:00:00 2001
From: Vijaykumar Baladaniya
Date: Mon, 15 Oct 2012 12:44:27 +0530
Subject: [IMP]Improve code.
bzr revid: vba@tinyerp.com-20121015071427-kgi4rlcqy6pwx8u9
---
addons/google_docs/google_docs.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 47029e78210..cdae5ab0399 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -125,7 +125,10 @@ class google_docs_ir_attachment(osv.osv):
google_docs_config = pool_gdoc_config.search(cr, uid, [('model_id', '=', res_model)], context=context)
if google_docs_config:
name_gdocs = pool_gdoc_config.browse(cr, uid, google_docs_config, context=context)[0].name_template
+ try:
name_gdocs = name_gdocs % model_fields_dic
+ except:
+ raise osv.except_osv(_('Key Error!'), _("Your Google Doc Name Pattern is not correct."))
google_template_id = pool_gdoc_config.browse(cr, uid, google_docs_config[0], context=context).gdocs_resource_id
google_document = pool_ir_attachment.copy_gdoc(cr, uid, res_model, res_id, name_gdocs, google_template_id, context=context)
else:
@@ -138,7 +141,7 @@ class config(osv.osv):
_columns = {
'model_id': fields.many2one('ir.model', 'Model', required=True),
- 'gdocs_resource_id': fields.char('Google Resource ID to Use as Template', size=256, help='''
+ 'gdocs_resource_id': fields.char('Google Resource ID to Use as Template', size=64, help='''
This is the id of the template document, on google side. You can find it thanks to its URL:
*for a text document with url like `https://docs.google.com/a/openerp.com/document/d/123456789/edit`, the ID is `document:123456789`
*for a spreadsheet document with url like `https://docs.google.com/a/openerp.com/spreadsheet/ccc?key=123456789#gid=0`, the ID is `spreadsheet:123456789`
--
cgit v1.2.3
From 66f00492b140566fa136c5ef55cd95dbb362d1ec Mon Sep 17 00:00:00 2001
From: Vijaykumar Baladaniya
Date: Mon, 15 Oct 2012 13:08:03 +0530
Subject: [IMP]Improve message.
bzr revid: vba@tinyerp.com-20121015073803-vr85y6d1n03al7u2
---
addons/google_docs/google_docs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index cdae5ab0399..7be713f4bbb 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -128,7 +128,7 @@ class google_docs_ir_attachment(osv.osv):
try:
name_gdocs = name_gdocs % model_fields_dic
except:
- raise osv.except_osv(_('Key Error!'), _("Your Google Doc Name Pattern is not correct."))
+ raise osv.except_osv(_('Key Error!'), _("Your Google Doc Name Pattern's key does not found in object."))
google_template_id = pool_gdoc_config.browse(cr, uid, google_docs_config[0], context=context).gdocs_resource_id
google_document = pool_ir_attachment.copy_gdoc(cr, uid, res_model, res_id, name_gdocs, google_template_id, context=context)
else:
--
cgit v1.2.3
From 9932152fae4904e994c74a47f149615b3ca39104 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Tue, 16 Oct 2012 13:00:53 +0530
Subject: [IMP] add counter on google doc when more than one document attached
bzr revid: rgaopenerp-20121016073053-nd6s90drak6crs0a
---
addons/google_docs/static/src/js/gdocs.js | 7 +++++++
1 file changed, 7 insertions(+)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index a1704cde69c..f293447f2ea 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -3,6 +3,13 @@ var QWeb = instance.web.qweb,
_t = instance.web._t;
instance.web.Sidebar = instance.web.Sidebar.extend({
+ on_attachments_loaded: function(attachments) {
+ var self = this;
+ _.chain(attachments)
+ .filter(function(attachment){ if (attachment.name ==='Google Doc') return true})
+ .map(function(attachment, i){ attachment.name = _.str.sprintf(_t("%s (%s)"), attachment.name, i+1)})
+ self._super(attachments);
+ },
redraw: function() {
var self = this;
this._super.apply(this, arguments);
--
cgit v1.2.3
From 7368b52a95524897be9bc511035ad5a6ba28c3e4 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Tue, 16 Oct 2012 17:12:59 +0530
Subject: [IMP] counter should be apply on multiple section with same name
attribute
bzr revid: rgaopenerp-20121016114259-9g496xqj8ldal1vk
---
addons/google_docs/static/src/js/gdocs.js | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index f293447f2ea..a0cc7353f3e 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -1,13 +1,18 @@
openerp.google_docs = function(instance, m) {
var QWeb = instance.web.qweb,
_t = instance.web._t;
-
+//{}
instance.web.Sidebar = instance.web.Sidebar.extend({
on_attachments_loaded: function(attachments) {
var self = this;
_.chain(attachments)
- .filter(function(attachment){ if (attachment.name ==='Google Doc') return true})
- .map(function(attachment, i){ attachment.name = _.str.sprintf(_t("%s (%s)"), attachment.name, i+1)})
+ .groupBy(function(attachment) { return attachment.name})
+ .each(function(attachment){
+ if(attachment.length > 1)
+ _.map(attachment, function(attachment, i){
+ attachment.name = _.str.sprintf(_t("%s (%s)"), attachment.name, i+1)
+ })
+ })
self._super(attachments);
},
redraw: function() {
--
cgit v1.2.3
From 067fa7fe7cd631a4cb50d494c7d99c050dd7fd28 Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Wed, 17 Oct 2012 12:16:15 +0530
Subject: [FIX]
bzr revid: hmo@tinyerp.com-20121017064615-gaodqeqwx25rgt34
---
addons/google_docs/google_docs.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 7be713f4bbb..6e839969998 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -125,10 +125,10 @@ class google_docs_ir_attachment(osv.osv):
google_docs_config = pool_gdoc_config.search(cr, uid, [('model_id', '=', res_model)], context=context)
if google_docs_config:
name_gdocs = pool_gdoc_config.browse(cr, uid, google_docs_config, context=context)[0].name_template
- try:
- name_gdocs = name_gdocs % model_fields_dic
- except:
- raise osv.except_osv(_('Key Error!'), _("Your Google Doc Name Pattern's key does not found in object."))
+ try:
+ name_gdocs = name_gdocs % model_fields_dic
+ except:
+ raise osv.except_osv(_('Key Error!'), _("Your Google Doc Name Pattern's key does not found in object."))
google_template_id = pool_gdoc_config.browse(cr, uid, google_docs_config[0], context=context).gdocs_resource_id
google_document = pool_ir_attachment.copy_gdoc(cr, uid, res_model, res_id, name_gdocs, google_template_id, context=context)
else:
--
cgit v1.2.3
From fee84c9c5d234748912d5ea9b478e72b8986a933 Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Wed, 17 Oct 2012 12:22:24 +0530
Subject: [FIX]
bzr revid: hmo@tinyerp.com-20121017065224-go11e1c1rmvr60vy
---
addons/google_docs/static/src/js/gdocs.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index fb9e95c0b63..a7d9074e2c8 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -1,7 +1,7 @@
openerp.google_docs = function(instance, m) {
-var QWeb = instance.web.qweb,
- _t = instance.web._t;
-//{}
+var _t = instance.web._t,
+ QWeb = instance.web.qweb;
+
instance.web.Sidebar = instance.web.Sidebar.extend({
on_attachments_loaded: function(attachments) {
var self = this;
--
cgit v1.2.3
From 99c6701ba55576f0bc0cf2ad03d27cafa1f8a2c3 Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Wed, 17 Oct 2012 12:40:08 +0530
Subject: [IMP] document: display name with number if more than one attachment
has same number
bzr revid: hmo@tinyerp.com-20121017071008-1khlntrrdi7cxgao
---
addons/google_docs/static/src/js/gdocs.js | 16 ++--------------
addons/google_docs/static/src/xml/gdocs.xml | 4 ++--
2 files changed, 4 insertions(+), 16 deletions(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index a7d9074e2c8..1cdb22aeb41 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -2,23 +2,11 @@ openerp.google_docs = function(instance, m) {
var _t = instance.web._t,
QWeb = instance.web.qweb;
- instance.web.Sidebar = instance.web.Sidebar.extend({
- on_attachments_loaded: function(attachments) {
- var self = this;
- _.chain(attachments)
- .groupBy(function(attachment) { return attachment.name})
- .each(function(attachment){
- if(attachment.length > 1)
- _.map(attachment, function(attachment, i){
- attachment.name = _.str.sprintf(_t("%s (%s)"), attachment.name, i+1)
- })
- })
- self._super(attachments);
- },
+ instance.web.Sidebar.include({
redraw: function() {
var self = this;
this._super.apply(this, arguments);
- self.$el.find('.oe_sidebar_add_attachment').after(QWeb.render('Google_doc', {widget: self}))
+ self.$el.find('.oe_sidebar_add_attachment').after(QWeb.render('AddGoogleDocumentItem', {widget: self}))
self.$el.find('.oe_sidebar_add_google_doc').on('click', function (e) {
self.on_google_doc();
});
diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml
index 85a3b3f8be0..0c8d9c3b01f 100644
--- a/addons/google_docs/static/src/xml/gdocs.xml
+++ b/addons/google_docs/static/src/xml/gdocs.xml
@@ -2,7 +2,7 @@
-
+
-
\ No newline at end of file
+
--
cgit v1.2.3
From 3da067914a9f2e3574213f2aba492c45bfb55d8d Mon Sep 17 00:00:00 2001
From: TTA <>
Date: Fri, 19 Oct 2012 16:10:20 +0530
Subject: Fixed list view issue.
bzr revid: vba@tinyerp.com-20121019104020-9tz7t6h7xwa4dali
---
addons/google_docs/google_docs.py | 3 ++-
addons/google_docs/static/src/js/gdocs.js | 35 +++++++++++++++++--------------
2 files changed, 21 insertions(+), 17 deletions(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 6e839969998..f0f6f22a7c5 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -114,7 +114,8 @@ class google_docs_ir_attachment(osv.osv):
a length of 1 element only (batch processing is not supported in the code, though nothing really prevent it)
:return: the google document object created
'''
- assert len(ids) == 1, 'Creating google docs may only be done by one at a time'
+ if len(ids) != 1:
+ raise osv.except_osv(_('Google Docs Error!'), _("Creating google docs may only be done by one at a time."))
res_id = ids[0]
pool_ir_attachment = self.pool.get('ir.attachment')
pool_gdoc_config = self.pool.get('google.docs.config')
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index 1cdb22aeb41..6e8ff59f377 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -13,24 +13,27 @@ var _t = instance.web._t,
},
on_google_doc: function() {
var self = this;
- var form = self.getParent();
- form.sidebar_context().then(function (context) {
- var ds = new instance.web.DataSet(this, 'ir.attachment', context);
- ds.call('google_doc_get', [form.dataset.model, [form.datarecord.id], context]).then(function(r) {
- if (r == 'False') {
- var params = {
- error: response,
- message: _t("The user google credentials are not set yet. Contact your administrator for help.")
+ var view = self.getParent();
+ var ids = ( view.fields_view.type != "form" )? view.groups.get_selection().ids : [ view.datarecord.id ];
+ if( !_.isEmpty(ids) ){
+ view.sidebar_context().then(function (context) {
+ var ds = new instance.web.DataSet(this, 'ir.attachment', context);
+ ds.call('google_doc_get', [view.dataset.model, ids, context]).then(function(r) {
+ if (r == 'False') {
+ var params = {
+ error: response,
+ message: _t("The user google credentials are not set yet. Contact your administrator for help.")
+ }
+ $(openerp.web.qweb.render("DialogWarning", params)).dialog({
+ title: _t("User Google credentials are not yet set."),
+ modal: true,
+ });
}
- $(openerp.web.qweb.render("DialogWarning", params)).dialog({
- title: _t("User Google credentials are not yet set."),
- modal: true,
- });
- }
- }).done(function(){
- form.reload();
+ }).done(function(){
+ view.reload();
+ });
});
- });
+ }
}
});
};
--
cgit v1.2.3
From f180333dfa3e67dca5e714ccb61ed04f8b5b39d4 Mon Sep 17 00:00:00 2001
From: Tejas Tank
Date: Tue, 23 Oct 2012 16:12:48 +0530
Subject: Google Docs depends on document module.
bzr revid: tta@openerp.com-20121023104248-gn6irlu3yl40esvr
---
addons/google_docs/__openerp__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/__openerp__.py b/addons/google_docs/__openerp__.py
index 8b9a4123aa9..c37f7e21eef 100644
--- a/addons/google_docs/__openerp__.py
+++ b/addons/google_docs/__openerp__.py
@@ -32,7 +32,7 @@
'security/ir.model.access.csv',
'res_config_user_view.xml'
],
- 'depends': ['google_base_account'],
+ 'depends': ['google_base_account','document'],
'description': """
Module to attach a google document to any model.
================================================
--
cgit v1.2.3
From 8031b99ad4cad6063812fd485080a3af736ac2dd Mon Sep 17 00:00:00 2001
From: Tejas Tank
Date: Tue, 23 Oct 2012 18:28:04 +0530
Subject: [IMP] Default resource name as google doc title.
bzr revid: tta@openerp.com-20121023125804-8aohdltduwrhn5wr
---
addons/google_docs/__openerp__.py | 1 +
addons/google_docs/google_docs.py | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/__openerp__.py b/addons/google_docs/__openerp__.py
index c37f7e21eef..2d064fdb8a9 100644
--- a/addons/google_docs/__openerp__.py
+++ b/addons/google_docs/__openerp__.py
@@ -28,6 +28,7 @@
'installable': True,
'auto_install': False,
'js': ['static/src/js/gdocs.js'],
+ 'qweb': ['static/src/xml/gdocs.xml'],
'data': [
'security/ir.model.access.csv',
'res_config_user_view.xml'
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index f0f6f22a7c5..5d6db04e309 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -61,7 +61,8 @@ class google_docs_ir_attachment(osv.osv):
#login with the base account google module
client = self._auth(cr, uid, context=context)
# create the document in google docs
- local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL)
+ title = context.get("name","Untitled Document.")
+ local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL,title=title)
#create a new doc in Google Docs
gdocs_resource = client.post(entry=local_resource, uri='https://docs.google.com/feeds/default/private/full/')
# create an ir.attachment into the db
@@ -149,7 +150,7 @@ This is the id of the template document, on google side. You can find it thanks
*for a presentation (slide show) document with url like `https://docs.google.com/a/openerp.com/presentation/d/123456789/edit#slide=id.p`, the ID is `presentation:123456789`
*for a drawing document with url like `https://docs.google.com/a/openerp.com/drawings/d/123456789/edit`, the ID is `drawings:123456789`
...
-'''),
+''', required=True),
'name_template': fields.char('Google Doc Name Pattern', size=64, help='Choose how the new google docs will be named, on google side', required=True),
}
--
cgit v1.2.3
From bef70dd63854791f3137ae4908f18889543c6f33 Mon Sep 17 00:00:00 2001
From: Tejas Tank
Date: Thu, 25 Oct 2012 13:08:34 +0530
Subject: [FIX] Document name and google doc index.
bzr revid: tta@openerp.com-20121025073834-0tcjrqe8p7n3m2yx
---
addons/google_docs/google_docs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 5d6db04e309..60d6446c8ee 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -90,7 +90,7 @@ class google_docs_ir_attachment(osv.osv):
try:
original_resource = client.get_resource_by_id(gdoc_template_id)
#copy the document you choose in the configuration
- copy_resource = client.copy_resource(original_resource, 'copy_%s' % original_resource.title.text)
+ copy_resource = client.copy_resource(original_resource, name_gdocs)
except:
raise osv.except_osv(_('Google Docs Error!'), _("Your resource id is not correct. You can find the id in the google docs URL."))
# create an ir.attachment
--
cgit v1.2.3
From d4e81fb5295015bdf0b031ecf288cc615a31c8be Mon Sep 17 00:00:00 2001
From: Tejas Tank
Date: Thu, 25 Oct 2012 14:57:11 +0530
Subject: [IMP] Change of tooltip.
bzr revid: tta@openerp.com-20121025092711-jnic00h06urdq790
---
addons/google_docs/google_docs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 60d6446c8ee..c1139b2eb5a 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -151,7 +151,7 @@ This is the id of the template document, on google side. You can find it thanks
*for a drawing document with url like `https://docs.google.com/a/openerp.com/drawings/d/123456789/edit`, the ID is `drawings:123456789`
...
''', required=True),
- 'name_template': fields.char('Google Doc Name Pattern', size=64, help='Choose how the new google docs will be named, on google side', required=True),
+ 'name_template': fields.char('Google Doc Name Pattern', size=64, help='Choose how the new google docs will be named, on google side. Eg. gdoc_%(field_name)s', required=True),
}
_defaults = {
--
cgit v1.2.3
From 08e37a27580d8322311dd8f27c082293ca7548b9 Mon Sep 17 00:00:00 2001
From: Tejas Tank
Date: Thu, 1 Nov 2012 12:48:46 +0530
Subject: [IMP]: meaningful google doc name and newly created google document
open in new tab.
bzr revid: tta@openerp.com-20121101071846-i9k3jfa8bdzfwvu9
---
addons/google_docs/google_docs.py | 10 ++++++----
addons/google_docs/static/src/js/gdocs.js | 1 +
2 files changed, 7 insertions(+), 4 deletions(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index c1139b2eb5a..901ba17da3d 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -17,7 +17,7 @@
# along with this program. If not, see .
#
##############################################################################
-
+from datetime import datetime
from osv import osv, fields
from tools.translate import _
try:
@@ -61,7 +61,7 @@ class google_docs_ir_attachment(osv.osv):
#login with the base account google module
client = self._auth(cr, uid, context=context)
# create the document in google docs
- title = context.get("name","Untitled Document.")
+ title = "%s %s" % (context.get("name","Untitled Document."), datetime.today().strftime("%Y-%m-%d %H:%M:%S"))
local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL,title=title)
#create a new doc in Google Docs
gdocs_resource = client.post(entry=local_resource, uri='https://docs.google.com/feeds/default/private/full/')
@@ -70,10 +70,12 @@ class google_docs_ir_attachment(osv.osv):
'res_model': res_model,
'res_id': res_id,
'type': 'url',
- 'name': _('Google Doc'),
+ 'name': title,
'url': gdocs_resource.get_alternate_link().href,
}, context=context)
- return gdocs_resource.resource_id.text
+ return {'resource_id': gdocs_resource.resource_id.text,
+ 'title': title,
+ 'url': gdocs_resource.get_alternate_link().href}
def copy_gdoc(self, cr, uid, res_model, res_id, name_gdocs, gdoc_template_id, context=None):
'''
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index 6e8ff59f377..3a14e1f4ad6 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -30,6 +30,7 @@ var _t = instance.web._t,
});
}
}).done(function(){
+ window.open(r.url,"_blank");
view.reload();
});
});
--
cgit v1.2.3
From acac88ed5a334ee536c26ebc146871af386593c6 Mon Sep 17 00:00:00 2001
From: Tejas Tank
Date: Thu, 1 Nov 2012 12:56:31 +0530
Subject: [IMP] Use DEFAULT_SERVER_DATETIME_FORMAT constant.
bzr revid: tta@openerp.com-20121101072631-58bek7nog6qyeg8z
---
addons/google_docs/google_docs.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 901ba17da3d..462c8240810 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -18,6 +18,7 @@
#
##############################################################################
from datetime import datetime
+from tools import DEFAULT_SERVER_DATETIME_FORMAT
from osv import osv, fields
from tools.translate import _
try:
@@ -61,7 +62,7 @@ class google_docs_ir_attachment(osv.osv):
#login with the base account google module
client = self._auth(cr, uid, context=context)
# create the document in google docs
- title = "%s %s" % (context.get("name","Untitled Document."), datetime.today().strftime("%Y-%m-%d %H:%M:%S"))
+ title = "%s %s" % (context.get("name","Untitled Document."), datetime.today().strftime(DEFAULT_SERVER_DATETIME_FORMAT))
local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL,title=title)
#create a new doc in Google Docs
gdocs_resource = client.post(entry=local_resource, uri='https://docs.google.com/feeds/default/private/full/')
--
cgit v1.2.3
From dc015a8be2c62468ca0d353f8ba2315370485ae0 Mon Sep 17 00:00:00 2001
From: Tejas Tank
Date: Thu, 1 Nov 2012 14:50:13 +0530
Subject: [FIX] corrected code for opening new google doc.
bzr revid: tta@openerp.com-20121101092013-ks4hfd3cjj9trw8s
---
addons/google_docs/static/src/js/gdocs.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'addons/google_docs')
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index 3a14e1f4ad6..0cc93b2510c 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -29,7 +29,7 @@ var _t = instance.web._t,
modal: true,
});
}
- }).done(function(){
+ }).done(function(r){
window.open(r.url,"_blank");
view.reload();
});
--
cgit v1.2.3