Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
1621 Vizualizări

Hi,

Im trying to extend charfield, but im getting the following error:

The following modules are needed by other modules but have not been defined, they may not be present in the correct asset bundle:

  • @web/views/fields/char/char_field

The following modules could not be loaded because they have unmet dependencies, this is a secondary error which is likely caused by one of the above problems:

  • @my_module/js/masked_char_field

This is how im trying:

my_module/static/src/js/masked_char_field.js

/** @odoo-module **/

import { registry } from "@web/core/registry";
import { CharField } from "@web/views/fields/char/char_field";


class MaskedCharField extends CharField {
setup() {
super.setup();
console.log("Char field inherited");
}
}
MaskedCharField.supportedTypes = ['char'];
registry.category("fields").add("masked_char_field", MaskedCharField)

__manifest__.py

{
'name': "my_module",
'summary': "short",
'description': "long",
'author': "Me",
'website': "",
'category': 'Localization/Tools',
'version': '0.1',
'depends': ['base', 'web'],
'data': [],
'demo': [],
'assets': {
'web.assets_frontend': [
'my_module/static/src/js/masked_char_field.js'
],
},
'license': 'Other proprietary'
}


what im doing wrong?

Imagine profil
Abandonează
Autor Cel mai bun răspuns

Yessss! It worked perfectly, thanks!

Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

You are defining the asset bundle as web.assets_frontend, but you need to use web.assets_backend because Char field is defined in web.assets_backend.


Hope it helps

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
iul. 25
1513
1
mai 25
973
1
iul. 24
3351
0
aug. 24
341
1
apr. 24
2116