This question has been flagged
1 Reply
8587 Views

Hi everyone,i want to modify the fleet module and add a new menuitem but i have this error when i want to add a new field: 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]

myfile.py

class fleet_vehicle_type(osv.osv):
_name = 'fleet.vehicle.type'
_inherit='  fleet.vehicle.model.brand'
_order = 'sequence asc'
_description = 'Type de vehicule'
_columns = {
  'name': fields.char('Type', size=64),
}
fleet_vehicle_type()

my file.xml

  <?xml version="1.0" encoding="utf-8"?>
  <openerp>
    <data>
    <record model='ir.ui.view' id='fleet_vehicle_type_tree'>
        <field name="name">fleet.vehicle.type.tree</field>
        <field name="model">fleet.vehicle.type</field>
        <field name="arch" type="xml">
            <tree string="Types" version="7.0" editable="bottom">
                <field name="name" />
            </tree>
        </field>
    </record>

    <record model='ir.actions.act_window' id='fleet_vehicle_type_act'>
        <field name="name">Type de vehicule</field>
        <field name="res_model">fleet.vehicle.type</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,form</field>
        <field name="help" type="html">
          <p class="oe_view_nocontent_create">
            Click to create a new type.
          </p>
        </field>
    </record>

    <menuitem action="fleet_vehicle_type_act" parent="fleet.fleet_configuration" id="fleet_vehicle_type_menu" groups="base.group_no_one"/>

    </data>
  </openerp>
Avatar
Discard

the error is not caused by adding menu. It seems that a mandatory field is not correctly set

Author

what should i do please?

Best Answer

The field license_plate in model license.plate was removed improperly.

If you added in a custom module, you will have to put back the original python file that references that field, stop/start your sever, update the module, then uninstall the module completely before you can use the new code.

Avatar
Discard