notebook
This commit is contained in:
2
ow_vm_management/models/__init__.py
Normal file
2
ow_vm_management/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import vps_server
|
||||
from . import res_partner
|
||||
BIN
ow_vm_management/models/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
ow_vm_management/models/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
ow_vm_management/models/__pycache__/res_partner.cpython-39.pyc
Normal file
BIN
ow_vm_management/models/__pycache__/res_partner.cpython-39.pyc
Normal file
Binary file not shown.
BIN
ow_vm_management/models/__pycache__/vps_server.cpython-39.pyc
Normal file
BIN
ow_vm_management/models/__pycache__/vps_server.cpython-39.pyc
Normal file
Binary file not shown.
6
ow_vm_management/models/res_partner.py
Normal file
6
ow_vm_management/models/res_partner.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from odoo import models, fields
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
vps_server_ids = fields.One2many('vps.server', 'customer_id', string='VPS Servers')
|
||||
19
ow_vm_management/models/vps_server.py
Normal file
19
ow_vm_management/models/vps_server.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
class VPSServer(models.Model):
|
||||
_name = 'vps.server'
|
||||
_description = 'VPS Server'
|
||||
_inherit = ['portal.mixin', 'mail.thread', 'mail.activity.mixin']
|
||||
|
||||
name = fields.Char(string='Server Name', required=True)
|
||||
ip_address = fields.Char(string='IP Address', required=True)
|
||||
cpu = fields.Integer(string='CPU Cores')
|
||||
ram = fields.Float(string='RAM (GB)')
|
||||
storage = fields.Float(string='Storage (GB)')
|
||||
os = fields.Char(string='Operating System')
|
||||
customer_id = fields.Many2one('res.partner', string='Customer', required=True)
|
||||
|
||||
def _compute_access_url(self):
|
||||
super()._compute_access_url()
|
||||
for server in self:
|
||||
server.access_url = '/my/vps-servers/%s' % server.id
|
||||
Reference in New Issue
Block a user