forked from erp-dev/erp
fix: added permission for plate_order and printing_order api
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
21
printing/migrations/0030_add_view_all_permissions.py
Normal file
21
printing/migrations/0030_add_view_all_permissions.py
Normal 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': '印染订单'},
|
||||
),
|
||||
]
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user