This question has been flagged
1 Reply
3688 Views

Hi,i'm trying to modify the fleet module of openerp 7 I added a new class: transport.point but i have this error : Integrity Error

The operation cannot be completed, probably due to the following: - deletion: you may be trying to delete a record while other records still reference it - creation/update: a mandatory field is not correctly set

[object with reference: license_plate - license.plate]

even if i didn't linked this class with the fleet.vehicle

file.py

class fleet_vehicle(osv.osv):

_name = 'fleet.vehicle'
_inherit='fleet.vehicle'
_columns = {
  'type':fields.selection([('ci','C.I'), ('fourgon','Fourgon'),('fourgonnette','Fourgonnette'),('minibus','Mini-bus'),('pickup','Pick-up'),('poidslourds','Poids Lourds'),('vfonction','V.fonction')],'Type'),
  'chauffeur': fields.many2one('hr.employee', 'Chauffeur',required=True),
  'name': fields.char('Nom du point', size=50, required=True),
  'amount': fields.float('Montant'),
}

fleet_vehicle()

class transport_point(osv.osv):
_name = 'transport.point'
     _inherit="fleet.vehicle"
_columns = {
    'name': fields.char('Nom du point', size=50, required=True),
    'amount': fields.float('Montant'),
}
_defaults={
    'amount': 0,
}

transport_point()

Avatar
Discard
Best Answer

Hi,

you have installed a base with demo data and you deleted a mandatory data.This error has no relation in your new class transport.point. To solve the problem :

1°-upgrade module fleet : settings>>Installed Modules>>Fleet Management>>upgrade

or

2°-create a new database.

Avatar
Discard
Author

Hi,I tried both options and i still have the same error;any other idea?

try to use a new database . should it work.

Author

i create a new database and i still have this error...

So you changed the original code a module fleet, use the original code of module fleet and should it work.

Author

yes i updated the module fleet.vehicle but i didn't erase the field license_plate and i just added 2 fields in the module fleet.vehicle

Author

it work's now;i erased the _inherit="fleet.vehicle" from the trannsport.point module

but in the code transport_point does not exist _inherit="fleet.vehicle"

Author

I update the question;thank's