跳至内容
菜单
此问题已终结
4 回复
9483 查看
I want immediate help to solve it.

Traceback (most recent call last): File "/opt/odoo17/odoo/odoo/tools/cache.py", line 99, in lookup r = d[key] File "", line 2, in __getitem__ File "/opt/odoo17/odoo/odoo/tools/func.py", line 87, in locked return func(inst, *args, **kwargs) File "/opt/odoo17/odoo/odoo/tools/lru.py", line 34, in __getitem__ a = self.d[obj] KeyError: ('ir.model.data', , 'gb_custom_hr.action_report_employment') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/odoo17/odoo/odoo/tools/convert.py", line 556, in _tag_root f(rec) File "/opt/odoo17/odoo/odoo/tools/convert.py", line 312, in _tag_menuitem act = self.env.ref(a_action).sudo() File "/opt/odoo17/odoo/odoo/api.py", line 572, in ref res_model, res_id = self['ir.model.data']._xmlid_to_res_model_res_id( File "/opt/odoo17/odoo/odoo/addons/base/models/ir_model.py", line 2182, in _xmlid_to_res_model_res_id return self._xmlid_lookup(xmlid) File "", line 2, in _xmlid_lookup File "/opt/odoo17/odoo/odoo/tools/cache.py", line 104, in lookup value = d[key] = self.method(*args, **kwargs) File "/opt/odoo17/odoo/odoo/addons/base/models/ir_model.py", line 2175, in _xmlid_lookup raise ValueError('External ID not found in the system: %s' % xmlid) ValueError: External ID not found in the system: gb_custom_hr.action_report_employment The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/opt/odoo17/odoo/odoo/http.py", line 1722, in _serve_db return service_model.retrying(self._serve_ir_http, self.env) File "/opt/odoo17/odoo/odoo/service/model.py", line 133, in retrying result = func() File "/opt/odoo17/odoo/odoo/http.py", line 1749, in _serve_ir_http response = self.dispatcher.dispatch(rule.endpoint, args) File "/opt/odoo17/odoo/odoo/http.py", line 1953, in dispatch result = self.request.registry['ir.http']._dispatch(endpoint) File "/opt/odoo17/odoo/addons/website/models/ir_http.py", line 235, in _dispatch response = super()._dispatch(endpoint) File "/opt/odoo17/odoo/odoo/addons/base/models/ir_http.py", line 222, in _dispatch result = endpoint(**request.params) File "/opt/odoo17/odoo/odoo/http.py", line 722, in route_wrapper result = endpoint(self, *args, **params_ok) File "/opt/odoo17/odoo/addons/web/controllers/dataset.py", line 28, in call_button action = self._call_kw(model, method, args, kwargs) File "/opt/odoo17/odoo/addons/web/controllers/dataset.py", line 20, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/opt/odoo17/odoo/odoo/api.py", line 466, in call_kw result = _call_kw_multi(method, model, args, kwargs) File "/opt/odoo17/odoo/odoo/api.py", line 453, in _call_kw_multi result = method(recs, *args, **kwargs) File "", line 2, in button_immediate_upgrade File "/opt/odoo17/odoo/odoo/addons/base/models/ir_module.py", line 75, in check_and_log return method(self, *args, **kwargs) File "/opt/odoo17/odoo/odoo/addons/base/models/ir_module.py", line 650, in button_immediate_upgrade return self._button_immediate_function(type(self).button_upgrade) File "/opt/odoo17/odoo/odoo/addons/base/models/ir_module.py", line 583, in _button_immediate_function registry = modules.registry.Registry.new(self._cr.dbname, update_module=True) File "", line 2, in new File "/opt/odoo17/odoo/odoo/tools/func.py", line 87, in locked return func(inst, *args, **kwargs) File "/opt/odoo17/odoo/odoo/modules/registry.py", line 113, in new odoo.modules.load_modules(registry, force_demo, status, update_module) File "/opt/odoo17/odoo/odoo/modules/loading.py", line 476, in load_modules processed_modules += load_marked_modules(env, graph, File "/opt/odoo17/odoo/odoo/modules/loading.py", line 364, in load_marked_modules loaded, processed = load_module_graph( File "/opt/odoo17/odoo/odoo/modules/loading.py", line 227, in load_module_graph load_data(env, idref, mode, kind='data', package=package) File "/opt/odoo17/odoo/odoo/modules/loading.py", line 71, in load_data tools.convert_file(env, package.name, filename, idref, mode, noupdate, kind) File "/opt/odoo17/odoo/odoo/tools/convert.py", line 627, in convert_file convert_xml_import(env, module, fp, idref, mode, noupdate) File "/opt/odoo17/odoo/odoo/tools/convert.py", line 693, in convert_xml_import obj.parse(doc.getroot()) File "/opt/odoo17/odoo/odoo/tools/convert.py", line 613, in parse self._tag_root(de) File "/opt/odoo17/odoo/odoo/tools/convert.py", line 556, in _tag_root f(rec) File "/opt/odoo17/odoo/odoo/tools/convert.py", line 569, in _tag_root raise ParseError('while parsing %s:%s, somewhere inside\n%s' % ( odoo.tools.convert.ParseError: while parsing /opt/odoo17/odoo/addons/gb_custom_hr/views/menu.xml:5, somewhere inside

