'Sets the value of a parameter.
:param string key: The key of the parameter value to set.
:param string value: The value to set.
:param list of string groups: List of group (xml_id allowed) to read this key.
:return: the previous value of the parameter or False if it did
not exist.
:rtype: string'

@api.model
def set_param(self, key, value, groups=()):

    self._get_param.clear_cache(self)
    param = self.search([('key', '=', key)])
    gids = []
    for group_xml in groups:
        group = self.env.ref(group_xml, raise_if_not_found=False)
        if group:
            gids.append((4, group.id))
        else:
            _logger.warning(('Potential    Security    Issue:    Group    [%s]    is    not    found.' % group_xml))
    vals = {'value': value}
    if gids:
        vals.update(group_ids=gids)
    if param:
        old = param.value
        if ((value is not False) and (value is not None)):
            param.write(vals)
        else:
            param.unlink()
        return old
    else:
        vals.update(key=key)
        if ((value is not False) and (value is not None)):
            self.create(vals)
        return False
