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)
|
@admin.register(StockMovemend)
|
||||||
class StockMovemendAdmin(admin.ModelAdmin):
|
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]
|
inlines = [StockMovemendProductInline]
|
||||||
|
ordering = ('-number',)
|
||||||
|
|
||||||
|
|
||||||
@admin.register(StockMovmendProduct)
|
@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:
|
if created:
|
||||||
last_party = StockMovemend.objects.order_by('number').last()
|
last_party = StockMovemend.objects.order_by('number').last()
|
||||||
instance.number = (last_party.number + 1) if last_party else 1
|
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