WIP: Aureplop/kpsul js refactor #501
1 changed files with 7 additions and 5 deletions
|
@ -1332,11 +1332,13 @@ def kpsul_cancel_operations(request):
|
||||||
# Note : si InventoryArticle est maj par .save(), stock_error
|
# Note : si InventoryArticle est maj par .save(), stock_error
|
||||||
# est recalculé automatiquement
|
# est recalculé automatiquement
|
||||||
if ope.article and ope.article_nb:
|
if ope.article and ope.article_nb:
|
||||||
last_stock = (InventoryArticle.objects
|
last_stock = (
|
||||||
|
InventoryArticle.objects
|
||||||
.select_related('inventory')
|
.select_related('inventory')
|
||||||
.filter(article=ope.article)
|
.filter(article=ope.article)
|
||||||
.order_by('inventory__at')
|
.order_by('inventory__at')
|
||||||
.last())
|
.last()
|
||||||
|
)
|
||||||
if not last_stock or last_stock.inventory.at < ope.group.at:
|
if not last_stock or last_stock.inventory.at < ope.group.at:
|
||||||
to_articles_stocks[ope.article] += ope.article_nb
|
to_articles_stocks[ope.article] += ope.article_nb
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue