콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
7239 화면

 

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.



아바타
취소
베스트 답변

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 

아바타
취소
베스트 답변

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

아바타
취소
베스트 답변

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

아바타
취소
관련 게시물 답글 화면 활동
1
5월 20
3938
0
1월 21
2231
1
12월 23
17947
2
8월 18
3797
0
3월 15
4985