-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #658 from savoirfairelinux/feature/delivered-orders
Allow batch order status change
- Loading branch information
Showing
4 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,44 @@ | ||
from django.contrib import admin | ||
from order.models import Order, Order_item, OrderStatusChange | ||
|
||
admin.site.register(Order) | ||
admin.site.register(Order_item) | ||
|
||
def make_delivered(modeladmin, request, queryset): | ||
queryset.update(status='D') | ||
make_delivered.short_description = "Mark selected orders as delivered" | ||
|
||
|
||
class OrderItemInline(admin.TabularInline): | ||
model = Order_item | ||
|
||
|
||
class OrderItemAdmin(admin.ModelAdmin): | ||
search_fields = ['order__id'] | ||
list_display = ( | ||
'order', | ||
'order_item_type', | ||
'component_group', | ||
'total_quantity', | ||
'billable_flag', | ||
'price', | ||
) | ||
|
||
|
||
class OrderAdmin(admin.ModelAdmin): | ||
search_fields = ['client__member__lastname', 'client__member__firstname'] | ||
list_filter = ('status', 'delivery_date') | ||
list_display = ( | ||
'id', | ||
'client', | ||
'status', | ||
'price', | ||
'delivery_date', | ||
'creation_date', | ||
) | ||
actions = [make_delivered] | ||
inlines = [ | ||
OrderItemInline | ||
] | ||
|
||
admin.site.register(Order, OrderAdmin) | ||
admin.site.register(Order_item, OrderItemAdmin) | ||
admin.site.register(OrderStatusChange) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters