mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 12:35:46 +00:00
Merge branch 'master' of https://github.com/inventree/InvenTree into template-reduce-duplication
This commit is contained in:
@ -822,6 +822,7 @@ class SOAllocationList(generics.ListAPIView):
|
||||
kwargs['item_detail'] = str2bool(params.get('item_detail', False))
|
||||
kwargs['order_detail'] = str2bool(params.get('order_detail', False))
|
||||
kwargs['location_detail'] = str2bool(params.get('location_detail', False))
|
||||
kwargs['customer_detail'] = str2bool(params.get('customer_detail', False))
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
@ -846,6 +847,12 @@ class SOAllocationList(generics.ListAPIView):
|
||||
if order is not None:
|
||||
queryset = queryset.filter(line__order=order)
|
||||
|
||||
# Filter by "stock item"
|
||||
item = params.get('item', params.get('stock_item', None))
|
||||
|
||||
if item is not None:
|
||||
queryset = queryset.filter(item=item)
|
||||
|
||||
# Filter by "outstanding" order status
|
||||
outstanding = params.get('outstanding', None)
|
||||
|
||||
@ -865,7 +872,6 @@ class SOAllocationList(generics.ListAPIView):
|
||||
|
||||
# Default filterable fields
|
||||
filter_fields = [
|
||||
'item',
|
||||
]
|
||||
|
||||
|
||||
|
@ -92,5 +92,4 @@ class OrderMatchItemForm(MatchItemForm):
|
||||
default_amount=clean_decimal(row.get('purchase_price', '')),
|
||||
)
|
||||
|
||||
# return default
|
||||
return super().get_special_field(col_guess, row, file_manager)
|
||||
|
@ -822,15 +822,26 @@ class PurchaseOrderLineItem(OrderLineItem):
|
||||
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def get_api_url():
|
||||
return reverse('api-po-line-list')
|
||||
|
||||
class Meta:
|
||||
unique_together = (
|
||||
('order', 'part', 'quantity', 'purchase_price')
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def get_api_url():
|
||||
return reverse('api-po-line-list')
|
||||
|
||||
def clean(self):
|
||||
|
||||
super().clean()
|
||||
|
||||
if self.order.supplier and self.part:
|
||||
# Supplier part *must* point to the same supplier!
|
||||
if self.part.supplier != self.order.supplier:
|
||||
raise ValidationError({
|
||||
'part': _('Supplier part must match supplier')
|
||||
})
|
||||
|
||||
def __str__(self):
|
||||
return "{n} x {part} from {supplier} (for {po})".format(
|
||||
n=decimal2string(self.quantity),
|
||||
|
@ -495,6 +495,7 @@ class SalesOrderAllocationSerializer(InvenTreeModelSerializer):
|
||||
part_detail = PartBriefSerializer(source='item.part', many=False, read_only=True)
|
||||
item_detail = stock.serializers.StockItemSerializer(source='item', many=False, read_only=True)
|
||||
location_detail = stock.serializers.LocationSerializer(source='item.location', many=False, read_only=True)
|
||||
customer_detail = CompanyBriefSerializer(source='line.order.customer', many=False, read_only=True)
|
||||
|
||||
shipment_date = serializers.DateField(source='shipment.shipment_date', read_only=True)
|
||||
|
||||
@ -504,6 +505,7 @@ class SalesOrderAllocationSerializer(InvenTreeModelSerializer):
|
||||
part_detail = kwargs.pop('part_detail', True)
|
||||
item_detail = kwargs.pop('item_detail', False)
|
||||
location_detail = kwargs.pop('location_detail', False)
|
||||
customer_detail = kwargs.pop('customer_detail', False)
|
||||
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@ -519,12 +521,16 @@ class SalesOrderAllocationSerializer(InvenTreeModelSerializer):
|
||||
if not location_detail:
|
||||
self.fields.pop('location_detail')
|
||||
|
||||
if not customer_detail:
|
||||
self.fields.pop('customer_detail')
|
||||
|
||||
class Meta:
|
||||
model = order.models.SalesOrderAllocation
|
||||
|
||||
fields = [
|
||||
'pk',
|
||||
'line',
|
||||
'customer_detail',
|
||||
'serial',
|
||||
'quantity',
|
||||
'location',
|
||||
|
@ -48,7 +48,7 @@
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% if order.status == PurchaseOrderStatus.PENDING and order.lines.count > 0 %}
|
||||
{% if order.status == PurchaseOrderStatus.PENDING %}
|
||||
<button type='button' class='btn btn-outline-secondary' id='place-order' title='{% trans "Place order" %}'>
|
||||
<span class='fas fa-shopping-cart icon-blue'></span>
|
||||
</button>
|
||||
@ -178,7 +178,7 @@ src="{% static 'img/blank_image.png' %}"
|
||||
{{ block.super }}
|
||||
|
||||
|
||||
{% if order.status == PurchaseOrderStatus.PENDING and order.lines.count > 0 %}
|
||||
{% if order.status == PurchaseOrderStatus.PENDING %}
|
||||
$("#place-order").click(function() {
|
||||
launchModalForm("{% url 'po-issue' order.id %}",
|
||||
{
|
||||
|
Reference in New Issue
Block a user