Skip to content

Instantly share code, notes, and snippets.

@lvsmart
Last active September 1, 2016 05:48
Show Gist options
  • Select an option

  • Save lvsmart/41182702e9ce991da7647ce2c9d96b02 to your computer and use it in GitHub Desktop.

Select an option

Save lvsmart/41182702e9ce991da7647ce2c9d96b02 to your computer and use it in GitHub Desktop.
push
def push_order_po(modeladmin, request, queryset):
"""
推送指定的PO
"""
# TODO filter order
today = erp_time.day(2016, 3, 22)
push_presale_po.process_pre_order(FrappeClient(), today, 1, queryset)
def push_order_so(modeladmin, request, queryset):
"""
推送指定的SO
"""
# TODO filter order
today = erp_time.day(2016, 3, 23)
push_presale_so.process_pre_order(FrappeClient(), today, 1, queryset)
push_order_po.short_description = '发送指定的PO'
push_order_so.short_description = '发送指定的SO'
class OrderAdmin(admin.ModelAdmin):
list_display = ['order_uuid', 'order_id', 'order_status', 'erp_order_type', 'insert_date',
'shop_name']
list_filter = ['order_status', 'vender_id', 'sale_type', 'order_po_status', 'erp_order_type',
('insert_date', DateRangeFilter),
'payment_type', 'shop_name']
search_fields = ['shop_id', 'order_id', 'shop_name', 'order_uuid', 'order_pay_time']
ordering = ['modified']
actions = [push_order_po, push_order_so]
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instances[cls]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment