我是 OpenERP 的新手一个星期了,我一直在研究一个我想添加到 OpenERP 中的模块。
这是我正在处理的模块的一部分:
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' 详细说明每辆车作为一个列表,只能有一个 'vehicles' 类型。
“vehicles_package_details”是“vehicles”和“vehicles”之间的中间表,它的many2many关系被打破(规范化)。
每个“车辆”可以有许多“车辆包装细节”
每个“vehicles_package”可以有许多“vehicles_package_details”
许多“lem_package”可以有一个“vehicles_package”
到目前为止,我得到的错误是这个错误:
"Programming Error There is no reference field 'vehicles_id' found for 'work_order.vehicles_package_details'"
每次我添加一些复杂的关系并尝试在 OpenERP 中安装这个模块。
关系是否有问题或缺少需要添加或拼错某些单词的内容?
我尝试重新安装 OpenERP 和模块/重新加载数据库/刷新...我现在很难过。
谢谢 =)