mirror of
https://github.com/ae-utbm/sith.git
synced 2025-09-14 12:05:44 +00:00
feat: automatic product archiving
This commit is contained in:
13
counter/tasks.py
Normal file
13
counter/tasks.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# Create your tasks here
|
||||
|
||||
from celery import shared_task
|
||||
|
||||
from counter.models import Product
|
||||
|
||||
|
||||
@shared_task
|
||||
def archive_product(product_id):
|
||||
product = Product.objects.get(id=product_id)
|
||||
product.archived = True
|
||||
product.save()
|
||||
product.counters.clear()
|
Reference in New Issue
Block a user