[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

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."))

View File

@ -27,10 +27,10 @@
<div>
<field name='filter_id' context="{'default_user_id': False, 'default_model_id': model_id, 'hide_user_field': True}" domain="[('user_id','=',False)]"/>
<p class="oe_grey">
To Create a new filter, go to the list of documents you want to attach a google document to and
save the filter. Then come back to this view. The saved filter will be available in the field above.
For instance, to attach a document to the sales orders of Agrolait, go to sale orders list view,
filter on Agrolait and save the filter.
<b>To create a new filter:</b><br/>
- Go to your "Related Document Model" page and set the filter parameters in the "Search" view (Example of filter based on Leads/Opportunities: Sales Team Contains Sales Department)<br/>
- In this same "Search" view, select the menu "Save Current Filter", enter the name (Ex: Sales Department) and add the option "Share with all users"
The filter must therefore be available in this page.
</p>
</div>
<field name='gdocs_template_url' placeholder="https://docs.google.com/document/d/1vOtpJK9scIQz6taD9tJRIETWbEw3fSiaQHArsJYcua4/edit" required="1"/>