[19.0][MIG] web_widget_x2many_2d_matrix: Migration to 19.0#3438
[19.0][MIG] web_widget_x2many_2d_matrix: Migration to 19.0#3438ferran-S73 wants to merge 153 commits intoOCA:19.0from
Conversation
of one of the axes is a many2one field
[ADD] show grand total [IMP] classify floats as floats
[IMP] write formatted value to back to input
[RFR] and being on it, make reacting to changes in overrides simple
this is necessary for correct operation after creating new records
* README update to newest OCA template * Example in README * Massive performance boost for big matrices, specially on Firefox * Assign id on row in order to find it back in all cases * Fix OCA#321, choked on cached writes
Declare as many options prefixed with this string as you need for binding a field value with an HTML node attribute (disabled, class, style...) called as the `<name>` passed in the option. NOTE: This doesn't prevent to require to fill the full matrix with all the combination records.
…s_clickable attrs XML attributes for the widget that allows to configure if the axis will be clickable or not in case the source field is a many2one field.
Chris is no longer active, Jasmin was already maintainer in v17 and David has been proposing fixes and taking care already that everything is properly working and mainteined across versions.
<=v15 used to pass the list view field node to the rendering widget, enabling full configurability of the value field
…ckable) it was possible to make the axis fields links to the record if they were many2one fields
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: web-18.0/web-18.0-web_widget_x2many_2d_matrix Translate-URL: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_widget_x2many_2d_matrix/
Currently translated at 100.0% (7 of 7 strings) Translation: web-18.0/web-18.0-web_widget_x2many_2d_matrix Translate-URL: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_widget_x2many_2d_matrix/it/
use components to render axes and aggregates, allowing custom widgets there
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: web-18.0/web-18.0-web_widget_x2many_2d_matrix Translate-URL: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_widget_x2many_2d_matrix/
Currently translated at 100.0% (8 of 8 strings) Translation: web-18.0/web-18.0-web_widget_x2many_2d_matrix Translate-URL: https://translation.odoo-community.org/projects/web-18-0/web-18-0-web_widget_x2many_2d_matrix/it/
alexey-pelykh
left a comment
There was a problem hiding this comment.
Thanks for picking up this migration, @ferran-S73!
I maintain this module, so I went through the changes carefully. The many2one tuple-to-object migration (value[0] → value.id, value[1] → value.display_name) and the users → user_ids rename in the demo view are both correct for 19.0. Manifest version bump looks good too.
However, I have one concern that I believe needs to be addressed before merging:
Renderer setup: onWillUpdateProps vs onWillRender
The 18.0 version uses onWillRender to recalculate columns, rows, and matrix on every render cycle. The 19.0 PR replaces this with setup() + onWillUpdateProps. The problem is that onWillUpdateProps only fires when the parent passes new props — it does not fire when the user edits a value cell inline. Inline edits mutate the records within this.props.list without the parent re-passing props to the renderer, so the matrix/totals would not update.
The 18.0 branch includes a test that validates exactly this scenario ("matrix totals are updated correctly after several edits"), which was dropped in this PR. I suspect the test was removed because it fails with the current onWillUpdateProps approach.
Suggested fix: keep using onWillRender as in 18.0 — it's still available in OWL 3 and correctly handles all reactivity scenarios:
setup() {
onWillRender(() => {
const records = this.list.records;
this.columns = this._getColumns(records);
this.rows = this._getRows(records);
this.matrix = this._getMatrix(records);
});
}And please restore the dropped test from 18.0 as well:
test("matrix totals are updated correctly after several edits", async () => { ... });(along with the contains and queryAll imports it needs).
Everything else looks clean — nice work on the migration overall.
Migration from #3310