Skip to Content
Menu
This question has been flagged
2 Replies
1108 Views

I just started venturing into the wonderful world of Odoo module programming, and working throught the tutorials.


When I make a mistake in the XML though, I get quite cryptic error messages, for example (not to mention the extensive backtraces that are not very useful for a beginner):


2024-01-17 15:01:35,403 4115 WARNING bf odoo.tools.convert: /home/bf/odoo/extra-addons/estate/views/estate_property_type_views.xml:3:0:ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element odoo has extra content: record
(...a lot of backtracing...)
AssertionError: Element odoo has extra content: record, line 3


While the problem was, that i had a right after the , on a completely different line number.


Is there some way to check the XMLs, or have more descriptive error messages?

Avatar
Discard
Best Answer

Hi Bart.
The trick for "decrypting" the error messages independently of the platform or language you are using, is to always take a slow look at the message and find out which is the reference that originated the error, and ignore the rest of the stack. 

Some tricks you might use for quickly finding the origin of an error:
Give preference when a file you are working on, instead of other framework or language files in the error stack.

Usually the error comes in "waves" (or stacks), and the code that causes the error is often at the end of those stacks, or near the end. When a piece of code is not understood by the compiler or the parser, a property is missing, or the object type is not what should be expected by a following function or action.

Also, look closely at line numbers after each error. Those lines can pinpoint the exact location of the error when it originated in a specific location, or in case it is an error that comes from somewhere else, you can backtrace to the faulty code that originated the error, issue with properties, either bad names or missing values, etc. 

Use print to your advantage. In case you are not sure why there is an error, use a print command to output the values before the error occurs, that way, you can check if some expected value, or model is not working properly.

An advanced way of doing this is using debug mode on your Code editor. This allows you to stop the application anywhere and lets you look up every variable and object that is loaded into memory, and which values they hold.
This is particularly useful when you are developing functions or actions and you are not sure if your values are being passed to the function properly, or if there is any issue during the action. 

Avatar
Discard
Best Answer

Hi,

When we derive a non-attribute in fields, this issue happens.

 For more details please check the below blog:

 https://www.cybrosys.com/blog/how-to-fix-the-common-errors-in-odoo-16


Hope it helps

Avatar
Discard
Related Posts Replies Views Activity
1
Dec 24
1134
1
Jul 24
1679
1
Jan 24
4644
1
Mar 24
4254
0
Jul 23
1787