Browse Source

[ADD] Possibility to create a non square matrix

pull/797/head
Sebastian Kennedy 8 years ago
parent
commit
1b19b11eb5
  1. 9
      web_widget_x2many_2d_matrix/static/src/js/web_widget_x2many_2d_matrix.js
  2. 6
      web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml

9
web_widget_x2many_2d_matrix/static/src/js/web_widget_x2many_2d_matrix.js

@ -272,6 +272,15 @@ openerp.web_widget_x2many_2d_matrix = function(instance)
return vals;
},
row_xy_exists: function(x, y)
{
if( x in this.by_x_axis && y in this.by_x_axis[x] ) {
return true;
}
return false;
},
// return the value of a coordinate
get_xy_value: function(x, y)
{

6
web_widget_x2many_2d_matrix/static/src/xml/web_widget_x2many_2d_matrix.xml

@ -16,8 +16,10 @@
<th><t t-esc="widget.get_y_axis_label(y)" /></th>
<td t-foreach="widget.get_x_axis_values()" t-as="x" t-att-class="'oe_list_field_cell' + (widget.is_numeric ? ' oe_number' : '')" t-att-data-x="x">
<span t-att-class="widget.get_xy_value_class()">
<input class="edit" t-att-data-id="widget.get_xy_id(x, y)" t-att-value="widget.format_xy_value(widget.get_xy_value(x, y))" t-att="widget.get_xy_att(x, y)"/>
<span class="read"><t t-esc="widget.format_xy_value(widget.get_xy_value(x, y))" /></span>
<t t-if="widget.row_xy_exists(x, y)">
<input class="edit" t-att-data-id="widget.get_xy_id(x, y)" t-att-value="widget.format_xy_value(widget.get_xy_value(x, y))" t-att="widget.get_xy_att(x, y)"/>
<span class="read"><t t-esc="widget.format_xy_value(widget.get_xy_value(x, y))" /></span>
</t>
</span>
</td>
<td t-if="widget.show_row_totals" class="row_total oe_number" t-att-data-y="y"/>

Loading…
Cancel
Save