Skip to Content
Menu
This question has been flagged
3 Replies
5780 Views

 

I'm developing a custom module, I just started coding the view I have a context error with my variables, how can I solve this:
 
record "student_action" model="ir.actions.act_window">
field "name">
student
​field "res_model">
iti.student
record​

menuitem "iti_root" name="iti"/>
menuitem "iti_student_menu"
name="student"
​   parent = "iti_root" action="student_action"/>

and my model is:

from odoo.odoo import models, fields
class ItiStudent(models.Model):
_name ="iti.student"


and the message error is :

odoo.tools.convert.ParseError: while parsing 
file:/e:/odoo/odoo15/custom_moduls/iti/views/iti_student_views.xml:4 Invalid model name 'iti.student' in action definition. View error context: '-no context-'


 I can't find where the problem is.



Avatar
Discard
Best Answer

I have met this same error info by the following mistake...

 for one line in the tree/list view, the typo of "optional" with "option"


field name="state" widget='badge' optional="show"/

this kind of "no hints" error is really hard to debug... I commented out the blocks line by line and finally find the mistake in last line 

Avatar
Discard
Best Answer

Hi,

The error message indicates that there is an issue with the model name in your action definition. The model name should be in the format module_name.model_name.

In XML:
<record model="ir.actions.act_window" id="student_action">
    <field name="name">student</field>
<field name="res_model">iti.student</field>
</record>

<menuitem name="iti" id="iti_root"/>
<menuitem name="student" id="iti_student_menu" parent="iti_root" action="student_action"/>

In Python:
from odoo import models, fields

class ItiStudent(models.Model):
    _name = "iti.student"

Hope it helps

Avatar
Discard
Best Answer

HI,

It seems something wrong with the xml file or with the created model. In order to sort it out, you can do as follows:

* comment/remove the importing of XML files from the manifest file and upgrade your module
* see if you can see the added model in Settings -> Database Structure -> Models
* If not found ensure the files are imported in the init file

* if the model is added to the db, try uncommenting the xml import from manifest and upgrade module.

Sample ir.actions.act_window : https://github.com/odoomates/odooapps/blob/16.0/om_hospital/views/patient_view.xml


Thanks

Avatar
Discard
Related Posts Replies Views Activity
1
May 20
3508
0
Jan 21
1775
1
Dec 23
17127
2
Aug 18
3179
0
Mar 15
4322