|
@ -27,6 +27,8 @@ odoo.define('web_widget_x2many_2d_matrix.widget', function (require) { |
|
|
field_y_axis: 'y', |
|
|
field_y_axis: 'y', |
|
|
field_label_y_axis: 'y', |
|
|
field_label_y_axis: 'y', |
|
|
field_value: 'value', |
|
|
field_value: 'value', |
|
|
|
|
|
x_axis_clickable: true, |
|
|
|
|
|
y_axis_clickable: true, |
|
|
// information about our datatype
|
|
|
// information about our datatype
|
|
|
is_numeric: false, |
|
|
is_numeric: false, |
|
|
show_row_totals: true, |
|
|
show_row_totals: true, |
|
@ -36,6 +38,14 @@ odoo.define('web_widget_x2many_2d_matrix.widget', function (require) { |
|
|
// Store fields used to fill HTML attributes
|
|
|
// Store fields used to fill HTML attributes
|
|
|
fields_att: {}, |
|
|
fields_att: {}, |
|
|
|
|
|
|
|
|
|
|
|
parse_boolean: function(val) |
|
|
|
|
|
{ |
|
|
|
|
|
if (val.toLowerCase() === 'true' || val === '1') { |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// read parameters
|
|
|
// read parameters
|
|
|
init: function(field_manager, node) |
|
|
init: function(field_manager, node) |
|
|
{ |
|
|
{ |
|
@ -43,6 +53,8 @@ odoo.define('web_widget_x2many_2d_matrix.widget', function (require) { |
|
|
this.field_y_axis = node.attrs.field_y_axis || this.field_y_axis; |
|
|
this.field_y_axis = node.attrs.field_y_axis || this.field_y_axis; |
|
|
this.field_label_x_axis = node.attrs.field_label_x_axis || this.field_x_axis; |
|
|
this.field_label_x_axis = node.attrs.field_label_x_axis || this.field_x_axis; |
|
|
this.field_label_y_axis = node.attrs.field_label_y_axis || this.field_y_axis; |
|
|
this.field_label_y_axis = node.attrs.field_label_y_axis || this.field_y_axis; |
|
|
|
|
|
this.x_axis_clickable = node.attrs.x_axis_clickable != undefined ? this.parse_boolean(node.attrs.x_axis_clickable) : this.x_axis_clickable; |
|
|
|
|
|
this.y_axis_clickable = node.attrs.y_axis_clickable != undefined ? this.parse_boolean(node.attrs.y_axis_clickable) : this.y_axis_clickable; |
|
|
this.field_value = node.attrs.field_value || this.field_value; |
|
|
this.field_value = node.attrs.field_value || this.field_value; |
|
|
for (var property in node.attrs) { |
|
|
for (var property in node.attrs) { |
|
|
if (property.startsWith("field_att_")) { |
|
|
if (property.startsWith("field_att_")) { |
|
@ -50,8 +62,8 @@ odoo.define('web_widget_x2many_2d_matrix.widget', function (require) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
this.field_editability = node.attrs.field_editability || this.field_editability; |
|
|
this.field_editability = node.attrs.field_editability || this.field_editability; |
|
|
this.show_row_totals = node.attrs.show_row_totals || this.show_row_totals; |
|
|
|
|
|
this.show_column_totals = node.attrs.show_column_totals || this.show_column_totals; |
|
|
|
|
|
|
|
|
this.show_row_totals = node.attrs.show_row_totals != undefined ? this.parse_boolean(node.attrs.show_row_totals) : this.show_row_totals; |
|
|
|
|
|
this.show_column_totals = node.attrs.show_column_totals != undefined ? this.parse_boolean(node.attrs.show_column_totals) : this.show_column_totals; |
|
|
return this._super(field_manager, node); |
|
|
return this._super(field_manager, node); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -349,14 +361,14 @@ odoo.define('web_widget_x2many_2d_matrix.widget', function (require) { |
|
|
|
|
|
|
|
|
setup_many2one_axes: function() |
|
|
setup_many2one_axes: function() |
|
|
{ |
|
|
{ |
|
|
if(this.fields[this.field_x_axis].type == 'many2one') |
|
|
|
|
|
|
|
|
if(this.fields[this.field_x_axis].type == 'many2one' && this.x_axis_clickable) |
|
|
{ |
|
|
{ |
|
|
this.$el.find('th[data-x]').addClass('oe_link') |
|
|
this.$el.find('th[data-x]').addClass('oe_link') |
|
|
.click(_.partial( |
|
|
.click(_.partial( |
|
|
this.proxy(this.many2one_axis_click), |
|
|
this.proxy(this.many2one_axis_click), |
|
|
this.field_x_axis, 'x')); |
|
|
this.field_x_axis, 'x')); |
|
|
} |
|
|
} |
|
|
if(this.fields[this.field_y_axis].type == 'many2one') |
|
|
|
|
|
|
|
|
if(this.fields[this.field_y_axis].type == 'many2one' && this.y_axis_clickable) |
|
|
{ |
|
|
{ |
|
|
this.$el.find('tr[data-y] th').addClass('oe_link') |
|
|
this.$el.find('tr[data-y] th').addClass('oe_link') |
|
|
.click(_.partial( |
|
|
.click(_.partial( |
|
|