u
This commit is contained in:
@@ -220,9 +220,9 @@ export const article = {
|
|||||||
return http('/api/article', {
|
return http('/api/article', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: {
|
body: {
|
||||||
parentId,
|
parentId: Number(parentId),
|
||||||
name,
|
name,
|
||||||
...(track_stock !== undefined ? { track_stock } : {}),
|
...(track_stock !== undefined ? { track_stock: Boolean(track_stock) } : {}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -320,7 +320,7 @@ export const article = {
|
|||||||
setBrandIdBySku(sku, brandId) {
|
setBrandIdBySku(sku, brandId) {
|
||||||
return http(`/api/article/${encodeURIComponent(sku)}/brand`, {
|
return http(`/api/article/${encodeURIComponent(sku)}/brand`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
body: { brandId },
|
body: { brandId: brandId != null ? Number(brandId) : null },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -363,9 +363,13 @@ export const article = {
|
|||||||
* → 201 { supplier: ArticleSupplier }
|
* → 201 { supplier: ArticleSupplier }
|
||||||
*/
|
*/
|
||||||
addSupplier(sku, body) {
|
addSupplier(sku, body) {
|
||||||
|
const payload = {
|
||||||
|
...body,
|
||||||
|
entityId: Number(body?.entityId),
|
||||||
|
};
|
||||||
return http(`/api/article/${encodeURIComponent(sku)}/supplier`, {
|
return http(`/api/article/${encodeURIComponent(sku)}/supplier`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body,
|
body: payload,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -657,7 +661,7 @@ export const category = {
|
|||||||
create({ parentId, name }) {
|
create({ parentId, name }) {
|
||||||
return http('/api/category', {
|
return http('/api/category', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: { parentId, name },
|
body: { parentId: Number(parentId), name },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -457,8 +457,14 @@ export async function buildManifestBody(
|
|||||||
lines: buildLines(form.lines, { requireAtLeastOne }),
|
lines: buildLines(form.lines, { requireAtLeastOne }),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (form.partyId != null) body[partyField] = form.partyId;
|
if (form.partyId != null && form.partyId !== '') {
|
||||||
else if (!requireAtLeastOne) body[partyField] = null;
|
const pid = Number(form.partyId);
|
||||||
|
if (!Number.isNaN(pid)) {
|
||||||
|
body[partyField] = pid;
|
||||||
|
}
|
||||||
|
} else if (!requireAtLeastOne) {
|
||||||
|
body[partyField] = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Add files if attachments exist
|
// Add files if attachments exist
|
||||||
if (form.attachments && form.attachments.length > 0) {
|
if (form.attachments && form.attachments.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user