1
0
forked from erp-dev/erp

feat: added some filed to shipment serializers

This commit is contained in:
2026-04-23 17:51:48 +08:00
parent 35a03218d8
commit d4fbb2c7fe
11 changed files with 287 additions and 1 deletions

View File

@@ -28,6 +28,9 @@ from shipment.models import (
from shipment.signals import shipment_created
UNSET = object()
def _resolve_user_merchant(user):
emp = getattr(user, "employee", None)
return getattr(emp, "merchant", None) if emp else None
@@ -405,6 +408,7 @@ def create_shipment_delivery(
contact_phone: str = "",
vehicle_capacity: str = "",
shipment_ids: list[int],
shipment_order_ids: list | None = None,
created_by,
remark: str = "",
internal_remark: str = "",
@@ -434,6 +438,7 @@ def create_shipment_delivery(
vehicle_capacity=(vehicle_capacity or "").strip(),
remark=(remark or "").strip(),
internal_remark=(internal_remark or "").strip(),
shipment_order_ids=shipment_order_ids,
created_by=created_by,
operator=operator,
)
@@ -453,6 +458,7 @@ def update_shipment_delivery(
contact_phone: str | None = None,
vehicle_capacity: str | None = None,
shipment_ids: list[int] | None = None,
shipment_order_ids=UNSET,
remark: str | None = None,
internal_remark: str | None = None,
operator=None,
@@ -481,6 +487,9 @@ def update_shipment_delivery(
if internal_remark is not None:
delivery.internal_remark = (internal_remark or "").strip()
if shipment_order_ids is not UNSET:
delivery.shipment_order_ids = shipment_order_ids
if shipment_ids is not None:
shipments = _resolve_delivery_shipments(
shipment_ids=shipment_ids,