Hello! I'm working on a ticket reservation and selling system based on tryton 3.8.
As discussed with pokoli on #tryton, my model is quite special because i have two one2many-relations towards ticket.ticket (one from ticket.reservation and one from ticket.sale). The goal was to get all tickets of a reservation into a sale with the following on_change function (the number of tickets in the system should be kept constant). The problem is, that with this piece of code the number of reserved ticket is newly created, so if i select a reservation with tickets id:162 and id:163 it creates me two new empty tickets instead of updating the reserved ones... Here is the code: class Ticketsale(ModelSQL, ModelView): """ Ticket sale """ __name__ = 'ticket.sale' receipt_number = fields.Char('Receipt number', readonly=True, select=True) pos_create_date = fields.DateTime('Create date', readonly=True) reservation = fields.Many2One('ticket.reservation', 'Reservation') voucher = fields.Many2One('ticket.voucher', 'Voucher') tickets = fields.One2Many('ticket.ticket', 'sale', "Tickets") @fields.depends('reservation','tickets') def on_change_reservation(self): if self.reservation: tkts = list(self.tickets) for t in self.reservation.tickets: tkts.append(t) self.tickets = tuple(tkts) I already found another solution with the use of a button. Just wanted to know (btw pokoli too) if the behaviour of tryton is correct in that (indeed very special and uncommon) case. Kind regards, Clemens Hupka. -- You received this message because you are subscribed to the Google Groups "tryton-dev" group. To view this discussion on the web visit https://groups.google.com/d/msgid/tryton-dev/675c1ae1-becd-4036-8efb-a704942baf9a%40googlegroups.com.