mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
fixes
This commit is contained in:
parent
1794f65d19
commit
8cd8581dbf
@ -268,8 +268,18 @@ class PurchaseOrderLineItemSerializer(InvenTreeModelSerializer):
|
||||
|
||||
data = super().validate(data)
|
||||
|
||||
supplier_part = data['part']
|
||||
purchase_order = data['order']
|
||||
supplier_part = data.get('part', None)
|
||||
purchase_order = data.get('order', None)
|
||||
|
||||
if not supplier_part:
|
||||
raise ValidationError({
|
||||
'part': _('Supplier part must be specified'),
|
||||
})
|
||||
|
||||
if not purchase_order:
|
||||
raise ValidationError({
|
||||
'order': _('Purchase order must be specified'),
|
||||
})
|
||||
|
||||
# Check that the supplier part and purchase order match
|
||||
if supplier_part is not None and supplier_part.supplier != purchase_order.supplier:
|
||||
|
@ -534,7 +534,7 @@ function orderParts(parts_list, options={}) {
|
||||
`;
|
||||
|
||||
var supplier_part_input = constructField(
|
||||
`supplier_part_${pk}`,
|
||||
`part_${pk}`,
|
||||
{
|
||||
type: 'related field',
|
||||
required: true,
|
||||
@ -631,7 +631,7 @@ function orderParts(parts_list, options={}) {
|
||||
parts.forEach(function(part) {
|
||||
// Configure the "supplier part" field
|
||||
initializeRelatedField({
|
||||
name: `supplier_part_${part.pk}`,
|
||||
name: `part_${part.pk}`,
|
||||
model: 'supplierpart',
|
||||
api_url: '{% url "api-supplier-part-list" %}',
|
||||
required: true,
|
||||
@ -674,7 +674,7 @@ function orderParts(parts_list, options={}) {
|
||||
// Extract information from the row
|
||||
var data = {
|
||||
quantity: getFormFieldValue(`quantity_${pk}`, {type: 'decimal',}, opts),
|
||||
supplier_part: getFormFieldValue(`supplier_part_${pk}`, {}, opts),
|
||||
part: getFormFieldValue(`part_${pk}`, {}, opts),
|
||||
order: getFormFieldValue(`order_${pk}`, {}, opts),
|
||||
}
|
||||
|
||||
@ -725,7 +725,7 @@ function orderParts(parts_list, options={}) {
|
||||
part: pk,
|
||||
onSuccess: function(response) {
|
||||
setRelatedFieldData(
|
||||
`supplier_part_${pk}`,
|
||||
`part_${pk}`,
|
||||
response,
|
||||
opts
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user