mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Tweaks
This commit is contained in:
parent
23ac83d2a8
commit
6245d65ebc
@ -22,7 +22,7 @@ from markdownx.models import MarkdownxField
|
||||
from mptt.models import MPTTModel, TreeForeignKey
|
||||
|
||||
from InvenTree.status_codes import BuildStatus
|
||||
from InvenTree.helpers import increment, getSetting
|
||||
from InvenTree.helpers import increment, getSetting, normalize
|
||||
from InvenTree.validators import validate_build_order_reference
|
||||
|
||||
import InvenTree.fields
|
||||
@ -589,8 +589,8 @@ class BuildItem(models.Model):
|
||||
|
||||
if self.quantity > self.stock_item.quantity:
|
||||
errors['quantity'] = [_("Allocated quantity ({n}) must not exceed available quantity ({q})".format(
|
||||
n=self.quantity,
|
||||
q=self.stock_item.quantity
|
||||
n=normalize(self.quantity),
|
||||
q=normalize(self.stock_item.quantity)
|
||||
))]
|
||||
|
||||
if self.stock_item.quantity - self.stock_item.allocation_count() + self.quantity < self.quantity:
|
||||
|
10
InvenTree/build/templates/build/edit_build_item.html
Normal file
10
InvenTree/build/templates/build/edit_build_item.html
Normal file
@ -0,0 +1,10 @@
|
||||
{% extends "modal_form.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block pre_form_content %}
|
||||
<div class='alert alert-block alert-info'>
|
||||
<p>
|
||||
{% trans "Alter the quantity of stock allocated to the build output" %}
|
||||
</p>
|
||||
</div>
|
||||
{% endblock %}
|
@ -700,7 +700,7 @@ class BuildItemEdit(AjaxUpdateView):
|
||||
""" View to edit a BuildItem object """
|
||||
|
||||
model = BuildItem
|
||||
ajax_template_name = 'modal_form.html'
|
||||
ajax_template_name = 'build/edit_build_item.html'
|
||||
form_class = forms.EditBuildItemForm
|
||||
ajax_form_title = _('Edit Stock Allocation')
|
||||
role_required = 'build.change'
|
||||
@ -720,14 +720,9 @@ class BuildItemEdit(AjaxUpdateView):
|
||||
|
||||
form = super(BuildItemEdit, self).get_form()
|
||||
|
||||
query = StockItem.objects.all()
|
||||
|
||||
if build_item.stock_item:
|
||||
part_id = build_item.stock_item.part.id
|
||||
query = query.filter(part=part_id)
|
||||
|
||||
form.fields['stock_item'].queryset = query
|
||||
|
||||
form.fields['build'].widget = HiddenInput()
|
||||
# Hide fields which we do not wish the user to edit
|
||||
for field in ['build', 'stock_item', 'install_into']:
|
||||
if form[field].value():
|
||||
form.fields[field].widget = HiddenInput()
|
||||
|
||||
return form
|
||||
|
@ -252,7 +252,7 @@ function loadBuildOutputAllocationTable(buildId, partId, output, options={}) {
|
||||
},
|
||||
{
|
||||
field: 'sub_part_detail.full_name',
|
||||
title: "{% trans "Required Part" %}",
|
||||
title: '{% trans "Required Part" %}',
|
||||
sortable: true,
|
||||
formatter: function(value, row, index, field) {
|
||||
var url = `/part/${row.sub_part}/`;
|
||||
@ -326,7 +326,7 @@ function loadBuildTable(table, options) {
|
||||
$(table).inventreeTable({
|
||||
method: 'get',
|
||||
formatNoMatches: function() {
|
||||
return "{% trans "No builds matching query" %}";
|
||||
return '{% trans "No builds matching query" %}';
|
||||
},
|
||||
url: options.url,
|
||||
queryParams: filters,
|
||||
|
Loading…
Reference in New Issue
Block a user