コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
828 ビュー

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?

アバター
破棄
著作者 最善の回答

Yessss! It worked perfectly, thanks!

アバター
破棄
最善の回答

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

アバター
破棄
関連投稿 返信 ビュー 活動
1
5月 25
213
0
11月 24
742
1
7月 24
2105
0
8月 24
340
1
4月 24
1589