from django_filters import rest_framework as filters

from apps.mtm.models import Material
from .models import IProduct, MaterialBatch
class MbFilterSet(filters.FilterSet):
    material = filters.ModelMultipleChoiceFilter(field_name="material", queryset=Material.objects.all())
    class Meta:
        model = MaterialBatch
        fields = ['material', 'warehouse']


class IProductFilterSet(filters.FilterSet):

    order = filters.NumberFilter(field_name="wproduct__subproduction_plan__production_plan__order")
    class Meta:
        model = IProduct
        fields = ['material', 'warehouse', 'batch', 'order', 'is_mtested', 'is_mtestok']