This commit is contained in:
seb
2026-10-01 21:15:55 +02:00
parent 84e547660e
commit 856d5419a1
2 changed files with 25 additions and 1 deletions

View File

@@ -116,7 +116,7 @@ export default function adjust(provider) {
const resolvedArticles = [];
for (const item of normalizedLines) {
const resolved = await resolveArticle(googleAuthId, item.sku, activeTx);
const artRes = await runner.query('SELECT is_father, articlelist_id FROM article WHERE id = @articleId', {
const artRes = await runner.query('SELECT is_father, articlelist_id, track_stock FROM article WHERE id = @articleId', {
articleId: resolved.articleId,
});
if (artRes.rows[0]?.is_father) {
@@ -127,6 +127,10 @@ export default function adjust(provider) {
throw new Error(`A Stückliste cannot have manual stock adjustments (${item.sku})`);
}
if (Number(artRes.rows[0]?.track_stock ?? 1) === 0) {
throw new Error(`Stock tracking is disabled for article (${item.sku})`);
}
const nameRes = await runner.query(GET_ARTICLE_NAME_SQL, {
articleId: resolved.articleId,
languageId: resolved.languageId,