fix(itam): Model software must be related linked to organization model

ref: #833 #820
This commit is contained in:
2025-06-16 15:48:32 +09:30
parent 2027f3fe97
commit ded80d4a8c
3 changed files with 45 additions and 2 deletions

View 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",
),
),
]

View File

@ -1,6 +1,7 @@
from django.db import models
from access.fields import AutoLastModifiedField
from access.models.tenant import Tenant
from core.models.centurion import CenturionModel
from core.models.manufacturer import Manufacturer
@ -117,6 +118,19 @@ class Software(
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(
Manufacturer,
blank= True,

View File

@ -1139,8 +1139,7 @@ markers = [
"model_ticketcommentcategory: Select all ticket comment category tests.",
"models: Selects all models tests.",
"model_tenant: Select all Tentant model tests.",
"model_ticketcategory: Select all Ticket Categeory tests.",
"model_ticketcommentcategory: select all ticket comment category tests.",
"model_usersettings: Select tests for model User Settings.",
"module_access: Selects all tests from module access.",
"module_accounting: Selects all tests from module accounting.",
"module_api: Selects all tests from module api.",