Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
3857 Widoki
OwlError: An error occured in the owl lifecycle (see this Error's "cause" property)
    at handleError (http://localhost:8069/web/assets/debug/web.assets_web.js:9154:35)
    at App.handleError (http://localhost:8069/web/assets/debug/web.assets_web.js:13345:20)
    at Fiber._render (http://localhost:8069/web/assets/debug/web.assets_web.js:9300:30)
    at Fiber.render (http://localhost:8069/web/assets/debug/web.assets_web.js:9289:18)
    at ComponentNode.initiateRender (http://localhost:8069/web/assets/debug/web.assets_web.js:9954:23)

Caused by: TypeError: Cannot read properties of undefined (reading 'name')
    at Field.template (eval at compile (http://localhost:8069/web/assets/debug/web.assets_web.js:13107:20), :16:92)
    at Fiber._render (http://localhost:8069/web/assets/debug/web.assets_web.js:9297:38)
    at Fiber.render (http://localhost:8069/web/assets/debug/web.assets_web.js:9289:18)
    at ComponentNode.initiateRender (http://localhost:8069/web/assets/debug/web.assets_web.js:9954:23)


Awatar
Odrzuć

add your code snippet along with the post

Autor

/** @odoo-module */

import { standardFieldProps } from "@web/views/fields/standard_field_props";
import { Component, xml } from "@odoo/owl";
import { registry } from "@web/core/registry";

export class MyTextField extends Component {
setup(){
super.setup();

console.log('Hello')
}

/**
* @param {boolean} newValue
*/
onChange(newValue) {

this.props.update(newValue);
}
}

MyTextField.template = xml`
<input t-att-id="props.id" class="text-danger" t-att-value="props.value" onChange.bind="onChange" />
`;
MyTextField.props = {
...standardFieldProps,
};

registry.category("fields").add("my_text_field", MyTextField);

Simple example from odoo docs not working

Autor

pls help with this

Autor Najlepsza odpowiedź

This is how above error is solved ... i dont know the reason
but i use the code from booleanfield widget 

export another const with object, where key is component and value is class 


export const activeCompanyToggleField = {    component: MyTextField ,};
registry.category("fields").add("active_company", activeCompanyToggleField);

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
gru 23
926
3
cze 24
3343
0
sty 23
1763
0
lut 24
1641
1
gru 24
3810