forked from erp-dev/erp
feat: added n-to-1 relation between sales_order_item and printing_job model
This commit is contained in:
@@ -312,7 +312,7 @@ CELERY_BEAT_SCHEDULE = {
|
||||
},
|
||||
'mdy_product_sync': {
|
||||
'task': 'api_v1.tasks.sync_mdy_products',
|
||||
'schedule': crontab(hour='*/1', minute=0),
|
||||
'schedule': crontab(minute='*/10'),
|
||||
'kwargs': {
|
||||
'page_size': MDY_SYNC_PAGE_SIZE,
|
||||
'max_pages': MDY_SYNC_MAX_PAGES,
|
||||
@@ -321,7 +321,7 @@ CELERY_BEAT_SCHEDULE = {
|
||||
},
|
||||
'mdy_customer_sync': {
|
||||
'task': 'api_v1.tasks.sync_mdy_customers',
|
||||
'schedule': crontab(hour='*/1', minute=0),
|
||||
'schedule': crontab(hour='*/5', minute=0),
|
||||
'kwargs': {
|
||||
'page_size': MDY_SYNC_PAGE_SIZE,
|
||||
'max_pages': MDY_SYNC_MAX_PAGES,
|
||||
|
||||
@@ -24,6 +24,11 @@ from rest_framework_simplejwt.views import (
|
||||
# TokenRefreshView,
|
||||
)
|
||||
|
||||
# 自定义后台站点标题(simpleui 也会读取)
|
||||
admin.site.site_header = "宇问科技"
|
||||
admin.site.site_title = "宇问科技"
|
||||
admin.site.index_title = "管理后台"
|
||||
|
||||
class CustomTokenObtainPairView(TokenObtainPairView):
|
||||
"""自定义登录视图"""
|
||||
|
||||
|
||||
@@ -226,6 +226,18 @@ def pick_product(fields: dict) -> Product:
|
||||
从字段字典中提取产品信息
|
||||
"""
|
||||
data = {k: fields.get(v, '') for k, v in product_type_map.items()}
|
||||
|
||||
def _to_int(value):
|
||||
if value in ('', None):
|
||||
return None
|
||||
try:
|
||||
return int(value)
|
||||
except (TypeError, ValueError):
|
||||
return None
|
||||
|
||||
data['pieces'] = _to_int(data.get('pieces'))
|
||||
data['segment_size'] = _to_int(data.get('segment_size'))
|
||||
|
||||
return Product(**data)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user