I have pre-existing keys in a selection in a contact form. I added new keys using "selection_add" parameter and I wanted to find out what would be the opposite of a selection_add parameter to remove any old keys from a selection.
There isn't any selection_remove
option, unfortunately. You could redefine the field's selection
value entirely, removing the option(s) you don't want.
If a field is defined with:
class ResPartner(models.Model):
_name = 'res.partner'
some_field = fields.Selection(string='Some Field',
selection=[('a', 'A'), ('b', 'B'), ('c', 'C')])
Then you can inherit the class and override the field's selection value
class ResPartner(models.Model):
_inherit = 'res.partner'
some_field = fields.Selection(selection=[('a', 'A'), ('b', 'B')])