Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sales order shipment / completed buttons #7305

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
12 changes: 3 additions & 9 deletions src/backend/InvenTree/order/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,22 +1024,16 @@ def can_complete(self, raise_error=False, allow_incomplete_lines=False):
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')
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@
<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" %}
Expand Down
Loading