Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
8456 Lượt xem

Hi, I am a newbie in Odoo development, we use odoo v16.0.

We want to be able to change the color of the backend by using a custom module. We searched the web and found some suggestions.

We have a custom module folder structure with __manifest__.py

My manifest file:

{
​'name': 'Better looking backend theme',
​'summary': 'Better Theme Backend',
​'description': 'Better backend theme',
​'category': 'Theme/Creative',
​'depends': ['base'],
​'author': 'Mickey Mouse',
​'data': [
​'views/assets.xml',
​],
​'assets': {
​"web.assets_backend": [
​'inx_backend_theme/static/src/css/theme.css',
​],
​},
​'images': [
​'static/description/icon.png',
​​],
​'installable': True,
​'auto_install': False,
​'application': True,
}



My assets.xml file












The css file

.o_main_navbar {
​background-color: #0071ce !important;
}


This is the log:

The log when attempting to Activate the module:
Traceback (most recent call last): File "/odoo/odoo/tools/cache.py", line 85, in lookup r = d[key] ~^^^^^ File "", line 2, in __getitem__ File "/odoo/odoo/tools/func.py", line 87, in locked return func(inst, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/odoo/odoo/tools/lru.py", line 34, in __getitem__ a = self.d[obj] ~~~~~~^^^^^ KeyError: ('ir.model.data', , 'web.assets_backend') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/odoo/odoo/tools/convert.py", line 698, in _tag_root f(rec) File "/odoo/odoo/tools/convert.py", line 676, in _tag_template return self._tag_record(record) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/odoo/odoo/tools/convert.py", line 568, in _tag_record f_val = self.id_get(f_ref, raise_if_not_found=nodeattr2bool(rec, 'forcecreate', True)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/odoo/odoo/tools/convert.py", line 681, in id_get res = self.model_id_get(id_str, raise_if_not_found) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/odoo/odoo/tools/convert.py", line 687, in model_id_get return self.env['ir.model.data']._xmlid_to_res_model_res_id(id_str, raise_if_not_found=raise_if_not_found) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/odoo/odoo/addons/base/models/ir_model.py", line 2002, in _xmlid_to_res_model_res_id return self._xmlid_lookup(xmlid)[1:3] ^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 2, in _xmlid_lookup File "/odoo/odoo/tools/cache.py", line 90, in lookup value = d[key] = self.method(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/odoo/odoo/addons/base/models/ir_model.py", line 1995, in _xmlid_lookup raise ValueError('External ID not found in the system: %s' % xmlid) ValueError: External ID not found in the system: web.assets_backend The above exception was the direct cause of the following exception:


When trying to Activate the module I get the above error. Again, we run Odoo CE v16.0

We need help to understand what's wrong

Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

the xml file is not visible, here it is
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<template id="inx_backend_theme" name="Backaend color theme changer" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" type="text/scss" href="/inx_backend_theme/static/src/css/theme.css"/>
</xpath>
</template>
</data>
</odoo>

Câu trả lời hay nhất

you can use base_setup in depends instead of just base. I think your problem is that system is not recognizing the web.assets_backend id because of 2 reason I suppose

  • There would be spelling mistake
  • Web module is not mentioned in depends directly or indirectly.
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Good evening, 
just delete ​'views/assets.xml' from data.
Then this problem is solved.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 7 22
2063
2
thg 4 24
5705
1
thg 9 23
3232
2
thg 4 22
3951
0
thg 12 18
3280