summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto López López (OpenERP) <rlo@openerp.com>2012-03-05 17:11:15 +0100
committerRoberto López López (OpenERP) <rlo@openerp.com>2012-03-05 17:11:15 +0100
commitfd89caf3cb964e150cb5b8cc7c224cc64ae32fe4 (patch)
tree21c8b990b85fc3e6ed84b5ac81ef76fc5e6a1637
parentce1d3ce094db59b966adf02f8f0a841d84df1707 (diff)
[imp]
bzr revid: rlo@openerp.com-20120305161115-i20h6xst3sg5n181
-rw-r--r--addons/google_docs/google_docs.py42
-rw-r--r--addons/google_docs/res_config_user_view.xml12
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 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
+
<!-- add google docs config field in user form -->
- <record id="view_google_docs_users_config_inherited_form" model="ir.ui.view">
- <field name="name">res.gdocs.users.form</field>
+
+ <record model="ir.ui.view" id="view_google_docs_users_config_inherited_form">
+ <field name="name">google_docs.config.user.inherited.form</field>
<field name="model">res.users</field>
+ <field name="inherit_id" ref="base.view_users_form" />
<field name="type">form</field>
- <field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<group name="default_filters" position="inside">
- <field name="context_model_id" string='Model ID' completion='1' readonly='0'/>
- <field name="context_context_gdocs_resource_id" string='Google Docs resource ID' completion='1' readonly='0'/>
+ <field name="context_model_id" completion="1"
+ readonly="0"/>
</group>
</field>
</record>