summaryrefslogtreecommitdiff
path: root/addons/google_docs
diff options
context:
space:
mode:
authorDharti Ratani (Open ERP) <dhr@tinyerp.com>2013-03-20 11:09:10 +0530
committerDharti Ratani (Open ERP) <dhr@tinyerp.com>2013-03-20 11:09:10 +0530
commit1c251ffcf12007434f7c378916654ea14a04723e (patch)
tree771a78f534c38e1f1a9598ab07749d95dd946f59 /addons/google_docs
parent0bc08f0e361566656319347e352f3f99f8b5002a (diff)
[IMP]Made changes as per the review of RPA on 19th march
bzr revid: dhr@tinyerp.com-20130320053910-ywjxwwqvxjgrygia
Diffstat (limited to 'addons/google_docs')
-rw-r--r--addons/google_docs/google_docs.py30
-rw-r--r--addons/google_docs/google_docs_demo.xml2
-rw-r--r--addons/google_docs/res_config_user_view.xml8
3 files changed, 23 insertions, 17 deletions
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py
index 020e78a90ae..2eabcb1f693 100644
--- a/addons/google_docs/google_docs.py
+++ b/addons/google_docs/google_docs.py
@@ -172,7 +172,8 @@ class google_docs_ir_attachment(osv.osv):
""" filter the list record_ids that satisfy the action filter """
records = {}
if record_ids and action_filter:
- assert action.model_id.model == action_filter.model_id, "Filter model different from action rule model"
+ if not action.model_id.model == action_filter.model_id:
+ raise osv.except_osv(_('Warning!'), _("Something went wrong with the configuration of attachments with google drive.Please contact your Administrator to fix the problem."))
model = self.pool.get(action_filter.model_id)
domain = [('id', 'in', [record_ids])] + eval(action_filter.domain)
ctx = dict(context or {})
@@ -183,7 +184,7 @@ class google_docs_ir_attachment(osv.osv):
def get_attachment(self, cr, uid, res_model, rec_name, ids, context=None):
res_id = ids[0]
pool_gdoc_config = self.pool.get('google.docs.config')
- config_ids = pool_gdoc_config.search(cr, uid, [('model_id', '=', res_model)], context=context)[0]
+ config_ids = pool_gdoc_config.search(cr, uid, [('model_id', '=', res_model),('name','=',rec_name['label'])], context=context)[0]
action = pool_gdoc_config.browse(cr, uid, config_ids, context=context)
attachment = {}
model_fields_dic = self.pool.get(res_model).read(cr, uid, res_id, [], context=context)
@@ -219,15 +220,18 @@ class config(osv.osv):
result = {}
for data in self.browse(cr, uid, ids, context):
template_url = data.gdocs_template_url
- url = urlparse(template_url)
- res = url.path.split('/')
- resource = res[1]
- if res[1]== "spreadsheet":
- key = url.query.split('=')[1]
- else:
- key = res[3]
- res_id = resource + ":" + key
- result[data.id] = str(res_id)
+ try:
+ url = urlparse(template_url)
+ res = url.path.split('/')
+ resource = res[1]
+ if res[1]== "spreadsheet":
+ key = url.query.split('=')[1]
+ else:
+ key = res[3]
+ res_id = resource + ":" + key
+ result[data.id] = str(res_id)
+ except:
+ raise osv.except_osv(_('Incorrect URL!'), _("Please enter a valid URL."))
return result
_columns = {
@@ -239,7 +243,8 @@ class config(osv.osv):
'name_template': fields.char('Google Drive Name Pattern', size=64, help='Choose how the new google drive will be named, on google side. Eg. gdoc_%(field_name)s', required=True),
}
- def onchange_model_id(self, cr, uid, ids, model_id):
+ def onchange_model_id(self, cr, uid, ids, model_id,filter_id):
+ print 'fffffffff',filter_id
res = {'domain':{'filter_id':[]}}
if model_id:
model_name = self.pool.get('ir.model').read(cr, uid, model_id, ['model'])
@@ -248,6 +253,7 @@ class config(osv.osv):
res['domain'] = {'filter_id': [('model_id', '=', mod_name)]}
else:
res['value'] = {'filter_id': False}
+ print 'rrrrrrr',res
return res
_defaults = {
diff --git a/addons/google_docs/google_docs_demo.xml b/addons/google_docs/google_docs_demo.xml
index a5288dcf606..4f63aa0955c 100644
--- a/addons/google_docs/google_docs_demo.xml
+++ b/addons/google_docs/google_docs_demo.xml
@@ -16,7 +16,7 @@
<field name="model_id" ref="crm.model_crm_lead"/>
<field name="filter_id" ref="filter_crm"/>
<field name="gdocs_template_url">https://docs.google.com/spreadsheet/ccc?key=0Ah2qnrLAoZmUdGRvdVdmS1VoSDctWk1kd18taGZ4ckE#gid=0</field>
- <field name="name_template">lead_sales-department_%%(name)s_review</field>
+ <field name="name_template">lead_sales-department_%(name)s_review</field>
</record>
</data>
diff --git a/addons/google_docs/res_config_user_view.xml b/addons/google_docs/res_config_user_view.xml
index 0350e6bb238..c801f838202 100644
--- a/addons/google_docs/res_config_user_view.xml
+++ b/addons/google_docs/res_config_user_view.xml
@@ -59,10 +59,10 @@
<field name='view_id' ref='view_google_docs_config_tree'/>
<field name="help" type="html">
<p>
- "Link your first Google document to openERP documents
- You use to control the quality of your product in a spreadheet ?
- You review the delivery checklist for each delivery order in a foreign country ? ...
- Link your own templates on any documents of OpenERP
+ Link your first Google document to OpenERP documents.
+ You can use it to control the quality of your product in a spreadsheet or
+ review the delivery checklist for each delivery order in a foreign country
+ and in many more ways. Link your own templates on any documents of OpenERP.
</p>
</field>
</record>