[IMP] google_docs : changes for tooltip and name_template

bzr revid: rpr@tinyerp.com-20130403090404-skf3m78u0ervtg6y
This commit is contained in:
Rajesh Prajapati (OpenERP)
2013-04-03 14:34:04 +05:30
parent d241e853ca
commit cc69f7e2e2
2 changed files with 8 additions and 7 deletions
+4 -3
View File
@@ -164,12 +164,13 @@ class google_docs_ir_attachment(osv.osv):
model_ids = pool_model.search(cr, uid, [('model','=',res_model)])
if not model_ids:
return attachment
model = pool_model.browse(cr, uid, model_ids[0], context=context)
record = self.pool.get(res_model).browse(cr, uid, res_id, context=context)
model = pool_model.browse(cr, uid, model_ids[0], context=context).name
filter_name = config.filter_id and config.filter_id.name or False
record = self.pool.get(res_model).read(cr, uid, res_id, [], context=context)
record.update({'model': model,'filter':filter_name})
name_gdocs = config.name_template or "%(name)s_%(model)s_%(filter)s_gdrive"
try:
name_gdocs = name_gdocs % {'name': record.name, 'model': model.name, 'filter': filter_name}
name_gdocs = name_gdocs % record
except:
raise osv.except_osv(_('Key Error!'), _("Your Google Doc Name Pattern's key does not found in object."))