web icon indicating copy to clipboard operation
web copied to clipboard

[BUG] - x2many_2d_matrix when using field_att_ attribute

Open sbejaoui opened this issue 3 years ago • 2 comments

The x2many_2d_matrix widget had a useful feature to set an HTML attribute based on a boolean field. a common use case is to deactivate the input dynamically.

It works in v10 and seems to be unintentionally lost in the refactoring made with the v11 migration (https://github.com/OCA/web/commit/69cc921ab36e4dee42c68d749f3ce259bc5b5e5f)

Impacted versions:

  • 11.0+

Expected behavior:

<field nolabel="1" name="x2many_ids" widget="x2many_2d_matrix"
    field_x_axis="field_x_axis_id" 
    field_x_axis="field_y_axis_id" 
    field_value="field_value"
    field_att_disabled="disabled">
    <tree>

1

Current behavior:

Error message : TypeError: Cannot set property 'disabled' of undefined.

I will propose a MR to fix this later. But if someone want to do it here are the missing code blocks:

  1. https://github.com/OCA/web/blob/10.0/web_widget_x2many_2d_matrix/static/src/js/web_widget_x2many_2d_matrix.js#L38
  2. https://github.com/OCA/web/blob/10.0/web_widget_x2many_2d_matrix/static/src/js/web_widget_x2many_2d_matrix.js#L227

It will be nice to add this feature to the readme

sbejaoui avatar Jun 07 '21 16:06 sbejaoui