forked from DGNum/gestioCOF
Merge branch 'Aufinal/dev_supplier' into 'master'
Ajoute un fournisseur aux données de dev See merge request !202
This commit is contained in:
commit
63cb7b7fd0
1 changed files with 19 additions and 2 deletions
|
@ -12,7 +12,8 @@ from django.core.management import call_command
|
|||
|
||||
from gestioncof.management.base import MyBaseCommand
|
||||
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
|
||||
DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)),
|
||||
|
@ -125,8 +126,24 @@ class Command(MyBaseCommand):
|
|||
amount_error=0
|
||||
)
|
||||
|
||||
# ---
|
||||
# Fournisseur
|
||||
# ---
|
||||
|
||||
supplier, created = Supplier.objects.get_or_create(name="Panoramix")
|
||||
if created:
|
||||
articles = random.sample(list(Article.objects.all()), 40)
|
||||
to_create = []
|
||||
for article in articles:
|
||||
to_create.append(SupplierArticle(
|
||||
supplier=supplier,
|
||||
article=article
|
||||
))
|
||||
|
||||
SupplierArticle.objects.bulk_create(to_create)
|
||||
|
||||
# ---
|
||||
# Opérations
|
||||
# ---
|
||||
|
||||
call_command('createopes','100', '7')
|
||||
call_command('createopes', '100', '7', '--transfers=20')
|
||||
|
|
Loading…
Reference in a new issue