1
0
forked from erp-dev/erp

fix: added permission for plate_order and printing_order api

This commit is contained in:
2026-01-14 18:14:22 +08:00
parent fae667c965
commit cae0f8434e
17 changed files with 867 additions and 15 deletions

View File

@@ -8,7 +8,7 @@ class PrintingConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'printing'
verbose_name = '印染管理'
def ready(self):
"""注册信号处理函数"""
from stateflow.signals import process_completed

View File

@@ -20,6 +20,7 @@ def on_printing_job_process_completed(sender, **kwargs):
数量和单位从指定的流程节点参数中获取(通过 settings 配置)。
配置项:
AUTO_CREATE_SALESITEM_FROM_PRINT_ORDER: 是否启用自动创建销售品(默认 True
PRINTING_SALES_ITEM_SOURCE_STATE_ID: 指定从哪个 State 获取参数
PRINTING_SALES_ITEM_QUANTITY_KEY: 数量参数的 key
PRINTING_SALES_ITEM_UNIT_KEY: 单位参数的 key
@@ -31,6 +32,11 @@ def on_printing_job_process_completed(sender, **kwargs):
last_completed_by: 最后步骤操作人
其他参数见 stateflow.signals.process_completed
"""
# 检查是否启用自动创建销售品
if not getattr(settings, 'AUTO_CREATE_SALESITEM_FROM_PRINT_ORDER', True):
logger.debug('[printing.handlers] AUTO_CREATE_SALESITEM_FROM_PRINT_ORDER=False跳过销售品创建')
return
from shipment.models import SalesItem, UnitChoices
logger.info(

View File

@@ -0,0 +1,21 @@
# Generated by Django 5.2.8 on 2026-01-14 08:46
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('printing', '0029_add_merchant_to_models'),
]
operations = [
migrations.AlterModelOptions(
name='plateorder',
options={'ordering': ['-created_at'], 'permissions': [('can_invalidate_plateorder', '可以作废开版订单'), ('can_activate_plateorder', '可以恢复开版订单'), ('view_all_plateorders', '查看所有开版订单(突破客户可见性限制)')], 'verbose_name': '开版订单', 'verbose_name_plural': '开版订单'},
),
migrations.AlterModelOptions(
name='printingorder',
options={'permissions': [('can_invalidate_printingorder', '可以作废印染订单'), ('can_activate_printingorder', '可以恢复印染订单'), ('view_all_printingorders', '查看所有印染订单(突破客户可见性限制)')], 'verbose_name': '印染订单', 'verbose_name_plural': '印染订单'},
),
]

View File

@@ -185,6 +185,7 @@ class PlateOrder(ModelBase):
permissions = [
('can_invalidate_plateorder', '可以作废开版订单'),
('can_activate_plateorder', '可以恢复开版订单'),
('view_all_plateorders', '查看所有开版订单(突破客户可见性限制)'),
]
@property
@@ -318,6 +319,7 @@ class PrintingOrder(ModelBase):
permissions = [
('can_invalidate_printingorder', '可以作废印染订单'),
('can_activate_printingorder', '可以恢复印染订单'),
('view_all_printingorders', '查看所有印染订单(突破客户可见性限制)'),
]
@property