forked from DGNum/gestioCOF
Création d'un inventaire avec stock initial lors de la création d'un
article
This commit is contained in:
parent
3c5f8c49aa
commit
fefa6ca5e2
1 changed files with 11 additions and 0 deletions
|
@ -567,6 +567,17 @@ class ArticleCreate(SuccessMessageMixin, CreateView):
|
||||||
SupplierArticle.objects.create(
|
SupplierArticle.objects.create(
|
||||||
article = article, supplier = supplier)
|
article = article, supplier = supplier)
|
||||||
|
|
||||||
|
# Inventaire avec stock initial
|
||||||
|
inventory = Inventory()
|
||||||
|
inventory.by = self.request.user.profile.account_kfet
|
||||||
|
inventory.save()
|
||||||
|
InventoryArticle.objects.create(
|
||||||
|
inventory = inventory,
|
||||||
|
article = article,
|
||||||
|
stock_old = article.stock,
|
||||||
|
stock_new = article.stock,
|
||||||
|
)
|
||||||
|
|
||||||
# Creating
|
# Creating
|
||||||
return super(ArticleCreate, self).form_valid(form)
|
return super(ArticleCreate, self).form_valid(form)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue