OCA / web

Odoo web client UI related addons
GNU Affero General Public License v3.0
912 stars 1.86k forks source link

[17.0][MIG] web_widget_x2many_2d_matrix #2744

Closed norlinhenrik closed 5 months ago

norlinhenrik commented 6 months ago

The 16.0 fix for "editable boolean" is causing this in 17.0: image Error: Patch "web_widget_x2many_2d_matrix": Second argument is not the patch name anymore, it should be the object containing the patched properties

OCA-git-bot commented 6 months ago

Hi @SplashS, @Yajo, @Tardo, some modules you are maintaining are being modified, check this out!

IgnacioKase commented 6 months ago

Hey! I tried this code in Odoo 17 and this error is showing up:

UncaughtPromiseError > OwlError
Uncaught Promise > An error occured in the owl lifecycle (see this Error's "cause" property)
OwlError: An error occured in the owl lifecycle (see this Error's "cause" property)
    at handleError (http://localhost:8069/web/assets/1a02ac6/web.assets_web.min.js:916:101)
    at App.handleError (http://localhost:8069/web/assets/1a02ac6/web.assets_web.min.js:1542:29)
    at Fiber._render (http://localhost:8069/web/assets/1a02ac6/web.assets_web.min.js:941:19)
    at Fiber.render (http://localhost:8069/web/assets/1a02ac6/web.assets_web.min.js:939:6)
    at ComponentNode.initiateRender (http://localhost:8069/web/assets/1a02ac6/web.assets_web.min.js:1007:47)

Caused by: TypeError: Cannot read properties of undefined (reading 'name')
    at Field.template (eval at compile (http://localhost:8069/web/assets/1a02ac6/web.assets_web.min.js:1500:374), <anonymous>:18:53)
    at Fiber._render (http://localhost:8069/web/assets/1a02ac6/web.assets_web.min.js:940:96)
    at Fiber.render (http://localhost:8069/web/assets/1a02ac6/web.assets_web.min.js:939:6)
    at ComponentNode.initiateRender (http://localhost:8069/web/assets/1a02ac6/web.assets_web.min.js:1007:47)

I'm new at Owl and it's proving a bit hard to detect why that error is happening

legalsylvain commented 6 months ago

I'm new at Owl and it's proving a bit hard to detect why that error is happening

you can enable debug=assets to have a more explicit error.

IgnacioKase commented 6 months ago

I'm new at Owl and it's proving a bit hard to detect why that error is happening

you can enable debug=assets to have a more explicit error.

Hey, thanks for the tip! I did that but I'm getting the same error. However, I've been taking a look at the source code and I think the problem is related to the fact that the standardFieldProps have changed definition and some of the fields that this widget was using no longer exist. The dependency is here:

https://github.com/OCA/web/pull/2744/files#diff-ef115d96a8060ec878fd559f4abdb17a1d7fcb43c405598d91bff79f0486e2f0R74

This was the previous definition:


/** @odoo-module **/

export const standardFieldProps = {
    id: { type: String, optional: true },
    name: { type: String, optional: true },
    readonly: { type: Boolean, optional: true },
    record: { type: Object, optional: true },
    type: { type: String, optional: true },
    update: { type: Function, optional: true },
    value: true,
    decorations: { type: Object, optional: true },
    setDirty: { type: Function, optional: true },
};

and this is the new one


/** @odoo-module **/

/**
 * @typedef StandardFieldProps
 * @property {string} [id]
 * @property {string} name
 * @property {boolean} [readonly]
 * @property {import("@web/model/relational_model/record").Record} record
 */

export const standardFieldProps = {
    id: { type: String, optional: true },
    name: { type: String },
    readonly: { type: Boolean, optional: true },
    record: { type: Object },
};

So, we need to amend the widget to use this new fields

celm1990 commented 5 months ago

duplicate of https://github.com/OCA/web/pull/2756

celm1990 commented 5 months ago

The 16.0 fix for "editable boolean" is causing this in 17.0: image Error: Patch "web_widget_x2many_2d_matrix": Second argument is not the patch name anymore, it should be the object containing the patched properties

This error is present yet in runboat image