[FIX]: fix the problem for related fields, related fields act as a many2one fields
which is not exist in the db , so direct ql query will not work for them, direct sql will work only for many2one fields only to make relation with 2 tables lp bug: https://launchpad.net/bugs/379191 fixed bzr revid: mga@tinyerp.com-20090914104658-8submdrc2pjwflhy
This commit is contained in:
@@ -214,13 +214,16 @@ class report_creator(osv.osv):
|
||||
reference_model_dict[v.get('relation')] = relation_count+1
|
||||
else:
|
||||
reference_model_dict[v.get('relation')]=1
|
||||
str_where = model_dict.get(model)+"."+ k + "=" + model_dict.get(v.get('relation'))+'.id'
|
||||
where_list.append(str_where)
|
||||
|
||||
if isinstance(self.pool.get(model)._columns.get(k), fields.many2one):
|
||||
str_where = model_dict.get(model)+"."+ k + "=" + model_dict.get(v.get('relation'))+'.id'
|
||||
where_list.append(str_where)
|
||||
if reference_model_dict:
|
||||
self.model_set_id = model_dict.get(reference_model_dict.keys()[reference_model_dict.values().index(min(reference_model_dict.values()))])
|
||||
if model_list and not len(model_dict.keys()) == 1:
|
||||
raise osv.except_osv(_('No Related Models!!'),_('These is/are model(s) (%s) in selection which is/are not related to any other model') % ','.join(model_list))
|
||||
|
||||
print 'where_list : ', where_list
|
||||
if filter_ids and where_list<>[]:
|
||||
filter_list.append(' and ')
|
||||
filter_list.append(' ')
|
||||
|
||||
Reference in New Issue
Block a user