Friday 6 August 2021

How to create a dynamic selection field in Odoo?

I was trying to create a dynamic selection field based on conditions

x_material_orientation = fields.Selection(selection='_product_customer_uom_change',string='Material Orientation')

def _product_customer_uom_change(self):
        for rec in self:
            if rec.x_order_customer_uom.name == 'sht':
                return [('sheetfaceup','Sheets Face Up'),('sheetfacedown','Sheets Face Down')]
               
            elif rec.x_order_customer_uom.name == 'yds':
                return [('windfaceout','Wind Face Out'),('windfacein','Wind Face In')]

This would work this way? It is not working as of now. Any suggestion would be of great help!!



from How to create a dynamic selection field in Odoo?

No comments:

Post a Comment