Browse Source

[IMP] mis_builder: field_name is actually field_names

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

14
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): def _get_field_names(self, cr, uid, ids, name, args, context=None):
res = {} res = {}
for query in self.browse(cr, uid, ids, context=context): for query in self.browse(cr, uid, ids, context=context):
field_name = []
field_names = []
for field in query.field_ids: 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 return res
def onchange_field_ids(self, cr, uid, ids, field_ids, context=None): def onchange_field_ids(self, cr, uid, ids, field_ids, context=None):
# compute field_names # compute field_names
field_name = []
field_names = []
for field in self.pool.get('ir.model.fields').read(cr, uid, for field in self.pool.get('ir.model.fields').read(cr, uid,
field_ids[0][2], field_ids[0][2],
['name'], ['name'],
context=context): 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 = { _columns = {
'name': fields.char(size=32, required=True, 'name': fields.char(size=32, required=True,
@ -249,7 +249,7 @@ class mis_report_query(orm.Model):
string='Model'), string='Model'),
'field_ids': fields.many2many('ir.model.fields', required=True, 'field_ids': fields.many2many('ir.model.fields', required=True,
string='Fields to fetch'), string='Fields to fetch'),
'field_name': fields.function(_get_field_names, type='char',
'field_names': fields.function(_get_field_names, type='char',
string='Fetched fields name', string='Fetched fields name',
store={'mis.report.query': store={'mis.report.query':
(lambda self, cr, uid, ids, c={}: (lambda self, cr, uid, ids, c={}:

2
mis_builder/views/mis_builder.xml

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

Loading…
Cancel
Save