This question has been flagged
3 Replies
2202 Views

I downloaded the odoo14 files from GitHub and successfully installed the hr_hodidays app, but when clicking on this app in the menu, the contents of the module cannot be displayed and an error is reported

File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/addons/base/models/ir_http.py", line 237, in _dispatch

    result = request.dispatch()

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/http.py", line 683, in dispatch

    result = self._call_function(**self.params)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/http.py", line 359, in _call_function

    return checked_call(self.db, *args, **kwargs)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/service/model.py", line 94, in wrapper

    return f(dbname, *args, **kwargs)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/http.py", line 347, in checked_call

    result = self.endpoint(*a, **kw)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/http.py", line 912, in __call__

    return self.method(*args, **kw)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/http.py", line 531, in response_wrap

    response = f(*args, **kw)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/addons/web/controllers/main.py", line 1377, in call_kw

    return self._call_kw(model, method, args, kwargs)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/addons/web/controllers/main.py", line 1369, in _call_kw

    return call_kw(request.env[model], method, args, kwargs)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/api.py", line 392, in call_kw

    result = _call_kw_model(method, model, args, kwargs)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/api.py", line 365, in _call_kw_model

    result = method(recs, *args, **kwargs)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/models.py", line 1526, in load_views

    for [v_id, v_type] in views

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/models.py", line 1526, in <dictcomp>

    for [v_id, v_type] in views

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/addons/web/models/models.py", line 220, in fields_view_get

    r = super().fields_view_get(view_id, view_type, toolbar, submenu)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/models.py", line 1614, in fields_view_get

    xarch, xfields = view.postprocess_and_fields(etree.fromstring(result['arch']), model=self._name)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/addons/base/models/ir_ui_view.py", line 851, in postprocess_and_fields

    arch, name_manager = self._postprocess_view(node, model, validate=validate)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/addons/base/models/ir_ui_view.py", line 863, in _postprocess_view

    self.postprocess(node, [], editable, name_manager)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/addons/base/models/ir_ui_view.py", line 963, in postprocess

    self.postprocess(child, current_node_path, node_info['editable'], name_manager)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/addons/base/models/ir_ui_view.py", line 963, in postprocess

    self.postprocess(child, current_node_path, node_info['editable'], name_manager)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/addons/base/models/ir_ui_view.py", line 963, in postprocess

    self.postprocess(child, current_node_path, node_info['editable'], name_manager)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/addons/base/models/ir_ui_view.py", line 958, in postprocess

    transfer_node_to_modifiers(node, node_info['modifiers'], self._context, current_node_path)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/addons/base/models/ir_ui_view.py", line 66, in transfer_node_to_modifiers

    modifiers.update(ast.literal_eval(attrs))

  File "/Users/joy/.pyenv/versions/3.7.3/lib/python3.7/ast.py", line 46, in literal_eval

    node_or_string = parse(node_or_string, mode='eval')

  File "/Users/joy/.pyenv/versions/3.7.3/lib/python3.7/ast.py", line 35, in parse

    return compile(source, filename, mode, PyCF_ONLY_AST)

Exception


The above exception was the direct cause of the following exception:


Traceback (most recent call last):

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/http.py", line 639, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

  File "/Users/joy/Desktop/Internship_test/odoo-14.0/odoo/http.py", line 315, in _handle_exception

    raise exception.with_traceback(None) from new_cause

  File "<unknown>", line 1

    {'invisible': '('holiday_type', '!=', 'employee')'}

                                ^

SyntaxError: invalid syntax


Why does the official file also have errors, I don't know why there are syntax errors, and how do I solve this problem

Avatar
Discard
Author

Thanks for all the answers, now I know how to fix this error, but I thought this error occurs in the unknown file type, and I couldn't find this unknown type file, how can someone tell me how to trace this error? Thanks.

search in your all custom addons by this ({'invisible': '('holiday_type', '!=', 'employee')'})

and just modify it .

Best Answer

you have custom xml code ({'invisible': '('holiday_type', '!=', 'employee')'}) modify it to following :

correct syntax :

'invisible': [('holiday_type', '!=', 'employee')]

Avatar
Discard
Best Answer

Hello @Joy

Hope you are doing well.

If the issue is related to the syntax of  {'invisible': '('holiday_type', '!=', 'employee')'}

then there are 2 problems :

1. The value tuple is in single quotes which makes it a string so remove it.

2. Normally we write domain inside a list format so you can enclose your domain tuple in the list.

Eg:

{'invisible': [ ('invoice_without_email', '=', False)]}

So your final code line should be {'invisible': [('holiday_type', '!=', 'employee')]}

Regards,

Thanks

Regards,


   

Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

Avatar
Discard
Best Answer

Hi,

The issue is with your syntax, 

attrs="{'invisible':[('holiday_type','!=','employee')]}"

Hope it helps,

Kiran 

Avatar
Discard