Browse Source

add onchange on fields to fetch to get the list of fields name to use in kpi

pull/86/head
laetitia.gangloff@acsone.eu 10 years ago
committed by Stéphane Bidoul
parent
commit
f32f8fdd54
  1. 7
      mis_builder/models/mis_builder.py
  2. 4
      mis_builder/views/mis_builder.xml

7
mis_builder/models/mis_builder.py

@ -213,6 +213,13 @@ class mis_report_query(orm.Model):
res[query.id] = ', '.join(field_name)
return res
def onchange_field_ids(self, cr, uid, ids, field_ids, context=None):
# compute field_names
field_name = []
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)}}
_columns = {
'name': fields.char(size=32, required=True,
string='Name'),

4
mis_builder/views/mis_builder.xml

@ -26,7 +26,8 @@
<tree string="Queries" editable="bottom">
<field name="name"/>
<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)"/>
<field name="field_name"/>
<field name="date_field" domain="[('model_id', '=', model_id), ('ttype', 'in', ('date', 'datetime'))]"/>
<field name="domain"/>
@ -126,6 +127,7 @@
<field name="type"/>
<field name="offset"/>
<field name="duration"/>
<field name="normalize_factor"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="period_from"/>

Loading…
Cancel
Save