forked from erp-dev/erp
feat: new field for SalesItem model
This commit is contained in:
@@ -5,7 +5,7 @@ from .models import Shipment, SalesItem
|
|||||||
class SalesItemInline(admin.TabularInline):
|
class SalesItemInline(admin.TabularInline):
|
||||||
model = SalesItem
|
model = SalesItem
|
||||||
extra = 1
|
extra = 1
|
||||||
fields = ['name', 'quantity', 'unit', 'printing_job_id', 'customer_id', 'created_by']
|
fields = ['name', 'quantity', 'unit', 'position', 'remark', 'printing_job_id', 'customer_id', 'created_by']
|
||||||
readonly_fields = ['created_by']
|
readonly_fields = ['created_by']
|
||||||
|
|
||||||
|
|
||||||
@@ -38,9 +38,9 @@ class ShipmentAdmin(admin.ModelAdmin):
|
|||||||
|
|
||||||
@admin.register(SalesItem)
|
@admin.register(SalesItem)
|
||||||
class SalesItemAdmin(admin.ModelAdmin):
|
class SalesItemAdmin(admin.ModelAdmin):
|
||||||
list_display = ['id', 'name', 'quantity', 'unit', 'shipment_status', 'printing_job_id', 'customer_id', 'created_by', 'created_at']
|
list_display = ['id', 'name', 'quantity', 'unit', 'position', 'shipment_status', 'printing_job_id', 'customer_id', 'created_by', 'created_at']
|
||||||
list_filter = ['unit', 'created_at', ('shipment', admin.EmptyFieldListFilter)]
|
list_filter = ['unit', 'created_at', ('shipment', admin.EmptyFieldListFilter)]
|
||||||
search_fields = ['name', 'shipment__customer__name']
|
search_fields = ['name', 'shipment__customer__name', 'position', 'remark']
|
||||||
readonly_fields = ['created_at', 'updated_at', 'created_by']
|
readonly_fields = ['created_at', 'updated_at', 'created_by']
|
||||||
raw_id_fields = ['shipment']
|
raw_id_fields = ['shipment']
|
||||||
|
|
||||||
|
|||||||
23
shipment/migrations/0003_salesitem_position_remark.py
Normal file
23
shipment/migrations/0003_salesitem_position_remark.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Generated by Django 5.2.8 on 2026-01-13 11:07
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('shipment', '0002_salesitem_shipment_nullable'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='salesitem',
|
||||||
|
name='position',
|
||||||
|
field=models.CharField(blank=True, default='', max_length=200, verbose_name='货位'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='salesitem',
|
||||||
|
name='remark',
|
||||||
|
field=models.CharField(blank=True, default='', max_length=200, verbose_name='备注'),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -115,6 +115,20 @@ class SalesItem(ModelBase):
|
|||||||
help_text='销售品级别的客户ID(可空)'
|
help_text='销售品级别的客户ID(可空)'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
position = models.CharField(
|
||||||
|
max_length=200,
|
||||||
|
blank=True,
|
||||||
|
default='',
|
||||||
|
verbose_name='货位'
|
||||||
|
)
|
||||||
|
|
||||||
|
remark = models.CharField(
|
||||||
|
max_length=200,
|
||||||
|
blank=True,
|
||||||
|
default='',
|
||||||
|
verbose_name='备注'
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'sales_item'
|
db_table = 'sales_item'
|
||||||
verbose_name = '销售品'
|
verbose_name = '销售品'
|
||||||
|
|||||||
Reference in New Issue
Block a user