Skip to Content
Menu
This question has been flagged
1 Reply
2257 Views
odoo.tools.convert.ParseError: "Error while validating constraint

Field `roll_no` does not exist

Error context:
View `school.new`
[view_id: 516, xml_id: n/a, model: ir.module.module, parent_id: n/a]
None" while parsing /home/ahmed/Documents/odoo/addons/HelloModule/views/school.xml:3, near
<record id="school_from_view" model="ir.ui.view">
<field name="name">school.new</field>
<field name="model">ir.module.module</field>
<field name="arch" type="xml">
<form>
<sheet>
<form>

<field name="name"/>
<field name="roll_no"/>
<field name="divison"/>
</form>
</sheet>
</form>
</field>
</record>

moedels/__init__.py

from . import classroom

models/classroom.py

from . import api,fields,models
class SchoolNew(models.Model):    
    _name= 'school.new'    
    name = fields.Char(string="Name")    
    roll_no = fields.Interger('Rollno')        
    divison = fields.Char('div')        

views/school.xml


<?xml version="1.0" encoding="utf-8"?><odoo>    <record id="school_from_view" model="ir.ui.view">        <field name="name">school.new</field>        <field name="model">ir.module.module</field>        <field name="arch" type="xml">        <form>            <sheet>                <form>
<field name = "name"/> <field name = "roll_no"/> <field name = "divison"/> </form> </sheet> </form> </field> </record> <record id="school_action_new" model="ir.actions.act_window"> <field name="name">School.new</field> <field name="res_model">schoolNew</field> <field name="view_type">form</field> <field name="view_mode">form</field> </record> <menuitem name="School" id="menu_school"/> <menuitem name = "classroom" parent="menu_school" action = "school_action_new" id="menu_classroom"/> </odoo>











Avatar
Discard
Best Answer

Hi,

The error message says that the field you have used in the xml/views is not defined in the corresponding model. but in your case the field can be seen in the python file. So the issue might be you haven't restarted the service after adding the new field. So please restart the odoo service and see whether you have the same error.


Thanks

Avatar
Discard