i was adding the wizard in employee module using my custom module. Now, i got stuck with this error. Anyone please helps me out.

形象
丢弃
最佳答案

Hello,

Unfortunately, I cannot directly access and check your Odoo code. 

However, I can guide you on how to verify the order of declarations in the manifest file and ensure the menu view is placed last.

Look for the following declarations in the manifest file:

  • 'qweb': [ ... ], (Defines QWeb views)
  • 'actions': [ ... ], (Defines actions)
  • 'menu': [ ... ], (Defines menu items)

Hope it helps

 



形象
丢弃
编写者

Is it necessary to have these 3 declarations in __manifest__.py file.

编写者

'data':[
'security/ir.model.access.csv',
'views/hr_employee_views.xml',
'views/hr_employee_history_views.xml',
'views/hr_employee_report_views.xml',
'report/ir_actions_report.xml',
'report/employee_report.xml',
'wizard/employee_details_report_view.xml',
'views/menu.xml',
],
Is this correct

编写者

It's get resolved, after the data in __manifest__.py get changed as above.

But new error is formed:
Traceback (most recent call last):
File "/opt/odoo17/odoo/odoo/http.py", line 1722, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/opt/odoo17/odoo/odoo/service/model.py", line 133, in retrying
result = func()
File "/opt/odoo17/odoo/odoo/http.py", line 1749, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/opt/odoo17/odoo/odoo/http.py", line 1953, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "/opt/odoo17/odoo/addons/website/models/ir_http.py", line 235, in _dispatch
response = super()._dispatch(endpoint)
File "/opt/odoo17/odoo/odoo/addons/base/models/ir_http.py", line 222, in _dispatch
result = endpoint(**request.params)
File "/opt/odoo17/odoo/odoo/http.py", line 722, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/opt/odoo17/odoo/addons/web/controllers/dataset.py", line 28, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/opt/odoo17/odoo/addons/web/controllers/dataset.py", line 20, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo17/odoo/odoo/api.py", line 466, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo17/odoo/odoo/api.py", line 453, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "<decorator-gen-83>", line 2, in button_immediate_upgrade
File "/opt/odoo17/odoo/odoo/addons/base/models/ir_module.py", line 75, in check_and_log
return method(self, *args, **kwargs)
File "/opt/odoo17/odoo/odoo/addons/base/models/ir_module.py", line 650, in button_immediate_upgrade
return self._button_immediate_function(type(self).button_upgrade)
File "/opt/odoo17/odoo/odoo/addons/base/models/ir_module.py", line 583, in _button_immediate_function
registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "<decorator-gen-16>", line 2, in new
File "/opt/odoo17/odoo/odoo/tools/func.py", line 87, in locked
return func(inst, *args, **kwargs)
File "/opt/odoo17/odoo/odoo/modules/registry.py", line 113, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/opt/odoo17/odoo/odoo/modules/loading.py", line 476, in load_modules
processed_modules += load_marked_modules(env, graph,
File "/opt/odoo17/odoo/odoo/modules/loading.py", line 364, in load_marked_modules
loaded, processed = load_module_graph(
File "/opt/odoo17/odoo/odoo/modules/loading.py", line 227, in load_module_graph
load_data(env, idref, mode, kind='data', package=package)
File "/opt/odoo17/odoo/odoo/modules/loading.py", line 71, in load_data
tools.convert_file(env, package.name, filename, idref, mode, noupdate, kind)
File "/opt/odoo17/odoo/odoo/tools/convert.py", line 627, in convert_file
convert_xml_import(env, module, fp, idref, mode, noupdate)
File "/opt/odoo17/odoo/odoo/tools/convert.py", line 693, in convert_xml_import
obj.parse(doc.getroot())
File "/opt/odoo17/odoo/odoo/tools/convert.py", line 613, in parse
self._tag_root(de)
File "/opt/odoo17/odoo/odoo/tools/convert.py", line 567, in _tag_root
raise ParseError(msg) from None # Restart with "--log-handler odoo.tools.convert:DEBUG" for complete traceback
odoo.tools.convert.ParseError: while parsing /opt/odoo17/odoo/addons/gb_custom_hr/wizard/employee_details_report_view.xml:3
Error while validating view near:

<footer>
<button name="action_print_report" type="object" string="Print" class="btn-primary"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</form>
action_print_report is not a valid action on employee.details.report.wizard

View error context:
{'file': '/opt/odoo17/odoo/addons/gb_custom_hr/wizard/employee_details_report_view.xml',
'line': 13,
'name': 'employee.report.wizard.form',
'view': ir.ui.view(2714,),
'view.model': 'employee.details.report.wizard',
'view.parent': ir.ui.view(),
'xmlid': 'view_report_employee_form'}

Probably the method 'action_print_report' is not present in the wizard python file, please check again sir

编写者

Yes, that was the issue. Thank you

wait sir, i'm the one the help you in the first place and point out the last issue, please mark my answer as best answer not this one

最佳答案

Hi,

The error message "External ID not found in the system" typically occurs when Odoo is unable to locate the specified external identifier (XML ID) in its database.

In your case, the XML ID gb_custom_hr.action_report_employment is not found in the system. This could happen for several reasons:

1)Double-check the XML ID to ensure that it is spelled correctly and matches the actual ID used in your code or configuration.

2)Verify that the XML ID is correctly defined in your code or data files. It should be defined either in a view, a menu item, an action, or any other relevant place.

