Odoo API constraints

odoo
@api.constrains('ir_actions_server_ids')
​def _check_ir_actions_server_ids(self):
​"""
​Constraint to choose actions only for templates
​"""
​for config in self:
​not_temp = config.ir_actions_server_ids.filtered(lambda action: action.model_id.model != "product.template")
​if not_temp:
​raise UserError(_('One of the actions you selected does not relate to product template. Please fix'))

Illustration: Real code example