diff options
| author | Parth Gajjar (Open ERP) <pga@tinyerp.com> | 2013-05-30 15:16:19 +0530 |
|---|---|---|
| committer | Parth Gajjar (Open ERP) <pga@tinyerp.com> | 2013-05-30 15:16:19 +0530 |
| commit | 0784c33c381fd7c718c1209b9759e2611fc40af3 (patch) | |
| tree | 488bb35f1df3e96551e8c4805ebfe744b7f26df6 /addons/google_docs/google_docs.py | |
| parent | d68d2e44eb30b70266e6f11656e7bf4705b3824d (diff) | |
[ADD] Managing Folders in Google Drive
bzr revid: pga@tinyerp.com-20130530094619-nvhpyvid4sqzur9l
Diffstat (limited to 'addons/google_docs/google_docs.py')
| -rw-r--r-- | addons/google_docs/google_docs.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 98ca35e20cc..93274ba6d24 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -85,9 +85,13 @@ class config(osv.osv): # Copy template in to drive with help of new access token if content.has_key('access_token'): + request_url = "https://www.googleapis.com/drive/v2/files/%s?fields=parents/id&access_token=%s" % (tamplate_id, content['access_token']) + resp, parents = Http().request(request_url, "GET") + parents_dict = json.loads(parents) + headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} record_url = "Click on link to open Record in OpenERP\n %s/?db=%s#id=%s&model=%s" %(google_web_base_url, cr.dbname, res_id, res_model ) - data = {"title": name_gdocs, "description": record_url} + data = {"title": name_gdocs, "description": record_url, "parents":parents_dict['parents']} request_url = "https://www.googleapis.com/drive/v2/files/%s/copy?access_token=%s" % (tamplate_id, content['access_token']) resp, content = Http().request(request_url, "POST", json.dumps(data), headers) content = json.loads(content) |
