Domanda

I'm new to OpenERP for a week now and I've been working on a module that I wanted to add into OpenERP.

This is a part of the module I'm working on:

class vehicle_details(osv.osv):
_name = "work_order.vehicle_details"
_description = "Vehicle Details"
_columns = {
    'vehicle_name' : fields.char("Vehicle Name", size=128),
    'vehicle_gps_id' : fields.char("Vehicle GPS ID", size=128),
    'vehicle_available' : fields.boolean ("Available"),
    'vehicles_id' : fields.many2one("work_order.vehicles", "Vehicles ID", ondelete="no action")
}

class vehicles(osv.osv):
_name = "work_order.vehicles"
_description = "Vehicles"
_columns = {
    'vehicles_type' : fields.char("Vehicle Type", size=128),
    'vehicles_total' : fields.integer("Total Vehicles", readonly=True),
    'vehicles_amount' : fields.integer("Vehicles Amount Available"),
    'unit_of_measure' : fields.char("UoM", size=64),
    'vehicles_package_details_id' : fields.one2many("work_order.vehicles_package_details", "vehicles_id", "Package Details ID")
}

class vehicles_package(osv.osv):
_name = "work_order.vehicles_package"
_description = "Vehicles Package"
_columns = {
    'vehicles_until_date' : fields.datetime("Until Date"),
    'vehicles_package_description' : fields.text("Package Description"),
    'vehicles_package_details_id' : fields.one2many("work_order.vehicles_package_details", "vehicles_package_id", "Package Details ID"),
    'vehicles_package_total' : fields.integer("Package Total")
}

class vehicles_package_details(osv.osv):
_name = "work_order.vehicles_package_details"
_description = "Vehicles Package Details"
_column = {
    'vehicles_id' : fields.many2one("work_order.vehicles", "Vehicles ID", ondelete="no action"),
    'vehicles_package_id' : fields.many2one("work_order.vehicles_package", "Package ID", ondelete="no action"),
    'vehicles_details_total' : fields.integer("Details Total")
}

class lem_package(osv.osv):
_name = "work_order.lem_package"
_description = "LEM Package"
_columns = {
    'work_order_id' : fields.many2one("work_order.work_order", "Work Order ID", ondelete="no action"),
    'clab_package_id' : fields.many2one("work_order.clab_package", "Contract Labour Package ID", ondelete="no action"),
    'equip_package_id' : fields.many2one("work_order.equip_package", "Equipment Package ID", ondelete="no action"),
    'materials_package_id' : fields.many2one("work_order.materials_package", "Materials Package ID", ondelete="no action"),
    'vehicles_package_id' : fields.many2one("work_order.vehicles_package", "Vehicles Package ID", ondelete="no action"),
    'hr_package_id' : fields.many2one("work_order.hr_package", "HR Package ID", ondelete="no action") #connect to HR app
}

'vehicle_details' detailing each and every single vehicle as a list, can have only one 'vehicles' type.

'vehicles_package_details' is a middle table between 'vehicles' and 'vehicles' in a many2many relationship broken (normalized) down.

each 'vehicles' can have many 'vehicles_package_details'

each 'vehicles_package' can have many 'vehicles_package_details'

many 'lem_package' can have a single 'vehicles_package'

So far the error I've been getting is this error:

"Programming Error There is no reference field 'vehicles_id' found for 'work_order.vehicles_package_details'"

every time I added a bit of complexity of the relationship and try to install this module in OpenERP.

Is there something wrong with the relationship or any missing content that needed to add or misspelled some words?

I tried re-installing OpenERP and module/reload db/refresh... I'm stumped right now.

Thanks =)

È stato utile?

Soluzione

on your vehicles_package_details is a mistake i do sooooo often ^^

_column = <--- _columns <-- the s at the end

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top