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)
|
data = super().validate(data)
|
||||||
|
|
||||||
supplier_part = data['part']
|
supplier_part = data.get('part', None)
|
||||||
purchase_order = data['order']
|
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
|
# Check that the supplier part and purchase order match
|
||||||
if supplier_part is not None and supplier_part.supplier != purchase_order.supplier:
|
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(
|
var supplier_part_input = constructField(
|
||||||
`supplier_part_${pk}`,
|
`part_${pk}`,
|
||||||
{
|
{
|
||||||
type: 'related field',
|
type: 'related field',
|
||||||
required: true,
|
required: true,
|
||||||
@ -631,7 +631,7 @@ function orderParts(parts_list, options={}) {
|
|||||||
parts.forEach(function(part) {
|
parts.forEach(function(part) {
|
||||||
// Configure the "supplier part" field
|
// Configure the "supplier part" field
|
||||||
initializeRelatedField({
|
initializeRelatedField({
|
||||||
name: `supplier_part_${part.pk}`,
|
name: `part_${part.pk}`,
|
||||||
model: 'supplierpart',
|
model: 'supplierpart',
|
||||||
api_url: '{% url "api-supplier-part-list" %}',
|
api_url: '{% url "api-supplier-part-list" %}',
|
||||||
required: true,
|
required: true,
|
||||||
@ -674,7 +674,7 @@ function orderParts(parts_list, options={}) {
|
|||||||
// Extract information from the row
|
// Extract information from the row
|
||||||
var data = {
|
var data = {
|
||||||
quantity: getFormFieldValue(`quantity_${pk}`, {type: 'decimal',}, opts),
|
quantity: getFormFieldValue(`quantity_${pk}`, {type: 'decimal',}, opts),
|
||||||
supplier_part: getFormFieldValue(`supplier_part_${pk}`, {}, opts),
|
part: getFormFieldValue(`part_${pk}`, {}, opts),
|
||||||
order: getFormFieldValue(`order_${pk}`, {}, opts),
|
order: getFormFieldValue(`order_${pk}`, {}, opts),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,7 +725,7 @@ function orderParts(parts_list, options={}) {
|
|||||||
part: pk,
|
part: pk,
|
||||||
onSuccess: function(response) {
|
onSuccess: function(response) {
|
||||||
setRelatedFieldData(
|
setRelatedFieldData(
|
||||||
`supplier_part_${pk}`,
|
`part_${pk}`,
|
||||||
response,
|
response,
|
||||||
opts
|
opts
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user