pythonodooodoo-14

iteratively selecting a subset of a model by select fields in odoo 14


I have a model

I need to provide 4 select fields

The values choosen in the first select field will be used to calculate a subset of the model to show in the second select fiedl

the valued choosen in the second select field will be used to calculate a subset of the model to show in the third select field

and so on

I read returning domains from on_change methods is deprecated in odoo 14

I'm a bit confused

How am I supposed to do this ?


Solution

  • You can still use it this way, for example:

    booking_date = fields.Date(string="Booking date")

    @api.onchange('booking_date') 
        def onchange_booking_date(self):
            if self.booking_date:
                 ...