wherehouse: fix stock movemend model field number which is auto agrement feature
This commit is contained in:
@@ -13,8 +13,9 @@ class StockMovemendProductInline(admin.TabularInline):
|
||||
|
||||
@admin.register(StockMovemend)
|
||||
class StockMovemendAdmin(admin.ModelAdmin):
|
||||
list_display = ['id', 'wherehouse_to', 'wherehouse_from', 'movemend_type']
|
||||
list_display = ['id', "number", 'wherehouse_to', 'wherehouse_from', 'movemend_type']
|
||||
inlines = [StockMovemendProductInline]
|
||||
ordering = ('-number',)
|
||||
|
||||
|
||||
@admin.register(StockMovmendProduct)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
from .stock_movemend import *
|
||||
@@ -8,4 +8,4 @@ def set_stock_movemend_number(sender, instance, created, **kwargs):
|
||||
if created:
|
||||
last_party = StockMovemend.objects.order_by('number').last()
|
||||
instance.number = (last_party.number + 1) if last_party else 1
|
||||
instance.save(update_fields=["number"])
|
||||
instance.save(update_fields=["number"])
|
||||
Reference in New Issue
Block a user