From fefd25861a820d489feeb85f665c79d88b017c24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Fri, 24 Feb 2012 11:52:15 +0100
Subject: [PATCH 001/452] [IMP] new module google_docs
bzr revid: rlo@openerp.com-20120224105215-clev3ip7n8zhb3kt
---
addons/google_docs/__init__.py | 1 +
addons/google_docs/__openerp__.py | 6 ++
addons/google_docs/google_docs.py | 119 ++++++++++++++++++++++++++++++
3 files changed, 126 insertions(+)
create mode 100644 addons/google_docs/__init__.py
create mode 100644 addons/google_docs/__openerp__.py
create mode 100644 addons/google_docs/google_docs.py
diff --git a/addons/google_docs/__init__.py b/addons/google_docs/__init__.py
new file mode 100644
index 00000000000..dd6285502c0
--- /dev/null
+++ b/addons/google_docs/__init__.py
@@ -0,0 +1 @@
+import google_docs
diff --git a/addons/google_docs/__openerp__.py b/addons/google_docs/__openerp__.py
new file mode 100644
index 00000000000..991a3e07e2c
--- /dev/null
+++ b/addons/google_docs/__openerp__.py
@@ -0,0 +1,6 @@
+{
+ 'name': 'Wiki',
+ 'version': '0.1',
+ 'depends': ['google_base_account'],
+ 'description': 'Module to attach a google document to any model.'
+}
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
new file mode 100644
index 00000000000..a2693ac95a7
--- /dev/null
+++ b/addons/google_docs/google_docs.py
@@ -0,0 +1,119 @@
+from osv import osv, fields
+import gdata.docs.data
+import gdata.docs.client
+from gdata.client import RequestError
+
+class google_docs(osv.osv):
+ _name = 'google.docs'
+
+ _table = 'google_docs_templates'
+ _columns = {
+ 'id': fields.integer('ID', readonly=True),
+ 'model': fields.many2one('ir.model', 'Model'),
+ 'gdocs_res_id': fields.char('Google resource ID', size=64, translate=False)
+ }
+
+ edit_url_template = 'https://docs.google.com/Edit?docid=%s'
+ prefix_gdoc_id_res = 'document:'
+
+ def copy_gdoc(self, cr, uid, model, context=None):
+ '''Associate a copy of the gdoc identified by 'gdocs_res_id' to the current entity.
+ @param cr: the current row from the database cursor.
+ @param uid: the current user ID, for security checks.
+ @param model: the current model name.
+ @param context: a standard dictionary for contextual values.
+ @return the url of the copy itself.
+ @return -1 if the template hasn't been assigned yet.
+ @return -2 if the google_base_account hasn't been configured yet.'''
+
+ if context==None:
+ context={}
+
+ # check template for the current model
+ model_obj = self.pool.get(model)
+ res_gdocs_obj = self.pool.get('google.docs')
+ domain = [('model' , '=', model_obj)]
+ gdoc = res_gdocs_obj.search(cr,uid,domain,context=context)
+ if not gdoc:
+ return -1
+
+ # check google_base_account
+ users_obj = self.pool.get('res.users')
+ user = users_obj.browse(cr, uid, [uid])[0]
+ if not user.gmail_user or not user.gmail_password:
+ return -2
+
+ # copy the document
+ client = gdata.docs.client.DocsClient(source='openerp.com')
+ client.ssl = True
+ client.http_client.debug = False
+ client.ClientLogin(user.gmail_user, user.gmail_password, client.source, service='writely')
+ resource = client.get_resource_by_id(gdoc.gdocs_res_id)
+ copied_resource = client.copy_resource(entry=resource, title=resource.title.text + ' (generated from OpenERP)')
+
+ return self.edit_url_template % (copied_resource.resource_id.text,)
+
+ def get_documents_list(self, cr, uid, context=None):
+ '''Return the list of google documents available at the user's account.
+ @param cr: the current row from the database cursor.
+ @param uid: the current user ID, for security checks.
+ @param context: a standard dictionary for contextual values.
+ @return a list with information about the documents in form of tuples (document_name, document_resource_id).
+ @return -2 if the google_base_account hasn't been configured yet.'''
+
+ if context == None:
+ context = {}
+
+ # check google_base_account
+ users_obj = self.pool.get('res.users')
+ user = users_obj.browse(cr, uid, [uid])[0]
+ if not user.gmail_user or not user.gmail_password:
+ return -2
+
+ # get the documents list
+ client = gdata.docs.client.DocsClient(source='openerp.com')
+ client.ssl = True
+ client.http_client.debug = False
+ client.ClientLogin(user.gmail_user, user.gmail_password, client.source, service='writely')
+
+ return map(lambda doc: (doc.title.text, doc.resource_id.text[len(prefix_gdoc_id_res):]), filter(lambda r: r.resource_id.text.startswith('document:'), client.get_all_resources()))
+
+
+ def set_model_document_template(self, cr, uid, model, resource_id, context=None):
+ '''Set the default document template for the specified model. This template doesn't have to be a google documents template itself, but just a document.
+ @param cr: current row for the database cursor.
+ @param uid: the current user ID, for security checks.
+ @param model: the current model name.
+ @param resource_id: resource_id associated to the chosen document.
+ @param context: a standard dictionary for contextual values.
+ @return 0 on successful execution.
+ @return -2 if the google_base_account hasn't been configured yet.
+ @retrurn -3 if the given resource_id doesn't exist in the user's google docs account.
+ '''
+
+ if context == None:
+ context = {}
+
+ # check google_base_account
+ users_obj = self.pool.get('res.users')
+ user = users_obj.browse(cr, uid, [uid])[0]
+ if not user.gmail_user or not user.gmail_password:
+ return -2
+
+ # check resource_id
+ client = gdata.docs.client.DocsClient(source='openerp.com')
+ client.ssl = True
+ client.http_client.debug = False
+ client.ClientLogin(user.gmail_user, user.gmail_password, client.source, service='writely')
+ try:
+ client.get_resource_by_id(resource_id)
+ except RequestError:
+ return -3
+
+ # set the model document template
+ model_template_id = self.create(cr, uid,
+ { 'model': self.pool.get(model),
+ 'gdocs_res_id': resource_id
+ })
+
+ return 0
From e4a58bf7c57a8c00a8c7451372bed96704f522d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Fri, 24 Feb 2012 12:03:09 +0100
Subject: [PATCH 002/452] [FIX]
bzr revid: rlo@openerp.com-20120224110309-0hdmfu8vo918906q
---
addons/google_docs/google_docs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index a2693ac95a7..957fcbf0871 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -88,7 +88,7 @@ class google_docs(osv.osv):
@param context: a standard dictionary for contextual values.
@return 0 on successful execution.
@return -2 if the google_base_account hasn't been configured yet.
- @retrurn -3 if the given resource_id doesn't exist in the user's google docs account.
+ @return -3 if the given resource_id doesn't exist in the user's google docs account.
'''
if context == None:
From 9d28250005d879408ebbd73a05c8be40ee1a8105 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Fri, 24 Feb 2012 14:30:15 +0100
Subject: [PATCH 003/452] [imp]
bzr revid: rlo@openerp.com-20120224133015-2vt3gnkknnh2vrjd
---
addons/google_docs/google_docs.py | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 957fcbf0871..46db3eb4448 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -2,6 +2,7 @@ from osv import osv, fields
import gdata.docs.data
import gdata.docs.client
from gdata.client import RequestError
+from gdata.docs.service import DOCUMENT_LABEL
class google_docs(osv.osv):
_name = 'google.docs'
@@ -13,14 +14,16 @@ class google_docs(osv.osv):
'gdocs_res_id': fields.char('Google resource ID', size=64, translate=False)
}
+ name_template = 'Sales order %s %s'
edit_url_template = 'https://docs.google.com/Edit?docid=%s'
- prefix_gdoc_id_res = 'document:'
+ prefix_gdoc_id_res = DOCUMENT_LABEL + ':'
- def copy_gdoc(self, cr, uid, model, context=None):
+ def copy_gdoc(self, cr, uid, model, folder=None, context=None):
'''Associate a copy of the gdoc identified by 'gdocs_res_id' to the current entity.
@param cr: the current row from the database cursor.
@param uid: the current user ID, for security checks.
@param model: the current model name.
+ @param folder: folder in which to store the copy.
@param context: a standard dictionary for contextual values.
@return the url of the copy itself.
@return -1 if the template hasn't been assigned yet.
@@ -49,7 +52,7 @@ class google_docs(osv.osv):
client.http_client.debug = False
client.ClientLogin(user.gmail_user, user.gmail_password, client.source, service='writely')
resource = client.get_resource_by_id(gdoc.gdocs_res_id)
- copied_resource = client.copy_resource(entry=resource, title=resource.title.text + ' (generated from OpenERP)')
+ copied_resource = client.copy_resource(entry=resource, title= self.name_template % (, model))
return self.edit_url_template % (copied_resource.resource_id.text,)
@@ -117,3 +120,10 @@ class google_docs(osv.osv):
})
return 0
+
+
+class google_docs_folder(osv.osv):
+ _name = 'google.docs.folder'
+ _columns = {
+ 'res_id': fields.char('GDocs resource id', size=64, translate=False),
+ }
From 9eaa5de2aca09c44976d5472dbb66565038be494 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Fri, 24 Feb 2012 14:52:28 +0100
Subject: [PATCH 004/452] [fix]
bzr revid: rlo@openerp.com-20120224135228-rurois3a83l50lu1
---
addons/google_docs/google_docs.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 46db3eb4448..538511b51c2 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -12,9 +12,9 @@ class google_docs(osv.osv):
'id': fields.integer('ID', readonly=True),
'model': fields.many2one('ir.model', 'Model'),
'gdocs_res_id': fields.char('Google resource ID', size=64, translate=False)
+ 'name_template': fields.char('Google resource ID', size=64, translate=False)
}
- name_template = 'Sales order %s %s'
edit_url_template = 'https://docs.google.com/Edit?docid=%s'
prefix_gdoc_id_res = DOCUMENT_LABEL + ':'
@@ -32,6 +32,15 @@ class google_docs(osv.osv):
if context==None:
context={}
+ template_vars = {
+ 'db' : cr.dbname,
+ 'model' : model,
+ 'id' : id,
+ 'salt' : salt,
+ 'name' : '',
+ }
+ name_template = 'Sales order %s %s'
+
# check template for the current model
model_obj = self.pool.get(model)
res_gdocs_obj = self.pool.get('google.docs')
From 2df3400a35696a0a95925edd1592c2467e9802a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Fri, 24 Feb 2012 14:53:15 +0100
Subject: [PATCH 005/452] [fix]
bzr revid: rlo@openerp.com-20120224135315-31phn9wvp1meth03
---
addons/google_docs/google_docs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 538511b51c2..d4f48edb91a 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -12,7 +12,7 @@ class google_docs(osv.osv):
'id': fields.integer('ID', readonly=True),
'model': fields.many2one('ir.model', 'Model'),
'gdocs_res_id': fields.char('Google resource ID', size=64, translate=False)
- 'name_template': fields.char('Google resource ID', size=64, translate=False)
+ 'name_template': fields.char('GDoc name template', size=64, translate=False)
}
edit_url_template = 'https://docs.google.com/Edit?docid=%s'
From 33c3e277b6b496f8aa1c5a22c244390e29a6fba5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Fri, 24 Feb 2012 14:54:58 +0100
Subject: [PATCH 006/452] [fix]
bzr revid: rlo@openerp.com-20120224135458-2bz5k9fyyjymylye
---
addons/google_docs/google_docs.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index d4f48edb91a..0ad64124d04 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -88,7 +88,7 @@ class google_docs(osv.osv):
client.http_client.debug = False
client.ClientLogin(user.gmail_user, user.gmail_password, client.source, service='writely')
- return map(lambda doc: (doc.title.text, doc.resource_id.text[len(prefix_gdoc_id_res):]), filter(lambda r: r.resource_id.text.startswith('document:'), client.get_all_resources()))
+ return map(lambda doc: (doc.title.text, doc.resource_id.text[len(prefix_gdoc_id_res):]), filter(lambda r: r.resource_id.text.startswith(prefix_gdoc_id_res), client.get_all_resources()))
def set_model_document_template(self, cr, uid, model, resource_id, context=None):
From d680f6c1a16d8f1415b78c8de674c32b6949aba3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Fri, 24 Feb 2012 15:01:19 +0100
Subject: [PATCH 007/452] [fix]
bzr revid: rlo@openerp.com-20120224140119-hoapkm5d13uietx1
---
addons/google_docs/google_docs.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 0ad64124d04..718952fba34 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -27,19 +27,20 @@ class google_docs(osv.osv):
@param context: a standard dictionary for contextual values.
@return the url of the copy itself.
@return -1 if the template hasn't been assigned yet.
- @return -2 if the google_base_account hasn't been configured yet.'''
+ @return -2 if the google_base_account hasn't been configured yet.
+ '''
if context==None:
context={}
- template_vars = {
+ template_vars = {
'db' : cr.dbname,
'model' : model,
'id' : id,
'salt' : salt,
'name' : '',
}
- name_template = 'Sales order %s %s'
+ name_template = 'Sales order %s %s'
# check template for the current model
model_obj = self.pool.get(model)
@@ -71,7 +72,8 @@ class google_docs(osv.osv):
@param uid: the current user ID, for security checks.
@param context: a standard dictionary for contextual values.
@return a list with information about the documents in form of tuples (document_name, document_resource_id).
- @return -2 if the google_base_account hasn't been configured yet.'''
+ @return -2 if the google_base_account hasn't been configured yet.
+ '''
if context == None:
context = {}
From 38291a99acc380b8f5e4f17736f06dfe28815267 Mon Sep 17 00:00:00 2001
From: Antony Lesuisse
Date: Fri, 24 Feb 2012 15:39:23 +0100
Subject: [PATCH 008/452] commit
bzr revid: al@openerp.com-20120224143923-pm9home907bxztqt
---
addons/google_docs/google_docs.py | 56 +++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 718952fba34..8a48de0b05c 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -4,6 +4,62 @@ import gdata.docs.client
from gdata.client import RequestError
from gdata.docs.service import DOCUMENT_LABEL
+# _columns = {
+# 'id': fields.integer('ID', readonly=True),
+# 'model': fields.many2one('ir.model', 'Model'),
+# 'multiple': fields.boolean('Multiple'),
+# 'gdocs_res_id': fields.char('Google resource ID', size=64, translate=False)
+#
+# }
+#
+## edit_url_template = 'https://docs.google.com/Edit?docid=%s'
+## prefix_gdoc_id_res = 'document:'
+#
+# def google_docs_get(self, cr, uid, model, id):
+# attachment = self.search(cr, uid, [('res_model', '=', model), ('res_id', '=', id), ('type', '=', 'url'), ('url', 'like', 'https://docs.oogle.com')])
+# if attachment:
+# return self.read(cr, uid, attachment)[0]['url']
+# else:
+# url = self.pad_generate_url(cr, uid, model, id)
+# self.create(cr, uid, {
+# 'res_model' : model,
+# 'res_id' : id,
+# 'type' : 'url',
+# 'name' : 'Pad',
+# 'url' : url,
+# })
+# return url
+#
+# def generate_name(self, cr, uid, model, id):
+# template_vars = {
+# 'db' : cr.dbname,
+# 'model' : model,
+# 'id' : id,
+# 'salt' : salt,
+# 'name' : self.pool.get(model).name_get(cr,uid,[id])[0],
+# }
+# return pad_url_template % template_vars
+#
+#
+# def button_add_google_docs_google_docs_add_doc(self, cr, uid, model, id):
+# #pad_url_template = self.pool.get('res.users').browse(cr,uid,[uid])[0].company_id.pad_url_template
+# #s = string.ascii_uppercase + string.digits
+# #salt = ''.join([s[random.randint(0, len(s) - 1)] for i in range(8)])
+#
+# # i lookup in the table google_docs.templates to check the policy
+#
+# # if multiple: 1
+#
+# # if i find a template i will duplicate the template
+#
+# # else empty 'word' text
+#
+# # else
+# # if no document exists do like 1 -^
+# # else
+# # jumpt to the existing document
+#
+
class google_docs(osv.osv):
_name = 'google.docs'
From 8876e8c045fdee003b13cf1befa5e9daa4b2ebae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Fri, 24 Feb 2012 16:02:34 +0100
Subject: [PATCH 009/452] [imp] button
bzr revid: rlo@openerp.com-20120224150234-l1do7nj8576lfwcd
---
addons/google_docs/res_company.xml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
create mode 100644 addons/google_docs/res_company.xml
diff --git a/addons/google_docs/res_company.xml b/addons/google_docs/res_company.xml
new file mode 100644
index 00000000000..0324039c8f2
--- /dev/null
+++ b/addons/google_docs/res_company.xml
@@ -0,0 +1,16 @@
+
+
+
+ res.company.form.gdocs
+ res.company
+ form
+
+
+
+
+
+
+
+
+
+
From fd914eb2e3e09fec08733989e5c8456d4516194a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Fri, 24 Feb 2012 16:29:20 +0100
Subject: [PATCH 010/452] [fix]
bzr revid: rlo@openerp.com-20120224152920-vdi47f2k49kke2e0
---
addons/google_docs/google_docs.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 8a48de0b05c..90edb15b104 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -67,7 +67,7 @@ class google_docs(osv.osv):
_columns = {
'id': fields.integer('ID', readonly=True),
'model': fields.many2one('ir.model', 'Model'),
- 'gdocs_res_id': fields.char('Google resource ID', size=64, translate=False)
+ 'gdocs_res_id': fields.char('Google resource ID', size=64, translate=False),
'name_template': fields.char('GDoc name template', size=64, translate=False)
}
@@ -96,7 +96,7 @@ class google_docs(osv.osv):
'salt' : salt,
'name' : '',
}
- name_template = 'Sales order %s %s'
+ name_template = 'Sales order %s'
# check template for the current model
model_obj = self.pool.get(model)
@@ -118,7 +118,7 @@ class google_docs(osv.osv):
client.http_client.debug = False
client.ClientLogin(user.gmail_user, user.gmail_password, client.source, service='writely')
resource = client.get_resource_by_id(gdoc.gdocs_res_id)
- copied_resource = client.copy_resource(entry=resource, title= self.name_template % (, model))
+ copied_resource = client.copy_resource(entry=resource, title= self.name_template % (model, ))
return self.edit_url_template % (copied_resource.resource_id.text,)
From ebfb0be2e156b49a14790300ce746dba78a159d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Mon, 27 Feb 2012 10:02:24 +0100
Subject: [PATCH 011/452] [IMP] copy from pad
bzr revid: rlo@openerp.com-20120227090224-zujpg9zhf2nd5ioe
---
addons/google_docs/__openerp__.py | 12 ++++++++
.../{res_company.xml => res_gdocs.xml} | 2 +-
addons/google_docs/static/src/js/gdocs.js | 29 +++++++++++++++++++
addons/google_docs/static/src/xml/gdocs.xml | 13 +++++++++
4 files changed, 55 insertions(+), 1 deletion(-)
rename addons/google_docs/{res_company.xml => res_gdocs.xml} (91%)
create mode 100644 addons/google_docs/static/src/js/gdocs.js
create mode 100644 addons/google_docs/static/src/xml/gdocs.xml
diff --git a/addons/google_docs/__openerp__.py b/addons/google_docs/__openerp__.py
index 991a3e07e2c..2461be1e151 100644
--- a/addons/google_docs/__openerp__.py
+++ b/addons/google_docs/__openerp__.py
@@ -1,6 +1,18 @@
{
'name': 'Wiki',
'version': '0.1',
+ 'author': 'OpenERP SA',
+ 'website': 'http://openerp.com',
+ 'data': [
+ 'res_gdocs.xml'
+ ],
+ 'installable': True,
+ 'auto_install': False,
+ 'web': True,
+ 'js': ['static/src/js/gdocs.js'],
+ 'qweb' : [
+ "static/src/xml/*.xml",
+ ],
'depends': ['google_base_account'],
'description': 'Module to attach a google document to any model.'
}
diff --git a/addons/google_docs/res_company.xml b/addons/google_docs/res_gdocs.xml
similarity index 91%
rename from addons/google_docs/res_company.xml
rename to addons/google_docs/res_gdocs.xml
index 0324039c8f2..b1a54fdc63e 100644
--- a/addons/google_docs/res_company.xml
+++ b/addons/google_docs/res_gdocs.xml
@@ -2,7 +2,7 @@
res.company.form.gdocs
- res.company
+ google.docs
form
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
new file mode 100644
index 00000000000..e605577d45a
--- /dev/null
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -0,0 +1,29 @@
+openerp.gdocs = function(instance) {
+
+instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({
+ on_attachments_loaded: function(attachments) {
+ this._super(attachments);
+ var self = this;
+ var $padbtn = self.$element.find('button.gdocs');
+ var is_pad = function(a) {
+ return a.type == 'url' && a.name == 'GDocs';
+ };
+ if (_.any(attachments, is_pad)) {
+ $padbtn.hide();
+ } else {
+ $padbtn.show().click(self.on_add_pad);
+ }
+ },
+ on_add_pad: function() {
+ var self = this;
+ var $padbtn = this.$element.find('button.gdocs');
+ $padbtn.attr('disabled', 'true').find('img, span').toggle();
+ this.view.dataset.call_button('pad_get', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) {
+ $padbtn.hide();
+ self.do_update();
+ self.do_action(r.result);
+ });
+ }
+});
+
+};
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..52decbfdbc1
--- /dev/null
+++ b/addons/google_docs/static/src/xml/gdocs.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
From eaf646c9e226c6bb729f5fdbdfdb291bf902631a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Mon, 27 Feb 2012 10:19:29 +0100
Subject: [PATCH 012/452] [imp] view
bzr revid: rlo@openerp.com-20120227091929-pvcmtg5kes25pxid
---
addons/google_docs/res_gdocs.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/google_docs/res_gdocs.xml b/addons/google_docs/res_gdocs.xml
index b1a54fdc63e..660252de986 100644
--- a/addons/google_docs/res_gdocs.xml
+++ b/addons/google_docs/res_gdocs.xml
@@ -7,7 +7,7 @@
-
+
From cea3437f596f73558e23f1e67d61029daccf8d6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Mon, 27 Feb 2012 11:56:36 +0100
Subject: [PATCH 013/452] [imp] view
bzr revid: rlo@openerp.com-20120227105636-czaw0ghb4jl6if1j
---
addons/google_docs/{res_gdocs.xml => google_docs.xml} | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
rename addons/google_docs/{res_gdocs.xml => google_docs.xml} (91%)
diff --git a/addons/google_docs/res_gdocs.xml b/addons/google_docs/google_docs.xml
similarity index 91%
rename from addons/google_docs/res_gdocs.xml
rename to addons/google_docs/google_docs.xml
index 660252de986..d0e842b566e 100644
--- a/addons/google_docs/res_gdocs.xml
+++ b/addons/google_docs/google_docs.xml
@@ -8,7 +8,7 @@
-
+
From 37ed7a1d9f1819fd39cbf0eb0679ae17e1afd91a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Mon, 27 Feb 2012 13:38:34 +0100
Subject: [PATCH 014/452] [imp] view
bzr revid: rlo@openerp.com-20120227123834-todar214ngca7pu0
---
addons/google_docs/google_docs.py | 3 +--
addons/google_docs/static/src/js/gdocs.js | 20 ++++++++++----------
addons/google_docs/static/src/xml/gdocs.xml | 2 +-
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 90edb15b104..def1f3097e1 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -74,12 +74,11 @@ class google_docs(osv.osv):
edit_url_template = 'https://docs.google.com/Edit?docid=%s'
prefix_gdoc_id_res = DOCUMENT_LABEL + ':'
- def copy_gdoc(self, cr, uid, model, folder=None, context=None):
+ def copy_gdoc(self, cr, uid, model, context=None):
'''Associate a copy of the gdoc identified by 'gdocs_res_id' to the current entity.
@param cr: the current row from the database cursor.
@param uid: the current user ID, for security checks.
@param model: the current model name.
- @param folder: folder in which to store the copy.
@param context: a standard dictionary for contextual values.
@return the url of the copy itself.
@return -1 if the template hasn't been assigned yet.
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index e605577d45a..30edffaad7f 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -4,22 +4,22 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte
on_attachments_loaded: function(attachments) {
this._super(attachments);
var self = this;
- var $padbtn = self.$element.find('button.gdocs');
- var is_pad = function(a) {
+ var $gdocbtn = self.$element.find('button.gdocs');
+ var is_gdoc = function(a) {
return a.type == 'url' && a.name == 'GDocs';
};
- if (_.any(attachments, is_pad)) {
- $padbtn.hide();
+ if (_.any(attachments, is_gdoc)) {
+ $gdocbtn.hide();
} else {
- $padbtn.show().click(self.on_add_pad);
+ $gdocbtn.show().click(self.on_add_gdoc);
}
},
- on_add_pad: function() {
+ on_add_gdoc: function() {
var self = this;
- var $padbtn = this.$element.find('button.gdocs');
- $padbtn.attr('disabled', 'true').find('img, span').toggle();
- this.view.dataset.call_button('pad_get', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) {
- $padbtn.hide();
+ var $gdocbtn = this.$element.find('button.gdocs');alert($gdocbtn);
+ $gdocbtn.attr('disabled', 'true').find('img, span').toggle();
+ this.view.dataset.call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) {
+ $gdocbtn.hide();
self.do_update();
self.do_action(r.result);
});
diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml
index 52decbfdbc1..bc7a56842ba 100644
--- a/addons/google_docs/static/src/xml/gdocs.xml
+++ b/addons/google_docs/static/src/xml/gdocs.xml
@@ -4,7 +4,7 @@
-
From 1fcc9a8b17bf2c730afa5ebaf71ee3d5d4975196 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Wed, 7 Mar 2012 10:30:30 +0100
Subject: [PATCH 044/452] [imp] add entries into user preferences form
bzr revid: rlo@openerp.com-20120307093030-hrp6k8vvyhej7enc
---
.../google_base_account_view.xml | 46 +++++++++++++------
addons/google_docs/google_docs.xml | 20 ++++++++
2 files changed, 51 insertions(+), 15 deletions(-)
diff --git a/addons/google_base_account/google_base_account_view.xml b/addons/google_base_account/google_base_account_view.xml
index 9296ba135c0..eb01e3ad370 100644
--- a/addons/google_base_account/google_base_account_view.xml
+++ b/addons/google_base_account/google_base_account_view.xml
@@ -1,20 +1,36 @@
-
- res.users.google.form1
- res.users
- form
-
-
-
-
-
-
-
-
-
-
-
+
+ res.users.google.form1
+ res.users
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+ res.users.prefs.google.form1
+ res.users
+ form
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/google_docs/google_docs.xml b/addons/google_docs/google_docs.xml
index 333909f11a0..1d49319749a 100644
--- a/addons/google_docs/google_docs.xml
+++ b/addons/google_docs/google_docs.xml
@@ -4,6 +4,26 @@
+
+ res.user.google_docs.prefs.inherited
+ res.users
+
+ form
+
+
+
+
+
+
+
+
+
+
+
+
res.user.google_docs.config.inherited
res.users
From 714c70e435e4efd24537a68c853e6b13b2f457b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Mon, 12 Mar 2012 13:38:52 +0100
Subject: [PATCH 045/452] [imp] menu entry
bzr revid: rlo@openerp.com-20120312123852-qc8881g3s3w1rk9n
---
addons/google_docs/res_config_user_view.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/addons/google_docs/res_config_user_view.xml b/addons/google_docs/res_config_user_view.xml
index 1292947812f..cc6268f6757 100644
--- a/addons/google_docs/res_config_user_view.xml
+++ b/addons/google_docs/res_config_user_view.xml
@@ -16,5 +16,6 @@
+
From a08205304ba18db7160c56ba4dc5502f36c689e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Mon, 12 Mar 2012 15:41:31 +0100
Subject: [PATCH 046/452] [imp]
bzr revid: rlo@openerp.com-20120312144131-k6sx56o0x699cr56
---
addons/google_docs/google_docs.py | 27 ++++++++++++---------
addons/google_docs/res_config_user_view.xml | 5 ++--
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 91c6d1daab4..874c8893ca6 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -109,7 +109,7 @@ class google_docs(osv.osv):
def doc_get(self, cr, uid, model, id, type_doc):# TODO fix logic here
google_docs_config_ref = self.pool.get('res.users')
ir_attachment_ref = self.pool.get('ir.attachment')
- google_docs_config = google_docs_config_ref.search(cr, uid, [('model_id', '=', model)])
+ google_docs_config = google_docs_config_ref.search(cr, uid, [('context_model_id', '=', model)])
if not google_docs_config:
google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, id, type_doc)
@@ -121,20 +121,22 @@ class google_docs(osv.osv):
if not google_docs_config:
return -1
-class users(osv.osv):
- _inherit = 'res.users'
- _description = "User\'s gdocs config"
+class config(osv.osv):
+ _name = 'google.docs.config'
+ _description = "Google Docs templates config"
_columns = {
'context_model_id': fields.many2one('ir.model', 'Model'),
'context_gdocs_resource_id': fields.char('Google resource ID', size=64),
'context_name_template': fields.char('GDoc name template ', size=64, help='This is the name which appears on google side'),
- 'context_name': fields.char('Name', size=64, help='This is the attachment\'s name. As well, it appears on the panel.')
- # 'multi': fields.boolean('Multiple documents')
+ 'context_name': fields.char('Name', size=64, help='This is the attachment\'s name. As well, it appears on the panel.'),
+ 'context_multiple': fields.boolean('Multiple documents')
}
_defaults = {
- 'context_name_template': 'Google Document'
+ 'context_name_template': 'Google Document',
+ 'context_name': 'pr_%(name)',
+ 'context_multiple': False,
}
def create(self, cr, uid, vals, context=None):
@@ -143,12 +145,13 @@ class users(osv.osv):
if vals.get('context_gdocs_resource_id') and vals.get('context_model_id'):
self.write(cr, uid,
{
- 'model_id': model_obj.get(cr, uid, vals.get('context_model_id'))[0],
- 'gdocs_resource_id': vals.get('context_gdocs_resource_id'),
- 'name_template': vals('context_name_template'),
- 'name': vals('context_name'),
+ 'context_model_id': model_obj.get(cr, uid, vals.get('context_model_id'))[0],
+ 'context_gdocs_resource_id': vals.get('context_gdocs_resource_id'),
+ 'context_name_template': vals.get('context_name_template'),
+ 'context_name': self.context_name % {'name': vals.get('context_name')},
+ 'context_multiple': vals.get('context_multiple'),
},
context)
return res
-users()
+config()
diff --git a/addons/google_docs/res_config_user_view.xml b/addons/google_docs/res_config_user_view.xml
index cc6268f6757..25d043808f6 100644
--- a/addons/google_docs/res_config_user_view.xml
+++ b/addons/google_docs/res_config_user_view.xml
@@ -6,8 +6,7 @@
google_docs.config.user.inherited.form
- res.users
-
+ google.docs.config
form
@@ -16,6 +15,6 @@
-
+
From a03c7370a726745028b4ae95fb080212edcb09b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Wed, 14 Mar 2012 10:28:16 +0100
Subject: [PATCH 047/452] [fix] fix views according to review
bzr revid: rlo@openerp.com-20120314092816-9y67h31gmm7lfjgf
---
.../google_base_account_view.xml | 16 ---------------
addons/google_docs/google_docs.xml | 20 -------------------
2 files changed, 36 deletions(-)
diff --git a/addons/google_base_account/google_base_account_view.xml b/addons/google_base_account/google_base_account_view.xml
index eb01e3ad370..3f228a6dee8 100644
--- a/addons/google_base_account/google_base_account_view.xml
+++ b/addons/google_base_account/google_base_account_view.xml
@@ -16,21 +16,5 @@
-
-
- res.users.prefs.google.form1
- res.users
- form
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/google_docs/google_docs.xml b/addons/google_docs/google_docs.xml
index 1d49319749a..333909f11a0 100644
--- a/addons/google_docs/google_docs.xml
+++ b/addons/google_docs/google_docs.xml
@@ -4,26 +4,6 @@
-
- res.user.google_docs.prefs.inherited
- res.users
-
- form
-
-
-
-
-
-
-
-
-
-
-
-
res.user.google_docs.config.inherited
res.users
From 7774af75d71376aa937acbbe3804daa3cdd92b01 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Wed, 14 Mar 2012 11:42:05 +0100
Subject: [PATCH 048/452] [imp] menu entry
bzr revid: rlo@openerp.com-20120314104205-y3rpasw7vft8lcb7
---
addons/google_docs/__openerp__.py | 7 +++++--
addons/google_docs/res_config_user_view.xml | 8 +++++++-
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/addons/google_docs/__openerp__.py b/addons/google_docs/__openerp__.py
index 84fc2899ec3..437e5a864f5 100644
--- a/addons/google_docs/__openerp__.py
+++ b/addons/google_docs/__openerp__.py
@@ -4,9 +4,9 @@
'author': 'OpenERP SA',
'website': 'http://openerp.com',
'category': 'Tools',
- 'data': [
+ ''' 'data': [
'google_docs.xml'
- ],
+ ],'''
'installable': True,
'auto_install': False,
'web': True,
@@ -14,6 +14,9 @@
'qweb' : [
"static/src/xml/gdocs.xml",
],
+ 'update_xml': [
+ 'res_config_user_view.xml'
+ ],
'depends': ['google_base_account'],
'description': 'Module to attach a google document to any model.'
}
diff --git a/addons/google_docs/res_config_user_view.xml b/addons/google_docs/res_config_user_view.xml
index 25d043808f6..ecad7aaeb74 100644
--- a/addons/google_docs/res_config_user_view.xml
+++ b/addons/google_docs/res_config_user_view.xml
@@ -15,6 +15,12 @@
-
+
+ google_docs.config.user.inherited.form
+ google.docs.config
+ ir.actions.act_window
+
+
+
From d7eafc7be860c2716a7f4cf23841aa2c4d4b92e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Wed, 14 Mar 2012 12:14:02 +0100
Subject: [PATCH 049/452] [imp] menu entry
bzr revid: rlo@openerp.com-20120314111402-pgvsget19m5ttzli
---
addons/google_docs/res_config_user_view.xml | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/addons/google_docs/res_config_user_view.xml b/addons/google_docs/res_config_user_view.xml
index ecad7aaeb74..6dee0d6211e 100644
--- a/addons/google_docs/res_config_user_view.xml
+++ b/addons/google_docs/res_config_user_view.xml
@@ -4,10 +4,10 @@
-
- google_docs.config.user.inherited.form
+
+ google_docs.config.form
google.docs.config
- form
+ tree
- google_docs.config.user.inherited.form
+ Models configuration
google.docs.config
ir.actions.act_window
-
+ form
+
-
+
+
From 416ffbb6350c45bc834974f36a3483348d58996a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Wed, 14 Mar 2012 13:55:02 +0100
Subject: [PATCH 050/452] [imp]
bzr revid: rlo@openerp.com-20120314125502-ca1g8cw7y3dm65e4
---
addons/google_docs/google_docs.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 874c8893ca6..4d2533b9c0b 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -140,15 +140,15 @@ class config(osv.osv):
}
def create(self, cr, uid, vals, context=None):
- res = super(users, self).create(cr, uid, vals, context=context)
+ res = super(config, self).create(cr, uid, vals, context=context)
model_obj=self.pool.get('ir.model')
if vals.get('context_gdocs_resource_id') and vals.get('context_model_id'):
self.write(cr, uid,
{
- 'context_model_id': model_obj.get(cr, uid, vals.get('context_model_id'))[0],
+ 'context_model_id': model_obj.read(cr, uid, [vals.get('context_model_id')])[0],
'context_gdocs_resource_id': vals.get('context_gdocs_resource_id'),
'context_name_template': vals.get('context_name_template'),
- 'context_name': self.context_name % {'name': vals.get('context_name')},
+ 'context_name': vals.get('context_name'),
'context_multiple': vals.get('context_multiple'),
},
context)
From 38cd2dbe298f3b93b8ebc6dc87e016f0e6e09173 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Wed, 14 Mar 2012 14:18:51 +0100
Subject: [PATCH 051/452] [imp] config form
bzr revid: rlo@openerp.com-20120314131851-a3kzuzxt7f33fc9x
---
addons/google_docs/google_docs.py | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 4d2533b9c0b..0d99f5f6d35 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -139,19 +139,4 @@ class config(osv.osv):
'context_multiple': False,
}
- def create(self, cr, uid, vals, context=None):
- res = super(config, self).create(cr, uid, vals, context=context)
- model_obj=self.pool.get('ir.model')
- if vals.get('context_gdocs_resource_id') and vals.get('context_model_id'):
- self.write(cr, uid,
- {
- 'context_model_id': model_obj.read(cr, uid, [vals.get('context_model_id')])[0],
- 'context_gdocs_resource_id': vals.get('context_gdocs_resource_id'),
- 'context_name_template': vals.get('context_name_template'),
- 'context_name': vals.get('context_name'),
- 'context_multiple': vals.get('context_multiple'),
- },
- context)
- return res
-
config()
From 78903a8554d776632a17cde897ddcd2a7093b329 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Wed, 14 Mar 2012 16:29:29 +0100
Subject: [PATCH 052/452] [imp]
bzr revid: rlo@openerp.com-20120314152929-gqshx94zrcn34qzk
---
addons/google_docs/google_docs.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 0d99f5f6d35..e78444fb045 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -139,4 +139,11 @@ class config(osv.osv):
'context_multiple': False,
}
+ def has_config_set(self, cr, uid, model):
+ print model
+ import pdb
+ pdb.set_trace()
+ domain = [('context_model_id', '=', model)]
+ return self.search_count(cr, uid, domain) != 0
+
config()
From ebb97da4d16ffdbf74091bc6742f1f175ac0142b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?=
Date: Fri, 16 Mar 2012 10:00:54 +0100
Subject: [PATCH 053/452] [fix] fix according to requirements
bzr revid: rlo@openerp.com-20120316090054-0datu37ojj98lx13
---
addons/google_docs/google_docs.py | 12 +++----
addons/google_docs/static/src/js/gdocs.js | 39 ++++++++++-------------
2 files changed, 23 insertions(+), 28 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index e78444fb045..e822bb304bf 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -106,7 +106,7 @@ class google_docs_ir_attachment(osv.osv):
class google_docs(osv.osv):
_name = 'google.docs'
- def doc_get(self, cr, uid, model, id, type_doc):# TODO fix logic here
+ def doc_get(self, cr, uid, model, id, type_doc):
google_docs_config_ref = self.pool.get('res.users')
ir_attachment_ref = self.pool.get('ir.attachment')
google_docs_config = google_docs_config_ref.search(cr, uid, [('context_model_id', '=', model)])
@@ -139,11 +139,11 @@ class config(osv.osv):
'context_multiple': False,
}
- def has_config_set(self, cr, uid, model):
- print model
- import pdb
- pdb.set_trace()
+ def get_config(self, cr, uid, model):
domain = [('context_model_id', '=', model)]
- return self.search_count(cr, uid, domain) != 0
+ if self.search_count(cr, uid, domain) != 0:
+ return False
+ else:
+ return self.search(cr, uid, domain)
config()
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index 63978868901..b7353fd0bba 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -4,11 +4,24 @@ openerp.google_docs = function(instance, session) {
instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({
init: function() {
this._super.apply(this, arguments);
- this.$element.delegate('.oe_google_docs_text_button', 'click', this.on_add_text_gdoc);
- this.$element.delegate('.oe_google_docs_spreadsheet_button', 'click', this.on_add_spreadsheet_gdoc);
- this.$element.delegate('.oe_google_docs_slide_button', 'click', this.on_add_slide_gdoc);
+ var self = this;
+ var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context());
+ config.call('get_config', [this.view.dataset.ids[this.view.dataset.index]], function(r) {
+ console.log(r);
+ // if the configuration isn't set, the buttons should be hidden.
+ if (r==false) {
+ $('.oe_google_docs_text_button').css('display', 'none');
+
+ return;
+ }
+
+ var attachment = new instance.web.DataSet(this, 'ir.attachment', self.view.dataset.get_context());
+ attachment.call('copy_gdoc', [self.view.dataset.model, [self.view.datarecord.id]], function(res) {
+ console.log(res);
+ });
+ });
},
- on_add_text_gdoc: function() {
+ on_add_gdoc: function() {
var self = this;
var $gdocbtn = this.$element.find('.oe_google_docs_text_button');
$gdocbtn.attr('disabled', 'true').find('img, span').toggle();
@@ -28,24 +41,6 @@ openerp.google_docs = function(instance, session) {
self.do_update();
});
},
- on_add_spreadsheet_gdoc: function() {
- var self = this;
- var $gdocbtn = this.$element.find('.oe_google_docs_spreadsheet_button');
- $gdocbtn.attr('disabled', 'true').find('img, span').toggle();
- var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context());
- ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'spreadsheet'], function(r) {
- self.do_update();
- });
- },
- on_add_slide_gdoc: function() {
- var self = this;
- var $gdocbtn = this.$element.find('.oe_google_docs_slide_button');
- $gdocbtn.attr('disabled', 'true').find('img, span').toggle();
- var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context());
- ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'slide'], function(r) {
- self.do_update();
- });
- }
});
};
From 9d5db695ee3e1cfc1f0d306bccf117640a14927b Mon Sep 17 00:00:00 2001
From: MVA
Date: Mon, 19 Mar 2012 11:31:32 +0100
Subject: [PATCH 054/452] [REF] correct the code and change the view files
bzr revid: mva@openerp.com-20120319103132-av7c09avg4p0xgt3
---
addons/google_docs/__openerp__.py | 3 --
addons/google_docs/google_docs.py | 53 +++++++++++----------
addons/google_docs/google_docs.xml | 25 ----------
addons/google_docs/res_config_user_view.xml | 30 +++++++++---
addons/google_docs/static/src/js/gdocs.js | 3 +-
addons/google_docs/static/src/xml/gdocs.xml | 10 +---
6 files changed, 54 insertions(+), 70 deletions(-)
delete mode 100644 addons/google_docs/google_docs.xml
diff --git a/addons/google_docs/__openerp__.py b/addons/google_docs/__openerp__.py
index 437e5a864f5..237804c4f5b 100644
--- a/addons/google_docs/__openerp__.py
+++ b/addons/google_docs/__openerp__.py
@@ -4,9 +4,6 @@
'author': 'OpenERP SA',
'website': 'http://openerp.com',
'category': 'Tools',
- ''' 'data': [
- 'google_docs.xml'
- ],'''
'installable': True,
'auto_install': False,
'web': True,
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index e822bb304bf..d37f28eb349 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -30,22 +30,22 @@ except ImportError:
class google_docs_ir_attachment(osv.osv):
_inherit = 'ir.attachment'
- def _auth(self, cr, uid):
+ def _auth(self, cr, uid,context=None):
# check google_base_account
users_obj = self.pool.get('res.users')
user = users_obj.browse(cr, uid, [uid])[0]
- if not user.gmail_user or not user.gmail_password:
+ if not user.gmail_user or not user.gmail_password:
return False
# login
client = gdata.docs.client.DocsClient(source='openerp.com')
client.ssl = True
client.http_client.debug = False
- client.ClientLogin(user.gmail_user, user.gmail_password, client.source, service='writely')
+ client.ClientLogin(user.gmail_user, user.gmail_password, client.source, service='writely') #authentification in a gmail account
return client
- def create_empty_google_doc(self, cr, uid, model, ids, type_doc):
+ def create_empty_google_doc(self, cr, uid, model, ids, type_doc,context=None):
'''Associate a copy of the gdoc identified by 'gdocs_res_id' to the current entity.
@param cr: the current row from the database cursor.
@param uid: the current user ID, for security checks.
@@ -54,12 +54,13 @@ class google_docs_ir_attachment(osv.osv):
@return the document object.
@return False if the google_base_account hasn't been configured yet.
'''
-
+
# authenticate
client = self._auth(cr, uid)
if client == False:
- return False
-
+ return False #return an error
+
+
# create the document in google docs
if type_doc=='slide':
local_resource = gdata.docs.data.Resource(gdata.docs.data.PRESENTATION_LABEL)
@@ -67,6 +68,7 @@ class google_docs_ir_attachment(osv.osv):
local_resource = gdata.docs.data.Resource(gdata.docs.data.SPREADSHEET_LABEL)
else:
local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL)
+
gdocs_resource = client.post(entry=local_resource, uri='https://docs.google.com/feeds/default/private/full/')
# register into the db
@@ -76,30 +78,28 @@ class google_docs_ir_attachment(osv.osv):
'type': 'url',
'name': 'new_foo %s' % (type_doc,) , # TODO pending from the working config
'url': gdocs_resource.get_alternate_link().href
- })
-
+ },context=context)
+
+
return gdocs_resource
- def copy_gdoc(self, cr, uid, model, ids):
- if context is None:
- context={}
-
+ def copy_gdoc(self, cr, uid, model, ids,context=None):
client = self._auth(cr, uid)
if client == False:
return False
-
# fetch and copy the original document
original_resource = client.get_resource_by_id(gdocs_resource_id)
copy_resource = client.copy_resource(entry=original_resource)
-
+
# register into the db
self.create(cr, uid, {
'res_model': model,
'res_id': ids[0],
'type': 'url',
- 'name': 'copy_foo %s' (type_doc,) , # TODO pending from the working config
+ 'name': 'file_name',
+ 'name': 'copy_foo %s' (type_doc,) , #TODO pending from the working config
'url': copy_resource.get_alternate_link().href
- })
+ },context=context)
return copy_resource
@@ -107,20 +107,17 @@ class google_docs(osv.osv):
_name = 'google.docs'
def doc_get(self, cr, uid, model, id, type_doc):
- google_docs_config_ref = self.pool.get('res.users')
ir_attachment_ref = self.pool.get('ir.attachment')
- google_docs_config = google_docs_config_ref.search(cr, uid, [('context_model_id', '=', model)])
+ google_docs_config = self.pool.get('google.docs.config').search(cr, uid, [('context_model_id', '=', model)])
- if not google_docs_config:
- google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, id, type_doc)
- else:
+ if google_docs_config:
google_document = ir_attachment_ref.copy_gdoc(cr, uid, model, id)
-
- print google_docs_config
-
- if not google_docs_config:
+ else:
+ google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, id, type_doc)
return -1
+
+
class config(osv.osv):
_name = 'google.docs.config'
_description = "Google Docs templates config"
@@ -138,6 +135,10 @@ class config(osv.osv):
'context_name': 'pr_%(name)',
'context_multiple': False,
}
+ def has_config_set(self, cr, uid, model,context=None):
+ print model
+ import pdb
+ pdb.set_trace()
def get_config(self, cr, uid, model):
domain = [('context_model_id', '=', model)]
diff --git a/addons/google_docs/google_docs.xml b/addons/google_docs/google_docs.xml
deleted file mode 100644
index 333909f11a0..00000000000
--- a/addons/google_docs/google_docs.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
- res.user.google_docs.config.inherited
- res.users
-
- form
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/google_docs/res_config_user_view.xml b/addons/google_docs/res_config_user_view.xml
index 6dee0d6211e..09fa3ae4dda 100644
--- a/addons/google_docs/res_config_user_view.xml
+++ b/addons/google_docs/res_config_user_view.xml
@@ -4,25 +4,41 @@
-
- google_docs.config.form
+
+ google_docs.config.tree
google.docs.config
tree
-
+
-
+
+
+ google_docs.config.form
+ google.docs.config
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
Models configuration
google.docs.config
ir.actions.act_window
form
-
+
-
+
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index b7353fd0bba..c6bc1caa5ed 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -4,6 +4,7 @@ openerp.google_docs = function(instance, session) {
instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({
init: function() {
this._super.apply(this, arguments);
+ this.$element.delegate('.oe_google_docs_text_button', 'click', this.on_add_text_gdoc);
var self = this;
var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context());
config.call('get_config', [this.view.dataset.ids[this.view.dataset.index]], function(r) {
@@ -21,7 +22,7 @@ openerp.google_docs = function(instance, session) {
});
});
},
- on_add_gdoc: function() {
+ on_add_text_gdoc: function() {
var self = this;
var $gdocbtn = this.$element.find('.oe_google_docs_text_button');
$gdocbtn.attr('disabled', 'true').find('img, span').toggle();
diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml
index f401512e96b..1182e9f8421 100644
--- a/addons/google_docs/static/src/xml/gdocs.xml
+++ b/addons/google_docs/static/src/xml/gdocs.xml
@@ -4,13 +4,6 @@
-
-
-
-
-
-
-
Add GDoc - text
@@ -19,10 +12,11 @@
Add GDoc - spreadsheet
+
From f77cecb90c39041267455b05b23764f85e6783a5 Mon Sep 17 00:00:00 2001
From: MVA
Date: Tue, 20 Mar 2012 17:03:20 +0100
Subject: [PATCH 055/452] [IMP] add oauth
bzr revid: mva@openerp.com-20120320160320-tykxuosgpq1r28ag
---
addons/google_docs/google_docs.py | 52 +++++++++++++++------
addons/google_docs/res_config_user_view.xml | 2 -
addons/google_docs/static/src/js/gdocs.js | 1 -
addons/google_docs/static/src/xml/gdocs.xml | 7 ++-
4 files changed, 42 insertions(+), 20 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index d37f28eb349..09bb1879bdd 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -24,6 +24,9 @@ try:
import gdata.docs.client
from gdata.client import RequestError
from gdata.docs.service import DOCUMENT_LABEL
+ import gdata.auth
+ import gdata.docs.service
+ import webbrowser
except ImportError:
raise osv.except_osv(_('Google Docs Error!'), _('Please install gdata-python-client from http://code.google.com/p/gdata-python-client/downloads/list'))
@@ -56,11 +59,15 @@ class google_docs_ir_attachment(osv.osv):
'''
# authenticate
+
+ '''
client = self._auth(cr, uid)
if client == False:
- return False #return an error
-
-
+ return False
+ '''
+ client = self.pool.get('google.oauth')
+ client.login(cr,uid,ids,context=context)
+
# create the document in google docs
if type_doc=='slide':
local_resource = gdata.docs.data.Resource(gdata.docs.data.PRESENTATION_LABEL)
@@ -68,8 +75,9 @@ class google_docs_ir_attachment(osv.osv):
local_resource = gdata.docs.data.Resource(gdata.docs.data.SPREADSHEET_LABEL)
else:
local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL)
-
- gdocs_resource = client.post(entry=local_resource, uri='https://docs.google.com/feeds/default/private/full/')
+
+ #create a new doc in Google Docs
+ gdocs_resource = client.Post(entry=local_resource, uri='https://docs.google.com/feeds/default/private/full/')
# register into the db
self.create(cr, uid, {
@@ -117,14 +125,13 @@ class google_docs(osv.osv):
return -1
-
class config(osv.osv):
_name = 'google.docs.config'
_description = "Google Docs templates config"
_columns = {
'context_model_id': fields.many2one('ir.model', 'Model'),
- 'context_gdocs_resource_id': fields.char('Google resource ID', size=64),
+ 'context_gdocs_resource_id': fields.char('Google resource ID', size=64,help='This is the id of the template document you kind find it in the URL'),
'context_name_template': fields.char('GDoc name template ', size=64, help='This is the name which appears on google side'),
'context_name': fields.char('Name', size=64, help='This is the attachment\'s name. As well, it appears on the panel.'),
'context_multiple': fields.boolean('Multiple documents')
@@ -135,16 +142,35 @@ class config(osv.osv):
'context_name': 'pr_%(name)',
'context_multiple': False,
}
- def has_config_set(self, cr, uid, model,context=None):
- print model
- import pdb
- pdb.set_trace()
-
def get_config(self, cr, uid, model):
domain = [('context_model_id', '=', model)]
if self.search_count(cr, uid, domain) != 0:
return False
else:
return self.search(cr, uid, domain)
-
config()
+
+
+
+class oauth (osv.osv):
+ _name = 'google.oauth'
+ def login(self,cr,uid,ids,context=None):
+ consumer_key = '751376579939.apps.googleusercontent.com'
+ consumer_secret = '_KGpgyO8DZIseyG3N-j-h8gN'
+ gd_client = gdata.docs.service.DocsService()
+ #Set OAuth input parameters
+ gd_client.SetOAuthInputParameters(gdata.auth.OAuthSignatureMethod.HMAC_SHA1,consumer_key, consumer_secret=consumer_secret)
+ #Fetch OAuth Request token
+ request_token = gd_client.FetchOAuthRequestToken()
+ #Set the fetched OAuth token
+ gd_client.SetOAuthToken(request_token)
+ #Generate OAuth authorization URL
+ auth_url = gd_client.GenerateOAuthAuthorizationURL()
+ webbrowser.open(auth_url)
+ print gd_client.SetOAuthToken(request_token)
+ consumer_key = raw_input('Please enter consumer key: ')
+
+ #Upgrade to an OAuth access token
+ gd_client.UpgradeToOAuthAccessToken()
+ #Access Token
+ gd_client.token_store.find_token(request_token.scopes[0])
diff --git a/addons/google_docs/res_config_user_view.xml b/addons/google_docs/res_config_user_view.xml
index 09fa3ae4dda..9920cc6965b 100644
--- a/addons/google_docs/res_config_user_view.xml
+++ b/addons/google_docs/res_config_user_view.xml
@@ -29,8 +29,6 @@
-
-
Models configuration
google.docs.config
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index c6bc1caa5ed..c32dc4c8829 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -12,7 +12,6 @@ openerp.google_docs = function(instance, session) {
// if the configuration isn't set, the buttons should be hidden.
if (r==false) {
$('.oe_google_docs_text_button').css('display', 'none');
-
return;
}
diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml
index 1182e9f8421..927b35f115d 100644
--- a/addons/google_docs/static/src/xml/gdocs.xml
+++ b/addons/google_docs/static/src/xml/gdocs.xml
@@ -5,14 +5,13 @@
-
- Add GDoc - text
+
+ Add A Goole Docs
-
+
-
+
google_docs.config.tree
google.docs.config
tree
@@ -15,7 +15,7 @@
-
+
google_docs.config.form
google.docs.config
form
@@ -34,7 +34,7 @@
google.docs.config
ir.actions.act_window
form
-
+
diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml
index 927b35f115d..acb352bf9b0 100644
--- a/addons/google_docs/static/src/xml/gdocs.xml
+++ b/addons/google_docs/static/src/xml/gdocs.xml
@@ -5,17 +5,8 @@
-
Add A Goole Docs
-
From 2f1baf8f40908b54db0950f596fbe98e35d7cf9a Mon Sep 17 00:00:00 2001
From: MVA
Date: Wed, 28 Mar 2012 11:34:56 +0200
Subject: [PATCH 058/452] [IMP] replace the static name in the document name
bzr revid: mva@openerp.com-20120328093456-7wgnnvizvg0r747i
---
addons/google_docs/google_docs.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index bba8524023a..8c882a3422a 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -61,13 +61,13 @@ class google_docs_ir_attachment(osv.osv):
local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL)
#create a new doc in Google Docs
gdocs_resource = client.post(entry=local_resource, uri='https://docs.google.com/feeds/default/private/full/')
- name = gdocs_resource.title
+
# register into the db
self.create(cr, uid, {
'res_model': model,
'res_id': ids[0],
'type': 'url',
- 'name': name,
+ 'name': ('new_%s' % gdocs_resource.title.text),
'url': gdocs_resource.get_alternate_link().href,
},context=context)
@@ -86,8 +86,7 @@ class google_docs_ir_attachment(osv.osv):
'res_model': model,
'res_id': ids[0],
'type': 'url',
- 'name': 'file_name',
- 'name': 'copy_foo' , #TODO pending from the working config
+ 'name': 'copy_%s' % gdocs_resource.title.text,
'url': copy_resource.get_alternate_link().href
},context=context)
From c46481f1deb9e692058cd1ed42f9b96127ad6556 Mon Sep 17 00:00:00 2001
From: MVA
Date: Wed, 28 Mar 2012 11:47:18 +0200
Subject: [PATCH 059/452] [IMP] add a raise error to check if configuration is
ok
bzr revid: mva@openerp.com-20120328094718-xk5brbglmeo49cid
---
addons/google_docs/google_docs.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 8c882a3422a..13d9634dcf8 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -43,7 +43,8 @@ class google_docs_ir_attachment(osv.osv):
user_config = google_pool.default_get( cr, uid, {'user' : '' , 'password' : ''},context=context)
#login gmail account
client = google_pool.google_login( user_config['user'], user_config['password'], type='docs_client', context=context)
-
+ if not client:
+ raise osv.except_osv(('Google Docs Error!'),("Check your google configuration in users/synchronization") )
return client
def create_empty_google_doc(self, cr, uid, model, ids, type_doc,context=None):
From 774aa481c2f60df74d8b01f03b00cad002d8e105 Mon Sep 17 00:00:00 2001
From: MVA
Date: Wed, 28 Mar 2012 12:10:15 +0200
Subject: [PATCH 060/452] [IMP] correct the copy with the good document title
bzr revid: mva@openerp.com-20120328101015-4v1fit8z3cno9y91
---
addons/google_docs/google_docs.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 13d9634dcf8..1e6071cd716 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -78,16 +78,17 @@ class google_docs_ir_attachment(osv.osv):
def copy_gdoc(self, cr, uid, model, google_res_id, ids,context=None):
client = self._auth(cr, uid)
# fetch and copy the original document
+ print 'test'
original_resource = client.get_resource_by_id(google_res_id)
- #copy the document you choose in the configuration
- copy_resource = client.copy_resource(original_resource,'copy_foo')
+ #copy the document you choose in the configuration
+ copy_resource = client.copy_resource(original_resource,'copy_%s' % original_resource.title.text)
# register into the db
self.create(cr, uid, {
'res_model': model,
'res_id': ids[0],
'type': 'url',
- 'name': 'copy_%s' % gdocs_resource.title.text,
+ 'name': 'copy_%s' % original_resource.title.text,
'url': copy_resource.get_alternate_link().href
},context=context)
From 95a86ec57dfb22569ed9b1bd8ea36ae44f9e6856 Mon Sep 17 00:00:00 2001
From: MVA
Date: Wed, 28 Mar 2012 13:41:13 +0200
Subject: [PATCH 061/452] [IMP] add some comment and add a raise if the google
resource is not correct
bzr revid: mva@openerp.com-20120328114113-vspkkbvpdfnt3mho
---
addons/google_docs/google_docs.py | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 1e6071cd716..6e91ee64658 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -76,13 +76,18 @@ class google_docs_ir_attachment(osv.osv):
return 1
def copy_gdoc(self, cr, uid, model, google_res_id, ids,context=None):
+ '''
+ copy an existing document in google docs
+ '''
+
client = self._auth(cr, uid)
# fetch and copy the original document
- print 'test'
- original_resource = client.get_resource_by_id(google_res_id)
- #copy the document you choose in the configuration
- copy_resource = client.copy_resource(original_resource,'copy_%s' % original_resource.title.text)
-
+ try:
+ original_resource = client.get_resource_by_id(google_res_id)
+ #copy the document you choose in the configuration
+ copy_resource = client.copy_resource(original_resource,'copy_%s' % original_resource.title.text)
+ except:
+ raise osv.except_osv(('Google Docs Error!'),("Your ressource id is not correct. You can find the id in the google docs URL") )
# register into the db
self.create(cr, uid, {
'res_model': model,
@@ -126,6 +131,10 @@ class config(osv.osv):
'context_name': 'pr_%(name)',
}
def get_config(self, cr, uid, model):
+ '''
+ Method use with the js to hidde or show the add google doc button
+ @return : list of configuration ids or false
+ '''
domain = [('context_model_id', '=', model)]
if self.search_count(cr, uid, domain) != 0:
return False
From d4152e970378881f82373d4e09c8d23eea1d2535 Mon Sep 17 00:00:00 2001
From: MVA
Date: Fri, 30 Mar 2012 16:51:49 +0200
Subject: [PATCH 062/452] [IMP] change js remove unusfull code and the file
name configuration
bzr revid: mva@openerp.com-20120330145149-04gqj8lvleb9pa53
---
addons/google_docs/google_docs.py | 39 ++++++++++++---------
addons/google_docs/res_config_user_view.xml | 11 +++---
addons/google_docs/static/src/js/gdocs.js | 20 ++++-------
addons/google_docs/static/src/xml/gdocs.xml | 3 +-
4 files changed, 35 insertions(+), 38 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 6e91ee64658..3045cbab279 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -47,7 +47,7 @@ class google_docs_ir_attachment(osv.osv):
raise osv.except_osv(('Google Docs Error!'),("Check your google configuration in users/synchronization") )
return client
- def create_empty_google_doc(self, cr, uid, model, ids, type_doc,context=None):
+ def create_empty_google_doc(self, cr, uid, name_gdocs, model, ids, type_doc,context=None):
'''Associate a copy of the gdoc identified by 'gdocs_res_id' to the current entity.
@param cr: the current row from the database cursor.
@param uid: the current user ID, for security checks.
@@ -62,24 +62,22 @@ class google_docs_ir_attachment(osv.osv):
local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL)
#create a new doc in Google Docs
gdocs_resource = client.post(entry=local_resource, uri='https://docs.google.com/feeds/default/private/full/')
-
# register into the db
self.create(cr, uid, {
'res_model': model,
'res_id': ids[0],
'type': 'url',
- 'name': ('new_%s' % gdocs_resource.title.text),
+ 'name': 'Google Doc',
'url': gdocs_resource.get_alternate_link().href,
},context=context)
return 1
- def copy_gdoc(self, cr, uid, model, google_res_id, ids,context=None):
+ def copy_gdoc(self, cr, uid, name_gdocs, model, google_res_id, ids,context=None):
'''
copy an existing document in google docs
'''
-
client = self._auth(cr, uid)
# fetch and copy the original document
try:
@@ -93,7 +91,7 @@ class google_docs_ir_attachment(osv.osv):
'res_model': model,
'res_id': ids[0],
'type': 'url',
- 'name': 'copy_%s' % original_resource.title.text,
+ 'name': name_gdocs,
'url': copy_resource.get_alternate_link().href
},context=context)
@@ -104,14 +102,20 @@ class google_docs(osv.osv):
def doc_get(self, cr, uid, model, id, type_doc,context=None):
ir_attachment_ref = self.pool.get('ir.attachment')
- google_docs_config = self.pool.get('google.docs.config').search(cr, uid, [('context_model_id', '=', model)])
+ pool_gdoc_config = self.pool.get('google.docs.config')
+ google_docs_config = pool_gdoc_config.search(cr, uid, [('model_id', '=', model)])
+ name_gdocs=''
+ if google_docs_config:
+ name_gdocs = pool_gdoc_config.browse(cr,uid,google_docs_config,context=context)[0].name_template
+ print name_gdocs
+
# check if a model is configurate with a template
if google_docs_config:
for google_config in self.pool.get('google.docs.config').browse(cr,uid,google_docs_config,context=context):
- google_res_id = google_config.context_gdocs_resource_id
- google_document = ir_attachment_ref.copy_gdoc(cr, uid, model,google_res_id, id)
+ google_res_id = google_config.gdocs_resource_id
+ google_document = ir_attachment_ref.copy_gdoc(cr, uid,name_gdocs ,model,google_res_id, id)
else:
- google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, id, type_doc)
+ google_document = ir_attachment_ref.create_empty_google_doc(cr, uid,name_gdocs, model, id, type_doc)
return -1
@@ -120,24 +124,25 @@ class config(osv.osv):
_description = "Google Docs templates config"
_columns = {
- 'context_model_id': fields.many2one('ir.model', 'Model'),
- 'context_gdocs_resource_id': fields.char('Google resource ID', size=64,help='This is the id of the template document you kind find it in the URL'),
- 'context_name_template': fields.char('GDoc name template ', size=64, help='This is the name which appears on google side'),
- 'context_name': fields.char('Name', size=64, help='This is the attachment\'s name. As well, it appears on the panel.'),
+ 'model_id': fields.many2one('ir.model', 'Model'),
+ 'gdocs_resource_id': fields.char('Google resource ID', size=64,help='This is the id of the template document you kind find it in the URL'),
+ 'name_template': fields.char('GDoc name template ', size=64, help='This is the name which appears on google side'),
}
_defaults = {
- 'context_name_template': 'Google Document',
- 'context_name': 'pr_%(name)',
+ 'name_template': 'pr_%(name)',
}
def get_config(self, cr, uid, model):
'''
Method use with the js to hidde or show the add google doc button
@return : list of configuration ids or false
'''
- domain = [('context_model_id', '=', model)]
+ domain = [('model_id', '=', model)]
if self.search_count(cr, uid, domain) != 0:
return False
+ # attached only one document to a model
+ if self.pool.get('ir.attachment').search_count(cr,uid,[('url','like','https://docs.google.com/document%')]) !=0:
+ return False
else:
return self.search(cr, uid, domain)
diff --git a/addons/google_docs/res_config_user_view.xml b/addons/google_docs/res_config_user_view.xml
index be56f324d2d..46abe5b2d80 100644
--- a/addons/google_docs/res_config_user_view.xml
+++ b/addons/google_docs/res_config_user_view.xml
@@ -10,7 +10,7 @@
tree
-
+
@@ -21,10 +21,9 @@
form
-
-
-
-
+
+
+
@@ -34,7 +33,7 @@
google.docs.config
ir.actions.act_window
form
-
+
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index c32dc4c8829..9dc4f5c88d3 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -8,36 +8,28 @@ openerp.google_docs = function(instance, session) {
var self = this;
var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context());
config.call('get_config', [this.view.dataset.ids[this.view.dataset.index]], function(r) {
- console.log(r);
// if the configuration isn't set, the buttons should be hidden.
if (r==false) {
- $('.oe_google_docs_text_button').css('display', 'none');
+ $('.oe_google_docs_text_button',this.$element).hide();
return;
}
var attachment = new instance.web.DataSet(this, 'ir.attachment', self.view.dataset.get_context());
attachment.call('copy_gdoc', [self.view.dataset.model, [self.view.datarecord.id]], function(res) {
- console.log(res);
});
});
},
+ start: function() {
+ this._super();
+ console.log($('.oe_google_docs_text_button',this.$element))
+ $('.oe_google_docs_text_button',this.$element)
+ },
on_add_text_gdoc: function() {
var self = this;
var $gdocbtn = this.$element.find('.oe_google_docs_text_button');
$gdocbtn.attr('disabled', 'true').find('img, span').toggle();
var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context());
ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) {
- console.log(r);
- if (r == 'False') {
- var params = {
- error: response,
- message: "The user google credentials are not set yet. Contact your administrator for help."
- }
- $(openerp.web.qweb.render("DialogWarning", params)).dialog({
- title: "User Google credentials are not yet set.",
- modal: true,
- });
- }
self.do_update();
});
},
diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml
index acb352bf9b0..2de7efcbd43 100644
--- a/addons/google_docs/static/src/xml/gdocs.xml
+++ b/addons/google_docs/static/src/xml/gdocs.xml
@@ -5,7 +5,8 @@
- Add A Goole Docs
+
+ Goole Docs
From a85f78a48bb5a8681746925eaf6eb62243472453 Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Mon, 2 Apr 2012 11:58:17 +0530
Subject: [PATCH 063/452] [ADD]event_sale: Add event_items fields for
product_ids and sales_ends fields.
bzr revid: atp@tinyerp.com-20120402062817-yjd1pay0kqolv8fe
---
addons/event_sale/event_sale.py | 30 +++++++++++++++++-
addons/event_sale/event_sale_view.xml | 45 +++++++++++++++++++++++++++
2 files changed, 74 insertions(+), 1 deletion(-)
diff --git a/addons/event_sale/event_sale.py b/addons/event_sale/event_sale.py
index df115c0eef4..0208714b083 100644
--- a/addons/event_sale/event_sale.py
+++ b/addons/event_sale/event_sale.py
@@ -92,4 +92,32 @@ class sale_order_line(osv.osv):
message = _("The registration %s has been created from the Sale Order %s.") % (registration_id, order_line.order_id.name)
registration_obj.log(cr, uid, registration_id, message)
return super(sale_order_line, self).button_confirm(cr, uid, ids, context=context)
-
+
+class event_event(osv.osv):
+ _inherit = 'event.event'
+ _columns = {
+ 'event_item_ids': fields.one2many('event.items','event_id', 'Event Items'),
+ }
+
+class event_items(osv.osv):
+ _name = "event.items"
+ _columns = {
+ 'product_id': fields.many2one('product.product', 'Product', required=True),
+ 'qty': fields.integer('Quantity'),
+ 'price': fields.integer('Price'),
+ 'uom_id': fields.many2one('product.uom', 'Unit of Measure'),
+ 'discount': fields.integer('Discount'),
+ 'event_id': fields.many2one('event.event', 'Event'),
+ 'sales_end_date': fields.date('Sales End')
+ }
+
+ def onchange_product_id(self, cr, uid, ids, product, context=None):
+ product_obj = self.pool.get('product.product')
+ data = {}
+ if not product:
+ return {'value': data}
+ price = product_obj.browse(cr, uid, product).list_price
+ uom = product_obj.browse(cr, uid, product).uom_id.id
+ data['price'] = price
+ data['uom_id'] = uom
+ return {'value': data}
diff --git a/addons/event_sale/event_sale_view.xml b/addons/event_sale/event_sale_view.xml
index 4387e3a725a..1eb15e944a9 100644
--- a/addons/event_sale/event_sale_view.xml
+++ b/addons/event_sale/event_sale_view.xml
@@ -29,5 +29,50 @@
+
+
+ Events Inherit
+ event.event
+ form
+
+
+
+
+
+
+
+
+
+
+
+ Event Items Tree
+ event.items
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+ Event Items Form
+ event.items
+ form
+
+
+
+
+
From fb989dbfb7161b9f79ce5bf2024a5f13423b1b6f Mon Sep 17 00:00:00 2001
From: MVA
Date: Mon, 2 Apr 2012 15:18:17 +0200
Subject: [PATCH 064/452] [IMP] change the way to name the attachement and
change when you already have a google document the button will be hide
bzr revid: mva@openerp.com-20120402131817-oxv227m8i11pfsjx
---
addons/google_docs/google_docs.py | 19 +++++------
addons/google_docs/static/src/js/gdocs.js | 40 +++++++++++++----------
2 files changed, 30 insertions(+), 29 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 3045cbab279..e195fcf21a6 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -105,9 +105,11 @@ class google_docs(osv.osv):
pool_gdoc_config = self.pool.get('google.docs.config')
google_docs_config = pool_gdoc_config.search(cr, uid, [('model_id', '=', model)])
name_gdocs=''
+ model_fields_dic = self.pool.get(model).read(cr,uid,id,[])
+
if google_docs_config:
name_gdocs = pool_gdoc_config.browse(cr,uid,google_docs_config,context=context)[0].name_template
- print name_gdocs
+ name_gdocs = name_gdocs % model_fields_dic[0]
# check if a model is configurate with a template
if google_docs_config:
@@ -130,22 +132,17 @@ class config(osv.osv):
}
_defaults = {
- 'name_template': 'pr_%(name)',
+ 'name_template': 'pr_%(name)s',
}
- def get_config(self, cr, uid, model):
+ def get_config(self, cr, uid, ids, model,context=None):
'''
Method use with the js to hidde or show the add google doc button
@return : list of configuration ids or false
'''
- domain = [('model_id', '=', model)]
- if self.search_count(cr, uid, domain) != 0:
- return False
- # attached only one document to a model
- if self.pool.get('ir.attachment').search_count(cr,uid,[('url','like','https://docs.google.com/document%')]) !=0:
- return False
+ if self.pool.get('ir.attachment').search_count(cr,uid,[('url','like','https://docs.google.com/document%'),('res_model','=',model),('res_id','=',ids[0])]) !=0:
+ return False
else:
- return self.search(cr, uid, domain)
-
+ return True
config()
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index 9dc4f5c88d3..425de5045d8 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -5,31 +5,35 @@ openerp.google_docs = function(instance, session) {
init: function() {
this._super.apply(this, arguments);
this.$element.delegate('.oe_google_docs_text_button', 'click', this.on_add_text_gdoc);
- var self = this;
- var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context());
- config.call('get_config', [this.view.dataset.ids[this.view.dataset.index]], function(r) {
- // if the configuration isn't set, the buttons should be hidden.
- if (r==false) {
- $('.oe_google_docs_text_button',this.$element).hide();
- return;
- }
+ },
+
+
+ on_attachments_loaded: function(attachments) {
+ this._super(attachments);
+ var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context());
+ config.call('get_config', [[this.view.datarecord.id],this.view.dataset.model,this.view.dataset.get_context()], function(r) {
+ if (r == false){
+ $('.oe_google_docs_text_button',this.$element).hide();
+ }
+ });
+ },
- var attachment = new instance.web.DataSet(this, 'ir.attachment', self.view.dataset.get_context());
- attachment.call('copy_gdoc', [self.view.dataset.model, [self.view.datarecord.id]], function(res) {
- });
- });
- },
- start: function() {
- this._super();
- console.log($('.oe_google_docs_text_button',this.$element))
- $('.oe_google_docs_text_button',this.$element)
- },
on_add_text_gdoc: function() {
var self = this;
var $gdocbtn = this.$element.find('.oe_google_docs_text_button');
$gdocbtn.attr('disabled', 'true').find('img, span').toggle();
var ds = new instance.web.DataSet(this, 'google.docs', this.view.dataset.get_context());
ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) {
+ if (r == 'False') {
+ var params = {
+ error: response,
+ message: "The user google credentials are not set yet. Contact your administrator for help."
+ }
+ $(openerp.web.qweb.render("DialogWarning", params)).dialog({
+ title: "User Google credentials are not yet set.",
+ modal: true,
+ });
+ }
self.do_update();
});
},
From 515af1d3d988af70a833a22ada9edce49dd3c351 Mon Sep 17 00:00:00 2001
From: MVA
Date: Tue, 3 Apr 2012 09:07:52 +0200
Subject: [PATCH 065/452] [IMP] change the domain to enable spreadsheet and
reindentation in the js file
bzr revid: mva@openerp.com-20120403070752-4gfw1hg3p6ifzmwi
---
addons/google_docs/google_docs.py | 2 +-
addons/google_docs/static/src/js/gdocs.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index e195fcf21a6..5a6d33e9725 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -139,7 +139,7 @@ class config(osv.osv):
Method use with the js to hidde or show the add google doc button
@return : list of configuration ids or false
'''
- if self.pool.get('ir.attachment').search_count(cr,uid,[('url','like','https://docs.google.com/document%'),('res_model','=',model),('res_id','=',ids[0])]) !=0:
+ if self.pool.get('ir.attachment').search_count(cr,uid,[('url','like','https://docs.google.com/%'),('res_model','=',model),('res_id','=',ids[0])]) !=0:
return False
else:
return True
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index 425de5045d8..a8e941f01f6 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -13,7 +13,7 @@ openerp.google_docs = function(instance, session) {
var config = new instance.web.DataSet(this, 'google.docs.config', this.view.dataset.get_context());
config.call('get_config', [[this.view.datarecord.id],this.view.dataset.model,this.view.dataset.get_context()], function(r) {
if (r == false){
- $('.oe_google_docs_text_button',this.$element).hide();
+ $('.oe_google_docs_text_button',this.$element).hide();
}
});
},
From cbf9c244beab1689c1499baad9a3084d18625474 Mon Sep 17 00:00:00 2001
From: "Jagdish Panchal (Open ERP)"
Date: Tue, 10 Apr 2012 12:46:27 +0530
Subject: [PATCH 066/452] [IMP] set home page of all menus
bzr revid: jap@tinyerp.com-20120410071627-4gk2gz2fhf45ruux
---
addons/account/account_invoice_view.xml | 3 +++
addons/account/board_account_view.xml | 2 +-
addons/document/board_document_view.xml | 4 ++--
addons/document/document_view.xml | 4 ++++
addons/event/event_view.xml | 2 ++
addons/hr/hr_board.xml | 2 +-
addons/hr/hr_view.xml | 3 +++
addons/membership/membership_view.xml | 2 ++
addons/mrp/board_manufacturing_view.xml | 4 ++--
addons/mrp/mrp_view.xml | 3 +++
addons/project/board_project_view.xml | 4 ++--
addons/project/project_view.xml | 3 +++
addons/purchase/board_purchase_view.xml | 2 +-
addons/purchase/purchase_view.xml | 11 +++++++----
.../purchase_requisition_view.xml | 2 +-
addons/sale/board_sale_view.xml | 4 ++--
addons/sale/sale_view.xml | 2 +-
addons/stock/board_warehouse_view.xml | 2 +-
addons/stock/stock_view.xml | 5 ++++-
19 files changed, 45 insertions(+), 19 deletions(-)
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index 6d499b4d3ad..4444c51dd02 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -430,6 +430,9 @@
With Customer Invoices you can create and manage sales invoices issued to your customers. OpenERP can also generate draft invoices automatically from sales orders or deliveries. You should only confirm them before sending them to your customers.
+
diff --git a/addons/account/board_account_view.xml b/addons/account/board_account_view.xml
index 6417bb99d88..1d7865c0f01 100644
--- a/addons/account/board_account_view.xml
+++ b/addons/account/board_account_view.xml
@@ -63,7 +63,7 @@
-
+
diff --git a/addons/document/board_document_view.xml b/addons/document/board_document_view.xml
index 4412423c97b..44fb44d2a18 100644
--- a/addons/document/board_document_view.xml
+++ b/addons/document/board_document_view.xml
@@ -49,8 +49,8 @@
id="menu_reports_document_manager"
icon="terp-graph"/>
-
+
board.document.manager.form1
diff --git a/addons/document/document_view.xml b/addons/document/document_view.xml
index e426444f26d..4ddd85bb8f7 100644
--- a/addons/document/document_view.xml
+++ b/addons/document/document_view.xml
@@ -357,6 +357,10 @@
action="action_document_file_form"
id="menu_document_files"
parent="menu_document_doc"/>
+
+
+
ir.actions.act_window
diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml
index 0825cef42c5..200b9f88237 100644
--- a/addons/event/event_view.xml
+++ b/addons/event/event_view.xml
@@ -304,6 +304,8 @@
Event is the low level object used by meeting and others documents that should be synchronized with mobile devices or calendar applications through caldav. Most of the users should work in the Calendar menu, and not in the list of events.
+
+
-
+
diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml
index a954d916385..df5de845c9e 100644
--- a/addons/hr/hr_view.xml
+++ b/addons/hr/hr_view.xml
@@ -188,6 +188,9 @@
Here you can manage your work force by creating employees and assigning them specific properties in the system. Maintain all employee related information and keep track of anything that needs to be recorded for them. The personal information tab will help you maintain their identity data. The Categories tab gives you the opportunity to assign them related employee categories depending on their position and activities within the company. A category can be a seniority level within the company or a department. The Timesheets tab allows to assign them a specific timesheet and analytic journal where they will be able to enter time through the system. In the note tab, you can enter text data that should be recorded for a specific employee.
+
+
kanban
diff --git a/addons/membership/membership_view.xml b/addons/membership/membership_view.xml
index bdb04525d43..074bed97fcd 100644
--- a/addons/membership/membership_view.xml
+++ b/addons/membership/membership_view.xml
@@ -208,6 +208,8 @@
+
+
diff --git a/addons/mrp/board_manufacturing_view.xml b/addons/mrp/board_manufacturing_view.xml
index cb81d51d439..4ce4f5e5995 100644
--- a/addons/mrp/board_manufacturing_view.xml
+++ b/addons/mrp/board_manufacturing_view.xml
@@ -35,8 +35,8 @@
id="menu_board_manufacturing" parent="menus_dash_mrp"
sequence="1"/>
-
+
diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml
index f96147e9344..7533ddea12e 100644
--- a/addons/mrp/mrp_view.xml
+++ b/addons/mrp/mrp_view.xml
@@ -840,6 +840,9 @@
+
+
Manufacturing Orders
ir.actions.act_window
diff --git a/addons/project/board_project_view.xml b/addons/project/board_project_view.xml
index f4a855283ba..bca37ac3fc4 100644
--- a/addons/project/board_project_view.xml
+++ b/addons/project/board_project_view.xml
@@ -117,9 +117,9 @@
parent="menu_project_dashboard"
sequence="1"/>
-
+ name="Project" sequence="10" action="open_board_project"/> -->
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index 95538513f0c..2b86de95427 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -542,6 +542,9 @@
+
+
Overpassed Tasks
project.task
diff --git a/addons/purchase/board_purchase_view.xml b/addons/purchase/board_purchase_view.xml
index 4c9e776b96b..4d8280059b0 100644
--- a/addons/purchase/board_purchase_view.xml
+++ b/addons/purchase/board_purchase_view.xml
@@ -116,7 +116,7 @@
parent="menu_purchase_deshboard"
sequence="4"/>
-
+
diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index 007c85b98f1..4de426e71f9 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -3,7 +3,7 @@
@@ -312,8 +312,11 @@
-
+ sequence="0"/>
+
+
+
Purchase Orders
ir.actions.act_window
@@ -323,7 +326,7 @@
Use this menu to search within your purchase orders by references, supplier, products, etc. For each purchase order, you can track the products received, and control the supplier invoices.
-
+
diff --git a/addons/purchase_requisition/purchase_requisition_view.xml b/addons/purchase_requisition/purchase_requisition_view.xml
index d6a736eea9c..5e77f46b1a2 100644
--- a/addons/purchase_requisition/purchase_requisition_view.xml
+++ b/addons/purchase_requisition/purchase_requisition_view.xml
@@ -173,7 +173,7 @@
diff --git a/addons/sale/board_sale_view.xml b/addons/sale/board_sale_view.xml
index 8a6caf1a849..4d45151dece 100644
--- a/addons/sale/board_sale_view.xml
+++ b/addons/sale/board_sale_view.xml
@@ -124,9 +124,9 @@
-
+ name="Sales"/> -->
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 09ad9381e26..6feff81e9ee 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -1,7 +1,7 @@
diff --git a/addons/stock/board_warehouse_view.xml b/addons/stock/board_warehouse_view.xml
index b8de9cf445e..a24f59aa08f 100644
--- a/addons/stock/board_warehouse_view.xml
+++ b/addons/stock/board_warehouse_view.xml
@@ -70,7 +70,7 @@
-
+
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index 592cb180d22..1d81f80829c 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -4,7 +4,7 @@
@@ -1924,6 +1924,9 @@
Stock Management
+
+
From 4347226b1d16f73c84f9606b613ec0053602d628 Mon Sep 17 00:00:00 2001
From: "Jagdish Panchal (Open ERP)"
Date: Tue, 10 Apr 2012 16:21:25 +0530
Subject: [PATCH 067/452] [IMP] board: improve xml code to set module kanban on
setting main menu
bzr revid: jap@tinyerp.com-20120410105125-ysmtfc1qgizmldly
---
addons/board/board_data_admin.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/board/board_data_admin.xml b/addons/board/board_data_admin.xml
index 5f8c2f1b05c..88580c3deb5 100644
--- a/addons/board/board_data_admin.xml
+++ b/addons/board/board_data_admin.xml
@@ -54,7 +54,7 @@
-
+
From 95952a8d56abb3c69e3597991b3c3819e65c8775 Mon Sep 17 00:00:00 2001
From: "Bharat Devnani (OpenERP)"
Date: Tue, 17 Apr 2012 15:03:40 +0530
Subject: [PATCH 068/452] [ADD] added functionality which checks the available
seats at the time of confirming registration, and set current date in demo
data inorder to show the upcoming events
bzr revid: bde@tinyerp.com-20120417093340-824lazijkbf83m1x
---
addons/event/event.py | 12 ++++++++++++
addons/event/event_demo.xml | 8 ++++----
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/addons/event/event.py b/addons/event/event.py
index 6bf1ea24786..071835fa240 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -102,6 +102,14 @@ class event_event(osv.osv):
total_confirmed = self.event.register_current
if total_confirmed < self.event.register_min or total_confirmed > self.event.register_max and self.event.register_max!=0:
raise osv.except_osv(_('Error!'),_("The total of confirmed registration for the event '%s' does not meet the expected minimum/maximum. You should maybe reconsider those limits before going further") % (self.event.name))
+
+ def check_registration_limits_before(self, cr, uid, ids, no_of_registration, context=None):
+ total_confirmed = self.browse(cr, uid, ids, context=context).register_current
+ register_max = self.browse(cr, uid, ids, context=context).register_max
+ available_seats = register_max - total_confirmed
+ if no_of_registration > available_seats:
+ raise osv.except_osv(_('Warning!'),_("Only %d Seats are Available!") % (available_seats))
+
def confirm_event(self, cr, uid, ids, context=None):
register_pool = self.pool.get('event.registration')
@@ -295,6 +303,10 @@ class event_registration(osv.osv):
def registration_open(self, cr, uid, ids, context=None):
""" Open Registration
"""
+ event_obj = self.pool.get('event.event')
+ event_id = self.browse(cr, uid, ids, context=context)[0].event_id.id
+ no_of_registration = self.browse(cr, uid, ids, context=context)[0].nb_register
+ event_obj.check_registration_limits_before(cr, uid, event_id, no_of_registration, context=context)
res = self.confirm_registration(cr, uid, ids, context=context)
self.mail_user(cr, uid, ids, context=context)
return res
diff --git a/addons/event/event_demo.xml b/addons/event/event_demo.xml
index 96bc64e12aa..d5907b4bebf 100644
--- a/addons/event/event_demo.xml
+++ b/addons/event/event_demo.xml
@@ -38,16 +38,16 @@
Opera of Verdi
-
-
+
+
50
350
Conference on ERP Business
-
-
+
+
200
From 27d279e3c3e21233005efa5b4c2aca788044f912 Mon Sep 17 00:00:00 2001
From: "Bharat Devnani (OpenERP)"
Date: Tue, 17 Apr 2012 17:01:20 +0530
Subject: [PATCH 069/452] [IMP] improved the date manipulation in
event/event_demo.xml
bzr revid: bde@tinyerp.com-20120417113120-cm6tro3par1vtpy2
---
addons/event/event_demo.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/addons/event/event_demo.xml b/addons/event/event_demo.xml
index d5907b4bebf..81dad07b5e4 100644
--- a/addons/event/event_demo.xml
+++ b/addons/event/event_demo.xml
@@ -38,16 +38,16 @@
Opera of Verdi
-
-
+
+
50
350
Conference on ERP Business
-
-
+
+
200
From 89547acdfb6d883b6fc5c8790dbd2cc3abadedca Mon Sep 17 00:00:00 2001
From: "Bharat Devnani (OpenERP)"
Date: Wed, 18 Apr 2012 14:56:37 +0530
Subject: [PATCH 070/452] [ADD] added text area in kanban view inorder to input
number of seats
bzr revid: bde@tinyerp.com-20120418092637-uprsxgafbu1tl8vw
---
addons/event/__openerp__.py | 3 +++
addons/event/event.py | 6 +++++-
addons/event/event_view.xml | 1 +
addons/event/static/src/css/event.css | 3 +++
4 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/addons/event/__openerp__.py b/addons/event/__openerp__.py
index ea0e4316ef5..b9753835aeb 100644
--- a/addons/event/__openerp__.py
+++ b/addons/event/__openerp__.py
@@ -54,6 +54,9 @@ Note that:
'demo_xml': ['event_demo.xml'],
'test': ['test/process/event_draft2done.yml'],
'css': ['static/src/css/event.css'],
+ 'js': [
+ #'static/src/js/event.js',
+ ],
'installable': True,
'application': True,
'auto_install': False,
diff --git a/addons/event/event.py b/addons/event/event.py
index 6bf1ea24786..27b8269db20 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -215,10 +215,13 @@ class event_event(osv.osv):
register_pool = self.pool.get('event.registration')
user_pool = self.pool.get('res.users')
user = user_pool.browse(cr, uid, uid, context=context)
+ print "user", user
curr_reg_ids = register_pool.search(cr, uid, [('user_id', '=', user.id), ('event_id', '=' , ids[0])])
+ print "curr_reg_ids", curr_reg_ids
#the subscription is done with UID = 1 because in case we share the kanban view, we want anyone to be able to subscribe
if not curr_reg_ids:
- curr_reg_ids = [register_pool.create(cr, 1, {'event_id': ids[0] ,'email': user.user_email, 'name':user.name, 'user_id': user.id,})]
+ curr_reg_ids = [register_pool.create(cr, 1, {'event_id': ids[0] ,'email': user.user_email, 'name':user.name, 'user_id': user.id, 'nb_register': 5})]
+ print "::::::::::::::", curr_reg_ids
return register_pool.confirm_registration(cr, 1, curr_reg_ids, context=context)
def unsubscribe_to_event(self, cr, uid, ids, context=None):
@@ -288,6 +291,7 @@ class event_registration(osv.osv):
return self.write(cr, uid, ids, {'state': 'draft'}, context=context)
def confirm_registration(self, cr, uid, ids, context=None):
+ print "confirm_registrationconfirm_registration"
self.message_append(cr, uid, ids,_('State set to open'),body_text= _('Open'))
return self.write(cr, uid, ids, {'state': 'open'}, context=context)
diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml
index 4e22569c3e1..d4bbe059084 100644
--- a/addons/event/event_view.xml
+++ b/addons/event/event_view.xml
@@ -203,6 +203,7 @@
+
Subscribe
diff --git a/addons/event/static/src/css/event.css b/addons/event/static/src/css/event.css
index a0f738e6323..52cf194dbe7 100644
--- a/addons/event/static/src/css/event.css
+++ b/addons/event/static/src/css/event.css
@@ -115,4 +115,7 @@ div.oe_fold_column{
display: inline;
background-color: #DC5F59;
}
+ .no_of_seats{
+ width:40px;
+ }
From a163b926e393ef63b30c5f23aad2d652be7ef57d Mon Sep 17 00:00:00 2001
From: "DBR (OpenERP)"
Date: Wed, 18 Apr 2012 17:54:59 +0530
Subject: [PATCH 071/452] [IMP]stock: click on warehouse menu tn open product
kanban view
bzr revid: dbr@tinyerp.com-20120418122459-l27y5wa1b38oaid6
---
addons/product/product_view.xml | 11 +++++++++--
addons/stock/stock_view.xml | 2 +-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml
index 2a12fc9ad08..b721dd2031d 100644
--- a/addons/product/product_view.xml
+++ b/addons/product/product_view.xml
@@ -263,19 +263,26 @@
-
+
tree
-
+
form
+
+
+ kanban
+
+
+
+
diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml
index cfa73a8806d..4edc1cef753 100644
--- a/addons/stock/stock_view.xml
+++ b/addons/stock/stock_view.xml
@@ -5,7 +5,7 @@
+ web_icon_hover="images/warehouse-hover.png" action="product.product_normal_action"/>
From c6ee2737b344ce7f211eac70c9b57c3b7850ea5f Mon Sep 17 00:00:00 2001
From: "DBR (OpenERP)"
Date: Thu, 19 Apr 2012 12:58:30 +0530
Subject: [PATCH 072/452] [IMP]sale : remove action of partner form
bzr revid: dbr@tinyerp.com-20120419072830-gu41w6tmdmfgowp5
---
addons/hr/hr_board.xml | 1 -
addons/sale/sale_view.xml | 3 +--
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/addons/hr/hr_board.xml b/addons/hr/hr_board.xml
index 20c0e626619..582d6175d8b 100644
--- a/addons/hr/hr_board.xml
+++ b/addons/hr/hr_board.xml
@@ -24,7 +24,6 @@
-
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 9b6ede9a278..fc9bc907b1e 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -2,8 +2,7 @@
+ id="base.menu_base_partner" name="Sales" sequence="0" groups="base.group_sale_salesman,base.group_sale_manager"/>
From d30492d5e316feb39772bae44906712e697c666b Mon Sep 17 00:00:00 2001
From: "DBR (OpenERP)"
Date: Thu, 19 Apr 2012 16:04:08 +0530
Subject: [PATCH 073/452] [IMP]sale: Add action
bzr revid: dbr@tinyerp.com-20120419103408-d3fag9s327hdow8h
---
addons/sale/sale_view.xml | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index fc9bc907b1e..9a0147ef909 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -1,8 +1,6 @@
-
+
From 6a15e8bf4a84355acdbf0bdb2fe3dd77e23108fb Mon Sep 17 00:00:00 2001
From: "Bharat Devnani (OpenERP)"
Date: Thu, 19 Apr 2012 17:45:06 +0530
Subject: [PATCH 074/452] [ADD] added image on home page dashboard for event
module
bzr revid: bde@tinyerp.com-20120419121506-o0fgrf39f306r9h0
---
addons/event/event_view.xml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml
index f3f3c165f93..bff081c1911 100644
--- a/addons/event/event_view.xml
+++ b/addons/event/event_view.xml
@@ -2,7 +2,9 @@
-
+
From edd102bc770c84f546dd45147bbc07feca762145 Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Mon, 23 Apr 2012 11:37:44 +0530
Subject: [PATCH 076/452] [IMP]: Improve code.
bzr revid: atp@tinyerp.com-20120423060744-gx0jm63z8ba6cq5i
---
addons/event/event.py | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/addons/event/event.py b/addons/event/event.py
index f8a15112bfa..a633dc41961 100644
--- a/addons/event/event.py
+++ b/addons/event/event.py
@@ -115,12 +115,10 @@ class event_event(osv.osv):
def check_registration_limits_before(self, cr, uid, ids, no_of_registration, context=None):
available_seats = self.check_available_seats(cr, uid, ids, context=context)
- if no_of_registration > available_seats:
- if available_seats == 0:
- raise osv.except_osv(_('Warning!'),_("No Tickets Available!"))
- else:
- raise osv.except_osv(_('Warning!'),_("Only %d Seats are Available!") % (available_seats))
-
+ if available_seats and no_of_registration > available_seats:
+ raise osv.except_osv(_('Warning!'),_("Only %d Seats are Available!") % (available_seats))
+ elif available_seats == 0:
+ raise osv.except_osv(_('Warning!'),_("No Tickets Available!"))
def confirm_event(self, cr, uid, ids, context=None):
register_pool = self.pool.get('event.registration')
@@ -231,16 +229,10 @@ class event_event(osv.osv):
}
def subscribe_to_event(self, cr, uid, ids, context=None):
- num_of_seats = int(context.get('ticket', 1))
- available_seats = self.check_available_seats(cr, uid, ids, context=context)
- if num_of_seats > available_seats:
- if available_seats == 0:
- raise osv.except_osv(_('Warning!'),_("No Tickets Available!"))
- else:
- raise osv.except_osv(_('Warning!'),_("Only %d Seats are Available!") % (available_seats))
-
register_pool = self.pool.get('event.registration')
user_pool = self.pool.get('res.users')
+ num_of_seats = int(context.get('ticket', 1))
+ self.check_registration_limits_before(cr, uid, ids, num_of_seats, context=context)
user = user_pool.browse(cr, uid, uid, context=context)
curr_reg_ids = register_pool.search(cr, uid, [('user_id', '=', user.id), ('event_id', '=' , ids[0])])
#the subscription is done with UID = 1 because in case we share the kanban view, we want anyone to be able to subscribe
From b3d0828564370a97f340b567131425fc8ba9e8c8 Mon Sep 17 00:00:00 2001
From: Xavier Morel
Date: Mon, 23 Apr 2012 11:50:57 +0200
Subject: [PATCH 077/452] [FIX] bloody logo link
bzr revid: xmo@openerp.com-20120423095057-gytshtkft5002693
---
addons/web/static/src/xml/base.xml | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 57970c1486e..65c084731bc 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -275,7 +275,10 @@
-
+
+ d.url = '/' + (window.location.search || '');
+
+
|