diff --git a/kfet/forms.py b/kfet/forms.py index 6709beb1..ea12d424 100644 --- a/kfet/forms.py +++ b/kfet/forms.py @@ -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) + TransferGroup, Supplier) from gestioncof.models import CofProfile # ----- @@ -192,6 +192,18 @@ class ArticleForm(forms.ModelForm): queryset = ArticleCategory.objects.all(), required = False) + suppliers = forms.ModelMultipleChoiceField( + queryset = Supplier.objects.all(), + required = False) + supplier_new = forms.CharField( + max_length = 45, + required = False) + + def __init__(self, *args, **kwargs): + super(ArticleForm, self).__init__(*args, **kwargs) + if self.instance.pk: + self.initial['suppliers'] = self.instance.suppliers.values_list('pk', flat=True) + def clean(self): category = self.cleaned_data.get('category') category_new = self.cleaned_data.get('category_new') @@ -201,6 +213,7 @@ class ArticleForm(forms.ModelForm): elif not category: category, _ = ArticleCategory.objects.get_or_create(name=category_new) self.cleaned_data['category'] = category + super(ArticleForm, self).clean() class Meta: diff --git a/kfet/migrations/0037_auto_20160826_2333.py b/kfet/migrations/0037_auto_20160826_2333.py new file mode 100644 index 00000000..9f937b60 --- /dev/null +++ b/kfet/migrations/0037_auto_20160826_2333.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('kfet', '0036_auto_20160823_1910'), + ] + + operations = [ + migrations.AlterField( + model_name='supplierarticle', + name='TVA', + field=models.DecimalField(null=True, max_digits=4, decimal_places=2, default=None, blank=True), + ), + migrations.AlterField( + model_name='supplierarticle', + name='box_capacity', + field=models.PositiveSmallIntegerField(null=True, default=None, blank=True), + ), + migrations.AlterField( + model_name='supplierarticle', + name='box_type', + field=models.CharField(null=True, max_length=7, choices=[('caisse', 'Caisse'), ('carton', 'Carton'), ('palette', 'Palette'), ('fût', 'Fût')], default=None, blank=True), + ), + migrations.AlterField( + model_name='supplierarticle', + name='price_HT', + field=models.DecimalField(null=True, max_digits=7, decimal_places=4, default=None, blank=True), + ), + migrations.AlterField( + model_name='supplierarticle', + name='rights', + field=models.DecimalField(null=True, max_digits=7, decimal_places=4, default=None, blank=True), + ), + ] diff --git a/kfet/models.py b/kfet/models.py index 51560d4b..47c734a3 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -376,6 +376,9 @@ class Supplier(models.Model): phone = models.CharField(max_length = 10) comment = models.TextField() + def __str__(self): + return self.name + class SupplierArticle(models.Model): supplier = models.ForeignKey( Supplier, on_delete = models.PROTECT) @@ -389,11 +392,19 @@ class SupplierArticle(models.Model): ) box_type = models.CharField( choices = BOX_TYPE_CHOICES, - max_length = choices_length(BOX_TYPE_CHOICES)) - box_capacity = models.PositiveSmallIntegerField() - price_HT = models.DecimalField(max_digits = 7, decimal_places = 4) - TVA = models.DecimalField(max_digits = 4, decimal_places = 2) - rights = models.DecimalField(max_digits = 7, decimal_places = 4) + max_length = choices_length(BOX_TYPE_CHOICES), + blank = True, null = True, default = None) + box_capacity = models.PositiveSmallIntegerField( + blank = True, null = True, default = None) + price_HT = models.DecimalField( + max_digits = 7, decimal_places = 4, + blank = True, null = True, default = None) + TVA = models.DecimalField( + max_digits = 4, decimal_places = 2, + blank = True, null = True, default = None) + rights = models.DecimalField( + max_digits = 7, decimal_places = 4, + blank = True, null = True, default = None) class Order(models.Model): supplier = models.ForeignKey( diff --git a/kfet/static/kfet/css/history.css b/kfet/static/kfet/css/history.css index e7d6858c..976f5782 100644 --- a/kfet/static/kfet/css/history.css +++ b/kfet/static/kfet/css/history.css @@ -79,17 +79,16 @@ padding-left:20px; } -#history div.general.ui-selected, #history div.general.ui-selecting, #history div.ope.ui-selected, #history div.ope.ui-selecting { background-color:rgba(200,16,46,0.6); color:#FFF; } -#history .ope.canceled { +#history .ope.canceled, #history .transfer.canceled { color:#444; } -#history .ope.canceled::before { +#history .ope.canceled::before, #history.transfer.canceled::before { position: absolute; content: ' '; width:100%; @@ -97,3 +96,11 @@ top: 12px; border-top: 1px solid rgba(200,16,46,0.5); } + +#history .transfer .amount { + width:80px; +} + +#history .transfer .from_acc { + padding-left:10px; +} diff --git a/kfet/static/kfet/css/transfers_form.css b/kfet/static/kfet/css/transfers_form.css index b2920b5d..231a0c89 100644 --- a/kfet/static/kfet/css/transfers_form.css +++ b/kfet/static/kfet/css/transfers_form.css @@ -30,7 +30,7 @@ .transfer_form td { height:50px; - vertical-align:middle; + vertical-align:middle !important; padding:0 !important; } diff --git a/kfet/templates/kfet/transfers.html b/kfet/templates/kfet/transfers.html index 5a32527b..1875a21e 100644 --- a/kfet/templates/kfet/transfers.html +++ b/kfet/templates/kfet/transfers.html @@ -30,11 +30,11 @@ {{ transfergroup.comment }} {% for transfer in transfergroup.transfers.all %} -