summaryrefslogtreecommitdiff
path: root/addons/google_docs
diff options
context:
space:
mode:
authorDharti Ratani (Open ERP) <dhr@tinyerp.com>2013-03-18 17:14:03 +0530
committerDharti Ratani (Open ERP) <dhr@tinyerp.com>2013-03-18 17:14:03 +0530
commit7ba1c001491333c0ee5c6cc36728cb2ec95d9c63 (patch)
treedbbd83655588c5a8093aacca163017cdb2121d15 /addons/google_docs
parentea53f4fbf6b705d0662749cdf1261269ddbecc09 (diff)
[IMP]Changed the demo data for filter and changed the name of the newly created attachment
bzr revid: dhr@tinyerp.com-20130318114403-uifxi4p9nlkbac9r
Diffstat (limited to 'addons/google_docs')
-rw-r--r--addons/google_docs/__openerp__.py2
-rw-r--r--addons/google_docs/google_docs.py18
-rw-r--r--addons/google_docs/google_docs_demo.xml5
3 files changed, 13 insertions, 12 deletions
diff --git a/addons/google_docs/__openerp__.py b/addons/google_docs/__openerp__.py
index 8d16a78a371..8f304e071a6 100644
--- a/addons/google_docs/__openerp__.py
+++ b/addons/google_docs/__openerp__.py
@@ -36,7 +36,7 @@
'demo': [
'google_docs_demo.xml'
],
- 'depends': ['google_base_account','crm','document'],
+ 'depends': ['google_base_account','crm'],
'description': """
Integrate Google document with OpenERP.
=======================================
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index b72943c750d..945daa6c119 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -111,7 +111,7 @@ class google_docs_ir_attachment(osv.osv):
# 'title': title,
# 'url': gdocs_resource.get_alternate_link().href}
- def copy_gdoc(self, cr, uid, res_model, res_id, name_gdocs,name, gdoc_template_id, context=None):
+ def copy_gdoc(self, cr, uid, res_model, res_id, name_gdocs, gdoc_template_id, context=None):
'''
copy an existing document in google docs
:param res_model: the object for which the google doc is created
@@ -134,7 +134,7 @@ class google_docs_ir_attachment(osv.osv):
'res_model': res_model,
'res_id': res_id,
'type': 'url',
- 'name': name,
+ 'name': name_gdocs,
'url': copy_resource.get_alternate_link().href
}, context=context)
return copy_resource.resource_id.text
@@ -190,21 +190,23 @@ class google_docs_ir_attachment(osv.osv):
# check if a model is configured with a template
if config_ids:
name_gdocs = action.name_template
- print 'name_gdocss',name_gdocs
try:
+ name_gdocs = name_gdocs % model_fields_dic
if name_gdocs.find('model')!=-1:
name_gdocs = name_gdocs.replace('model',action.model_id.name)
if name_gdocs.find('filter')!=-1:
- name_gdocs = name_gdocs.replace('filter',action.filter_id.name)
- name_gdocs = name_gdocs % model_fields_dic
+ if action.filter_id:
+ name_gdocs = name_gdocs.replace('filter',action.filter_id.name)
+ else:
+ name_gdocs = name_gdocs.replace('_filter',"")
except:
raise osv.except_osv(_('Key Error!'), _("Your Google Doc Name Pattern's key does not found in object."))
- attach_ids = self.search(cr, uid, [('res_model','=',res_model),('name','=',action.name),('res_id','=',res_id)])
+ attach_ids = self.search(cr, uid, [('res_model','=',res_model),('name','=',name_gdocs),('res_id','=',res_id)])
if not attach_ids:
google_template_id = action.gdocs_resource_id
- self.copy_gdoc(cr, uid, action.model_id.model, res_id, name_gdocs, action.name, google_template_id, context=context)
- attach_ids = self.search(cr, uid, [('res_model','=',res_model),('name','=',action.name),('res_id','=',res_id)])
+ self.copy_gdoc(cr, uid, action.model_id.model, res_id, name_gdocs, google_template_id, context=context)
+ attach_ids = self.search(cr, uid, [('res_model','=',res_model),('name','=',name_gdocs),('res_id','=',res_id)])
attachments = self.browse(cr, uid, attach_ids, context)[0]
attachment['url'] = attachments.url
return attachment
diff --git a/addons/google_docs/google_docs_demo.xml b/addons/google_docs/google_docs_demo.xml
index b679b749c9b..a5288dcf606 100644
--- a/addons/google_docs/google_docs_demo.xml
+++ b/addons/google_docs/google_docs_demo.xml
@@ -4,10 +4,9 @@
<!-- filter demo -->
<record id="filter_crm" model="ir.filters">
- <field name="name">Sales Team</field>
+ <field name="name">Sales Department</field>
<field name="model_id">crm.lead</field>
- <field name="is_default">False</field>
- <field name="domain">[['section_id', 'ilike', 'sales department']]</field>
+ <field name="domain">[['section_id', '=', 1]]</field>
<field name="context">{'lang': 'en_US', 'tz': 'Europe/Brussels', 'uid': 1}</field>
</record>