from django import forms
from .models import GoodsReception

class GoodsReceptionForm(forms.ModelForm):
    class Meta:
        model = GoodsReception
        fields = '__all__'

    def clean(self):
        cleaned_data = super().clean()
        if not cleaned_data.get('quality_check') or not cleaned_data.get('shelf_life_valid'):
            cleaned_data['is_accepted'] = False
        return cleaned_data