[IMP] google_docs : changes for google template creation for user

bzr revid: rpr@tinyerp.com-20130404070523-3wt0hcot93jw6fop
This commit is contained in:
Rajesh Prajapati (OpenERP) 2013-04-04 12:35:23 +05:30
parent b25b6cb314
commit 811e51f362
2 changed files with 12 additions and 25 deletions

View File

@ -132,8 +132,11 @@ class google_docs_ir_attachment(osv.osv):
# check if a model is configured with a template
config_ids = pool_gdoc_config.search(cr, uid, [('model_id', '=', res_model)], context=context)
configs = []
for config in pool_gdoc_config.browse(cr, uid, config_ids, context=context):
for config in pool_gdoc_config.browse(cr, SUPERUSER_ID, config_ids, context=context):
if config.filter_id:
if (config.filter_id.user_id and config.filter_id.user_id.id != uid):
#Private
continue
google_doc_configs = self._filter(cr, uid, config, config.filter_id, res_id, context=context)
if google_doc_configs:
configs.append({'id': config.id, 'name': config.name})
@ -158,7 +161,7 @@ class google_docs_ir_attachment(osv.osv):
pool_gdoc_config = self.pool.get('google.docs.config')
pool_model = self.pool.get("ir.model")
attachment = {'url': False}
config = pool_gdoc_config.browse(cr, uid, config_id, context=context)
config = pool_gdoc_config.browse(cr, SUPERUSER_ID, config_id, context=context)
if config:
res_model = config.model_id
model_ids = pool_model.search(cr, uid, [('model','=',res_model)])
@ -220,11 +223,11 @@ class config(osv.osv):
}
def onchange_model_id(self, cr, uid, ids, model_id, context=None):
res = {}
res = {'domain':{'filter_id':[]}}
if model_id:
res['domain'] = {'filter_id': [('model_id', '=', model_id), ('user_id','=',False)]}
res['domain'] = {'filter_id': [('model_id', '=', model_id)]}
else:
res['value'] = {'filter_id': [('user_id','=',False)]}
res['value'] = {'filter_id': False}
return res
_defaults = {

View File

@ -25,12 +25,11 @@
<field name="model_id" on_change="onchange_model_id(model_id)"/>
<label for='filter_id'/>
<div>
<field name='filter_id' context="{'default_user_id': False, 'default_model_id': model_id, 'hide_user_field': True}" domain="[('user_id','=',False)]"/>
<field name='filter_id'/>
<p class="oe_grey">
<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.
- Go to the OpenERP document you want to filter. For instance, go to Opportunities and search on Sales Department.<br/>
- In this same "Search" view, select the menu "Save Current Filter", enter the name (Ex: Sales Department)
</p>
</div>
<field name='gdocs_template_url' placeholder="https://docs.google.com/document/d/1vOtpJK9scIQz6taD9tJRIETWbEw3fSiaQHArsJYcua4/edit" required="1"/>
@ -60,11 +59,7 @@ The filter must therefore be available in this page.
<p class="oe_view_nocontent_create">
Click to add a new template.
</p><p>
Link your google drive template to any record of OpenERP.
If you have really specific documents you want your collaborator fill in,
e.g.
Using a spreadsheet to control the quality of your product, reviewing the delivery checklist for each delivery order in a foreign country in a document...
Its very easy to manage them by adding a Google Drive template in OpenERP to link your specific document to any records.
Link your own google drive templates to any record of OpenERP. If you have really specific documents you want your collaborator fill in, e.g. Use a spreadsheet to control the quality of your product or review the delivery checklist for each order in a foreign country, ... Its very easy to manage them, link them to OpenERP and use them to collaborate with your employees.
</p>
</field>
</record>
@ -84,17 +79,6 @@ The filter must therefore be available in this page.
</field>
</record>
<record id="inherited_ir_filters_view" model="ir.ui.view">
<field name="name">filters</field>
<field name="model">ir.filters</field>
<field name="inherit_id" ref="base.ir_filters_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='user_id']" position="replace">
<field name="user_id" invisible="context.get('hide_user_field', False)"/>
</xpath>
</field>
</record>
<menuitem name='Google Drive configuration' id='menu_gdocs_config' parent='base.menu_administration'/>
<menuitem id='menu_gdocs_model_config' parent='menu_gdocs_config' action='action_google_docs_users_config'/>
</data>