mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-03 22:55:43 +00:00 
			
		
		
		
	Add metadata mixin to Part and PartCategory models
This commit is contained in:
		
							
								
								
									
										23
									
								
								InvenTree/part/migrations/0076_auto_20220516_0819.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								InvenTree/part/migrations/0076_auto_20220516_0819.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
# Generated by Django 3.2.13 on 2022-05-16 08:19
 | 
			
		||||
 | 
			
		||||
from django.db import migrations, models
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Migration(migrations.Migration):
 | 
			
		||||
 | 
			
		||||
    dependencies = [
 | 
			
		||||
        ('part', '0075_auto_20211128_0151'),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    operations = [
 | 
			
		||||
        migrations.AddField(
 | 
			
		||||
            model_name='part',
 | 
			
		||||
            name='metadata',
 | 
			
		||||
            field=models.JSONField(blank=True, help_text='JSON metadata field, for use by external plugins', null=True, verbose_name='Plugin Metadata'),
 | 
			
		||||
        ),
 | 
			
		||||
        migrations.AddField(
 | 
			
		||||
            model_name='partcategory',
 | 
			
		||||
            name='metadata',
 | 
			
		||||
            field=models.JSONField(blank=True, help_text='JSON metadata field, for use by external plugins', null=True, verbose_name='Plugin Metadata'),
 | 
			
		||||
        ),
 | 
			
		||||
    ]
 | 
			
		||||
@@ -46,29 +46,29 @@ from common.models import InvenTreeSetting
 | 
			
		||||
 | 
			
		||||
from InvenTree import helpers
 | 
			
		||||
from InvenTree import validators
 | 
			
		||||
from InvenTree.models import InvenTreeTree, InvenTreeAttachment, DataImportMixin
 | 
			
		||||
from InvenTree.fields import InvenTreeURLField
 | 
			
		||||
from InvenTree.helpers import decimal2string, normalize, decimal2money
 | 
			
		||||
 | 
			
		||||
import InvenTree.ready
 | 
			
		||||
import InvenTree.tasks
 | 
			
		||||
 | 
			
		||||
from InvenTree.fields import InvenTreeURLField
 | 
			
		||||
from InvenTree.helpers import decimal2string, normalize, decimal2money
 | 
			
		||||
from InvenTree.models import InvenTreeTree, InvenTreeAttachment, DataImportMixin
 | 
			
		||||
from InvenTree.status_codes import BuildStatus, PurchaseOrderStatus, SalesOrderStatus
 | 
			
		||||
 | 
			
		||||
import common.models
 | 
			
		||||
from build import models as BuildModels
 | 
			
		||||
from order import models as OrderModels
 | 
			
		||||
from company.models import SupplierPart
 | 
			
		||||
import part.settings as part_settings
 | 
			
		||||
from stock import models as StockModels
 | 
			
		||||
 | 
			
		||||
import common.models
 | 
			
		||||
 | 
			
		||||
import part.settings as part_settings
 | 
			
		||||
from plugin.models import MetadataMixin
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
logger = logging.getLogger("inventree")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class PartCategory(InvenTreeTree):
 | 
			
		||||
class PartCategory(MetadataMixin, InvenTreeTree):
 | 
			
		||||
    """ PartCategory provides hierarchical organization of Part objects.
 | 
			
		||||
 | 
			
		||||
    Attributes:
 | 
			
		||||
@@ -327,7 +327,7 @@ class PartManager(TreeManager):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@cleanup.ignore
 | 
			
		||||
class Part(MPTTModel):
 | 
			
		||||
class Part(MetadataMixin, MPTTModel):
 | 
			
		||||
    """ The Part object represents an abstract part, the 'concept' of an actual entity.
 | 
			
		||||
 | 
			
		||||
    An actual physical instance of a Part is a StockItem which is treated separately.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user