Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

newbie ask for help about module development?

By
Lance
on 5/8/14, 7:03 AM 1,116 views

An exception occurred while I'm trying to write my module.

This is a part of my .py file:

class classroom(osv.osv):
    _name = 'course.classroom'
    _description = 'Classrooms'
    columns = {
               'building' : fields.char('Building', size=64, required=True),
               'room_num' : fields.char('Room Number', size=64, required=True),
               'seats' : fields.integer(string='Seats', required=True), }

And this for view.xml file:

<record model="ir.ui.view" id="course_classroom_form">
    <field name="name">Classroom</field>
    <field name="model">course.classroom</field>
    <field name="arch" type="xml">
        <form string="Classroom" >
            <field name="building" />
            <field name="room_num" />
            <field name="seats" />
        </form>
    </field>
</record>

When I install the module, it prompt the message below:

ParseError: "ValidateError The field(s) arch, model failed against a constraint: The model name does not exist or the view architecture cannot be rendered." while parsing file:///D:/Work%20Files/Project%20Files/workspace/openerp-8.0dev-20131208-000101/openerp/addons/course/course_view.xml:5, near <record model="ir.ui.view" id="course_classroom_form"> <field name="name">Classroom</field> <field name="model">course.classroom</field> <field name="arch" type="xml"> <form string="Classroom"> <field name="building"/> <field name="room_num"/> <field name="seats"/> </form> </field> </record>

I couldn't figure it out after spending a lot of time, could anyone help me? Thank u.

1

Nehal

--Nehal--
2090
| 5 2 8
Ahmadabad, India
--Nehal--
Nehal
On 5/8/14, 7:11 AM

Hi,

Try to do the following:

In py file :

class classroom(osv.osv):
    _name = 'course.classroom'
    _description = 'Classrooms'
    _columns = {
               'building' : fields.char('Building', size=64, required=True),
               'room_num' : fields.char('Room Number', size=64, required=True),
               'seats' : fields.integer(string='Seats', required=True), }
classroom()

In xml file:

<record model="ir.ui.view" id="course_classroom_form">
    <field name="name">Classroom</field>
    <field name="model">course.classroom</field>
    <field name="arch" type="xml">
        <form string="Classroom" >
            <field name="building" />
            <field name="room_num" />
            <field name="seats" />
        </form>
    </field>
</record>

You can also refer the following links: http://www.ibcscorp.com/openerp-custom-module-development-quick-start-guide/ or https://doc.openerp.com/v6.1/developer/03_modules_1/ or https://accounts.openerp.com/forum/Help-1/question/16336

Thanks for help, I've added "classroom()" to the py file, but it still prompt the same error. My heart broken T T.

Lance
on 5/8/14, 7:22 AM

Have you restarted the server? The changes of py file always needs to restart server, and changes in xml file needs to upgrade of module.

Nehal
on 5/8/14, 7:35 AM

maybe I forgot the "_" before "columns", = = what a shame... I'll try again, thank u.

Lance
on 5/8/14, 7:39 AM

That's it!!! Sorry for wasting your time.And thanks a lot.

Lance
on 5/8/14, 7:44 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 5/8/14, 7:03 AM
Seen: 1116 times
Last updated: 3/16/15, 8:10 AM