Browse Source

[IMP] mis_builder: field_name is actually field_names

pull/86/head
Stéphane Bidoul 10 years ago
parent
commit
e945b8b93e
  1. 22
      mis_builder/models/mis_builder.py
  2. 2
      mis_builder/views/mis_builder.xml

22
mis_builder/models/mis_builder.py

@ -226,21 +226,21 @@ class mis_report_query(orm.Model):
def _get_field_names(self, cr, uid, ids, name, args, context=None):
res = {}
for query in self.browse(cr, uid, ids, context=context):
field_name = []
field_names = []
for field in query.field_ids:
field_name.append(field.name)
res[query.id] = ', '.join(field_name)
field_names.append(field.name)
res[query.id] = ', '.join(field_names)
return res
def onchange_field_ids(self, cr, uid, ids, field_ids, context=None):
# compute field_names
field_name = []
field_names = []
for field in self.pool.get('ir.model.fields').read(cr, uid,
field_ids[0][2],
['name'],
context=context):
field_name.append(field['name'])
return {'value': {'field_name': ', '.join(field_name)}}
field_names.append(field['name'])
return {'value': {'field_names': ', '.join(field_names)}}
_columns = {
'name': fields.char(size=32, required=True,
@ -249,11 +249,11 @@ class mis_report_query(orm.Model):
string='Model'),
'field_ids': fields.many2many('ir.model.fields', required=True,
string='Fields to fetch'),
'field_name': fields.function(_get_field_names, type='char',
string='Fetched fields name',
store={'mis.report.query':
(lambda self, cr, uid, ids, c={}:
ids, ['field_ids'], 20), }),
'field_names': fields.function(_get_field_names, type='char',
string='Fetched fields name',
store={'mis.report.query':
(lambda self, cr, uid, ids, c={}:
ids, ['field_ids'], 20), }),
'date_field': fields.many2one('ir.model.fields', required=True,
string='Date field',
domain=[('ttype', 'in', ('date',

2
mis_builder/views/mis_builder.xml

@ -28,7 +28,7 @@
<field name="model_id"/>
<field name="field_ids" domain="[('model_id', '=', model_id)]" widget="many2many_tags"
on_change="onchange_field_ids(field_ids, context)"/>
<field name="field_name"/>
<field name="field_names"/>
<field name="date_field" domain="[('model_id', '=', model_id), ('ttype', 'in', ('date', 'datetime'))]"/>
<field name="domain"/>
</tree>

Loading…
Cancel
Save