[IMP]Made changes as per the review of RPA on 19th march
bzr revid: dhr@tinyerp.com-20130320053910-ywjxwwqvxjgrygia
This commit is contained in:
parent
0bc08f0e36
commit
1c251ffcf1
|
@ -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 = {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue