i have one problem , i have one class named as room details and second one is room booking. we can go to book a room by room booking model. I want to create a constraint to it . Problem is that if one person can book one room at one date&time if second person can book that room may be after that time or before that time.previously i askd this question , and there are some answers also i got but i cant figure it out.I cant able to find out the solution fromr that, please help me.
i will give my code
class room_management(osv.Model):
_name = 'room.management'
_columns = {
'name': fields.char('Name',requierd=True, help='Put a Name for your Room example: Interview room,board room,conference Hall...etc '),
'location':fields.char('Location',requierd=True,help="give the location as city name or street name..etc"),
'floar':fields.char('Floor Details',help='Enter the Foar no or name,like Foar 4B6 or somthing should identification'),
'address':fields.text('Address',requierd=True,help='Detailed Address'),
'no_seats':fields.integer('No of Seats',requierd=True,help='Number of seats occupied in this room'),
'room_no':fields.char('Room No',requierd=True,help='Should be unique',),
}
class room_booking(osv.Model):
_name = 'room.booking'
_columns = {
'room_id' : fields.many2one('room.management', string="Room Booking"),
'duration': fields.integer('Duration'),
'reason': fields.char('Reason',requierd=True ,help="short deatails about booking,Example:Simons Hr interview"),
'start': fields.datetime('Start At',requierd=True),
'end': fields.datetime('End At',requierd=True),
}