II have 2 models: CinemaSeat and BookingTicket. Here are my code:
class CinemaSeat(models.Model):
_name = 'cinema.seat'
seat_number = fields.Integer("Seat Number")
movie = fields.Char("Movie name")
date = fields.Date("Performance date")
status = fields.Selection([("1", "empty"), ("2", "reserved")])
booking_ids = fields.One2many("booking.ticket", "booking_seat", string="Booking ID")
class BookingTicket(models.Model):
_name = 'booking.ticket'
id = fields.Char("Booking ID")
name = fields.Char("Customer name")
mobile = fields.Char("Mobile number")
booking_seat = fields.Many2one("cinema.seat", string="Seat ID")
How to show two different values in many2one field in Odoo: https://goo.gl/8tYbcU