Ajout du listing et création d'inventaires

This commit is contained in:
Aurélien Delobelle 2016-08-27 14:12:01 +02:00
parent cd436faf9b
commit ffa73c41c3
7 changed files with 203 additions and 5 deletions

View file

@ -8,7 +8,7 @@ from django.forms.models import BaseInlineFormSet
from django.utils import timezone
from kfet.models import (Account, Checkout, Article, OperationGroup, Operation,
CheckoutStatement, ArticleCategory, Settings, AccountNegative, Transfer,
TransferGroup, Supplier)
TransferGroup, Supplier, Inventory, InventoryArticle)
from gestioncof.models import CofProfile
# -----
@ -397,3 +397,22 @@ TransferFormSet = modelformset_factory(
min_num = 1, validate_min = True,
extra = 9,
)
# -----
# Inventory forms
# -----
class InventoryArticleForm(forms.Form):
article = forms.ModelChoiceField(
queryset = Article.objects.all(),
widget = forms.HiddenInput(),
)
stock_new = forms.IntegerField(required = False)
def __init__(self, *args, **kwargs):
super(InventoryArticleForm, self).__init__(*args, **kwargs)
if 'initial' in kwargs:
self.name = kwargs['initial']['name']
self.stock_old = kwargs['initial']['stock_old']
self.category = kwargs['initial']['category']
self.category_name = kwargs['initial']['category__name']