Add restart vps in portal

This commit is contained in:
Mario
2024-08-04 23:45:11 +02:00
parent b79dbe4708
commit da325f0c79
5 changed files with 26 additions and 1 deletions

View File

@@ -89,7 +89,11 @@ class VPSServer(models.Model):
status = self._proxmox_request('GET', f'nodes/pve/{vm_type}/{vm_id}/status/current')
server.state = 'running' if status['data']['status'] == 'running' else 'stopped'
def action_restart_from_portal(self):
self.ensure_one()
if self.env.user.partner_id != self.customer_id:
raise AccessError(_("You don't have permission to restart this VPS."))
return self.action_reboot()
def action_fetch_proxmox_data(self):
self.ensure_one()