Exemplo n.º 1
0
                value=random.randint(50, 500)).save()
    MonthlyStat(year=2013, month=month, key='bar_nb',
                value=random.randint(50, 500)).save()
    MonthlyStat(year=2013, month=month, key='bar_average',
                value=random.randint(50, 500)).save()

# Création d'une dizaine de facture
for i in xrange(15):
    table = 'T%d' % random.randint(10, 25)
    f = Facture(table=Table.objects.get(nom=table),
                couverts=random.randint(1, 15))
    f.save()
    for produit in [salade, buffet, entrecote, pave, biere]:
        for j in xrange(3):
            p = ProduitVendu(produit=produit)
            p.save()
            f.add_product(p)
    nouveau_menu = ProduitVendu(produit=entree_plat)
    nouveau_menu.save()
    for produit in [salade, pave]:
        p = ProduitVendu(produit=produit)
        p.save()
        nouveau_menu.contient.add(p)
    nouveau_menu.save()
    if i % 2:
        f.send_in_the_kitchen()

# on sold une facture
type_cb = PaiementType.objects.get(nom='CB')
f.add_payment(type_cb, f.total_ttc)