forked from erp-dev/erp
fix: process id change when plate_order and printing_order update
This commit is contained in:
@@ -93,7 +93,7 @@ python manage.py backfill_merchant <merchant_id>
|
||||
|
||||
在 `settings.py` 中添加 `AUTO_CREATE_SALESITEM_FROM_PRINT_ORDER` 配置项:
|
||||
|
||||
- **默认值**: `True`(保持现有行为)
|
||||
- **默认值**: `False`(默认关闭,避免未确认流程就自动落库)
|
||||
- **环境变量**: `AUTO_CREATE_SALESITEM_FROM_PRINT_ORDER`
|
||||
- **作用**: 当设为 `False` 时,`printing/handlers.py` 中的流程完成信号处理器将不再自动创建销售品
|
||||
|
||||
@@ -103,6 +103,15 @@ python manage.py backfill_merchant <merchant_id>
|
||||
|
||||
---
|
||||
|
||||
### 6.1. 强制从 .env 读取 PRINTING_SALES_ITEM_SOURCE_STATE_ID(无默认值)
|
||||
|
||||
为避免遗漏配置导致“取错工序参数”,将 `PRINTING_SALES_ITEM_SOURCE_STATE_ID` 改为必须在 `.env` 中显式配置(不提供默认值)。
|
||||
|
||||
#### 修改文件
|
||||
- `flower/settings.py`: `PRINTING_SALES_ITEM_SOURCE_STATE_ID = env.int('PRINTING_SALES_ITEM_SOURCE_STATE_ID')`
|
||||
|
||||
---
|
||||
|
||||
### 7. Printing 模块客户可见性过滤
|
||||
|
||||
实现了基于客户可见性的订单查询过滤功能,确保员工只能看到自己负责的客户的订单。
|
||||
@@ -152,7 +161,15 @@ python manage.py backfill_merchant <merchant_id>
|
||||
- `shipment/migrations/0005_fix_shipment_external_finished_product_relation.py`(修正关系方向:Shipment 1→N ExternalFinishedProduct)
|
||||
|
||||
#### 测试
|
||||
- 运行 `api_v1.views.shipment.test_api`:13 个测试通过
|
||||
- 运行 `api_v1.views.shipment.test_api`:17 个测试通过
|
||||
|
||||
---
|
||||
|
||||
### 8.1. Admin 支持(Shipment)
|
||||
|
||||
补齐 Shipment 模块在 Django Admin 中的可用性,便于测试/排查数据:
|
||||
|
||||
- `shipment/admin.py`: 注册 `Shipment`、`SalesItem` 并提供基础展示/筛选字段
|
||||
|
||||
---
|
||||
|
||||
@@ -182,7 +199,15 @@ python manage.py backfill_merchant <merchant_id>
|
||||
#### merchant 强制归属(非空)
|
||||
- 为 `Shipment` 与 `SalesItem` 增加 `merchant` 外键且不允许为空
|
||||
- 创建时从 `request.user.employee.merchant` 自动绑定,并校验 customer 同商户
|
||||
- 普通版在关联销售品时校验销售品同商户,避免跨商户关联
|
||||
- 普通版在关联销售品时校验销售品同商户,避免跨商户关联(不一致则报错并回滚)
|
||||
- printing 流程完成自动创建 `SalesItem` 时增加 merchant 推导兜底(job → order → operator),避免 merchant 为空导致创建失败
|
||||
|
||||
#### Migration
|
||||
- `shipment/migrations/0006_add_merchant_to_shipment_and_salesitem.py`
|
||||
- 先以可空字段落库 → RunPython 补齐 → 再改为 `null=False`(避免 makemigrations 交互式默认值)
|
||||
|
||||
#### 响应字段补充
|
||||
- Shipment 响应增加 `merchant_id` / `merchant_name`(便于前端展示/二次校验)
|
||||
|
||||
#### 文档
|
||||
- `docs/shipment_api.md`: 补充 external create API 文档
|
||||
@@ -197,4 +222,4 @@ python manage.py backfill_merchant <merchant_id>
|
||||
|
||||
- API 独立于 printing 模块,避免影响现有功能
|
||||
- 完整的测试覆盖:正常查询、包含已出货、数据格式、404 错误、空结果、未认证
|
||||
- printing 和 shipment 模块全部测试通过(共 13 个测试用例)
|
||||
- printing 和 shipment 模块相关测试通过(`api_v1.views.shipment.test_api` 共 17 个用例)
|
||||
|
||||
Reference in New Issue
Block a user