1
0
forked from erp-dev/erp

feat: added area field into shipments model

This commit is contained in:
2026-01-16 17:58:17 +08:00
parent 2e0b7dc335
commit c73014f69c
7 changed files with 123 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shipment', '0007_add_remark_to_external_finished_product'),
]
operations = [
migrations.AddField(
model_name='shipment',
name='area',
field=models.CharField(blank=True, default='', help_text='出货地区(可空字符串)', max_length=30, verbose_name='地区'),
),
]

View File

@@ -127,6 +127,14 @@ class Shipment(ModelBase):
verbose_name='出货日期',
help_text='实际出货日期'
)
area = models.CharField(
max_length=30,
blank=True,
default='',
verbose_name='地区',
help_text='出货地区(可空字符串)',
)
remark = models.TextField(
blank=True,

View File

@@ -49,6 +49,7 @@ def create_shipment(
sales_item_ids: List[int],
created_by,
remark: str = '',
area: str = '',
) -> Shipment:
"""
创建出货单并关联销售品
@@ -104,6 +105,7 @@ def create_shipment(
merchant=merchant,
customer=customer,
shipment_date=shipment_date,
area=(area or '').strip(),
remark=remark,
created_by=created_by,
)
@@ -125,6 +127,7 @@ def create_external_shipment(
external_finished_products: List[dict],
created_by,
remark: str = '',
area: str = '',
) -> Shipment:
"""
创建出货单external 版),并批量写入外部成品表并关联到出货单。
@@ -160,6 +163,7 @@ def create_external_shipment(
merchant=merchant,
customer=customer,
shipment_date=shipment_date,
area=(area or '').strip(),
remark=remark,
created_by=created_by,
external_id=external_id,