class="icon octicon octicon-issue-opened"> Problemas 0 Pull Requests 0 Commits 13 Versões 0

Nenhuma Descrição

admin.py 1.5KB

    # -*- coding: utf-8 -*- from django.contrib import admin from django_admin import ChangeOnlyModelAdmin, SpecifiedQuantityQuerySetModelAdmin from stock.models import StockInfo, StockSendInfo from utils.redis.connect import r from utils.redis.rkeys import JDJOS_STOCK_CHANGED_SET from utils.stock_utils import send_all_stock_info class StockInfoAdmin(ChangeOnlyModelAdmin, admin.ModelAdmin): list_display = ('vendorProductId', 'vendorProductName', 'inventoryDate', 'totalQuantity', 'estimateDate', 'totalEstimateQuantity', 'costPrice', 'updated_at') readonly_fields = ('stock_id', 'vendorCode', 'vendorName', 'vendorProductId', 'vendorProductName', 'storeId', 'storeName', 'quantity', 'estimateQuantity', 'status') def save_model(self, request, obj, form, change): obj.save() if obj.inventoryDate and obj.estimateDate and ('inventoryDate' in form.changed_data or 'totalQuantity' in form.changed_data or 'estimateDate' in form.changed_data or 'totalEstimateQuantity' in form.changed_data or 'costPrice' in form.changed_data): r.sadd(JDJOS_STOCK_CHANGED_SET, obj.pk) class StockSendInfoAdmin(SpecifiedQuantityQuerySetModelAdmin, ChangeOnlyModelAdmin, admin.ModelAdmin): list_display = ('pk', 'submit') exclude = ('status', ) def save_model(self, request, obj, form, change): obj.save() if obj.submit: send_all_stock_info() admin.site.register(StockInfo, StockInfoAdmin) admin.site.register(StockSendInfo, StockSendInfoAdmin)
pai2 - Gogs: Go Git Service

拍爱

Brightcells: f07f4fc893 JsonResponse to response 10 anni fa
..
migrations 102152ca4a add api lensman_photo_bought & modify api wx_order_create_api and adjust return field 10 anni fa
__init__.py 30daca135b add api message_list_api/message_type_list_api/message_read_api 10 anni fa
admin.py 9618c6d3bd add var for jswe.js 10 anni fa
models.py f72ccb1875 isort import 10 anni fa
tests.py fabef63211 set line_length=200 for isort 10 anni fa
views.py f07f4fc893 JsonResponse to response 10 anni fa