from django import forms
from shoop.core.models import Address
from shoop.front.views.basket import DefaultBasketView


class AddressForm(forms.ModelForm):
    class Meta:
        model = Address
        fields = (
            "name", "phone", "email", "street",
            "street2", "postal_code", "city",
            "region", "country"
        )

    def __init__(self, *args, **kwargs):
        super(AddressForm, self).__init__(*args, **kwargs)
        for field_name in ("email", "postal_code"):
            self.fields[field_name].required = True


class B2bBasketView(DefaultBasketView):
    shipping_address_form_class = AddressForm
    billing_address_form_class = AddressForm

from django import forms
from shoop.front.views.basket import DefaultBasketView

from shoop.core.models import MutableAddress


class AddressForm(forms.ModelForm):
    class Meta:
        model = MutableAddress
        fields = (
            "name", "phone", "email", "street",
            "street2", "postal_code", "city",
            "region", "country"
        )

    def __init__(self, *args, **kwargs):
        super(AddressForm, self).__init__(*args, **kwargs)
        for field_name in ("email", "postal_code"):
            self.fields[field_name].required = True


class B2bBasketView(DefaultBasketView):
    shipping_address_form_class = AddressForm
    billing_address_form_class = AddressForm

Use MutableAddress instead of Address
Use MutableAddress instead of Address

  from django import forms
- from shoop.core.models import Address
  from shoop.front.views.basket import DefaultBasketView
+ 
+ from shoop.core.models import MutableAddress
  
  
  class AddressForm(forms.ModelForm):
      class Meta:
-         model = Address
+         model = MutableAddress
          fields = (
              "name", "phone", "email", "street",
              "street2", "postal_code", "city",
              "region", "country"
          )
  
      def __init__(self, *args, **kwargs):
          super(AddressForm, self).__init__(*args, **kwargs)
          for field_name in ("email", "postal_code"):
              self.fields[field_name].required = True
  
  
  class B2bBasketView(DefaultBasketView):
      shipping_address_form_class = AddressForm
      billing_address_form_class = AddressForm
  
Use MutableAddress instead of Address
## Code Before:
from django import forms
from shoop.core.models import Address
from shoop.front.views.basket import DefaultBasketView


class AddressForm(forms.ModelForm):
    class Meta:
        model = Address
        fields = (
            "name", "phone", "email", "street",
            "street2", "postal_code", "city",
            "region", "country"
        )

    def __init__(self, *args, **kwargs):
        super(AddressForm, self).__init__(*args, **kwargs)
        for field_name in ("email", "postal_code"):
            self.fields[field_name].required = True


class B2bBasketView(DefaultBasketView):
    shipping_address_form_class = AddressForm
    billing_address_form_class = AddressForm

## Instruction:
Use MutableAddress instead of Address
## Code After:
from django import forms
from shoop.front.views.basket import DefaultBasketView

from shoop.core.models import MutableAddress


class AddressForm(forms.ModelForm):
    class Meta:
        model = MutableAddress
        fields = (
            "name", "phone", "email", "street",
            "street2", "postal_code", "city",
            "region", "country"
        )

    def __init__(self, *args, **kwargs):
        super(AddressForm, self).__init__(*args, **kwargs)
        for field_name in ("email", "postal_code"):
            self.fields[field_name].required = True


class B2bBasketView(DefaultBasketView):
    shipping_address_form_class = AddressForm
    billing_address_form_class = AddressForm
