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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 14 deletions

View File

@ -49,7 +49,8 @@ runs:
shell: bash
run: |
python3 -m pip install -U pip
pip3 install invoke wheel uv
pip3 install -U invoke wheel
pip3 install uv==0.1.45
- name: Set the VIRTUAL_ENV variable for uv to work
run: echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV
shell: bash
@ -82,14 +83,16 @@ runs:
# Invoke commands
- name: Install dev requirements
if: ${{ inputs.dev-install == 'true' ||inputs.install == 'true' }}
if: ${{ inputs.dev-install == 'true' || inputs.install == 'true' }}
shell: bash
run: uv pip install --require-hashes -r src/backend/requirements-dev.txt
- name: Run invoke install
if: ${{ inputs.install == 'true' }}
shell: bash
run: invoke install --uv
# run: invoke install --uv
run: invoke install
- name: Run invoke update
if: ${{ inputs.update == 'true' }}
shell: bash
run: invoke update --uv
# run: invoke update --uv
run: invoke update

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" %}