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

TypeError: The model "fleet.vehicle" specifies an unexisting parent class "fleet.vehicle"

By
oumaima
on 5/22/13, 8:11 AM 2,795 views

Hi, I'm trying to modify the module fleet but i have this error when i try to add a new field: TypeError: The model "fleet.vehicle" specifies an unexisting parent class "fleet.vehicle" You may need to add a dependency on the parent class' module.

I'm working with openerp 7

__openerp.py

    enter code here{
    'name': 'flt',
    'version': '0.1',
    'category': 'Tools',
    'description': """Module gestion de transport""",
    'author': 'Oumaima Hilali',
    'website': 'http://openerp.com',
    'depends': ['mail','fleet'],
    'data': [
         'fleet_view.xml',
    ],
    'demo': [],
    'test':[],
    'installable': True,
    'images': [],
}

fleet.py

class fleet_vehicle(osv.osv):

    _name = 'fleet.vehicle'
    _inherit='fleet.vehicle'
    _columns = {
      'type':fields.char('Type', size=64, required=True),
    }
fleet_vehicle()

fleet_view.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
    <record model="ir.ui.view" id="view_fleet_inherit">
        <field name="name">fleet.vehicle.form.inherit</field>   
        <field name="model">fleet.vehicle</field>
        <field name="type">form</field>
        <field name="inherit_id" ref="fleet.fleet_vehicle_form">form</field>
        <field name="arch" type="xml">
        <field name="model_id" position="after">
          <field name="type" colspan="6"/>
        </field>
        </field>
    </record>               
</record>   
 </data>
</openerp>
0

Borni DHIFI

--Borni DHIFI--
5102
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 

http://www.linkedin.com/in/borni

Skype : dhifi.borni

Borni DHIFI
On 5/22/13, 8:35 AM

Hi,

Everything seems correct i tested your module it works without problem.

1°- remove tag </record> in fleet_view.xml.

2°- in your __init__.py add

import fleet

3°- upgrade your module Settings>>Installed Modules>>flt>>upgrade

yes it work's now..thank you

oumaima
on 5/22/13, 2:23 PM
0
Zainab Barwaniwala
On 1/22/14, 3:32 AM

i too got the same issue: but nothing works tried many forums pls check code

fleet_view

<openerp> <data> <record id="fleet_custom_view" model="ir.ui.view"> <field <="" p="">

name="name">fleet.vehicle.view</field> <field name="model">fleet.vehicle</field> <field <="" p="">

name="inherit_id" ref="fleet.fleet_vehicle_form"> form </field> <field name="arch" type="xml">

<field name="color" position="after"> <field name="registration_no"/> </field>

    </field>    
        </data>

</openerp>

_init_.py import fleet_custom import fleet

solution

fleet_view.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
    <!-- fleet vehicles customisation part/add fields to fleet  management -->
        <record id="fleet_custom_view" model="ir.ui.view">
            <field  name="name">fleet.vehicle.view</field>
            <field name="model">fleet.vehicle</field>
            <field  name="inherit_id" ref="fleet.fleet_vehicle_form"></field>                   
            <field name="arch" type="xml">                      
                    <field name='color' position='after'>
                      <field name="registration_no"/>
                     </field>
            </field>
          </record>        
    </data>
</openerp>

fleet_custom.py

from openerp.osv import fields, osv
class fleet_custom(osv.Model):
    _inherit = 'fleet.vehicle'   
    _columns = {
    'registration_no': fields.char('registration no',),
    }
fleet_custom()

__openerp__.py

{
'name': "fleet custom",
'category': 'fleet',
'depends': ['fleet'],
'data': [ 'fleet_view.xml', ],
'installable': True,
'application': False,
'auto_install': False,
}

_init__.py

import fleet_custom

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/22/13, 8:11 AM
Seen: 2795 times
Last updated: 3/16/15, 8:10 AM