3)If this XML ID is defined in a module, ensure that the module containing the XML ID is installed and properly loaded in your Odoo instance.

4)Ensure that you are referencing the XML ID within the correct scope. For example, if the XML ID belongs to a specific module, make sure you are referencing it within that module's context.

5) Make sure you have given the  XML id in the manifest before it is referenced or used in a different place.


Hope it helps

形象
丢弃
最佳答案

Hi,

Check for the usage of action_report_employment in your module and make sure this record will load into the db before it is referenced or used in a different place.

For example, if you have a menu linked with action, the action declaration should come first and then the menu definition

If you are new to odoo development, see:  Odoo  Development Tutorials

Thanks

形象
丢弃
编写者

I just added the action in wizard and menu item in views.

编写者

No, still on it

最佳答案

This error happens when you have malfunction xml file and in this case that xml file belong to the module 'gb_custom_hr' and the file name is 'menu.xml' . In order to help, i need you to provide the xml file or the whole addons 'gb_custom_hr' sir. I'll trouble shot for you.

形象
丢弃
编写者

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<menuitem id="menu_employee_reporter" name="Reports" parent="hr.menu_hr_root" sequence="1"/>
<menuitem id="menu_employee_reporting" name="Reports" action="action_report_employment" parent="menu_employee_reporter" sequence="1"/>
</data>
</odoo>

编写者

The provided code is menu.xml in views.

Oh i know where, the error said the xml id 'action_report_employment' has not been found anywhere inside the module 'gb_custom_hr' . Can you search the name 'action_report_employment' in the module or if you need quicik resolve, just give the module via email daiduongnguyen2709@gmail.com sir

编写者

This xml id 'action_report_employment' exists in my wizard

编写者

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_report_employee_form" model="ir.ui.view">
<field name="name">employee.report.wizard.form</field>
<field name="model">employee.details.report.wizard</field>
<field name="arch" type="xml">
<form string="Print Details">
<group>
<group>
<field name="name"/>
</group>
<group>
<field name="date_from"/>
<field name="date_to"/>
</group>
</group>
<footer>
<button name="action_print_report" type="object" string="Print" class="btn-primary"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_report_employment" model="ir.actions.act.window">
<field name="name">Employee Details</field>
<field name="type">ir.actions.act.window</field>
<field name="res_model">employee.details.report.wizard</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_report_employee_form"/>
<field name="target">new</field>
</record>
</odoo>

Ok good, so does it load in manifest ?
it should be something like this in your manifest:
'data': [
'wizard/your wizard xml here',
'views/menu.xml',
],
note because the action is in the wizard xml so it need to load first

编写者

Yes, I just added those in __manifest__.py

So dose it solved, try upgrade the module

编写者

No, still the same issue

You mark the wrong best answer