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/103] [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/103] [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/103] [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/103] [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/103] [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/103] [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/103] [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/103] 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/103] [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/103] [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/103] [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/103] [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/103] [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/103] [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 95d9cb9f4ec264b0ee35fdc5bef9058d9cfdbe0b 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 14:54:25 +0100 Subject: [PATCH 015/103] [imp] view bzr revid: rlo@openerp.com-20120227135425-879tmcgw20dfy2a1 --- addons/google_docs/__openerp__.py | 6 ++-- addons/google_docs/google_docs.py | 31 +++++++++++++++++---- addons/google_docs/static/src/js/gdocs.js | 1 + addons/google_docs/static/src/xml/gdocs.xml | 2 +- 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/addons/google_docs/__openerp__.py b/addons/google_docs/__openerp__.py index 2461be1e151..309ca13edc0 100644 --- a/addons/google_docs/__openerp__.py +++ b/addons/google_docs/__openerp__.py @@ -1,17 +1,17 @@ { - 'name': 'Wiki', + 'name': 'Google Docs', 'version': '0.1', 'author': 'OpenERP SA', 'website': 'http://openerp.com', 'data': [ - 'res_gdocs.xml' + 'google_docs.xml' ], 'installable': True, 'auto_install': False, 'web': True, 'js': ['static/src/js/gdocs.js'], 'qweb' : [ - "static/src/xml/*.xml", + "static/src/xml/gdocs.xml", ], '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 index def1f3097e1..59101ba5b09 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -70,7 +70,15 @@ class google_docs(osv.osv): 'gdocs_res_id': fields.char('Google resource ID', size=64, translate=False), 'name_template': fields.char('GDoc name template', size=64, translate=False) } + print ''' +######################################### + +GOOGLE DOCS + +######################################### + +''' edit_url_template = 'https://docs.google.com/Edit?docid=%s' prefix_gdoc_id_res = DOCUMENT_LABEL + ':' @@ -84,6 +92,15 @@ class google_docs(osv.osv): @return -1 if the template hasn't been assigned yet. @return -2 if the google_base_account hasn't been configured yet. ''' + print ''' + +######################################### + +google_docs.copy_gdoc() + +######################################### + +''' if context==None: context={} @@ -121,14 +138,15 @@ class google_docs(osv.osv): 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. + ' ''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 = {} @@ -146,10 +164,11 @@ class google_docs(osv.osv): 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(prefix_gdoc_id_res), 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. + '' '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. @@ -158,7 +177,7 @@ class google_docs(osv.osv): @return 0 on successful execution. @return -2 if the google_base_account hasn't been configured yet. @return -3 if the given resource_id doesn't exist in the user's google docs account. - ''' + ' '' if context == None: context = {} @@ -186,7 +205,7 @@ class google_docs(osv.osv): }) return 0 - +''' class google_docs_folder(osv.osv): _name = 'google.docs.folder' diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 30edffaad7f..579414ee74a 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -2,6 +2,7 @@ openerp.gdocs = function(instance) { instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ on_attachments_loaded: function(attachments) { + alert('gdocs.js.on_attachments_loaded()'); this._super(attachments); var self = this; var $gdocbtn = self.$element.find('button.gdocs'); diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml index bc7a56842ba..9f78a91c28f 100644 --- a/addons/google_docs/static/src/xml/gdocs.xml +++ b/addons/google_docs/static/src/xml/gdocs.xml @@ -4,7 +4,7 @@ - From 087c191730d611058b0303cf38d10989d868a7f8 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 14:57:51 +0100 Subject: [PATCH 016/103] [imp] view bzr revid: rlo@openerp.com-20120227135751-33nd5qduv2jp58cu --- addons/google_docs/google_docs.py | 56 ------------------------------- 1 file changed, 56 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 59101ba5b09..2f2c4919271 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -4,62 +4,6 @@ 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 3568bed68046537878e7386597abfb7978de3cdb 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 16:13:11 +0100 Subject: [PATCH 017/103] [imp] view bzr revid: rlo@openerp.com-20120227151311-38go1bn2ihs1n5jq --- addons/google_docs/static/src/js/gdocs.js | 10 ++++++++-- addons/google_docs/static/src/xml/gdocs.xml | 9 ++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 579414ee74a..14996da46a5 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -2,7 +2,6 @@ openerp.gdocs = function(instance) { instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ on_attachments_loaded: function(attachments) { - alert('gdocs.js.on_attachments_loaded()'); this._super(attachments); var self = this; var $gdocbtn = self.$element.find('button.gdocs'); @@ -17,7 +16,7 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte }, on_add_gdoc: function() { var self = this; - var $gdocbtn = this.$element.find('button.gdocs');alert($gdocbtn); + var $gdocbtn = this.$element.find('button.gdocs'); $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(); @@ -28,3 +27,10 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte }); }; + +$(function() { + console.log($('#gd-button')); + $('#gd-button').click(function(){alert('click');}); + alert('binded'); +} +); diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml index 9f78a91c28f..61c169fe531 100644 --- a/addons/google_docs/static/src/xml/gdocs.xml +++ b/addons/google_docs/static/src/xml/gdocs.xml @@ -4,7 +4,14 @@ - From f0a9682a6aa6814817cca4e31fe9561bed60d126 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 17:12:00 +0100 Subject: [PATCH 018/103] [imp] js things bzr revid: rlo@openerp.com-20120227161200-toovqcewybgxsitg --- addons/google_docs/static/src/js/gdocs.js | 28 ++++++--------------- addons/google_docs/static/src/xml/gdocs.xml | 2 +- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 14996da46a5..11690f70e2a 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,22 +1,16 @@ -openerp.gdocs = function(instance) { +console.log('fegegegwnw') +openerp.google_docs = function(instance) { +console.log('nw') instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ - on_attachments_loaded: function(attachments) { - this._super(attachments); - var self = this; - var $gdocbtn = self.$element.find('button.gdocs'); - var is_gdoc = function(a) { - return a.type == 'url' && a.name == 'GDocs'; - }; - if (_.any(attachments, is_gdoc)) { - $gdocbtn.hide(); - } else { - $gdocbtn.show().click(self.on_add_gdoc); - } + init: function() { + this._super.apply(this, arguments); + this.$element.delegate('.oe_google_docs_button', 'click', self.on_add_gdoc); }, on_add_gdoc: function() { var self = this; - var $gdocbtn = this.$element.find('button.gdocs'); +console.log('--------'); + var $gdocbtn = this.$element.find('.oe_google_docs_button'); $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(); @@ -28,9 +22,3 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte }; -$(function() { - console.log($('#gd-button')); - $('#gd-button').click(function(){alert('click');}); - alert('binded'); -} -); diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml index 61c169fe531..7ee2297c545 100644 --- a/addons/google_docs/static/src/xml/gdocs.xml +++ b/addons/google_docs/static/src/xml/gdocs.xml @@ -11,7 +11,7 @@


- From af04b6860cfe10259a63a44cd6b4a4f8234eed8e 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 17:14:13 +0100 Subject: [PATCH 019/103] [imp] js things bzr revid: rlo@openerp.com-20120227161413-ie6cn7rwoezhht6v --- addons/google_docs/static/src/js/gdocs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 11690f70e2a..6ef889e3fa0 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -5,7 +5,7 @@ console.log('nw') instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ init: function() { this._super.apply(this, arguments); - this.$element.delegate('.oe_google_docs_button', 'click', self.on_add_gdoc); + this.$element.delegate('.oe_google_docs_button', 'click', this.on_add_gdoc); }, on_add_gdoc: function() { var self = this; From ec2ceb5d6bf9c9a12102de64b2eded66cc7c7062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Tue, 28 Feb 2012 09:22:26 +0100 Subject: [PATCH 020/103] [imp] js is calling the module bzr revid: rlo@openerp.com-20120228082226-su74ddghivymtp09 --- addons/google_docs/static/src/js/gdocs.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 6ef889e3fa0..32a57e18c0c 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,18 +1,15 @@ -console.log('fegegegwnw') -openerp.google_docs = function(instance) { +openerp.google_docs = function(instance, session) { -console.log('nw') instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.extend({ init: function() { this._super.apply(this, arguments); - this.$element.delegate('.oe_google_docs_button', 'click', this.on_add_gdoc); + this.$element.delegate('.oe_google_docs_button', 'click', this.on_add_gdoc); }, on_add_gdoc: function() { var self = this; -console.log('--------'); var $gdocbtn = this.$element.find('.oe_google_docs_button'); $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) { + new openerp.sessions.session0.web.DataSet(this, 'google.docs').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); From 841f8b12b413dd7a0d4091182d092128f27da5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Tue, 28 Feb 2012 15:46:23 +0100 Subject: [PATCH 021/103] [imp] gdata code bzr revid: rlo@openerp.com-20120228144623-4bk6lsnthk2elqbv --- addons/google_docs/google_docs.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 2f2c4919271..1dd632aab83 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -49,38 +49,40 @@ google_docs.copy_gdoc() if context==None: context={} - template_vars = { + '''template_vars = { 'db' : cr.dbname, 'model' : model, 'id' : id, 'salt' : salt, 'name' : '', - } + }''' name_template = 'Sales order %s' - # 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 + # check template for the current model + # TODO check module logic + '''model_obj = self.pool.get(model[0]) + 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 +''' # 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= self.name_template % (model, )) + resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL) + new_resource = client.post(entry=resource, uri='https://docs.google.com/feeds/default/private/full/') - return self.edit_url_template % (copied_resource.resource_id.text,) + return self.edit_url_template % (new_resource.resource_id.text,) ''' def get_documents_list(self, cr, uid, context=None): From f8213e68f0a1d5ffde27a47b70211a0cb205db9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Wed, 29 Feb 2012 09:38:33 +0100 Subject: [PATCH 022/103] [imp] integration with google_base_account bzr revid: rlo@openerp.com-20120229083833-yd0wfg8x5ywc9e1c --- addons/google_docs/google_docs.py | 9 +++++++-- addons/google_docs/static/src/js/gdocs.js | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 1dd632aab83..1c36533e614 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -23,7 +23,7 @@ GOOGLE DOCS ######################################### ''' - edit_url_template = 'https://docs.google.com/Edit?docid=%s' + edit_url_template = 'https://docs.google.com/document/d/%s/edit' prefix_gdoc_id_res = DOCUMENT_LABEL + ':' def copy_gdoc(self, cr, uid, model, context=None): @@ -61,6 +61,9 @@ google_docs.copy_gdoc() # check google_base_account users_obj = self.pool.get('res.users') user = users_obj.browse(cr, uid, [uid])[0] + print '%s' % user.__dict__ + print '%s' % user.gmail_user + print '%s' % user.gmail_password if not user.gmail_user or not user.gmail_password: return -2 @@ -81,7 +84,9 @@ google_docs.copy_gdoc() client.ClientLogin(user.gmail_user, user.gmail_password, client.source, service='writely') resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL) new_resource = client.post(entry=resource, uri='https://docs.google.com/feeds/default/private/full/') - + print new_resource.__dict__ + print new_resource.resource_id.text + print new_resource.resource_id return self.edit_url_template % (new_resource.resource_id.text,) ''' diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 32a57e18c0c..6e0ae93fdf3 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -10,6 +10,7 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte var $gdocbtn = this.$element.find('.oe_google_docs_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); new openerp.sessions.session0.web.DataSet(this, 'google.docs').call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { + console.log(r); $gdocbtn.hide(); self.do_update(); self.do_action(r.result); From 4c04da28b7e3c78785cbb51892b26facc1b15f1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Wed, 29 Feb 2012 13:29:40 +0100 Subject: [PATCH 023/103] [imp] working... the only thing missing is linking from the model web to the gdoc web bzr revid: rlo@openerp.com-20120229122940-16h3bwa6j8zbz01s --- addons/google_docs/google_docs.py | 152 +++++----------------- addons/google_docs/static/src/js/gdocs.js | 4 +- 2 files changed, 36 insertions(+), 120 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 1c36533e614..57cd9441566 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -4,162 +4,80 @@ import gdata.docs.client from gdata.client import RequestError from gdata.docs.service import DOCUMENT_LABEL -class google_docs(osv.osv): - _name = 'google.docs' +class google_docs_config(osv.osv): + _name = 'google.docs.config' + _inherit = 'ir.attachment' - _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), - 'name_template': fields.char('GDoc name template', size=64, translate=False) + 'gdocs_resource_id': fields.char('Google resource ID', size=64), + 'name_template': fields.char('GDoc name template', size=64) } - print ''' -######################################### + _defaults = { + 'name_template': 'Google Document' + } -GOOGLE DOCS - -######################################### - -''' edit_url_template = 'https://docs.google.com/document/d/%s/edit' prefix_gdoc_id_res = DOCUMENT_LABEL + ':' def copy_gdoc(self, cr, uid, model, context=None): + #import pdb; pdb.set_trace() '''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. ''' - print ''' - -######################################### - -google_docs.copy_gdoc() - -######################################### - -''' if context==None: context={} - '''template_vars = { - 'db' : cr.dbname, - 'model' : model, - 'id' : id, - 'salt' : salt, - 'name' : '', - }''' name_template = 'Sales order %s' # check google_base_account users_obj = self.pool.get('res.users') user = users_obj.browse(cr, uid, [uid])[0] - print '%s' % user.__dict__ - print '%s' % user.gmail_user - print '%s' % user.gmail_password if not user.gmail_user or not user.gmail_password: return -2 - # check template for the current model - # TODO check module logic - '''model_obj = self.pool.get(model[0]) - 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 -''' - # copy the document + # create 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 = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL) - new_resource = client.post(entry=resource, uri='https://docs.google.com/feeds/default/private/full/') - print new_resource.__dict__ - print new_resource.resource_id.text - print new_resource.resource_id - return self.edit_url_template % (new_resource.resource_id.text,) + gdocs_resource = client.post(entry=resource, uri='https://docs.google.com/feeds/default/private/full/') + return gdocs_resource -''' - 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. - '' ' +class google_docs(osv.osv): + _name = 'google.docs' - 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 + def doc_get(self, cr, uid, model, id, context=None): + google_docs_ref = self.pool.get('google.docs.config') + gdocs_resource_id = google_docs_ref.search(cr, uid, [('model', '=', model)]) - # 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') + if gdocs_resource_id: + return google_docs_ref.edit_url_template % (gdocs_resource_id, ) + else: + gdocs_resource = google_docs_ref.copy_gdoc(cr, uid, model, context) + print gdocs_resource + if gdocs_resource == -2: + return gdocs_resource - 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())) -''' + print gdocs_resource -''' - 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. - @return -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 + import pdb; pdb.set_trace() + # save the reference + gdocs_resource_id = gdocs_resource.resource_id.text[gdocs_resource.prefix_gdoc_id_res+1:] + google_docs_ref.create(cr, uid, { + 'model': model, + 'google_resource_id': gdocs_resource_id, + 'name': gdocs_resource_title.text, }) - - return 0 -''' - -class google_docs_folder(osv.osv): - _name = 'google.docs.folder' - _columns = { - 'res_id': fields.char('GDocs resource id', size=64, translate=False), - } + print gdocs_resource.resource_id.text + print gdocs_resource_id + return google_docs_ref.edit_url_template % (gdocs_resource_id,) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 6e0ae93fdf3..14103681306 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -9,11 +9,9 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - new openerp.sessions.session0.web.DataSet(this, 'google.docs').call_button('copy_gdoc', [[this.view.datarecord.id], this.view.dataset.get_context()], function(r) { + new openerp.sessions.session0.web.DataSet(this, 'google.docs').call('doc_get', [this.view.datarecord.id, this.view.dataset.get_context()], function(r) { console.log(r); - $gdocbtn.hide(); self.do_update(); - self.do_action(r.result); }); } }); From 854e18a73724b97107dcaf172c77855713fe7a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Wed, 29 Feb 2012 13:37:58 +0100 Subject: [PATCH 024/103] [imp]fixrkremove pdb statements bzr revid: rlo@openerp.com-20120229123758-0tcguv9olvul3trk --- addons/google_docs/google_docs.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 57cd9441566..abc7d81e189 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -70,9 +70,8 @@ class google_docs(osv.osv): print gdocs_resource - import pdb; pdb.set_trace() # save the reference - gdocs_resource_id = gdocs_resource.resource_id.text[gdocs_resource.prefix_gdoc_id_res+1:] + gdocs_resource_id = gdocs_resource.resource_id.text[len(google_docs_ref.prefix_gdoc_id_res):] google_docs_ref.create(cr, uid, { 'model': model, 'google_resource_id': gdocs_resource_id, From 67ffbbac7a14a31d278043f1a5b962a41730ece1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Wed, 29 Feb 2012 13:39:42 +0100 Subject: [PATCH 025/103] [fix] remove debug statements bzr revid: rlo@openerp.com-20120229123942-a3ntcfz15xgqek4g --- addons/google_docs/google_docs.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index abc7d81e189..e253d62ffbb 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -64,12 +64,9 @@ class google_docs(osv.osv): return google_docs_ref.edit_url_template % (gdocs_resource_id, ) else: gdocs_resource = google_docs_ref.copy_gdoc(cr, uid, model, context) - print gdocs_resource if gdocs_resource == -2: return gdocs_resource - print gdocs_resource - # save the reference gdocs_resource_id = gdocs_resource.resource_id.text[len(google_docs_ref.prefix_gdoc_id_res):] google_docs_ref.create(cr, uid, { @@ -77,6 +74,5 @@ class google_docs(osv.osv): 'google_resource_id': gdocs_resource_id, 'name': gdocs_resource_title.text, }) - print gdocs_resource.resource_id.text - print gdocs_resource_id + return google_docs_ref.edit_url_template % (gdocs_resource_id,) From 1ade3b205fc01dc4d476fa295d8e046a44755b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Wed, 29 Feb 2012 18:23:19 +0100 Subject: [PATCH 026/103] [fix] bzr revid: rlo@openerp.com-20120229172319-rzwcu1egrhw9ggms --- addons/google_docs/google_docs.py | 9 +++++---- addons/google_docs/static/src/js/gdocs.js | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index e253d62ffbb..b60acd16197 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -55,11 +55,12 @@ class google_docs_config(osv.osv): class google_docs(osv.osv): _name = 'google.docs' - - def doc_get(self, cr, uid, model, id, context=None): + def doc_get(self, cr, uid, model, ids, context=None): google_docs_ref = self.pool.get('google.docs.config') - gdocs_resource_id = google_docs_ref.search(cr, uid, [('model', '=', model)]) - + gdocs_resource_id = google_docs_ref.search(cr, uid, [('model', '=', model), ('id', 'in', ids)]) + #print gdocs_resource_id + #print google_docs_ref.edit_url_template % (gdocs_resource_id, ) + #import pdb; pdb.set_trace() if gdocs_resource_id: return google_docs_ref.edit_url_template % (gdocs_resource_id, ) else: diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 14103681306..a126bfed5c3 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -9,8 +9,8 @@ instance.web.form.SidebarAttachments = instance.web.form.SidebarAttachments.exte var self = this; var $gdocbtn = this.$element.find('.oe_google_docs_button'); $gdocbtn.attr('disabled', 'true').find('img, span').toggle(); - new openerp.sessions.session0.web.DataSet(this, 'google.docs').call('doc_get', [this.view.datarecord.id, this.view.dataset.get_context()], function(r) { - console.log(r); + 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]], function(r) { self.do_update(); }); } From cde742506ee92500e9cd2e4c41b041613d225442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Wed, 29 Feb 2012 19:45:20 +0100 Subject: [PATCH 027/103] [fix] logic... bzr revid: rlo@openerp.com-20120229184520-vs679o9drs1vls4r --- addons/google_docs/google_docs.py | 97 +++++++++++++++++++++---------- 1 file changed, 65 insertions(+), 32 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index b60acd16197..689f5522cd3 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -4,24 +4,25 @@ import gdata.docs.client from gdata.client import RequestError from gdata.docs.service import DOCUMENT_LABEL -class google_docs_config(osv.osv): - _name = 'google.docs.config' +class google_docs_ir_attachment(osv.osv): _inherit = 'ir.attachment' - _columns = { - 'model': fields.many2one('ir.model', 'Model'), - 'gdocs_resource_id': fields.char('Google resource ID', size=64), - 'name_template': fields.char('GDoc name template', size=64) - } + def _auth(self, cr, uid): + # 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 - _defaults = { - 'name_template': 'Google Document' - } + # 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') + + return client - edit_url_template = 'https://docs.google.com/document/d/%s/edit' - prefix_gdoc_id_res = DOCUMENT_LABEL + ':' - - def copy_gdoc(self, cr, uid, model, context=None): + def create_empty_gdoc(self, cr, uid, model, context=None): #import pdb; pdb.set_trace() '''Associate a copy of the gdoc identified by 'gdocs_res_id' to the current entity. @param cr: the current row from the database cursor. @@ -35,45 +36,77 @@ class google_docs_config(osv.osv): if context==None: context={} - name_template = 'Sales order %s' - - # 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: + client = _auth(cr, uid) + if client == -2: return -2 - # create 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 = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL) gdocs_resource = client.post(entry=resource, uri='https://docs.google.com/feeds/default/private/full/') return gdocs_resource + def copy_gdoc(self, cr, uid, model, gdocs_resource_id, context=None): + if context==None: + context={} + + client = _auth(cr, uid) + if client == -2: + return -2 + + # fetch and copy the original document + original_resource = client.get_resource_by_id(gdocs_resource_id) + return client.copy_resource(entry=original_resource) + + def gdoc_get(self, cr, uid, model, context=None): + google_docs_config_ref = self.pool.get('google.docs.config') + google_template_ids = google_docs_config_ref.search(cr, uid, [('model', '=', model)]) + if not google_template_ids: + # there isn't any template. Create an empty doc. + return self.create_gdoc(cr, uid, model, context) + + # otherwise, copy document from existing template + return self.copy_gdoc(cr, uid, model, google_template_ids[0].gdocs_resource_id + +class google_docs_config(osv.osv): + _name = 'google.docs.config' + + _columns = { + 'model_id': fields.many2one('ir.model', 'Model'), + 'gdocs_resource_id': fields.char('Google resource ID', size=64), + 'name_template': fields.char('GDoc name template', size=64), + 'url': fields.char('url for the template', size=122), + } + + _defaults = { + 'name_template': 'Google Document' + } + + edit_url_template = 'https://docs.google.com/document/d/%s/edit' + prefix_gdoc_id_res = DOCUMENT_LABEL + ':' + + class google_docs(osv.osv): _name = 'google.docs' - def doc_get(self, cr, uid, model, ids, context=None): - google_docs_ref = self.pool.get('google.docs.config') + def doc_get(self, cr, uid, model, ids, context=None):# TODO fix logic here + google_docs_ref = self.pool.get('ir.attachment') gdocs_resource_id = google_docs_ref.search(cr, uid, [('model', '=', model), ('id', 'in', ids)]) #print gdocs_resource_id #print google_docs_ref.edit_url_template % (gdocs_resource_id, ) - #import pdb; pdb.set_trace() if gdocs_resource_id: return google_docs_ref.edit_url_template % (gdocs_resource_id, ) else: - gdocs_resource = google_docs_ref.copy_gdoc(cr, uid, model, context) + ir_attachment_res = self.pool.get('ir.attachment') + gdocs_resource = ir_attachment_res.create_empty_gdoc(cr, uid, model, context) if gdocs_resource == -2: return gdocs_resource # save the reference gdocs_resource_id = gdocs_resource.resource_id.text[len(google_docs_ref.prefix_gdoc_id_res):] + import pdb; pdb.set_trace() google_docs_ref.create(cr, uid, { - 'model': model, - 'google_resource_id': gdocs_resource_id, - 'name': gdocs_resource_title.text, + 'model_id': self.pool.get(model), + 'gdocs_resource_id': gdocs_resource_id, + 'name': gdocs_resource.title.text, }) return google_docs_ref.edit_url_template % (gdocs_resource_id,) From 2947f6dbb8563bfab55d457e9b1c0cc99f0fc4f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Thu, 1 Mar 2012 15:45:07 +0100 Subject: [PATCH 028/103] [imp] add middleware support for spreadsheets and presentations bzr revid: rlo@openerp.com-20120301144507-k9kqsrdzwi0h8mf5 --- addons/google_docs/google_docs.py | 93 ++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 34 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 689f5522cd3..3e6c398b155 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -22,39 +22,70 @@ class google_docs_ir_attachment(osv.osv): return client - def create_empty_gdoc(self, cr, uid, model, context=None): + def create_empty_google_doc(self, cr, uid, model, id, context=None): #import pdb; pdb.set_trace() '''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 the document object. @return -2 if the google_base_account hasn't been configured yet. ''' - if context==None: + if context is None: context={} - client = _auth(cr, uid) + # authenticate + client = self._auth(cr, uid) if client == -2: return -2 - resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL) - gdocs_resource = client.post(entry=resource, uri='https://docs.google.com/feeds/default/private/full/') + if 'type' not in context: + context['type'] = 'text' + + # create the document in google docs + if context['type']=='slide': + local_resource = gdata.docs.data.Resource(gdata.docs.data.PRESENTATION_LABEL) + elif context['type']=='spreadsheet': + 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 + self.create(cr, uid, { + 'model': context['active_model'], #model, + 'res_id': context['active_id'], + 'type': 'url', + #'name': TODO pending from the working config + 'url': gdocs_resource.get_alternate_link().href + }) + return gdocs_resource def copy_gdoc(self, cr, uid, model, gdocs_resource_id, context=None): - if context==None: + if context is None: context={} - client = _auth(cr, uid) + client = self._auth(cr, uid) if client == -2: return -2 # fetch and copy the original document original_resource = client.get_resource_by_id(gdocs_resource_id) - return client.copy_resource(entry=original_resource) + copy_resource = client.copy_resource(entry=original_resource) + + # register into the db + self.create(cr, uid, { + 'model': context['active_model'], + 'res_id': context['active_id'], + 'type': 'url', + #'name': TODO pending from the working config + 'url': copy_resource.get_alternate_link().href + }) + + return copy_resource def gdoc_get(self, cr, uid, model, context=None): google_docs_config_ref = self.pool.get('google.docs.config') @@ -64,7 +95,7 @@ class google_docs_ir_attachment(osv.osv): return self.create_gdoc(cr, uid, model, context) # otherwise, copy document from existing template - return self.copy_gdoc(cr, uid, model, google_template_ids[0].gdocs_resource_id + return self.copy_gdoc(cr, uid, model, google_template_ids[0].gdocs_resource_id) class google_docs_config(osv.osv): _name = 'google.docs.config' @@ -72,41 +103,35 @@ class google_docs_config(osv.osv): _columns = { 'model_id': fields.many2one('ir.model', 'Model'), 'gdocs_resource_id': fields.char('Google resource ID', size=64), - 'name_template': fields.char('GDoc name template', size=64), - 'url': fields.char('url for the template', size=122), + 'name_template': fields.char('GDoc name template ', size=64, help='This is the name which appears on google side'), + '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') } _defaults = { 'name_template': 'Google Document' } - edit_url_template = 'https://docs.google.com/document/d/%s/edit' - prefix_gdoc_id_res = DOCUMENT_LABEL + ':' class google_docs(osv.osv): _name = 'google.docs' def doc_get(self, cr, uid, model, ids, context=None):# TODO fix logic here - google_docs_ref = self.pool.get('ir.attachment') - gdocs_resource_id = google_docs_ref.search(cr, uid, [('model', '=', model), ('id', 'in', ids)]) - #print gdocs_resource_id - #print google_docs_ref.edit_url_template % (gdocs_resource_id, ) - if gdocs_resource_id: - return google_docs_ref.edit_url_template % (gdocs_resource_id, ) - else: - ir_attachment_res = self.pool.get('ir.attachment') - gdocs_resource = ir_attachment_res.create_empty_gdoc(cr, uid, model, context) - if gdocs_resource == -2: - return gdocs_resource + google_docs_config_ref = self.pool.get('google.docs.config') + ir_attachment_ref = self.pool.get('ir.attachment') + google_docs_config = google_docs_config_ref.search(cr, uid, [('model_id', '=', model)]) + + if not google_docs_config: + google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, ids, context) + #else: + - # save the reference - gdocs_resource_id = gdocs_resource.resource_id.text[len(google_docs_ref.prefix_gdoc_id_res):] - import pdb; pdb.set_trace() - google_docs_ref.create(cr, uid, { - 'model_id': self.pool.get(model), - 'gdocs_resource_id': gdocs_resource_id, - 'name': gdocs_resource.title.text, - }) + print google_docs_config - return google_docs_ref.edit_url_template % (gdocs_resource_id,) + if not google_docs_config: + return -1 + + + + return 0 From 82937d5cc8a812bee3ed4199757417e78f534dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Thu, 1 Mar 2012 16:09:14 +0100 Subject: [PATCH 029/103] [imp] add frontend support for spreadsheets and presentations bzr revid: rlo@openerp.com-20120301150914-0733ak0tdhdpaw8h --- addons/google_docs/static/src/js/gdocs.js | 28 ++++++++++++++++++--- addons/google_docs/static/src/xml/gdocs.xml | 12 +++++++-- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index a126bfed5c3..9723aac2723 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -3,14 +3,34 @@ 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_button', 'click', this.on_add_gdoc); + 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); }, - on_add_gdoc: function() { + on_add_text_gdoc: function() { var self = this; - var $gdocbtn = this.$element.find('.oe_google_docs_button'); + 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]], function(r) { + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'text'], function(r) { + 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(); }); } diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml index 7ee2297c545..f401512e96b 100644 --- a/addons/google_docs/static/src/xml/gdocs.xml +++ b/addons/google_docs/static/src/xml/gdocs.xml @@ -11,9 +11,17 @@


- + +
From 663a525f76ccf263dbb37b451a9c7f2898217a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Thu, 1 Mar 2012 16:25:30 +0100 Subject: [PATCH 030/103] [imp] integrate frontend - middleware bzr revid: rlo@openerp.com-20120301152530-2ldz1w96y4pu2x9w --- addons/google_docs/google_docs.py | 47 +++++++++---------------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 3e6c398b155..040dce932ea 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -22,32 +22,26 @@ class google_docs_ir_attachment(osv.osv): return client - def create_empty_google_doc(self, cr, uid, model, id, context=None): + def create_empty_google_doc(self, cr, uid, model, id, type_doc): #import pdb; pdb.set_trace() '''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. + @param type_doc: text, spreadsheet or slide. @return the document object. @return -2 if the google_base_account hasn't been configured yet. ''' - if context is None: - context={} - # authenticate client = self._auth(cr, uid) if client == -2: return -2 - if 'type' not in context: - context['type'] = 'text' - # create the document in google docs - if context['type']=='slide': + if type_doc=='slide': local_resource = gdata.docs.data.Resource(gdata.docs.data.PRESENTATION_LABEL) - elif context['type']=='spreadsheet': + elif type_doc=='spreadsheet': local_resource = gdata.docs.data.Resource(gdata.docs.data.SPREADSHEET_LABEL) else: local_resource = gdata.docs.data.Resource(gdata.docs.data.DOCUMENT_LABEL) @@ -55,8 +49,8 @@ class google_docs_ir_attachment(osv.osv): # register into the db self.create(cr, uid, { - 'model': context['active_model'], #model, - 'res_id': context['active_id'], + 'model': model, + 'res_id': ids[0], 'type': 'url', #'name': TODO pending from the working config 'url': gdocs_resource.get_alternate_link().href @@ -64,7 +58,7 @@ class google_docs_ir_attachment(osv.osv): return gdocs_resource - def copy_gdoc(self, cr, uid, model, gdocs_resource_id, context=None): + def copy_gdoc(self, cr, uid, model, id): if context is None: context={} @@ -78,8 +72,8 @@ class google_docs_ir_attachment(osv.osv): # register into the db self.create(cr, uid, { - 'model': context['active_model'], - 'res_id': context['active_id'], + 'model': model, + 'res_id': id[0], 'type': 'url', #'name': TODO pending from the working config 'url': copy_resource.get_alternate_link().href @@ -87,16 +81,6 @@ class google_docs_ir_attachment(osv.osv): return copy_resource - def gdoc_get(self, cr, uid, model, context=None): - google_docs_config_ref = self.pool.get('google.docs.config') - google_template_ids = google_docs_config_ref.search(cr, uid, [('model', '=', model)]) - if not google_template_ids: - # there isn't any template. Create an empty doc. - return self.create_gdoc(cr, uid, model, context) - - # otherwise, copy document from existing template - return self.copy_gdoc(cr, uid, model, google_template_ids[0].gdocs_resource_id) - class google_docs_config(osv.osv): _name = 'google.docs.config' @@ -117,21 +101,18 @@ class google_docs_config(osv.osv): class google_docs(osv.osv): _name = 'google.docs' - def doc_get(self, cr, uid, model, ids, context=None):# TODO fix logic here + def doc_get(self, cr, uid, model, id, type_doc):# TODO fix logic here google_docs_config_ref = self.pool.get('google.docs.config') ir_attachment_ref = self.pool.get('ir.attachment') google_docs_config = google_docs_config_ref.search(cr, uid, [('model_id', '=', model)]) - + if not google_docs_config: - google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, ids, context) - #else: - + google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, ids, type_doc) + else: + google_document = ir_attachment_ref.copy_gdoc(cr, uid, model, id) print google_docs_config if not google_docs_config: return -1 - - - return 0 From 65d257d4e9fd9bee1c6ab82e63f4f122aa2ffe41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Thu, 1 Mar 2012 16:28:05 +0100 Subject: [PATCH 031/103] [imp] bzr revid: rlo@openerp.com-20120301152805-p7wosq6x4johbosj --- 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 040dce932ea..34b4e5a16ed 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -107,7 +107,7 @@ class google_docs(osv.osv): google_docs_config = google_docs_config_ref.search(cr, uid, [('model_id', '=', model)]) if not google_docs_config: - google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, ids, type_doc) + google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, id, type_doc) else: google_document = ir_attachment_ref.copy_gdoc(cr, uid, model, id) From 2b774dddfb3bd5cfd43fccade36f6ac362ab25d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Fri, 2 Mar 2012 09:15:13 +0100 Subject: [PATCH 032/103] [imp] js bzr revid: rlo@openerp.com-20120302081513-mzexq3vw6ftzw45s --- addons/google_docs/static/src/js/gdocs.js | 77 ++++++++++++----------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 9723aac2723..825bd577b66 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,40 +1,47 @@ 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); - }, - 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) { - 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(); - }); - } -}); + 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); + }, + on_add_text_gdoc: function() { + console.log('on_add_text_gdoc:'); + 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('on_add_text_gdoc: return'); + self.do_update(); + }); + }, + on_add_spreadsheet_gdoc: function() { + console.log('on_add_spreadsheet_gdoc:'); + 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()); + console.log('on_add_spreadsheet_gdoc:'); + ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'spreadsheet'], function(r) { + console.log('on_add_spreadsheet_gdoc: return'); + self.do_update(); + }); + }, + on_add_slide_gdoc: function() { + console.log ('on_add_slide_gdoc:'); + 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) { + console.log('on_add_slide_gdoc: return'); + self.do_update(); + }); + } + }); }; From 9afb5cfe64b8f67e4ccfe6e048046fb6937aeef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Fri, 2 Mar 2012 09:30:13 +0100 Subject: [PATCH 033/103] [imp] py bzr revid: rlo@openerp.com-20120302083013-4pvtkjma36ovlzhy --- addons/google_docs/google_docs.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 34b4e5a16ed..5e1f30e38fa 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -22,8 +22,8 @@ class google_docs_ir_attachment(osv.osv): return client - def create_empty_google_doc(self, cr, uid, model, id, type_doc): - #import pdb; pdb.set_trace() + def create_empty_google_doc(self, cr, uid, model, ids, type_doc): + import pdb; pdb.set_trace() '''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. @@ -49,16 +49,16 @@ class google_docs_ir_attachment(osv.osv): # register into the db self.create(cr, uid, { - 'model': model, + 'res_model': model, 'res_id': ids[0], 'type': 'url', - #'name': TODO pending from the working config + 'name': 'new_foo', # TODO pending from the working config 'url': gdocs_resource.get_alternate_link().href }) return gdocs_resource - def copy_gdoc(self, cr, uid, model, id): + def copy_gdoc(self, cr, uid, model, ids): if context is None: context={} @@ -72,10 +72,10 @@ class google_docs_ir_attachment(osv.osv): # register into the db self.create(cr, uid, { - 'model': model, - 'res_id': id[0], + 'res_model': model, + 'res_id': ids[0], 'type': 'url', - #'name': TODO pending from the working config + 'name': 'copy_foo', # TODO pending from the working config 'url': copy_resource.get_alternate_link().href }) From f0775d762e80c2fdd48b689b253bb02db14e569a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Fri, 2 Mar 2012 09:40:06 +0100 Subject: [PATCH 034/103] [imp] kind of working, just the configuration is missing bzr revid: rlo@openerp.com-20120302084006-m3qx6zfypl6g57r8 --- addons/google_docs/google_docs.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 5e1f30e38fa..3f544c983bc 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -23,7 +23,6 @@ class google_docs_ir_attachment(osv.osv): return client def create_empty_google_doc(self, cr, uid, model, ids, type_doc): - import pdb; pdb.set_trace() '''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. @@ -52,7 +51,7 @@ class google_docs_ir_attachment(osv.osv): 'res_model': model, 'res_id': ids[0], 'type': 'url', - 'name': 'new_foo', # TODO pending from the working config + 'name': 'new_foo %s' % (type_doc,) , # TODO pending from the working config 'url': gdocs_resource.get_alternate_link().href }) @@ -75,7 +74,7 @@ class google_docs_ir_attachment(osv.osv): 'res_model': model, 'res_id': ids[0], 'type': 'url', - 'name': 'copy_foo', # TODO pending from the working config + 'name': 'copy_foo %s' (type_doc,) , # TODO pending from the working config 'url': copy_resource.get_alternate_link().href }) From ff1fc1a7e9476f33e8a580c0c1f8942e5004bf0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Fri, 2 Mar 2012 11:35:05 +0100 Subject: [PATCH 035/103] [imp] bzr revid: rlo@openerp.com-20120302103505-em22nbb5chumfzuf --- addons/google_docs/__openerp__.py | 3 +- addons/google_docs/google_docs.py | 43 +++++++++++++++++------ addons/google_docs/static/src/js/gdocs.js | 18 ++++++---- 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/addons/google_docs/__openerp__.py b/addons/google_docs/__openerp__.py index 309ca13edc0..be8eb85d21e 100644 --- a/addons/google_docs/__openerp__.py +++ b/addons/google_docs/__openerp__.py @@ -1,8 +1,9 @@ { 'name': 'Google Docs', - 'version': '0.1', + 'version': '0.2', 'author': 'OpenERP SA', 'website': 'http://openerp.com', + 'category': 'Tools', 'data': [ 'google_docs.xml' ], diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 3f544c983bc..a63043e65ba 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -1,8 +1,31 @@ +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2012 OpenERP SA (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + 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 +try: + import gdata.docs.data + import gdata.docs.client + from gdata.client import RequestError + from gdata.docs.service import DOCUMENT_LABEL +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')) class google_docs_ir_attachment(osv.osv): _inherit = 'ir.attachment' @@ -12,7 +35,7 @@ class google_docs_ir_attachment(osv.osv): 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 + return False # login client = gdata.docs.client.DocsClient(source='openerp.com') @@ -29,13 +52,13 @@ class google_docs_ir_attachment(osv.osv): @param model: the current model name. @param type_doc: text, spreadsheet or slide. @return the document object. - @return -2 if the google_base_account hasn't been configured yet. + @return False if the google_base_account hasn't been configured yet. ''' # authenticate client = self._auth(cr, uid) - if client == -2: - return -2 + if client == False: + return False # create the document in google docs if type_doc=='slide': @@ -62,8 +85,8 @@ class google_docs_ir_attachment(osv.osv): context={} client = self._auth(cr, uid) - if client == -2: - return -2 + if client == False: + return False # fetch and copy the original document original_resource = client.get_resource_by_id(gdocs_resource_id) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index 825bd577b66..63978868901 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -9,36 +9,40 @@ openerp.google_docs = function(instance, session) { this.$element.delegate('.oe_google_docs_slide_button', 'click', this.on_add_slide_gdoc); }, on_add_text_gdoc: function() { - console.log('on_add_text_gdoc:'); 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('on_add_text_gdoc: return'); + 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(); }); }, on_add_spreadsheet_gdoc: function() { - console.log('on_add_spreadsheet_gdoc:'); 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()); - console.log('on_add_spreadsheet_gdoc:'); ds.call('doc_get', [this.view.dataset.model, [this.view.datarecord.id], 'spreadsheet'], function(r) { - console.log('on_add_spreadsheet_gdoc: return'); self.do_update(); }); }, on_add_slide_gdoc: function() { - console.log ('on_add_slide_gdoc:'); 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) { - console.log('on_add_slide_gdoc: return'); self.do_update(); }); } From 01e67d6dd52daae8e4a54202501167b451655ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 5 Mar 2012 14:52:40 +0100 Subject: [PATCH 036/103] [imp] init config bzr revid: rlo@openerp.com-20120305135240-o1a4sjcerod4l7jh --- addons/google_docs/google_docs.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index a63043e65ba..c254b4944ea 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -104,7 +104,9 @@ class google_docs_ir_attachment(osv.osv): return copy_resource class google_docs_config(osv.osv): - _name = 'google.docs.config' + #_name = 'google.docs.config' + _inherit = 'res.users' + _description = 'User\'s gdocs config' _columns = { 'model_id': fields.many2one('ir.model', 'Model'), @@ -118,7 +120,19 @@ class google_docs_config(osv.osv): 'name_template': 'Google Document' } - + def create(self, cr, uid, vals, context=None): + res = super(users, 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, #[vals['model_id']], {'member_ids':[(4, res)]}, + { + '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) + return res class google_docs(osv.osv): _name = 'google.docs' From ce1d3ce094db59b966adf02f8f0a841d84df1707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 5 Mar 2012 15:50:01 +0100 Subject: [PATCH 037/103] [imp] config view bzr revid: rlo@openerp.com-20120305145001-uut48z736imzbwtn --- addons/google_docs/google_docs.py | 2 +- addons/google_docs/res_config_user_view.xml | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 addons/google_docs/res_config_user_view.xml diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index c254b4944ea..dc4fc7d07b7 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -124,7 +124,7 @@ class google_docs_config(osv.osv): res = super(users, 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, #[vals['model_id']], {'member_ids':[(4, res)]}, + 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'), diff --git a/addons/google_docs/res_config_user_view.xml b/addons/google_docs/res_config_user_view.xml new file mode 100644 index 00000000000..f328e408c10 --- /dev/null +++ b/addons/google_docs/res_config_user_view.xml @@ -0,0 +1,18 @@ + + + + + + res.gdocs.users.form + res.users + form + + + + + + + + + + From fd89caf3cb964e150cb5b8cc7c224cc64ae32fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Mon, 5 Mar 2012 17:11:15 +0100 Subject: [PATCH 038/103] [imp] bzr revid: rlo@openerp.com-20120305161115-i20h6xst3sg5n181 --- addons/google_docs/google_docs.py | 42 ++++++++++----------- addons/google_docs/res_config_user_view.xml | 12 +++--- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index dc4fc7d07b7..8e093271c9e 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -103,10 +103,27 @@ class google_docs_ir_attachment(osv.osv): return copy_resource -class google_docs_config(osv.osv): - #_name = 'google.docs.config' +class google_docs(osv.osv): + _name = 'google.docs' + + 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)]) + + if not google_docs_config: + google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, id, type_doc) + else: + google_document = ir_attachment_ref.copy_gdoc(cr, uid, model, id) + + print google_docs_config + + if not google_docs_config: + return -1 + +class users(osv.osv): _inherit = 'res.users' - _description = 'User\'s gdocs config' + _description = "User\'s gdocs config" _columns = { 'model_id': fields.many2one('ir.model', 'Model'), @@ -134,21 +151,4 @@ class google_docs_config(osv.osv): context) return res -class google_docs(osv.osv): - _name = 'google.docs' - - def doc_get(self, cr, uid, model, id, type_doc):# TODO fix logic here - google_docs_config_ref = self.pool.get('google.docs.config') - ir_attachment_ref = self.pool.get('ir.attachment') - google_docs_config = google_docs_config_ref.search(cr, uid, [('model_id', '=', model)]) - - if not google_docs_config: - google_document = ir_attachment_ref.create_empty_google_doc(cr, uid, model, id, type_doc) - else: - google_document = ir_attachment_ref.copy_gdoc(cr, uid, model, id) - - print google_docs_config - - if not google_docs_config: - return -1 - +google_docs_config() diff --git a/addons/google_docs/res_config_user_view.xml b/addons/google_docs/res_config_user_view.xml index f328e408c10..1292947812f 100644 --- a/addons/google_docs/res_config_user_view.xml +++ b/addons/google_docs/res_config_user_view.xml @@ -1,16 +1,18 @@ + - - res.gdocs.users.form + + + google_docs.config.user.inherited.form res.users + form - - - + From 0102ccd723b7e5837f657cb5fdc643e4b0ec00a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Tue, 6 Mar 2012 11:31:51 +0100 Subject: [PATCH 039/103] [imp] bzr revid: rlo@openerp.com-20120306103151-983wrsjoyw6rlo2h --- addons/google_docs/__openerp__.py | 2 +- addons/google_docs/google_docs.py | 2 +- addons/google_docs/google_docs.xml | 32 +++++++++++++++++------------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/addons/google_docs/__openerp__.py b/addons/google_docs/__openerp__.py index be8eb85d21e..84fc2899ec3 100644 --- a/addons/google_docs/__openerp__.py +++ b/addons/google_docs/__openerp__.py @@ -1,5 +1,5 @@ { - 'name': 'Google Docs', + 'name': 'Google Docs integration', 'version': '0.2', 'author': 'OpenERP SA', 'website': 'http://openerp.com', diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 8e093271c9e..1fc3daf7959 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -151,4 +151,4 @@ class users(osv.osv): context) return res -google_docs_config() +users() diff --git a/addons/google_docs/google_docs.xml b/addons/google_docs/google_docs.xml index d0e842b566e..12107a53419 100644 --- a/addons/google_docs/google_docs.xml +++ b/addons/google_docs/google_docs.xml @@ -1,16 +1,20 @@ + - - - res.company.form.gdocs - google.docs - form - - - - - - - - - + + + + + + res.user.google_docs.config.inherited + res.users + + form + + + + + + + From b216e3af53b8424c0243f953536c91c660951bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Tue, 6 Mar 2012 11:38:11 +0100 Subject: [PATCH 040/103] [imp] bzr revid: rlo@openerp.com-20120306103811-tjj7cgdc21jl2hs1 --- addons/google_docs/google_docs.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/google_docs/google_docs.xml b/addons/google_docs/google_docs.xml index 12107a53419..e623e23f005 100644 --- a/addons/google_docs/google_docs.xml +++ b/addons/google_docs/google_docs.xml @@ -11,8 +11,7 @@ form - + From 2a33e0e3b7c128040b1d8a1100cf66fa85e5c70d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Tue, 6 Mar 2012 13:03:19 +0100 Subject: [PATCH 041/103] [imp] bzr revid: rlo@openerp.com-20120306120319-uy3rny4texi1yzlu --- addons/google_docs/google_docs.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/google_docs/google_docs.xml b/addons/google_docs/google_docs.xml index e623e23f005..cb1fed68657 100644 --- a/addons/google_docs/google_docs.xml +++ b/addons/google_docs/google_docs.xml @@ -10,9 +10,9 @@ form - + - + From 80229d461930b205f15d1d8d2651efe1913360ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Tue, 6 Mar 2012 13:58:58 +0100 Subject: [PATCH 042/103] [imp] user config bzr revid: rlo@openerp.com-20120306125858-22qgeowa58mw419r --- addons/google_docs/google_docs.py | 10 +++++----- addons/google_docs/google_docs.xml | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 1fc3daf7959..91c6d1daab4 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -126,15 +126,15 @@ class users(osv.osv): _description = "User\'s gdocs config" _columns = { - 'model_id': fields.many2one('ir.model', 'Model'), - 'gdocs_resource_id': fields.char('Google resource ID', size=64), - 'name_template': fields.char('GDoc name template ', size=64, help='This is the name which appears on google side'), - 'name': fields.char('Name', size=64, help='This is the attachment\'s name. As well, it appears on the panel.') + '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') } _defaults = { - 'name_template': 'Google Document' + 'context_name_template': 'Google Document' } def create(self, cr, uid, vals, context=None): diff --git a/addons/google_docs/google_docs.xml b/addons/google_docs/google_docs.xml index cb1fed68657..0aeff3dde5f 100644 --- a/addons/google_docs/google_docs.xml +++ b/addons/google_docs/google_docs.xml @@ -12,6 +12,9 @@ + + + From 98036bbe03dde733bd680a947639309f97a4664e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Tue, 6 Mar 2012 14:08:08 +0100 Subject: [PATCH 043/103] [imp] user config bzr revid: rlo@openerp.com-20120306130808-c9vvp9zq67j6g4jx --- addons/google_docs/google_docs.xml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/google_docs/google_docs.xml b/addons/google_docs/google_docs.xml index 0aeff3dde5f..333909f11a0 100644 --- a/addons/google_docs/google_docs.xml +++ b/addons/google_docs/google_docs.xml @@ -10,12 +10,15 @@ form - - - - - - + + + + + + + + +
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/103] [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/103] [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/103] [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/103] [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/103] [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/103] [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/103] [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/103] [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/103] [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/103] [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/103] [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 @@ -
-
-
-
-
-
-
+
From f77cecb90c39041267455b05b23764f85e6783a5 Mon Sep 17 00:00:00 2001 From: MVA Date: Tue, 20 Mar 2012 17:03:20 +0100 Subject: [PATCH 055/103] [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 @@ - - From 2f1baf8f40908b54db0950f596fbe98e35d7cf9a Mon Sep 17 00:00:00 2001 From: MVA Date: Wed, 28 Mar 2012 11:34:56 +0200 Subject: [PATCH 058/103] [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/103] [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/103] [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/103] [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/103] [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 @@ From fb989dbfb7161b9f79ce5bf2024a5f13423b1b6f Mon Sep 17 00:00:00 2001 From: MVA Date: Mon, 2 Apr 2012 15:18:17 +0200 Subject: [PATCH 063/103] [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 064/103] [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 9241bce4156129737fd7702afcd39dc55f6efe9c Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Wed, 9 May 2012 11:42:01 +0530 Subject: [PATCH 065/103] [IMP] Title improvement. bzr revid: tta@openerp.com-20120509061201-tcq537146cbvxwyp --- addons/web/static/src/xml/base.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 6c540fd6957..07b41cf1a2e 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -368,7 +368,7 @@
- Activate the developper mode + Activate the developer mode

OpenERP

Version

From 195cb2811dbce3bdbbfd4c470b581c3871fbdbf1 Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Wed, 9 May 2012 19:12:00 +0530 Subject: [PATCH 066/103] Improve the Title bzr revid: tta@openerp.com-20120509134200-byd11lj0eokr6gpy --- addons/web/static/src/js/view_form.js | 1 + addons/web/static/src/js/views.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index b1289512f4f..d0eda645196 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2930,6 +2930,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ _template: 'One2Many.listview', do_add_record: function () { if (this.options.editable) { + console.log("this.options :: ",this.options); this._super.apply(this, arguments); } else { var self = this; diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 798c5bb1493..c4ff0efd70c 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -730,7 +730,7 @@ instance.web.Sidebar = instance.web.Widget.extend({ var view = this.getParent(); this.sections = [ { 'name' : 'print', 'label' : _t('Print'), }, - { 'name' : 'files', 'label' : _t('Attachement'), }, + { 'name' : 'files', 'label' : _t('Attachment'), }, { 'name' : 'other', 'label' : _t('More'), } ]; this.items = { From 5ca8f4239670345c517335559fb67e626bb92bef Mon Sep 17 00:00:00 2001 From: Minh Tran Date: Wed, 16 May 2012 14:25:22 +0200 Subject: [PATCH 067/103] [IMP] Fixed kanban view problems bzr revid: mit@openerp.com-20120516122522-du590ixokm32z19r --- addons/web/static/src/css/base.css | 9 ++++++++- addons/web/static/src/css/base.sass | 7 ++++++- addons/web_kanban/static/src/js/kanban.js | 2 +- addons/web_kanban/static/src/xml/web_kanban.xml | 4 ++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 5d2102630cb..6f5296315ae 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1942,6 +1942,14 @@ .openerp .oe-listview-content .numeric input { text-align: right; } +.openerp .oe_kanban_view { + position: absolute; + top: 110px; + bottom: 0; +} +.openerp .oe_kanban_groups { + height: 100%; +} .openerp .oe_kanban_group_title { margin: 1px 1px 4px; font-size: 15px; @@ -1949,7 +1957,6 @@ text-shadow: 0 1px 0 white; } .openerp .oe_kanban_column, .openerp .oe_kanban_group_header { - width: 240px; vertical-align: top; padding: 6px 7px 6px 6px; background: #f0eeee; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 567732ed080..071d5b3eeca 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1614,13 +1614,18 @@ $colour4: #8a89ba text-align: right // }}} // KanbanView {{{ + .oe_kanban_view + position: absolute + top: 110px + bottom: 0 + .oe_kanban_groups + height: 100% .oe_kanban_group_title margin: 1px 1px 4px font-size: 15px font-weight: bold text-shadow: 0 1px 0 white .oe_kanban_column, .oe_kanban_group_header - width: 240px vertical-align: top padding: 6px 7px 6px 6px background: #f0eeee diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 0fec031d4da..19f1bdcf10a 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -371,7 +371,7 @@ instance.web_kanban.KanbanGroup = instance.web.OldWidget.extend({ if (self.quick) { return; } self.quick = new instance.web_kanban.QuickCreate(this) .on('added', self, self.proxy('quick_add')); - self.quick.appendTo(self.$element.find('.oe_kanban_group_header')); + self.quick.appendTo(self.$element.find('.oe_kanban_header')); }); this.$records.find('.oe_kanban_show_more').click(this.do_show_more); if (this.state.folded) { diff --git a/addons/web_kanban/static/src/xml/web_kanban.xml b/addons/web_kanban/static/src/xml/web_kanban.xml index e5e0dffba93..cec843d8aff 100644 --- a/addons/web_kanban/static/src/xml/web_kanban.xml +++ b/addons/web_kanban/static/src/xml/web_kanban.xml @@ -16,9 +16,9 @@

- + -
+
From e994580e1dd25452ae0841d37da86891759e7a46 Mon Sep 17 00:00:00 2001 From: Minh Tran Date: Wed, 16 May 2012 18:01:59 +0200 Subject: [PATCH 068/103] some improvements to kanban view bzr revid: mit@openerp.com-20120516160159-pnb6twf5oox356gs --- addons/web/static/src/css/base.sass | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 071d5b3eeca..670696e025d 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1616,7 +1616,7 @@ $colour4: #8a89ba // KanbanView {{{ .oe_kanban_view position: absolute - top: 110px + top: 111px bottom: 0 .oe_kanban_groups height: 100% @@ -1631,6 +1631,8 @@ $colour4: #8a89ba background: #f0eeee border-left: 1px solid #f0f8f8 border-right: 1px solid #b9b9b9 + .oe_kanban_column + height: 100% .oe_kanban_record position: relative display: block From a49e0e43db1298ae43ad5ba01745f28affeaa265 Mon Sep 17 00:00:00 2001 From: Minh Tran Date: Fri, 18 May 2012 14:52:03 +0200 Subject: [PATCH 069/103] Restyling of kanban column header bzr revid: mit@openerp.com-20120518125203-1vc4k0s5vr9pwbwy --- addons/web/static/src/css/base.sass | 2 ++ addons/web_kanban/static/src/css/kanban.css | 15 --------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 670696e025d..cba50aa6279 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1633,6 +1633,8 @@ $colour4: #8a89ba border-right: 1px solid #b9b9b9 .oe_kanban_column height: 100% + .oe_kanban_aggregates + padding: 0 .oe_kanban_record position: relative display: block diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css index c74b038d1a6..73e7d060632 100644 --- a/addons/web_kanban/static/src/css/kanban.css +++ b/addons/web_kanban/static/src/css/kanban.css @@ -70,20 +70,6 @@ .openerp .oe_kanban_group_folded .oe_kanban_fold_icon { background: url(/web_kanban/static/src/img/plus-icon.png) no-repeat; } - -.openerp ul.oe_kanban_aggregates { - padding: 0; - margin: 0 0 0 22px; -} -.openerp ul.oe_kanban_aggregates li { - list-style: circle; - font-style: italic; -} -.openerp ul.oe_kanban_aggregates span { - text-decoration: underline; - font-size: 90%; -} - .openerp .oe_kanban_action_button { height: 22px; margin: 0; @@ -91,7 +77,6 @@ .openerp .oe_kanban_action_a { text-decoration: none; } - .openerp .oe_kanban_box { background: #FFF; border: 2px solid #CCC; From 3e5f595f17a26d0c3cf93926c0bae86df464fa16 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Fri, 18 May 2012 18:44:13 +0200 Subject: [PATCH 070/103] [IMP] kaban css improvement bzr revid: al@openerp.com-20120518164413-7wzidpc6m71oz47s --- addons/web/static/src/css/base.css | 98 ++++++++++++++++++++++++++++- addons/web/static/src/css/base.sass | 68 ++++++++++++++++---- 2 files changed, 152 insertions(+), 14 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 6f5296315ae..2f85065aa38 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1,4 +1,4 @@ -@charset "UTF-8"; +@charset "utf-8"; @font-face { font-family: "mnmliconsRegular"; src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot"); @@ -1944,7 +1944,7 @@ } .openerp .oe_kanban_view { position: absolute; - top: 110px; + top: 111px; bottom: 0; } .openerp .oe_kanban_groups { @@ -1963,6 +1963,12 @@ border-left: 1px solid #f0f8f8; border-right: 1px solid #b9b9b9; } +.openerp .oe_kanban_column { + height: 100%; +} +.openerp .oe_kanban_aggregates { + padding: 0; +} .openerp .oe_kanban_record { position: relative; display: block; @@ -2002,6 +2008,94 @@ -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); } +.openerp .oe_kanban_view { + position: absolute; + top: 111px; + bottom: 0; +} +.openerp .oe_kanban_card { + position: relative; + display: block; + min-height: 50px; + background: white; + border: 1px solid #d8d8d8; + border-bottom-color: #b9b9b9; + padding: 6px; + margin: 6px 0; + display: block; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; +} +.openerp .oe_kanban_card:last-child { + margin-bottom: 0; +} +.openerp .oe_kanban_card:hover { + -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.6); + -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.6); + -box-shadow: 0 0 3px rgba(0, 0, 0, 0.6); +} +.openerp .oe_kanban_card:hover .oe_kanban_menuaction { + display: block; +} +.openerp .oe_kanban_card h3 { + margin: 0 16px 0 0; +} +.openerp .oe_kanban_star { + float: left; + position: inline-block; + margin: 0 4px 0 0; +} +.openerp a.oe_kanban_menuaction { + position: absolute; + right: 4px; + display: none; + color: #4c4c4c; + cursor: pointer; +} +.openerp a.oe_kanban_menuaction:hover { + text-decoration: none; +} +.openerp .oe_kanban_avatar { + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); +} +.openerp .oe_kanban_status { + display: inline-block; + height: 12px; + width: 12px; + margin: 4px auto; + -moz-border-radius: 6px; + -webkit-border-radius: 6px; + border-radius: 6px; + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); + -box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); +} +.openerp .oe_kanban_status_green { + background: green; + background-position: center center; + background-image: -webkit-radial-gradient(circle, #55dd55 0%, #44aa44 40%, #339933 100%); + background-image: -moz-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); + background-image: -ms-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); + background-image: radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); +} +.openerp .oe_kanban_status_red { + background: red; + background-position: center center; + background-image: -webkit-radial-gradient(circle, #ee7777 0%, #cc3333 40%, #bb0808 100%); + background-image: -moz-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); + background-image: -ms-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); + background-image: radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); +} +.openerp .oe_kanban_text_red { + background: red; + color: black; +} .openerp .oe_trad_field.touched { border: 1px solid green !important; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index cba50aa6279..c5434d51ce4 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -853,18 +853,6 @@ $colour4: #8a89ba content: "k" .oe_vm_switch_diagram:after content: "f" - //.oe_vm_switch_list:after, .oe_vm_switch_tree:after - //content: "ö" - //.oe_vm_switch_graph:after - //content: "ó" - //.oe_vm_switch_gantt:after - //content: "y" - //.oe_vm_switch_calendar:after - //content: "b" - //.oe_vm_switch_kanban:after - //content: "ó" - //.oe_vm_switch_diagram:after - //content: "}" // }}} // ViewManager.sidebar {{{ .oe_form_dropdown_section @@ -1659,6 +1647,62 @@ $colour4: #8a89ba border-color: #e5e5e5 #dbdbdb #d2d2d2 @include radius(3px) @include box-shadow(0 1px 2px rgba(0,0,0,0.2)) + .oe_kanban_view + position: absolute + top: 111px + bottom: 0 + .oe_kanban_card + position: relative + display: block + min-height: 50px + background: white + border: 1px solid #d8d8d8 + border-bottom-color: #b9b9b9 + padding: 6px + margin: 6px 0 + display: block + @include radius(4px) + &:last-child + margin-bottom: 0 + &:hover + @include box-shadow(0 0 3px rgba(0,0,0,0.6)) + .oe_kanban_menuaction + display: block + h3 + margin: 0 16px 0 0 + .oe_kanban_star + float: left + position: inline-block + margin: 0 4px 0 0 + a.oe_kanban_menuaction + position: absolute + right: 4px + display: none + color: #4c4c4c + cursor: pointer + &:hover + text-decoration: none + .oe_kanban_avatar + @include radius(4px) + @include box-shadow(0 1px 2px rgba(0,0,0,0.2)) + //.oe_kanban_footer_left + // float: left + .oe_kanban_status + display: inline-block + height: 12px + width: 12px + margin: 4px auto + @include radius(6px) + @include box-shadow(0 1px 3px rgba(0,0,0,0.6)) + .oe_kanban_status_green + background: green + @include radial-gradient((#55dd55 0%, #44aa44 40%, #339933 100%)) + .oe_kanban_status_red + background: red + @include radial-gradient((#ee7777 0%, #cc3333 40%, #bb0808 100%)) + .oe_kanban_text_red + background: red + color: #000 // }}} // Translation {{{ .oe_trad_field.touched From 9f68a37a3213d3ad8f558936b6a516596ff02438 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Fri, 18 May 2012 18:45:17 +0200 Subject: [PATCH 071/103] crm.lead kanban view part1 bzr revid: al@openerp.com-20120518164517-onrofcuwdu1tubxc --- addons/crm/crm_lead_view.xml | 87 +++++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 36 deletions(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 9c3bd07562c..fcd1cdd777c 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -251,46 +251,60 @@ - oe_kanban_color_red + +
+ B + +
+

+ + + - + + + +

+
+ +
+
+ +
+
+ + oe_kanban_text_red + + + + : + + +
+ + +
+
+
+ +
From 099e96b5afa7ff48ee30a1d5ae59ffae331d9fc8 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 22 May 2012 12:38:37 +0200 Subject: [PATCH 072/103] [ADD] Converted kanban.sass to kanban.css bzr revid: fme@openerp.com-20120522103837-1ypp34gx1cthx6h2 --- addons/web_kanban/static/src/css/kanban.css | 910 +++++++++---------- addons/web_kanban/static/src/css/kanban.sass | 386 ++++++++ 2 files changed, 813 insertions(+), 483 deletions(-) create mode 100644 addons/web_kanban/static/src/css/kanban.sass diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css index fcc246543b5..2e33f499749 100644 --- a/addons/web_kanban/static/src/css/kanban.css +++ b/addons/web_kanban/static/src/css/kanban.css @@ -1,485 +1,429 @@ +@charset "utf-8"; .openerp .oe_kanban_view .ui-sortable-placeholder { - border: 1px dotted black; - visibility: visible !important; - height: 60px !important; -} -.openerp .oe_kanban_groups { - width: 100%; -} -.openerp .oe_kanban_group_header { - position: relative; -} -.openerp .oe_kanban_group_folded { - padding: 0 5px 0 5px; -} -.openerp .oe_kanban_group_folded .oe_kanban_group_title, -.openerp .oe_kanban_group_folded.oe_kanban_column > *, -.openerp .oe_kanban_group_folded .oe_kanban_aggregates { - display: none; -} -.openerp .oe_kanban_group_folded .oe_kanban_group_title_vertical { - display: block; -} - -.openerp .oe_kanban_group_title { - font-size: 100%; - font-weight: bold; - padding-left: 2px; - color: #333333; -} -.openerp .oe_kanban_group_title_undefined { - color: #666666; -} -.openerp .oe_kanban_group_title_vertical { - writing-mode: tb-rl; - -webkit-transform: rotate(90deg); - -moz-transform: rotate(90deg); - -o-transform: rotate(90deg); - -ms-transform: rotate(90deg); - transform: rotate(90deg); - width: 30px; - height: 20px; - font-size: 24px; - white-space: nowrap; - display: none; - position: absolute; - top: 10px; -} -.openerp .oe_kanban_show_more { - clear: both; - text-align: center; -} -.openerp .oe_kanban_grouped .oe_kanban_show_more .oe_button { - width: 100%; -} -.openerp .oe_kanban_ungrouped .oe_kanban_record { - float: left; - padding: 2px; - box-sizing: border-box; - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; -} -.openerp .oe_kanban_fold_icon { - cursor: pointer; - float: left; - padding: 2px; - width: 16px; - height: 16px; - background: url(/web_kanban/static/src/img/minus-icon.png) no-repeat; -} -.openerp .oe_kanban_group_folded .oe_kanban_fold_icon { - background: url(/web_kanban/static/src/img/plus-icon.png) no-repeat; -} -.openerp .oe_kanban_action_button { - height: 22px; - margin: 0; -} -.openerp .oe_kanban_action_a { - text-decoration: none; -} -.openerp .oe_kanban_box { - background: #FFF; - border: 2px solid #CCC; - border-radius: 4px; - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - margin-bottom: 5px; -} -.openerp .oe_kanban_box_header { - background: #EEE; - border-bottom: 1px solid #CCC; -} -.openerp .oe_kanban_title { - font-size: 95%; - font-weight: bold; - padding: 0 4px 0 4px; -} -.openerp .oe_kanban_small { - font-size: 80%; - font-weight: normal; -} -.openerp .oe_kanban_table { - width: 100%; - border: none; - border-collapse: collapse; - margin: 0; - padding: 0; -} -.openerp .oe_kanban_table tr td { - padding: 0; -} -.openerp .oe_kanban_table tr td.oe_kanban_title { - padding: 2px; -} -.openerp .oe_kanban_gravatar { - display: block; -} -.openerp .oe_kanban_box_content { - padding: 4px; - font-size: 90%; -} -.openerp .oe_kanban_button { - border: 1px solid #8ec1da; - background-color: #ddeef6; - border-radius: 3px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - color: #000000; - text-shadow: 0 1px #fff; - padding: 0 4px; - font-size: 85%; - margin: 1px; -} -.openerp a.oe_kanban_button:hover, -.openerp button.oe_kanban_button:hover { - background-color: #eeddf6; -} -.openerp .oe_kanban_buttons_set { - border-top: 1px dotted; - white-space: nowrap; - padding-top: 2px; - position: relative; - clear: both; -} -.openerp .oe_kanban_buttons_set a { - padding: 2px; -} -.oe_kanban_color_picker { - position: absolute; - top: -10px; - border: 1px solid black; - -moz-box-shadow: 2px 2px 5px #666; - -webkit-box-shadow: 2px 2px 5px #666; - box-shadow: 2px 2px 5px #666; - z-index: 2; -} -.oe_kanban_color_picker a { - display: block; - width: 30px; - height: 30px; - border: 1px solid black; - text-align: center; - text-decoration: none; -} -.oe_kanban_color_picker a:hover { - border-color: white; -} -.oe_kanban_color_picker span { - border: none; - font-size: 120%; - font-weight: bold; - color: black; - line-height: 30px; -} -.openerp .oe_kanban_left { - float: left; -} -.openerp .oe_kanban_right { - float: right; -} -.openerp .oe_kanban_clear { - clear: both; -} -.openerp .oe_kanban_box_show_onclick { - display: none; -} -.openerp .oe_kanban_draghandle { - cursor: move; -} -.openerp .oe_kanban_color_border { - border-color: #CCCCCC; -} -.openerp .oe_kanban_color_border { - border-color: #CCCCCC; -} -.openerp .oe_kanban_tooltip ul, -.openerp ul.oe_kanban_tooltip { - padding: 0 0 4px 0; - margin: 5px 0 0 15px; - list-style: circle; -} -.openerp .oe_kanban_highlight { - border-radius: 2px; - -moz-border-radius: 2px; - -webkit-border-radius: 2px; - padding: 1px 5px; - margin: 1px 4px; - white-space: nowrap; - display: inline-block; - line-height: 1em; -} - -.openerp .oe_kanban_add { - cursor: pointer; - position: absolute; - top: 6px; - right: 6px; - width: 16px; - height: 16px; - background: url(/web_kanban/static/src/img/plus-icon.png) no-repeat; -} - -.openerp .oe_kanban_quick_create { - /* apply block formatting context */ - overflow: hidden; -} -.openerp .oe_kanban_no_group .oe_kanban_quick_create { - width: 200px; - padding: 10px; -} -.openerp .oe_kanban_quick_create input { - display: block; - /* margins within width */ - box-sizing: border-box; - width: 100%; -} -.openerp .oe_kanban_quick_create button { - float: right; -} - -/* Custom colors are also present in kanban.js */ -/* Custom color#0 */ -.openerp .oe_kanban_color_0 .oe_kanban_color_bglight { - background: #FFFFFF; -} -.openerp .oe_kanban_color_0 .oe_kanban_color_bgdark { - background: #EEEEEE; -} -.openerp .oe_kanban_color_0 .oe_kanban_color_border { - border-color: #CCCCCC; -} -.openerp .oe_kanban_color_0 .oe_kanban_button { - background-color: #EEEEEE; - border-color: #CCCCCC; - text-shadow: 0 1px #FFFFFF; -} -.openerp .oe_kanban_color_0 .oe_kanban_button_active, -.openerp .oe_kanban_color_0 a.oe_kanban_button:hover, -.openerp .oe_kanban_color_0 button.oe_kanban_button:hover { - background-color: #999999; - color: #fff; - text-shadow: 0 1px #000; -} - -/* Custom color#1 */ -.openerp .oe_kanban_color_1 .oe_kanban_color_bglight { - background: #CCCCCC; -} -.openerp .oe_kanban_color_1 .oe_kanban_color_bgdark { - background: #999999; -} -.openerp .oe_kanban_color_1 .oe_kanban_color_border { - border-color: #666666; -} -.openerp .oe_kanban_color_1 .oe_kanban_button { - background-color: #999999; - border-color: #666666; - text-shadow: 0 1px #CCCCCC; -} -.openerp .oe_kanban_color_1 .oe_kanban_button_active, -.openerp .oe_kanban_color_1 a.oe_kanban_button:hover, -.openerp .oe_kanban_color_1 button.oe_kanban_button:hover { - background-color: #666666; - color: #fff; - text-shadow: 0 1px #000; -} - -/* Custom color#2 */ -.openerp .oe_kanban_color_2 .oe_kanban_color_bglight { - background: #FFC7C7; -} -.openerp .oe_kanban_color_2 .oe_kanban_color_bgdark { - background: #FF8F8F; -} -.openerp .oe_kanban_color_2 .oe_kanban_color_border { - border-color: #D97979; -} -.openerp .oe_kanban_color_2 .oe_kanban_button { - background-color: #FF8F8F; - border-color: #D97979; - text-shadow: 0 1px #FFC7C7; -} -.openerp .oe_kanban_color_2 .oe_kanban_button_active, -.openerp .oe_kanban_color_2 a.oe_kanban_button:hover, -.openerp .oe_kanban_color_2 button.oe_kanban_button:hover { - background-color: #CC5C5C; - color: #fff; - text-shadow: 0 1px #000; -} - -/* Custom color#3 */ -.openerp .oe_kanban_color_3 .oe_kanban_color_bglight { - background: #FFF1C7; -} -.openerp .oe_kanban_color_3 .oe_kanban_color_bgdark { - background: #FFE38F; -} -.openerp .oe_kanban_color_3 .oe_kanban_color_border { - border-color: #D9C179; -} -.openerp .oe_kanban_color_3 .oe_kanban_button { - background-color: #FFE38F; - border-color: #D9C179; - text-shadow: 0 1px #FFF1C7; -} -.openerp .oe_kanban_color_3 .oe_kanban_button_active, -.openerp .oe_kanban_color_3 a.oe_kanban_button:hover, -.openerp .oe_kanban_color_3 button.oe_kanban_button:hover { - background-color: #CCB05C; - color: #fff; - text-shadow: 0 1px #000; -} - -/* Custom color#4 */ -.openerp .oe_kanban_color_4 .oe_kanban_color_bglight { - background: #E3FFC7; -} -.openerp .oe_kanban_color_4 .oe_kanban_color_bgdark { - background: #C7FF8F; -} -.openerp .oe_kanban_color_4 .oe_kanban_color_border { - border-color: #A9D979; -} -.openerp .oe_kanban_color_4 .oe_kanban_button { - background-color: #C7FF8F; - border-color: #A9D979; - text-shadow: 0 1px #E3FFC7; -} -.openerp .oe_kanban_color_4 .oe_kanban_button_active, -.openerp .oe_kanban_color_4 a.oe_kanban_button:hover, -.openerp .oe_kanban_color_4 button.oe_kanban_button:hover { - background-color: #94CC5C; - color: #fff; - text-shadow: 0 1px #000; -} - -/* Custom color#5 */ -.openerp .oe_kanban_color_5 .oe_kanban_color_bglight { - background: #C7FFD5; -} -.openerp .oe_kanban_color_5 .oe_kanban_color_bgdark { - background: #8FFFAB; -} -.openerp .oe_kanban_color_5 .oe_kanban_color_border { - border-color: #79D991; -} -.openerp .oe_kanban_color_5 .oe_kanban_button { - background-color: #8FFFAB; - border-color: #79D991; - text-shadow: 0 1px #C7FFD5; -} -.openerp .oe_kanban_color_5 .oe_kanban_button_active, -.openerp .oe_kanban_color_5 a.oe_kanban_button:hover, -.openerp .oe_kanban_color_5 button.oe_kanban_button:hover { - background-color: #5CCC78; - color: #fff; - text-shadow: 0 1px #000; -} - -/* Custom color#6 */ -.openerp .oe_kanban_color_6 .oe_kanban_color_bglight { - background: #C7FFFF; -} -.openerp .oe_kanban_color_6 .oe_kanban_color_bgdark { - background: #8FFFFF; -} -.openerp .oe_kanban_color_6 .oe_kanban_color_border { - border-color: #79D9D9; -} -.openerp .oe_kanban_color_6 .oe_kanban_button { - background-color: #8FFFFF; - border-color: #79D9D9; - text-shadow: 0 1px #C7FFFF; -} -.openerp .oe_kanban_color_6 .oe_kanban_button_active, -.openerp .oe_kanban_color_6 a.oe_kanban_button:hover, -.openerp .oe_kanban_color_6 button.oe_kanban_button:hover { - background-color: #5CCCCC; - color: #fff; - text-shadow: 0 1px #000; -} - -/* Custom color#7 */ -.openerp .oe_kanban_color_7 .oe_kanban_color_bglight { - background: #C7D5FF; -} -.openerp .oe_kanban_color_7 .oe_kanban_color_bgdark { - background: #8FABFF; -} -.openerp .oe_kanban_color_7 .oe_kanban_color_border { - border-color: #8FABFF; -} -.openerp .oe_kanban_color_7 .oe_kanban_button { - background-color: #8FABFF; - border-color: #7995E9; - text-shadow: 0 1px #C7D5FF; -} -.openerp .oe_kanban_color_7 .oe_kanban_button_active, -.openerp .oe_kanban_color_7 a.oe_kanban_button:hover, -.openerp .oe_kanban_color_7 button.oe_kanban_button:hover { - background-color: #5C78CC; - color: #fff; - text-shadow: 0 1px #000; -} - -/* Custom color#8 */ -.openerp .oe_kanban_color_8 .oe_kanban_color_bglight { - background: #E3C7FF; -} -.openerp .oe_kanban_color_8 .oe_kanban_color_bgdark { - background: #C78FFF; -} -.openerp .oe_kanban_color_8 .oe_kanban_color_border { - border-color: #A979D9; -} -.openerp .oe_kanban_color_8 .oe_kanban_button { - background-color: #C78FFF; - border-color: #A979D9; - text-shadow: 0 1px #E3C7FF; -} -.openerp .oe_kanban_color_8 .oe_kanban_button_active, -.openerp .oe_kanban_color_8 a.oe_kanban_button:hover, -.openerp .oe_kanban_color_8 button.oe_kanban_button:hover { - background-color: #945CCC; - color: #fff; - text-shadow: 0 1px #000; -} - -/* Custom color#9 */ -.openerp .oe_kanban_color_9 .oe_kanban_color_bglight { - background: #FFC7F1; -} -.openerp .oe_kanban_color_9 .oe_kanban_color_bgdark { - background: #FF8FE3; -} -.openerp .oe_kanban_color_9 .oe_kanban_color_border { - border-color: #D979C1; -} -.openerp .oe_kanban_color_9 .oe_kanban_button { - background-color: #FF8FE3; - border-color: #D979C1; - text-shadow: 0 1px #FFC7F1; -} -.openerp .oe_kanban_color_9 .oe_kanban_button_active, -.openerp .oe_kanban_color_9 a.oe_kanban_button:hover, -.openerp .oe_kanban_color_9 button.oe_kanban_button:hover { - background-color: #CC5CB0; - color: #fff; - text-shadow: 0 1px #000; -} - -/* Red border */ -.openerp .oe_kanban_color_alert .oe_kanban_color_border, -.openerp .oe_kanban_color_red .oe_kanban_color_border { - border-color: #c00 !important; -} - -/* Green border */ -.openerp .oe_kanban_color_green .oe_kanban_color_border { - border-color: #0c0 !important; -} - -/* Blue border */ -.openerp .oe_kanban_color_blue .oe_kanban_color_border { - border-color: #00c !important; + border: 1px dotted black; + visibility: visible !important; + height: 60px !important; +} +.openerp .oe_kanban_view .oe_kanban_left { + float: left; +} +.openerp .oe_kanban_view .oe_kanban_right { + float: right; +} +.openerp .oe_kanban_view .oe_kanban_clear { + clear: both; +} +.openerp .oe_kanban_view .oe_kanban_groups { + width: 100%; +} +.openerp .oe_kanban_view .oe_kanban_group_header { + position: relative; +} +.openerp .oe_kanban_view .oe_kanban_group_folded { + padding: 0 5px 0 5px; +} +.openerp .oe_kanban_view .oe_kanban_group_folded .oe_kanban_group_title, .openerp .oe_kanban_view .oe_kanban_group_folded.oe_kanban_column > *, .openerp .oe_kanban_view .oe_kanban_group_folded .oe_kanban_aggregates { + display: none; +} +.openerp .oe_kanban_view .oe_kanban_group_folded .oe_kanban_group_title_vertical { + display: block; +} +.openerp .oe_kanban_view .oe_kanban_group_title { + font-size: 100%; + font-weight: bold; + padding-left: 2px; + color: #333333; +} +.openerp .oe_kanban_view .oe_kanban_group_title_undefined { + color: #666666; +} +.openerp .oe_kanban_view .oe_kanban_group_title_vertical { + writing-mode: tb-rl; + -webkit-transform: rotate(90deg); + -moz-transform: rotate(90deg); + -o-transform: rotate(90deg); + -ms-transform: rotate(90deg); + transform: rotate(90deg); + width: 30px; + height: 20px; + font-size: 24px; + white-space: nowrap; + display: none; + position: absolute; + top: 10px; +} +.openerp .oe_kanban_view .oe_kanban_fold_icon { + cursor: pointer; + float: left; + padding: 2px; + width: 16px; + height: 16px; + background: url(/web_kanban/static/src/img/minus-icon.png) no-repeat; +} +.openerp .oe_kanban_view .oe_kanban_group_folded .oe_kanban_fold_icon { + background: url(/web_kanban/static/src/img/plus-icon.png) no-repeat; +} +.openerp .oe_kanban_view .oe_kanban_add { + cursor: pointer; + position: absolute; + top: 6px; + right: 6px; + width: 16px; + height: 16px; + background: url(/web_kanban/static/src/img/plus-icon.png) no-repeat; +} +.openerp .oe_kanban_view .oe_kanban_quick_create { + overflow: hidden; +} +.openerp .oe_kanban_view .oe_kanban_no_group .oe_kanban_quick_create { + width: 200px; + padding: 10px; +} +.openerp .oe_kanban_view .oe_kanban_quick_create input { + display: block; + box-sizing: border-box; + width: 100%; +} +.openerp .oe_kanban_view .oe_kanban_quick_create button { + float: right; +} +.openerp .oe_kanban_view .oe_kanban_box { + background: white; + border: 2px solid #cccccc; + border-radius: 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + margin-bottom: 5px; +} +.openerp .oe_kanban_view .oe_kanban_box_header { + background: #eeeeee; + border-bottom: 1px solid #cccccc; +} +.openerp .oe_kanban_view .oe_kanban_title { + font-size: 95%; + font-weight: bold; + padding: 0 4px 0 4px; +} +.openerp .oe_kanban_view .oe_kanban_small { + font-size: 80%; + font-weight: normal; +} +.openerp .oe_kanban_view .oe_kanban_show_more { + clear: both; + text-align: center; +} +.openerp .oe_kanban_view .oe_kanban_grouped .oe_kanban_show_more .oe_button { + width: 100%; +} +.openerp .oe_kanban_view .oe_kanban_ungrouped .oe_kanban_record { + float: left; + padding: 2px; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; +} +.openerp .oe_kanban_view .oe_kanban_action_button { + height: 22px; + margin: 0; +} +.openerp .oe_kanban_view .oe_kanban_action_a { + text-decoration: none; +} +.openerp .oe_kanban_view .oe_kanban_table { + width: 100%; + border: none; + border-collapse: collapse; + margin: 0; + padding: 0; +} +.openerp .oe_kanban_view .oe_kanban_table tr td { + padding: 0; +} +.openerp .oe_kanban_view .oe_kanban_table tr td.oe_kanban_title { + padding: 2px; +} +.openerp .oe_kanban_view .oe_kanban_gravatar { + display: block; +} +.openerp .oe_kanban_view .oe_kanban_box_content { + padding: 4px; + font-size: 90%; +} +.openerp .oe_kanban_view .oe_kanban_button { + border: 1px solid #8ec1da; + background-color: #ddeef6; + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + color: black; + text-shadow: 0 1px white; + padding: 0 4px; + font-size: 85%; + margin: 1px; +} +.openerp .oe_kanban_view a.oe_kanban_button:hover, .openerp .oe_kanban_view .openerp button.oe_kanban_button:hover { + background-color: #eeddf6; +} +.openerp .oe_kanban_view .oe_kanban_buttons_set { + border-top: 1px dotted; + white-space: nowrap; + padding-top: 2px; + position: relative; + clear: both; +} +.openerp .oe_kanban_view .oe_kanban_buttons_set a { + padding: 2px; +} +.openerp .oe_kanban_view .oe_kanban_box_show_onclick { + display: none; +} +.openerp .oe_kanban_view .oe_kanban_draghandle { + cursor: move; +} +.openerp .oe_kanban_view .oe_kanban_color_border { + border-color: #cccccc; +} +.openerp .oe_kanban_view .oe_kanban_color_border { + border-color: #cccccc; +} +.openerp .oe_kanban_view .oe_kanban_tooltip ul, .openerp .oe_kanban_view ul.oe_kanban_tooltip { + padding: 0 0 4px 0; + margin: 5px 0 0 15px; + list-style: circle; +} +.openerp .oe_kanban_view .oe_kanban_highlight { + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + padding: 1px 5px; + margin: 1px 4px; + white-space: nowrap; + display: inline-block; + line-height: 1em; +} +.openerp .oe_kanban_view .oe_kanban_color_picker { + position: absolute; + top: -10px; + border: 1px solid black; + -moz-box-shadow: 2px 2px 5px #666666; + -webkit-box-shadow: 2px 2px 5px #666666; + box-shadow: 2px 2px 5px #666666; + z-index: 2; +} +.openerp .oe_kanban_view .oe_kanban_color_picker a { + display: block; + width: 30px; + height: 30px; + border: 1px solid black; + text-align: center; + text-decoration: none; +} +.openerp .oe_kanban_view .oe_kanban_color_picker a:hover { + border-color: white; +} +.openerp .oe_kanban_view .oe_kanban_color_picker span { + border: none; + font-size: 120%; + font-weight: bold; + color: black; + line-height: 30px; +} +.openerp .oe_kanban_view .oe_kanban_color_0 .oe_kanban_color_bglight { + background: white; +} +.openerp .oe_kanban_view .oe_kanban_color_0 .oe_kanban_color_bgdark { + background: #eeeeee; +} +.openerp .oe_kanban_view .oe_kanban_color_0 .oe_kanban_color_border { + border-color: #cccccc; +} +.openerp .oe_kanban_view .oe_kanban_color_0 .oe_kanban_button { + background-color: #eeeeee; + border-color: #cccccc; + text-shadow: 0 1px white; +} +.openerp .oe_kanban_view .oe_kanban_color_0 .oe_kanban_button_active, .openerp .oe_kanban_view .oe_kanban_color_0 a.oe_kanban_button:hover, .openerp .oe_kanban_view .oe_kanban_color_0 button.oe_kanban_button:hover { + background-color: #999999; + color: white; + text-shadow: 0 1px black; +} +.openerp .oe_kanban_view .oe_kanban_color_1 .oe_kanban_color_bglight { + background: #cccccc; +} +.openerp .oe_kanban_view .oe_kanban_color_1 .oe_kanban_color_bgdark { + background: #999999; +} +.openerp .oe_kanban_view .oe_kanban_color_1 .oe_kanban_color_border { + border-color: #666666; +} +.openerp .oe_kanban_view .oe_kanban_color_1 .oe_kanban_button { + background-color: #999999; + border-color: #666666; + text-shadow: 0 1px #cccccc; +} +.openerp .oe_kanban_view .oe_kanban_color_1 .oe_kanban_button_active, .openerp .oe_kanban_view .oe_kanban_color_1 a.oe_kanban_button:hover, .openerp .oe_kanban_view .oe_kanban_color_1 button.oe_kanban_button:hover { + background-color: #666666; + color: white; + text-shadow: 0 1px black; +} +.openerp .oe_kanban_view .oe_kanban_color_2 .oe_kanban_color_bglight { + background: #ffc7c7; +} +.openerp .oe_kanban_view .oe_kanban_color_2 .oe_kanban_color_bgdark { + background: #ff8f8f; +} +.openerp .oe_kanban_view .oe_kanban_color_2 .oe_kanban_color_border { + border-color: #d97979; +} +.openerp .oe_kanban_view .oe_kanban_color_2 .oe_kanban_button { + background-color: #ff8f8f; + border-color: #d97979; + text-shadow: 0 1px #ffc7c7; +} +.openerp .oe_kanban_view .oe_kanban_color_2 .oe_kanban_button_active, .openerp .oe_kanban_view .oe_kanban_color_2 a.oe_kanban_button:hover, .openerp .oe_kanban_view .oe_kanban_color_2 button.oe_kanban_button:hover { + background-color: #cc5c5c; + color: white; + text-shadow: 0 1px black; +} +.openerp .oe_kanban_view .oe_kanban_color_3 .oe_kanban_color_bglight { + background: #fff1c7; +} +.openerp .oe_kanban_view .oe_kanban_color_3 .oe_kanban_color_bgdark { + background: #ffe38f; +} +.openerp .oe_kanban_view .oe_kanban_color_3 .oe_kanban_color_border { + border-color: #d9c179; +} +.openerp .oe_kanban_view .oe_kanban_color_3 .oe_kanban_button { + background-color: #ffe38f; + border-color: #d9c179; + text-shadow: 0 1px #fff1c7; +} +.openerp .oe_kanban_view .oe_kanban_color_3 .oe_kanban_button_active, .openerp .oe_kanban_view .oe_kanban_color_3 a.oe_kanban_button:hover, .openerp .oe_kanban_view .oe_kanban_color_3 button.oe_kanban_button:hover { + background-color: #ccb05c; + color: white; + text-shadow: 0 1px black; +} +.openerp .oe_kanban_view .oe_kanban_color_4 .oe_kanban_color_bglight { + background: #e3ffc7; +} +.openerp .oe_kanban_view .oe_kanban_color_4 .oe_kanban_color_bgdark { + background: #c7ff8f; +} +.openerp .oe_kanban_view .oe_kanban_color_4 .oe_kanban_color_border { + border-color: #a9d979; +} +.openerp .oe_kanban_view .oe_kanban_color_4 .oe_kanban_button { + background-color: #c7ff8f; + border-color: #a9d979; + text-shadow: 0 1px #e3ffc7; +} +.openerp .oe_kanban_view .oe_kanban_color_4 .oe_kanban_button_active, .openerp .oe_kanban_view .oe_kanban_color_4 a.oe_kanban_button:hover, .openerp .oe_kanban_view .oe_kanban_color_4 button.oe_kanban_button:hover { + background-color: #94cc5c; + color: white; + text-shadow: 0 1px black; +} +.openerp .oe_kanban_view .oe_kanban_color_5 .oe_kanban_color_bglight { + background: #c7ffd5; +} +.openerp .oe_kanban_view .oe_kanban_color_5 .oe_kanban_color_bgdark { + background: #8fffab; +} +.openerp .oe_kanban_view .oe_kanban_color_5 .oe_kanban_color_border { + border-color: #79d991; +} +.openerp .oe_kanban_view .oe_kanban_color_5 .oe_kanban_button { + background-color: #8fffab; + border-color: #79d991; + text-shadow: 0 1px #c7ffd5; +} +.openerp .oe_kanban_view .oe_kanban_color_5 .oe_kanban_button_active, .openerp .oe_kanban_view .oe_kanban_color_5 a.oe_kanban_button:hover, .openerp .oe_kanban_view .oe_kanban_color_5 button.oe_kanban_button:hover { + background-color: #5ccc78; + color: white; + text-shadow: 0 1px black; +} +.openerp .oe_kanban_view .oe_kanban_color_6 .oe_kanban_color_bglight { + background: #c7ffff; +} +.openerp .oe_kanban_view .oe_kanban_color_6 .oe_kanban_color_bgdark { + background: #8fffff; +} +.openerp .oe_kanban_view .oe_kanban_color_6 .oe_kanban_color_border { + border-color: #79d9d9; +} +.openerp .oe_kanban_view .oe_kanban_color_6 .oe_kanban_button { + background-color: #8fffff; + border-color: #79d9d9; + text-shadow: 0 1px #c7ffff; +} +.openerp .oe_kanban_view .oe_kanban_color_6 .oe_kanban_button_active, .openerp .oe_kanban_view .oe_kanban_color_6 a.oe_kanban_button:hover, .openerp .oe_kanban_view .oe_kanban_color_6 button.oe_kanban_button:hover { + background-color: #5ccccc; + color: white; + text-shadow: 0 1px black; +} +.openerp .oe_kanban_view .oe_kanban_color_7 .oe_kanban_color_bglight { + background: #c7d5ff; +} +.openerp .oe_kanban_view .oe_kanban_color_7 .oe_kanban_color_bgdark { + background: #8fabff; +} +.openerp .oe_kanban_view .oe_kanban_color_7 .oe_kanban_color_border { + border-color: #8fabff; +} +.openerp .oe_kanban_view .oe_kanban_color_7 .oe_kanban_button { + background-color: #8fabff; + border-color: #7995e9; + text-shadow: 0 1px #c7d5ff; +} +.openerp .oe_kanban_view .oe_kanban_color_7 .oe_kanban_button_active, .openerp .oe_kanban_view .oe_kanban_color_7 a.oe_kanban_button:hover, .openerp .oe_kanban_view .oe_kanban_color_7 button.oe_kanban_button:hover { + background-color: #5c78cc; + color: white; + text-shadow: 0 1px black; +} +.openerp .oe_kanban_view .oe_kanban_color_8 .oe_kanban_color_bglight { + background: #e3c7ff; +} +.openerp .oe_kanban_view .oe_kanban_color_8 .oe_kanban_color_bgdark { + background: #c78fff; +} +.openerp .oe_kanban_view .oe_kanban_color_8 .oe_kanban_color_border { + border-color: #a979d9; +} +.openerp .oe_kanban_view .oe_kanban_color_8 .oe_kanban_button { + background-color: #c78fff; + border-color: #a979d9; + text-shadow: 0 1px #e3c7ff; +} +.openerp .oe_kanban_view .oe_kanban_color_8 .oe_kanban_button_active, .openerp .oe_kanban_view .oe_kanban_color_8 a.oe_kanban_button:hover, .openerp .oe_kanban_view .oe_kanban_color_8 button.oe_kanban_button:hover { + background-color: #945ccc; + color: white; + text-shadow: 0 1px black; +} +.openerp .oe_kanban_view .oe_kanban_color_9 .oe_kanban_color_bglight { + background: #ffc7f1; +} +.openerp .oe_kanban_view .oe_kanban_color_9 .oe_kanban_color_bgdark { + background: #ff8fe3; +} +.openerp .oe_kanban_view .oe_kanban_color_9 .oe_kanban_color_border { + border-color: #d979c1; +} +.openerp .oe_kanban_view .oe_kanban_color_9 .oe_kanban_button { + background-color: #ff8fe3; + border-color: #d979c1; + text-shadow: 0 1px #ffc7f1; +} +.openerp .oe_kanban_view .oe_kanban_color_9 .oe_kanban_button_active, .openerp .oe_kanban_view .oe_kanban_color_9 a.oe_kanban_button:hover, .openerp .oe_kanban_view .oe_kanban_color_9 button.oe_kanban_button:hover { + background-color: #cc5cb0; + color: white; + text-shadow: 0 1px black; +} +.openerp .oe_kanban_view .oe_kanban_color_alert .oe_kanban_color_border, .openerp .oe_kanban_view .oe_kanban_color_red .oe_kanban_color_border { + border-color: #cc0000 !important; +} +.openerp .oe_kanban_view .oe_kanban_color_green .oe_kanban_color_border { + border-color: #00cc00 !important; +} +.openerp .oe_kanban_view .oe_kanban_color_blue .oe_kanban_color_border { + border-color: #0000cc !important; } diff --git a/addons/web_kanban/static/src/css/kanban.sass b/addons/web_kanban/static/src/css/kanban.sass new file mode 100644 index 00000000000..0206736ce6a --- /dev/null +++ b/addons/web_kanban/static/src/css/kanban.sass @@ -0,0 +1,386 @@ +@charset "utf-8" + +.openerp .oe_kanban_view + // KanbanView {{{ + .ui-sortable-placeholder + border: 1px dotted black + visibility: visible !important + height: 60px !important + .oe_kanban_left + float: left + .oe_kanban_right + float: right + .oe_kanban_clear + clear: both + // }}} + // KanbanGroups {{{ + .oe_kanban_groups + width: 100% + .oe_kanban_group_header + position: relative + .oe_kanban_group_folded + padding: 0 5px 0 5px + .oe_kanban_group_folded + .oe_kanban_group_title, &.oe_kanban_column > *, .oe_kanban_aggregates + display: none + .oe_kanban_group_title_vertical + display: block + .oe_kanban_group_title + font-size: 100% + font-weight: bold + padding-left: 2px + color: #333333 + .oe_kanban_group_title_undefined + color: #666666 + .oe_kanban_group_title_vertical + writing-mode: tb-rl + -webkit-transform: rotate(90deg) + -moz-transform: rotate(90deg) + -o-transform: rotate(90deg) + -ms-transform: rotate(90deg) + transform: rotate(90deg) + width: 30px + height: 20px + font-size: 24px + white-space: nowrap + display: none + position: absolute + top: 10px + .oe_kanban_fold_icon + cursor: pointer + float: left + padding: 2px + width: 16px + height: 16px + background: url(/web_kanban/static/src/img/minus-icon.png) no-repeat + .oe_kanban_group_folded .oe_kanban_fold_icon + background: url(/web_kanban/static/src/img/plus-icon.png) no-repeat + // }}} + // KanbanQuickCreate {{{ + .oe_kanban_add + cursor: pointer + position: absolute + top: 6px + right: 6px + width: 16px + height: 16px + background: url(/web_kanban/static/src/img/plus-icon.png) no-repeat + .oe_kanban_quick_create + // apply block formatting context + overflow: hidden + .oe_kanban_no_group .oe_kanban_quick_create + width: 200px + padding: 10px + .oe_kanban_quick_create input + display: block + // margins within width + box-sizing: border-box + width: 100% + .oe_kanban_quick_create button + float: right + // }}} + // KanbanRecords {{{ + .oe_kanban_box + background: #FFF + border: 2px solid #CCC + border-radius: 4px + -moz-border-radius: 4px + -webkit-border-radius: 4px + margin-bottom: 5px + .oe_kanban_box_header + background: #EEE + border-bottom: 1px solid #CCC + .oe_kanban_title + font-size: 95% + font-weight: bold + padding: 0 4px 0 4px + .oe_kanban_small + font-size: 80% + font-weight: normal + .oe_kanban_show_more + clear: both + text-align: center + .oe_kanban_grouped .oe_kanban_show_more .oe_button + width: 100% + .oe_kanban_ungrouped .oe_kanban_record + float: left + padding: 2px + box-sizing: border-box + -moz-box-sizing: border-box + -webkit-box-sizing: border-box + .oe_kanban_action_button + height: 22px + margin: 0 + .oe_kanban_action_a + text-decoration: none + .oe_kanban_table + width: 100% + border: none + border-collapse: collapse + margin: 0 + padding: 0 + .oe_kanban_table tr td + padding: 0 + .oe_kanban_table tr td.oe_kanban_title + padding: 2px + .oe_kanban_gravatar + display: block + .oe_kanban_box_content + padding: 4px + font-size: 90% + .oe_kanban_button + border: 1px solid #8ec1da + background-color: #ddeef6 + border-radius: 3px + -moz-border-radius: 3px + -webkit-border-radius: 3px + color: #000000 + text-shadow: 0 1px #fff + padding: 0 4px + font-size: 85% + margin: 1px + a.oe_kanban_button:hover, .openerp button.oe_kanban_button:hover + background-color: #eeddf6 + .oe_kanban_buttons_set + border-top: 1px dotted + white-space: nowrap + padding-top: 2px + position: relative + clear: both + a + padding: 2px + .oe_kanban_box_show_onclick + display: none + .oe_kanban_draghandle + cursor: move + .oe_kanban_color_border + border-color: #CCCCCC + .oe_kanban_color_border + border-color: #CCCCCC + .oe_kanban_tooltip ul, ul.oe_kanban_tooltip + padding: 0 0 4px 0 + margin: 5px 0 0 15px + list-style: circle + .oe_kanban_highlight + border-radius: 2px + -moz-border-radius: 2px + -webkit-border-radius: 2px + padding: 1px 5px + margin: 1px 4px + white-space: nowrap + display: inline-block + line-height: 1em + + // }}} + // KanbanColorPicker {{{ + .oe_kanban_color_picker + position: absolute + top: -10px + border: 1px solid black + -moz-box-shadow: 2px 2px 5px #666 + -webkit-box-shadow: 2px 2px 5px #666 + box-shadow: 2px 2px 5px #666 + z-index: 2 + a + display: block + width: 30px + height: 30px + border: 1px solid black + text-align: center + text-decoration: none + &:hover + border-color: white + span + border: none + font-size: 120% + font-weight: bold + color: black + line-height: 30px + // }}} + // KanbanColors {{{ + // Custom colors are also present in kanban.js + // Custom color#0 + .oe_kanban_color_0 + .oe_kanban_color_bglight + background: #FFFFFF + .oe_kanban_color_bgdark + background: #EEEEEE + .oe_kanban_color_border + border-color: #CCCCCC + .oe_kanban_button + background-color: #EEEEEE + border-color: #CCCCCC + text-shadow: 0 1px #FFFFFF + .oe_kanban_button_active, a.oe_kanban_button:hover, button.oe_kanban_button:hover + background-color: #999999 + color: #fff + text-shadow: 0 1px #000 + + // Custom color#1 + .oe_kanban_color_1 + .oe_kanban_color_bglight + background: #CCCCCC + .oe_kanban_color_bgdark + background: #999999 + .oe_kanban_color_border + border-color: #666666 + .oe_kanban_button + background-color: #999999 + border-color: #666666 + text-shadow: 0 1px #CCCCCC + .oe_kanban_button_active, a.oe_kanban_button:hover, button.oe_kanban_button:hover + background-color: #666666 + color: #fff + text-shadow: 0 1px #000 + + // Custom color#2 + .oe_kanban_color_2 + .oe_kanban_color_bglight + background: #FFC7C7 + .oe_kanban_color_bgdark + background: #FF8F8F + .oe_kanban_color_border + border-color: #D97979 + .oe_kanban_button + background-color: #FF8F8F + border-color: #D97979 + text-shadow: 0 1px #FFC7C7 + .oe_kanban_button_active, a.oe_kanban_button:hover, button.oe_kanban_button:hover + background-color: #CC5C5C + color: #fff + text-shadow: 0 1px #000 + + // Custom color#3 + .oe_kanban_color_3 + .oe_kanban_color_bglight + background: #FFF1C7 + .oe_kanban_color_bgdark + background: #FFE38F + .oe_kanban_color_border + border-color: #D9C179 + .oe_kanban_button + background-color: #FFE38F + border-color: #D9C179 + text-shadow: 0 1px #FFF1C7 + .oe_kanban_button_active, a.oe_kanban_button:hover, button.oe_kanban_button:hover + background-color: #CCB05C + color: #fff + text-shadow: 0 1px #000 + + // Custom color#4 + .oe_kanban_color_4 + .oe_kanban_color_bglight + background: #E3FFC7 + .oe_kanban_color_bgdark + background: #C7FF8F + .oe_kanban_color_border + border-color: #A9D979 + .oe_kanban_button + background-color: #C7FF8F + border-color: #A9D979 + text-shadow: 0 1px #E3FFC7 + .oe_kanban_button_active, a.oe_kanban_button:hover, button.oe_kanban_button:hover + background-color: #94CC5C + color: #fff + text-shadow: 0 1px #000 + + // Custom color#5 + .oe_kanban_color_5 + .oe_kanban_color_bglight + background: #C7FFD5 + .oe_kanban_color_bgdark + background: #8FFFAB + .oe_kanban_color_border + border-color: #79D991 + .oe_kanban_button + background-color: #8FFFAB + border-color: #79D991 + text-shadow: 0 1px #C7FFD5 + .oe_kanban_button_active, a.oe_kanban_button:hover, button.oe_kanban_button:hover + background-color: #5CCC78 + color: #fff + text-shadow: 0 1px #000 + + // Custom color#6 + .oe_kanban_color_6 + .oe_kanban_color_bglight + background: #C7FFFF + .oe_kanban_color_bgdark + background: #8FFFFF + .oe_kanban_color_border + border-color: #79D9D9 + .oe_kanban_button + background-color: #8FFFFF + border-color: #79D9D9 + text-shadow: 0 1px #C7FFFF + .oe_kanban_button_active, a.oe_kanban_button:hover, button.oe_kanban_button:hover + background-color: #5CCCCC + color: #fff + text-shadow: 0 1px #000 + + // Custom color#7 + .oe_kanban_color_7 + .oe_kanban_color_bglight + background: #C7D5FF + .oe_kanban_color_bgdark + background: #8FABFF + .oe_kanban_color_border + border-color: #8FABFF + .oe_kanban_button + background-color: #8FABFF + border-color: #7995E9 + text-shadow: 0 1px #C7D5FF + .oe_kanban_button_active, a.oe_kanban_button:hover, button.oe_kanban_button:hover + background-color: #5C78CC + color: #fff + text-shadow: 0 1px #000 + + // Custom color#8 + .oe_kanban_color_8 + .oe_kanban_color_bglight + background: #E3C7FF + .oe_kanban_color_bgdark + background: #C78FFF + .oe_kanban_color_border + border-color: #A979D9 + .oe_kanban_button + background-color: #C78FFF + border-color: #A979D9 + text-shadow: 0 1px #E3C7FF + .oe_kanban_button_active, a.oe_kanban_button:hover, button.oe_kanban_button:hover + background-color: #945CCC + color: #fff + text-shadow: 0 1px #000 + + // Custom color#9 + .oe_kanban_color_9 + .oe_kanban_color_bglight + background: #FFC7F1 + .oe_kanban_color_bgdark + background: #FF8FE3 + .oe_kanban_color_border + border-color: #D979C1 + .oe_kanban_button + background-color: #FF8FE3 + border-color: #D979C1 + text-shadow: 0 1px #FFC7F1 + .oe_kanban_button_active, a.oe_kanban_button:hover, button.oe_kanban_button:hover + background-color: #CC5CB0 + color: #fff + text-shadow: 0 1px #000 + + // Red border + .oe_kanban_color_alert .oe_kanban_color_border, .oe_kanban_color_red .oe_kanban_color_border + border-color: #c00 !important + + // Green border + .oe_kanban_color_green .oe_kanban_color_border + border-color: #0c0 !important + + // Blue border + .oe_kanban_color_blue .oe_kanban_color_border + border-color: #00c !important + // }}} + +// au BufWritePost,FileWritePost *.sass :!sass --style expanded --line-numbers > "%:p:r.css" +// vim:tabstop=4:shiftwidth=4:softtabstop=4:fdm=marker: From 83de35f1cf58de800a11e5df7d6eb8378aaa0fca Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 22 May 2012 13:30:57 +0200 Subject: [PATCH 073/103] [IMP] Merge kanban declarations from base.sass to kanban.sass bzr revid: fme@openerp.com-20120522113057-7dfkcyiaxxbmnx9a --- addons/web/static/src/css/base.css | 154 ------------------ addons/web/static/src/css/base.sass | 103 ------------ addons/web_kanban/static/src/css/kanban.css | 160 +++++++++++++++++-- addons/web_kanban/static/src/css/kanban.sass | 127 +++++++++++++-- 4 files changed, 267 insertions(+), 277 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 60199338658..22559ca8aba 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1969,160 +1969,6 @@ .openerp .oe-listview-content .numeric input { text-align: right; } -.openerp .oe_kanban_view { - position: absolute; - top: 111px; - bottom: 0; -} -.openerp .oe_kanban_groups { - height: 100%; -} -.openerp .oe_kanban_group_title { - margin: 1px 1px 4px; - font-size: 15px; - font-weight: bold; - text-shadow: 0 1px 0 white; -} -.openerp .oe_kanban_column, .openerp .oe_kanban_group_header { - vertical-align: top; - padding: 6px 7px 6px 6px; - background: #f0eeee; - border-left: 1px solid #f0f8f8; - border-right: 1px solid #b9b9b9; -} -.openerp .oe_kanban_column { - height: 100%; -} -.openerp .oe_kanban_aggregates { - padding: 0; -} -.openerp .oe_kanban_record { - position: relative; - display: block; - min-height: 50px; - margin: 6px 0; - display: block; - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - border-radius: 4px; -} -.openerp .oe_kanban_record:last-child { - margin-bottom: 0; -} -.openerp .oe_kanban_record .oe_kanban_title { - font-weight: bold; - margin: 2px 4px; -} -.openerp .oe_kanban_gravatar { - width: 20px; - height: 20px; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); - -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); - -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); -} -.openerp .oe_kanban_avatar_toto { - height: 40px; - width: 40px; - border: 1px solid; - border-color: #e5e5e5 #dbdbdb #d2d2d2; - -moz-border-radius: 3px; - -webkit-border-radius: 3px; - border-radius: 3px; - -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); - -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); - -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); -} -.openerp .oe_kanban_view { - position: absolute; - top: 111px; - bottom: 0; -} -.openerp .oe_kanban_card { - position: relative; - display: block; - min-height: 50px; - background: white; - border: 1px solid #d8d8d8; - border-bottom-color: #b9b9b9; - padding: 6px; - margin: 6px 0; - display: block; - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - border-radius: 4px; -} -.openerp .oe_kanban_card:last-child { - margin-bottom: 0; -} -.openerp .oe_kanban_card:hover { - -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.6); - -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.6); - -box-shadow: 0 0 3px rgba(0, 0, 0, 0.6); -} -.openerp .oe_kanban_card:hover .oe_kanban_menuaction { - display: block; -} -.openerp .oe_kanban_card h3 { - margin: 0 16px 0 0; -} -.openerp .oe_kanban_star { - float: left; - position: inline-block; - margin: 0 4px 0 0; -} -.openerp a.oe_kanban_menuaction { - position: absolute; - right: 4px; - display: none; - color: #4c4c4c; - cursor: pointer; -} -.openerp a.oe_kanban_menuaction:hover { - text-decoration: none; -} -.openerp .oe_kanban_avatar { - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - border-radius: 4px; - -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); - -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); - -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); -} -.openerp .oe_kanban_status { - display: inline-block; - height: 12px; - width: 12px; - margin: 4px auto; - -moz-border-radius: 6px; - -webkit-border-radius: 6px; - border-radius: 6px; - -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); - -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); - -box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); -} -.openerp .oe_kanban_status_green { - background: green; - background-position: center center; - background-image: -webkit-radial-gradient(circle, #55dd55 0%, #44aa44 40%, #339933 100%); - background-image: -moz-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); - background-image: -ms-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); - background-image: radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); -} -.openerp .oe_kanban_status_red { - background: red; - background-position: center center; - background-image: -webkit-radial-gradient(circle, #ee7777 0%, #cc3333 40%, #bb0808 100%); - background-image: -moz-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); - background-image: -ms-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); - background-image: radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); -} -.openerp .oe_kanban_text_red { - background: red; - color: black; -} .openerp .oe_trad_field.touched { border: 1px solid green !important; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 227bdac69a7..c345ca9235b 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1619,109 +1619,6 @@ $colour4: #8a89ba input text-align: right // }}} - // KanbanView {{{ - .oe_kanban_view - position: absolute - top: 111px - bottom: 0 - .oe_kanban_groups - height: 100% - .oe_kanban_group_title - margin: 1px 1px 4px - font-size: 15px - font-weight: bold - text-shadow: 0 1px 0 white - .oe_kanban_column, .oe_kanban_group_header - vertical-align: top - padding: 6px 7px 6px 6px - background: #f0eeee - border-left: 1px solid #f0f8f8 - border-right: 1px solid #b9b9b9 - .oe_kanban_column - height: 100% - .oe_kanban_aggregates - padding: 0 - .oe_kanban_record - position: relative - display: block - min-height: 50px - margin: 6px 0 - display: block - @include radius(4px) - &:last-child - margin-bottom: 0 - .oe_kanban_title - font-weight: bold - margin: 2px 4px - .oe_kanban_gravatar - width: 20px - height: 20px - @include radius(3px) - @include box-shadow(0 1px 2px rgba(0,0,0,0.2)) - .oe_kanban_avatar_toto - height: 40px - width: 40px - border: 1px solid - border-color: #e5e5e5 #dbdbdb #d2d2d2 - @include radius(3px) - @include box-shadow(0 1px 2px rgba(0,0,0,0.2)) - .oe_kanban_view - position: absolute - top: 111px - bottom: 0 - .oe_kanban_card - position: relative - display: block - min-height: 50px - background: white - border: 1px solid #d8d8d8 - border-bottom-color: #b9b9b9 - padding: 6px - margin: 6px 0 - display: block - @include radius(4px) - &:last-child - margin-bottom: 0 - &:hover - @include box-shadow(0 0 3px rgba(0,0,0,0.6)) - .oe_kanban_menuaction - display: block - h3 - margin: 0 16px 0 0 - .oe_kanban_star - float: left - position: inline-block - margin: 0 4px 0 0 - a.oe_kanban_menuaction - position: absolute - right: 4px - display: none - color: #4c4c4c - cursor: pointer - &:hover - text-decoration: none - .oe_kanban_avatar - @include radius(4px) - @include box-shadow(0 1px 2px rgba(0,0,0,0.2)) - //.oe_kanban_footer_left - // float: left - .oe_kanban_status - display: inline-block - height: 12px - width: 12px - margin: 4px auto - @include radius(6px) - @include box-shadow(0 1px 3px rgba(0,0,0,0.6)) - .oe_kanban_status_green - background: green - @include radial-gradient((#55dd55 0%, #44aa44 40%, #339933 100%)) - .oe_kanban_status_red - background: red - @include radial-gradient((#ee7777 0%, #cc3333 40%, #bb0808 100%)) - .oe_kanban_text_red - background: red - color: #000 - // }}} // Translation {{{ .oe_trad_field.touched border: 1px solid green !important diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css index 2e33f499749..539a6682925 100644 --- a/addons/web_kanban/static/src/css/kanban.css +++ b/addons/web_kanban/static/src/css/kanban.css @@ -1,4 +1,9 @@ @charset "utf-8"; +.openerp .oe_kanban_view { + position: absolute; + top: 111px; + bottom: 0; +} .openerp .oe_kanban_view .ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; @@ -14,7 +19,28 @@ clear: both; } .openerp .oe_kanban_view .oe_kanban_groups { - width: 100%; + height: 100%; +} +.openerp .oe_kanban_view .oe_kanban_group_title { + margin: 1px 1px 4px; + padding-left: 2px; + font-size: 100%; + font-weight: bold; + color: #333333; + text-shadow: 0 1px 0 white; +} +.openerp .oe_kanban_view .oe_kanban_column, .openerp .oe_kanban_view .oe_kanban_group_header { + vertical-align: top; + padding: 6px 7px 6px 6px; + background: #f0eeee; + border-left: 1px solid #f0f8f8; + border-right: 1px solid #b9b9b9; +} +.openerp .oe_kanban_view .oe_kanban_column { + height: 100%; +} +.openerp .oe_kanban_view .oe_kanban_aggregates { + padding: 0; } .openerp .oe_kanban_view .oe_kanban_group_header { position: relative; @@ -28,12 +54,6 @@ .openerp .oe_kanban_view .oe_kanban_group_folded .oe_kanban_group_title_vertical { display: block; } -.openerp .oe_kanban_view .oe_kanban_group_title { - font-size: 100%; - font-weight: bold; - padding-left: 2px; - color: #333333; -} .openerp .oe_kanban_view .oe_kanban_group_title_undefined { color: #666666; } @@ -87,6 +107,46 @@ .openerp .oe_kanban_view .oe_kanban_quick_create button { float: right; } +.openerp .oe_kanban_view .oe_kanban_record { + position: relative; + display: block; + min-height: 50px; + margin: 6px 0; + display: block; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; +} +.openerp .oe_kanban_view .oe_kanban_record:last-child { + margin-bottom: 0; +} +.openerp .oe_kanban_view .oe_kanban_record .oe_kanban_title { + font-weight: bold; + margin: 2px 4px; +} +.openerp .oe_kanban_view .oe_kanban_gravatar { + display: block; + width: 20px; + height: 20px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); +} +.openerp .oe_kanban_view .oe_kanban_avatar_toto { + height: 40px; + width: 40px; + border: 1px solid; + border-color: #e5e5e5 #dbdbdb #d2d2d2; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); +} .openerp .oe_kanban_view .oe_kanban_box { background: white; border: 2px solid #cccccc; @@ -142,9 +202,6 @@ .openerp .oe_kanban_view .oe_kanban_table tr td.oe_kanban_title { padding: 2px; } -.openerp .oe_kanban_view .oe_kanban_gravatar { - display: block; -} .openerp .oe_kanban_view .oe_kanban_box_content { padding: 4px; font-size: 90%; @@ -201,6 +258,89 @@ display: inline-block; line-height: 1em; } +.openerp .oe_kanban_view .oe_kanban_card { + position: relative; + display: block; + min-height: 50px; + background: white; + border: 1px solid #d8d8d8; + border-bottom-color: #b9b9b9; + padding: 6px; + margin: 6px 0; + display: block; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; +} +.openerp .oe_kanban_view .oe_kanban_card:last-child { + margin-bottom: 0; +} +.openerp .oe_kanban_view .oe_kanban_card:hover { + -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.6); + -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.6); + -box-shadow: 0 0 3px rgba(0, 0, 0, 0.6); +} +.openerp .oe_kanban_view .oe_kanban_card:hover .oe_kanban_menuaction { + display: block; +} +.openerp .oe_kanban_view .oe_kanban_card h3 { + margin: 0 16px 0 0; +} +.openerp .oe_kanban_view .oe_kanban_star { + float: left; + position: inline-block; + margin: 0 4px 0 0; +} +.openerp .oe_kanban_view a.oe_kanban_menuaction { + position: absolute; + right: 4px; + display: none; + color: #4c4c4c; + cursor: pointer; +} +.openerp .oe_kanban_view a.oe_kanban_menuaction:hover { + text-decoration: none; +} +.openerp .oe_kanban_view .oe_kanban_avatar { + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); + -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); +} +.openerp .oe_kanban_view .oe_kanban_status { + display: inline-block; + height: 12px; + width: 12px; + margin: 4px auto; + -moz-border-radius: 6px; + -webkit-border-radius: 6px; + border-radius: 6px; + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); + -box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); +} +.openerp .oe_kanban_view .oe_kanban_status_green { + background: green; + background-position: center center; + background-image: -webkit-radial-gradient(circle, #55dd55 0%, #44aa44 40%, #339933 100%); + background-image: -moz-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); + background-image: -ms-radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); + background-image: radial-gradient(#55dd55 0%, #44aa44 40%, #339933 100%); +} +.openerp .oe_kanban_view .oe_kanban_status_red { + background: red; + background-position: center center; + background-image: -webkit-radial-gradient(circle, #ee7777 0%, #cc3333 40%, #bb0808 100%); + background-image: -moz-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); + background-image: -ms-radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); + background-image: radial-gradient(#ee7777 0%, #cc3333 40%, #bb0808 100%); +} +.openerp .oe_kanban_view .oe_kanban_text_red { + background: red; + color: black; +} .openerp .oe_kanban_view .oe_kanban_color_picker { position: absolute; top: -10px; diff --git a/addons/web_kanban/static/src/css/kanban.sass b/addons/web_kanban/static/src/css/kanban.sass index 0206736ce6a..45357f04d2e 100644 --- a/addons/web_kanban/static/src/css/kanban.sass +++ b/addons/web_kanban/static/src/css/kanban.sass @@ -1,7 +1,29 @@ @charset "utf-8" +// Mixins {{{ +@mixin radial-gradient($gradient) + background-position: center center + background-image: -webkit-radial-gradient(circle, $gradient) + background-image: -moz-radial-gradient($gradient) + background-image: -ms-radial-gradient($gradient) + background-image: radial-gradient($gradient) + +@mixin radius($radius: 5px) + -moz-border-radius: $radius + -webkit-border-radius: $radius + border-radius: $radius + +@mixin box-shadow($bsval: 0px 1px 4px #777) + -moz-box-shadow: $bsval + -webkit-box-shadow: $bsval + -box-shadow: $bsval +// }}} + .openerp .oe_kanban_view // KanbanView {{{ + position: absolute + top: 111px + bottom: 0 .ui-sortable-placeholder border: 1px dotted black visibility: visible !important @@ -15,21 +37,32 @@ // }}} // KanbanGroups {{{ .oe_kanban_groups - width: 100% + height: 100% + .oe_kanban_group_title + margin: 1px 1px 4px + padding-left: 2px + font-size: 100% + font-weight: bold + color: #333333 + text-shadow: 0 1px 0 white + .oe_kanban_column, .oe_kanban_group_header + vertical-align: top + padding: 6px 7px 6px 6px + background: #f0eeee + border-left: 1px solid #f0f8f8 + border-right: 1px solid #b9b9b9 + .oe_kanban_column + height: 100% + .oe_kanban_aggregates + padding: 0 .oe_kanban_group_header position: relative .oe_kanban_group_folded padding: 0 5px 0 5px - .oe_kanban_group_folded .oe_kanban_group_title, &.oe_kanban_column > *, .oe_kanban_aggregates display: none .oe_kanban_group_title_vertical display: block - .oe_kanban_group_title - font-size: 100% - font-weight: bold - padding-left: 2px - color: #333333 .oe_kanban_group_title_undefined color: #666666 .oe_kanban_group_title_vertical @@ -80,6 +113,31 @@ float: right // }}} // KanbanRecords {{{ + .oe_kanban_record + position: relative + display: block + min-height: 50px + margin: 6px 0 + display: block + @include radius(4px) + &:last-child + margin-bottom: 0 + .oe_kanban_title + font-weight: bold + margin: 2px 4px + .oe_kanban_gravatar + display: block + width: 20px + height: 20px + @include radius(3px) + @include box-shadow(0 1px 2px rgba(0,0,0,0.2)) + .oe_kanban_avatar_toto + height: 40px + width: 40px + border: 1px solid + border-color: #e5e5e5 #dbdbdb #d2d2d2 + @include radius(3px) + @include box-shadow(0 1px 2px rgba(0,0,0,0.2)) .oe_kanban_box background: #FFF border: 2px solid #CCC @@ -123,8 +181,6 @@ padding: 0 .oe_kanban_table tr td.oe_kanban_title padding: 2px - .oe_kanban_gravatar - display: block .oe_kanban_box_content padding: 4px font-size: 90% @@ -170,7 +226,58 @@ white-space: nowrap display: inline-block line-height: 1em - + .oe_kanban_card + position: relative + display: block + min-height: 50px + background: white + border: 1px solid #d8d8d8 + border-bottom-color: #b9b9b9 + padding: 6px + margin: 6px 0 + display: block + @include radius(4px) + &:last-child + margin-bottom: 0 + &:hover + @include box-shadow(0 0 3px rgba(0,0,0,0.6)) + .oe_kanban_menuaction + display: block + h3 + margin: 0 16px 0 0 + .oe_kanban_star + float: left + position: inline-block + margin: 0 4px 0 0 + a.oe_kanban_menuaction + position: absolute + right: 4px + display: none + color: #4c4c4c + cursor: pointer + &:hover + text-decoration: none + .oe_kanban_avatar + @include radius(4px) + @include box-shadow(0 1px 2px rgba(0,0,0,0.2)) + //.oe_kanban_footer_left + // float: left + .oe_kanban_status + display: inline-block + height: 12px + width: 12px + margin: 4px auto + @include radius(6px) + @include box-shadow(0 1px 3px rgba(0,0,0,0.6)) + .oe_kanban_status_green + background: green + @include radial-gradient((#55dd55 0%, #44aa44 40%, #339933 100%)) + .oe_kanban_status_red + background: red + @include radial-gradient((#ee7777 0%, #cc3333 40%, #bb0808 100%)) + .oe_kanban_text_red + background: red + color: #000 // }}} // KanbanColorPicker {{{ .oe_kanban_color_picker From df52a73fc7456a8f0c401b6789e6eb06a177f756 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Tue, 22 May 2012 15:39:44 +0200 Subject: [PATCH 074/103] [FIX] google docs new sidebar api bzr revid: al@openerp.com-20120522133944-71thw8qolitv8ft8 --- addons/google_docs/__openerp__.py | 3 -- addons/google_docs/static/src/js/gdocs.js | 49 ++++++++------------- addons/google_docs/static/src/xml/gdocs.xml | 13 ------ 3 files changed, 19 insertions(+), 46 deletions(-) delete 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 b1cfd1490d5..1df94f34221 100644 --- a/addons/google_docs/__openerp__.py +++ b/addons/google_docs/__openerp__.py @@ -29,9 +29,6 @@ 'auto_install': False, 'web': True, 'js': ['static/src/js/gdocs.js'], - 'qweb' : [ - "static/src/xml/gdocs.xml", - ], 'update_xml': [ 'res_config_user_view.xml' ], diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index a8e941f01f6..6fe830d383c 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -1,29 +1,19 @@ -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); - }, - - - 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(); - } - }); - }, - - 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) { +openerp.google_docs = function(instance, m) { + instance.web.Sidebar = instance.web.Sidebar.extend({ + on_attachments_loaded: function(attachments) { + self._super(attachements); + // if attachment contains a google doc url do nothing + // else + this.sidebar.add_items('other', [ + { label: _t('Google Doc'), callback: self.on_google_doc }, + ]); + }, + on_google_doc: function() { + var self = this; + var form = self.getParent(); + form.sidebar_context().then(function (context) { + var ds = new instance.web.DataSet(this, 'google.docs', context); + ds.call('doc_get', [form.view.dataset.model, [form.view.datarecord.id], 'text'], function(r) { if (r == 'False') { var params = { error: response, @@ -34,9 +24,8 @@ openerp.google_docs = function(instance, session) { modal: true, }); } - self.do_update(); + view.reload(); }); - }, - }); + } + } }; - diff --git a/addons/google_docs/static/src/xml/gdocs.xml b/addons/google_docs/static/src/xml/gdocs.xml deleted file mode 100644 index 2de7efcbd43..00000000000 --- a/addons/google_docs/static/src/xml/gdocs.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - From 0aa18780d22eff54ec1dc1f8859ac1f472a82066 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 22 May 2012 15:40:49 +0200 Subject: [PATCH 075/103] [ADD] Kanban: add dropdown menu bzr revid: fme@openerp.com-20120522134049-ciugahe41ytuqzet --- addons/web_kanban/static/src/css/kanban.css | 58 ++++++++++++++++---- addons/web_kanban/static/src/css/kanban.sass | 46 +++++++++++++--- addons/web_kanban/static/src/js/kanban.js | 31 +++++++++-- 3 files changed, 111 insertions(+), 24 deletions(-) diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css index 539a6682925..ee0517807e6 100644 --- a/addons/web_kanban/static/src/css/kanban.css +++ b/addons/web_kanban/static/src/css/kanban.css @@ -291,16 +291,6 @@ position: inline-block; margin: 0 4px 0 0; } -.openerp .oe_kanban_view a.oe_kanban_menuaction { - position: absolute; - right: 4px; - display: none; - color: #4c4c4c; - cursor: pointer; -} -.openerp .oe_kanban_view a.oe_kanban_menuaction:hover { - text-decoration: none; -} .openerp .oe_kanban_view .oe_kanban_avatar { -moz-border-radius: 4px; -webkit-border-radius: 4px; @@ -341,6 +331,54 @@ background: red; color: black; } +.openerp .oe_kanban_view a.oe_kanban_menuaction { + position: absolute; + top: 0px; + right: 3px; + display: none; + color: #4c4c4c; + cursor: pointer; +} +.openerp .oe_kanban_view a.oe_kanban_menuaction:hover { + text-decoration: none; +} +.openerp .oe_kanban_view .oe_kanban_menu { + display: none; + position: absolute; + top: 30px; + right: -140px; + padding: 4px; + border: 1px solid #afafb6; + width: 160px; + overflow-x: hidden; + z-index: 900; + background: white; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); + -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); + -box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); +} +.openerp .oe_kanban_view .oe_kanban_menu p { + margin-left: 12px; +} +.openerp .oe_kanban_view .oe_kanban_menu li a { + display: block; + padding: 3px 6px; + line-height: 14px; + color: #4c4c4c; + text-decoration: none; +} +.openerp .oe_kanban_view .oe_kanban_menu li a:hover { + background: #f0f0fa; + background: -moz-linear-gradient(#f0f0fa, #eeeef6); + background: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6)); + background: -webkit-linear-gradient(#f0f0fa, #eeeef6); + -moz-box-shadow: none; + -webkit-box-shadow: none; + -box-shadow: none; +} .openerp .oe_kanban_view .oe_kanban_color_picker { position: absolute; top: -10px; diff --git a/addons/web_kanban/static/src/css/kanban.sass b/addons/web_kanban/static/src/css/kanban.sass index 45357f04d2e..0c1cabd8e05 100644 --- a/addons/web_kanban/static/src/css/kanban.sass +++ b/addons/web_kanban/static/src/css/kanban.sass @@ -249,14 +249,6 @@ float: left position: inline-block margin: 0 4px 0 0 - a.oe_kanban_menuaction - position: absolute - right: 4px - display: none - color: #4c4c4c - cursor: pointer - &:hover - text-decoration: none .oe_kanban_avatar @include radius(4px) @include box-shadow(0 1px 2px rgba(0,0,0,0.2)) @@ -279,6 +271,44 @@ background: red color: #000 // }}} + // KanbanDropDown {{{ + a.oe_kanban_menuaction + position: absolute + top: 0px + right: 3px + display: none + color: #4c4c4c + cursor: pointer + &:hover + text-decoration: none + .oe_kanban_menu + display: none + position: absolute + top: 30px + right: -140px + padding: 4px + border: 1px solid #afafb6 + width: 160px + overflow-x: hidden + z-index: 900 + background: white + @include radius(3px) + @include box-shadow(0 1px 4px rgba(0,0,0,0.3)) + p + margin-left: 12px + li a + display: block + padding: 3px 6px + line-height: 14px + color: #4c4c4c + text-decoration: none + li a:hover + background: #f0f0fa + background: -moz-linear-gradient(#f0f0fa, #eeeef6) + background: -webkit-gradient(linear, left top, left bottom, from(#f0f0fa), to(#eeeef6)) + background: -webkit-linear-gradient(#f0f0fa, #eeeef6) + @include box-shadow(none) + // }}} // KanbanColorPicker {{{ .oe_kanban_color_picker position: absolute diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 1b06fd91ce1..c4d74e8d719 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -34,6 +34,25 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ this.limit = options.limit || 80; this.add_group_mutex = new $.Mutex(); }, + start: function() { + var self = this; + this._super.apply(this, arguments); + // Bind kanban cards dropdown menus + this.$element.on('click', '.oe_kanban_menuaction', function() { + var $menu = $(this).next('.oe_kanban_menu'); + var toggle = $menu.is(':visible'); + self.$element.find('.oe_kanban_menu').hide(); + $menu.toggle(!toggle); + return false; + }); + $('html').on('click', function() { + self.$element.find('.oe_kanban_menu').hide(); + }); + }, + destroy: function() { + this._super.apply(this, arguments); + $('html').off('click'); + }, on_loaded: function(data) { this.fields_view = data; this.$buttons = $(QWeb.render("KanbanView.buttons", {'widget': this})); @@ -359,7 +378,7 @@ instance.web_kanban.KanbanGroup = instance.web.OldWidget.extend({ if (!this.view.state.groups[key]) { this.view.state.groups[key] = { folded: false - } + }; } this.state = this.view.state.groups[key]; this.$records = null; @@ -534,8 +553,8 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({ }); }, bind_events: function() { - var self = this, - $show_on_click = self.$element.find('.oe_kanban_box_show_onclick'); + var self = this; + var $show_on_click = self.$element.find('.oe_kanban_box_show_onclick'); $show_on_click.toggle(this.state.folded); this.$element.find('.oe_kanban_box_show_onclick_trigger').click(function() { $show_on_click.toggle(); @@ -559,7 +578,8 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({ trigger: 'hover' }); - this.$element.find('.oe_kanban_action').click(function() { + this.$element.find('.oe_kanban_action').click(function(ev) { + ev.preventDefault(); var $action = $(this), type = $action.data('type') || 'button', method = 'do_action_' + (type === 'action' ? 'object' : type); @@ -570,7 +590,6 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({ } else { self.do_warn("Kanban: no action for type : " + type); } - return false; }); }, do_action_delete: function($action) { @@ -600,7 +619,7 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({ $cpicker.mouseenter(function() { clearTimeout($cpicker.data('timeoutId')); }).mouseleave(function(evt) { - var timeoutId = setTimeout(function() { $cpicker.remove() }, 500); + var timeoutId = setTimeout(function() { $cpicker.remove(); }, 500); $cpicker.data('timeoutId', timeoutId); }); $cpicker.find('a').click(function() { From cba255384f575dfa419bf1926af74861d996c5d5 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 22 May 2012 16:32:35 +0200 Subject: [PATCH 076/103] [IMP] Kanban: If no draghandle is found, make the whole card as draghandle bzr revid: fme@openerp.com-20120522143235-hores2mntqc82lde --- addons/web_kanban/static/src/js/kanban.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index c4d74e8d719..93a726d7dce 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -578,6 +578,11 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({ trigger: 'hover' }); + // If no draghandle is found, make the whole card as draghandle + if (!this.$element.find('.oe_kanban_draghandle').length) { + this.$element.children(':first').addClass('oe_kanban_draghandle'); + } + this.$element.find('.oe_kanban_action').click(function(ev) { ev.preventDefault(); var $action = $(this), From 9c0aa9b3d2be333ea14fdbc1b45cdb8398ac99f9 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 22 May 2012 17:57:02 +0200 Subject: [PATCH 077/103] [IMP] Improved kanban lead view bzr revid: fme@openerp.com-20120522155702-itya61830sqpfic3 --- addons/crm/crm_lead_view.xml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 9061bc3e160..c2c4aa7756f 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -251,12 +251,11 @@ - -
+
B -