2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 03:25:42 +00:00

Fix sales order shipment / completed buttons (#7305)

* Fix sales order shipment / completed buttons

- Template logic needed tweaks

* Adjust logic for completing a sales order

* Tweak UV version

- Trying to get CI to run properly

* Pin version

* Ignore uv

* Cleanup

* Fix another --uv command
This commit is contained in:
Oliver
2024-05-23 21:24:38 +10:00
committed by GitHub
parent b36bd5c35d
commit bc566c513f
3 changed files with 11 additions and 14 deletions

View File

@ -1024,22 +1024,16 @@ class SalesOrder(TotalPriceMixin, Order):
Throws a ValidationError if cannot be completed.
"""
try:
# Order without line items cannot be completed
if self.lines.count() == 0:
raise ValidationError(
_('Order cannot be completed as no parts have been assigned')
)
# Only an open order can be marked as shipped
elif not self.is_open and not self.is_completed:
if self.is_open and not self.is_completed:
raise ValidationError(_('Only an open order can be marked as complete'))
elif self.pending_shipment_count > 0:
if self.pending_shipment_count > 0:
raise ValidationError(
_('Order cannot be completed as there are incomplete shipments')
)
elif not allow_incomplete_lines and self.pending_line_count > 0:
if not allow_incomplete_lines and self.pending_line_count > 0:
raise ValidationError(
_('Order cannot be completed as there are incomplete line items')
)

View File

@ -88,10 +88,10 @@ src="{% static 'img/blank_image.png' %}"
<button type='button' class='btn btn-success' id='complete-order-shipments' title='{% trans "Ship Items" %}'>
<span class='fas fa-truck'></span> {% trans "Ship Items" %}
</button>
{% endif %}
<button type='button' class='btn btn-success' id='ship-order' title='{% trans "Mark As Shipped" %}'>
<span class='fas fa-check-circle'></span> {% trans "Mark As Shipped" %}
</button>
{% endif %}
{% elif order.status == SalesOrderStatus.SHIPPED %}
<button type='button' class='btn btn-success' id='complete-order' title='{% trans "Complete Sales Order" %}'>
<span class='fas fa-check-circle'></span> {% trans "Complete Order" %}