[IMP] mis_builder: simplify widget template
Plus more consistent vocabulary for row/col labelspull/189/head
parent
4dd0aec548
commit
992a14b316
|
@ -369,8 +369,8 @@ class KpiMatrix(object):
|
|||
header = [{'cols': []}, {'cols': []}]
|
||||
for col in self.iter_cols():
|
||||
header[0]['cols'].append({
|
||||
'description': col.description,
|
||||
'comment': col.comment,
|
||||
'label': col.description,
|
||||
'description': col.comment,
|
||||
'colspan': col.colspan,
|
||||
})
|
||||
for subcol in col.iter_subcols():
|
||||
|
@ -380,22 +380,22 @@ class KpiMatrix(object):
|
|||
'colspan': 1,
|
||||
})
|
||||
|
||||
content = []
|
||||
body = []
|
||||
for row in self.iter_rows():
|
||||
row_data = {
|
||||
'row_id': row.row_id,
|
||||
'parent_row_id': (row.parent_row and
|
||||
row.parent_row.row_id or None),
|
||||
'description': row.description,
|
||||
'comment': row.comment,
|
||||
'label': row.description,
|
||||
'description': row.comment,
|
||||
'style': self._style_model.to_css_style(
|
||||
row.style_props),
|
||||
'cols': []
|
||||
'cells': []
|
||||
}
|
||||
for cell in row.iter_cells():
|
||||
if cell is None:
|
||||
# TODO use subcol style here
|
||||
row_data['cols'].append({})
|
||||
row_data['cells'].append({})
|
||||
else:
|
||||
col_data = {
|
||||
'val': (cell.val
|
||||
|
@ -407,12 +407,12 @@ class KpiMatrix(object):
|
|||
}
|
||||
if cell.drilldown_arg:
|
||||
col_data['drilldown_arg'] = cell.drilldown_arg
|
||||
row_data['cols'].append(col_data)
|
||||
content.append(row_data)
|
||||
row_data['cells'].append(col_data)
|
||||
body.append(row_data)
|
||||
|
||||
return {
|
||||
'header': header,
|
||||
'content': content,
|
||||
'body': body,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,40 +10,40 @@
|
|||
</div>
|
||||
<table class="oe_list_content mis_builder">
|
||||
<thead>
|
||||
<t t-foreach="widget.mis_report_data.header" t-as="h">
|
||||
<tr class="oe_list_header_columns">
|
||||
<th class="oe_list_header_char">
|
||||
</th>
|
||||
<th t-foreach="h_value.cols" t-as="col" class="oe_list_header_char mis_builder_collabel" t-att-colspan="col.colspan">
|
||||
<t t-esc="col.description"/>
|
||||
<t t-if="col.comment">
|
||||
<br/>
|
||||
<t t-esc="col.comment"/>
|
||||
</t>
|
||||
</th>
|
||||
</tr>
|
||||
</t>
|
||||
<tr t-foreach="widget.mis_report_data.header" t-as="row" class="oe_list_header_columns">
|
||||
<th class="oe_list_header_char">
|
||||
</th>
|
||||
<th t-foreach="row.cols" t-as="col" class="oe_list_header_char mis_builder_collabel" t-att-colspan="col.colspan">
|
||||
<t t-esc="col.label"/>
|
||||
<t t-if="col.description">
|
||||
<br/>
|
||||
<t t-esc="col.description"/>
|
||||
</t>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr t-foreach="widget.mis_report_data.content" t-as="c">
|
||||
<td t-att="{'style': c_value.style}">
|
||||
<t t-esc="c_value.description"/>
|
||||
<tr t-foreach="widget.mis_report_data.body" t-as="row">
|
||||
<td t-att="{'style': row.style}">
|
||||
<t t-esc="row.label"/>
|
||||
<t t-if="row.description">
|
||||
<br/>
|
||||
<t t-esc="row.description"/>
|
||||
</t>
|
||||
</td>
|
||||
<td t-foreach="row.cells" t-as="cell" t-att="{'style': cell.style, 'title': cell.val_c}" class="mis_builder_amount">
|
||||
<t t-if="cell.drilldown_arg">
|
||||
<a href="javascript:void(0)"
|
||||
class="mis_builder_drilldown"
|
||||
t-att-data-drilldown="JSON.stringify(cell.drilldown_arg)"
|
||||
>
|
||||
<t t-esc="cell.val_r"/>
|
||||
</a>
|
||||
</t>
|
||||
<t t-if="!cell.drilldown_arg">
|
||||
<t t-esc="cell.val_r"/>
|
||||
</t>
|
||||
</td>
|
||||
<t t-foreach="c_value.cols" t-as="value">
|
||||
<td t-att="{'style': value_value.style, 'title': value_value.val_c}" class="mis_builder_amount">
|
||||
<t t-if="value_value.drilldown_arg">
|
||||
<a href="javascript:void(0)"
|
||||
class="mis_builder_drilldown"
|
||||
t-att-data-drilldown="JSON.stringify(value_value.drilldown_arg)"
|
||||
>
|
||||
<t t-esc="value_value.val_r"/>
|
||||
</a>
|
||||
</t>
|
||||
<t t-if="!value_value.drilldown_arg">
|
||||
<t t-esc="value_value.val_r"/>
|
||||
</t>
|
||||
</td>
|
||||
</t>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
|
|
Loading…
Reference in New Issue