def __init__(self, user, parent=None, *args, **kwargs):
        super(ProductForm, self).__init__(*args, **kwargs)

        self.fields['supplier'].queryset = Object.filter_permitted(
            user, Contact.objects)
        self.fields['supplier'].widget.attrs.update({'class': 'autocomplete',
                                                     'callback': reverse('identities_ajax_contact_lookup')})
        self.fields['supplier'].widget.attrs.update(
            {'popuplink': reverse('identities_contact_add')})
        self.fields['supplier'].label = _("Supplier")
        self.fields['active'].initial = True
        self.fields['active'].label = _("Active")

        manager = Product.objects.filter(active=True)
        if 'instance' in kwargs:
            instance = kwargs['instance']
            manager = manager.exclude(Q(parent=instance) & Q(pk=instance.id))
        self.fields['parent'].queryset = Object.filter_permitted(
            user, manager, mode='x')

        if parent:
            self.fields['parent'].initial = get_object_or_404(
                Product, pk=parent)
            self.fields['parent'].label = _("Parent")

        self.fields['product_type'].label = _("Product type")
        self.fields['code'].label = _("Code")
        self.fields['supplier_code'].label = _("Supplier code")
        self.fields['buy_price'].label = _("Buy price")
        self.fields['sell_price'].label = _("Sell price")
        self.fields['stock_quantity'].label = _("Stock quantity")
        self.fields['runout_action'].label = _("Runout action")
        self.fields['details'].label = _("Details")
dataset/ETHPy150Open treeio/treeio/treeio/sales/forms.py/ProductForm.__init__/original