forked from DGNum/gestioCOF
Add supplier to dev data
This commit is contained in:
parent
f32f83db75
commit
95c59de4fc
1 changed files with 21 additions and 2 deletions
|
@ -12,7 +12,8 @@ from django.core.management import call_command
|
||||||
|
|
||||||
from gestioncof.management.base import MyBaseCommand
|
from gestioncof.management.base import MyBaseCommand
|
||||||
from gestioncof.models import CofProfile
|
from gestioncof.models import CofProfile
|
||||||
from kfet.models import (Account, Checkout, CheckoutStatement)
|
from kfet.models import (Account, Checkout, CheckoutStatement, Supplier,
|
||||||
|
SupplierArticle, Article)
|
||||||
|
|
||||||
# Où sont stockés les fichiers json
|
# Où sont stockés les fichiers json
|
||||||
DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
||||||
|
@ -125,8 +126,26 @@ class Command(MyBaseCommand):
|
||||||
amount_error=0
|
amount_error=0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# Fournisseur
|
||||||
|
# ---
|
||||||
|
|
||||||
|
supplier, created = Supplier.objects.get_or_create(name="Panoramix")
|
||||||
|
if created:
|
||||||
|
articles = Article.objects.filter(category__name="Autres Bieres")
|
||||||
|
if not articles.exists():
|
||||||
|
articles = random.sample(Article.objects.all(), 30)
|
||||||
|
to_create = []
|
||||||
|
for article in articles:
|
||||||
|
to_create.append(SupplierArticle(
|
||||||
|
supplier=supplier,
|
||||||
|
article=article
|
||||||
|
))
|
||||||
|
|
||||||
|
SupplierArticle.objects.bulk_create(to_create)
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
# Opérations
|
# Opérations
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
call_command('createopes','100', '7')
|
call_command('createopes', '100', '7', '--transfers=20')
|
||||||
|
|
Loading…
Reference in a new issue