Merge pull request #3818 from hSaria/2233-move-inventoryitem

Closes #2233: Ability to move inventory items between devices
This commit is contained in:
Jeremy Stretch 2020-01-02 11:55:18 -05:00 committed by GitHub
commit 970586b07b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 4 deletions

View File

@ -6,6 +6,7 @@
* [#3062](https://github.com/netbox-community/netbox/issues/3062) - Add `assigned_to_interface` filter for IP addresses * [#3062](https://github.com/netbox-community/netbox/issues/3062) - Add `assigned_to_interface` filter for IP addresses
* [#3461](https://github.com/netbox-community/netbox/issues/3461) - Fail gracefully on custom link rendering exception * [#3461](https://github.com/netbox-community/netbox/issues/3461) - Fail gracefully on custom link rendering exception
* [#3705](https://github.com/netbox-community/netbox/issues/3705) - Provide request context when executing custom scripts * [#3705](https://github.com/netbox-community/netbox/issues/3705) - Provide request context when executing custom scripts
* [#2288](https://github.com/netbox-community/netbox/issues/2288) - Ability to move inventory items between devices
* [#3762](https://github.com/netbox-community/netbox/issues/3762) - Add date/time picker widgets * [#3762](https://github.com/netbox-community/netbox/issues/3762) - Add date/time picker widgets
* [#3788](https://github.com/netbox-community/netbox/issues/3788) - Enable partial search for inventory items * [#3788](https://github.com/netbox-community/netbox/issues/3788) - Enable partial search for inventory items
* [#3812](https://github.com/netbox-community/netbox/issues/3812) - Optimize size of pages containing a dynamic selection field * [#3812](https://github.com/netbox-community/netbox/issues/3812) - Optimize size of pages containing a dynamic selection field

View File

@ -3285,9 +3285,12 @@ class InventoryItemForm(BootstrapMixin, forms.ModelForm):
class Meta: class Meta:
model = InventoryItem model = InventoryItem
fields = [ fields = [
'name', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'description', 'tags', 'name', 'device', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'description', 'tags',
] ]
widgets = { widgets = {
'device': APISelect(
api_url="/api/dcim/devices/"
),
'manufacturer': APISelect( 'manufacturer': APISelect(
api_url="/api/dcim/manufacturers/" api_url="/api/dcim/manufacturers/"
) )
@ -3323,9 +3326,19 @@ class InventoryItemBulkEditForm(BootstrapMixin, BulkEditForm):
queryset=InventoryItem.objects.all(), queryset=InventoryItem.objects.all(),
widget=forms.MultipleHiddenInput() widget=forms.MultipleHiddenInput()
) )
device = forms.ModelChoiceField(
queryset=Device.objects.all(),
required=False,
widget=APISelect(
api_url="/api/dcim/devices/"
)
)
manufacturer = forms.ModelChoiceField( manufacturer = forms.ModelChoiceField(
queryset=Manufacturer.objects.all(), queryset=Manufacturer.objects.all(),
required=False required=False,
widget=APISelect(
api_url="/api/dcim/manufacturers/"
)
) )
part_id = forms.CharField( part_id = forms.CharField(
max_length=50, max_length=50,
@ -3356,11 +3369,14 @@ class InventoryItemFilterForm(BootstrapMixin, forms.Form):
manufacturer = FilterChoiceField( manufacturer = FilterChoiceField(
queryset=Manufacturer.objects.all(), queryset=Manufacturer.objects.all(),
to_field_name='slug', to_field_name='slug',
null_label='-- None --' widget=APISelect(
api_url="/api/dcim/manufacturers/",
value_field="slug",
)
) )
discovered = forms.NullBooleanField( discovered = forms.NullBooleanField(
required=False, required=False,
widget=forms.Select( widget=StaticSelect2(
choices=BOOLEAN_WITH_BLANK_CHOICES choices=BOOLEAN_WITH_BLANK_CHOICES
) )
) )