fix(itam): Model software must be related linked to organization model
ref: #833 #820
This commit is contained in:
30
app/itam/migrations/0024_alter_software_organization.py
Normal file
30
app/itam/migrations/0024_alter_software_organization.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Generated by Django 5.1.9 on 2025-06-16 06:10
|
||||||
|
|
||||||
|
import access.models.tenancy_abstract
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("access", "0016_remove_tenant_slug_alter_tenant_manager_and_more"),
|
||||||
|
("itam", "0023_remove_softwareversion_is_global_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="software",
|
||||||
|
name="organization",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
help_text="Tenant this belongs to",
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
related_name="software",
|
||||||
|
to="access.tenant",
|
||||||
|
validators=[
|
||||||
|
access.models.tenancy_abstract.TenancyAbstractModel.validatate_organization_exists
|
||||||
|
],
|
||||||
|
verbose_name="Tenant",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
@ -1,6 +1,7 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from access.fields import AutoLastModifiedField
|
from access.fields import AutoLastModifiedField
|
||||||
|
from access.models.tenant import Tenant
|
||||||
|
|
||||||
from core.models.centurion import CenturionModel
|
from core.models.centurion import CenturionModel
|
||||||
from core.models.manufacturer import Manufacturer
|
from core.models.manufacturer import Manufacturer
|
||||||
@ -117,6 +118,19 @@ class Software(
|
|||||||
verbose_name_plural = 'Softwares'
|
verbose_name_plural = 'Softwares'
|
||||||
|
|
||||||
|
|
||||||
|
organization = models.ForeignKey(
|
||||||
|
Tenant,
|
||||||
|
blank = False,
|
||||||
|
help_text = 'Tenant this belongs to',
|
||||||
|
null = False,
|
||||||
|
on_delete = models.CASCADE,
|
||||||
|
related_name = 'software',
|
||||||
|
validators = [
|
||||||
|
CenturionModel.validatate_organization_exists
|
||||||
|
],
|
||||||
|
verbose_name = 'Tenant'
|
||||||
|
)
|
||||||
|
|
||||||
publisher = models.ForeignKey(
|
publisher = models.ForeignKey(
|
||||||
Manufacturer,
|
Manufacturer,
|
||||||
blank= True,
|
blank= True,
|
||||||
|
@ -1139,8 +1139,7 @@ markers = [
|
|||||||
"model_ticketcommentcategory: Select all ticket comment category tests.",
|
"model_ticketcommentcategory: Select all ticket comment category tests.",
|
||||||
"models: Selects all models tests.",
|
"models: Selects all models tests.",
|
||||||
"model_tenant: Select all Tentant model tests.",
|
"model_tenant: Select all Tentant model tests.",
|
||||||
"model_ticketcategory: Select all Ticket Categeory tests.",
|
"model_usersettings: Select tests for model User Settings.",
|
||||||
"model_ticketcommentcategory: select all ticket comment category tests.",
|
|
||||||
"module_access: Selects all tests from module access.",
|
"module_access: Selects all tests from module access.",
|
||||||
"module_accounting: Selects all tests from module accounting.",
|
"module_accounting: Selects all tests from module accounting.",
|
||||||
"module_api: Selects all tests from module api.",
|
"module_api: Selects all tests from module api.",
|
||||||
|
Reference in New Issue
Block a user