mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-01 11:10:54 +00:00
Feature/icons for PartCategory and StockLocation (#3542)
* Added icon to stock location - added `icon` field to `stock_stocklocation` model - added input field to stock location form - added icon to breadcrumb treeview in header - added icon to sub-locations table - added icon to location detail information - added `STOCK_LOCATION_DEFAULT_ICON` setting as default * Added icon to part category - added `icon` field to `part_partcategory` model - added input field to part category form - added icon to breadcrumb treeview in header - added icon to sub-categories table - added icon to category detail information - added `PART_CATEGORY_DEFAULT_ICON` setting as default * Added `blocktrans` to allowed tags in ci check * fix: style * Added `endblocktrans` to allowed tags in ci check * fix: missing `,` in ci check allowed tags script * Removed blocktrans from js and fixed style
This commit is contained in:
18
InvenTree/stock/migrations/0083_stocklocation_icon.py
Normal file
18
InvenTree/stock/migrations/0083_stocklocation_icon.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.15 on 2022-08-15 08:38
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('stock', '0082_alter_stockitem_link'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='stocklocation',
|
||||
name='icon',
|
||||
field=models.CharField(blank=True, help_text='Icon (optional)', max_length=100, verbose_name='Icon'),
|
||||
),
|
||||
]
|
@ -78,6 +78,13 @@ class StockLocation(MetadataMixin, InvenTreeTree):
|
||||
"""Return API url."""
|
||||
return reverse('api-location-list')
|
||||
|
||||
icon = models.CharField(
|
||||
blank=True,
|
||||
max_length=100,
|
||||
verbose_name=_("Icon"),
|
||||
help_text=_("Icon (optional)")
|
||||
)
|
||||
|
||||
owner = models.ForeignKey(Owner, on_delete=models.SET_NULL, blank=True, null=True,
|
||||
verbose_name=_('Owner'),
|
||||
help_text=_('Select Owner'),
|
||||
|
@ -570,6 +570,7 @@ class LocationTreeSerializer(InvenTree.serializers.InvenTreeModelSerializer):
|
||||
'pk',
|
||||
'name',
|
||||
'parent',
|
||||
'icon',
|
||||
]
|
||||
|
||||
|
||||
@ -607,6 +608,7 @@ class LocationSerializer(InvenTree.serializers.InvenTreeModelSerializer):
|
||||
'pathstring',
|
||||
'items',
|
||||
'owner',
|
||||
'icon',
|
||||
]
|
||||
|
||||
|
||||
|
@ -14,7 +14,12 @@
|
||||
|
||||
{% block heading %}
|
||||
{% if location %}
|
||||
{% trans "Stock Location" %}: {{ location.name }}
|
||||
{% trans "Stock Location" %}:
|
||||
{% settings_value "STOCK_LOCATION_DEFAULT_ICON" as default_icon %}
|
||||
{% if location.icon or default_icon %}
|
||||
<span class="{{ location.icon|default:default_icon }}"></span>
|
||||
{% endif %}
|
||||
{{ location.name }}
|
||||
{% else %}
|
||||
{% trans "Stock" %}
|
||||
{% endif %}
|
||||
@ -380,7 +385,8 @@
|
||||
node.href = `/stock/location/${node.pk}/`;
|
||||
|
||||
return node;
|
||||
}
|
||||
},
|
||||
defaultIcon: global_settings.STOCK_LOCATION_DEFAULT_ICON,
|
||||
});
|
||||
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user