Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix(inventory): review fixes for receipt quantities starting at zero

naveenkashea67cd8c92dc
diff --git a/.ai/playbooks/receipt-quantities-start-at-zero.md b/.ai/playbooks/receipt-quantities-start-at-zero.md
index c950ebb548..5556bcc33a 100644
--- a/.ai/playbooks/receipt-quantities-start-at-zero.md
+++ b/.ai/playbooks/receipt-quantities-start-at-zero.md
@@ -1,6 +1,6 @@
# Receipt Quantities Start at Zero
-Last tested: 2026-10-16
+Last tested: 2026-10-16 (re-run after review fixes)
Routes: /x/settings/inventory, /x/purchase-order/<id>/details → Receive, /x/receipt/<id>/details
## Prerequisites
@@ -20,6 +20,8 @@ Routes: /x/settings/inventory, /x/purchase-order/<id>/details → Receive, /x/re
- PO details → button "Receive" (first receipt) or "Receipts" dropdown → menuitem
"New Receipt" (later receipts). Redirects to `/x/receipt/<id>/details`.
- Verify: every line's Received textbox reads 0, Ordered/Outstanding unchanged, Post disabled.
+ Hovering Post shows "Enter a received quantity, or tick a unit, on at least one line."
+ (`agent-browser hover @<Post ref>`); entering a quantity enables Post and drops the tooltip.
### 3. Enter a quantity, post
- `fill` the line's Received textbox, then click another textbox to blur (commits via
diff --git a/.claude/rules/shipments-receipts-ui-patterns.md b/.claude/rules/shipments-receipts-ui-patterns.md
index a3c4b26ca6..beedaecde1 100644
--- a/.claude/rules/shipments-receipts-ui-patterns.md
+++ b/.claude/rules/shipments-receipts-ui-patterns.md
@@ -23,6 +23,10 @@ only holds the two list routes `shipments.tsx` / `receipts.tsx`).
rental shipment and one Draft rental receipt per agreement, enforced by the partial unique
indexes `shipment_oneOpenDraftPerRentalAgreement_idx` / `receipt_oneOpenDraftPerRentalAgreement_idx`),
else invokes `create` with `shipmentFromRentalAgreement` / `receiptFromRentalAgreement`.
+ A receipt's lines start at the quantity still to receive, or at 0 when
+ `companySettings.receiptQuantitiesStartAtZero` is on (Settings → Inventory → Receiving —
+ every source `create` builds lines for: Purchase Order, Inbound Transfer, Sales Return Order;
+ a PO's fixed-asset lines then start unticked). Shipments are not affected.
- `$id.tsx` — layout loader: parallel `getShipment` / `getShipmentLines` / `getShipmentTracking`,
plus fixed-asset lines (`shipmentFixedAssetLine`) and related items. Receipt also loads
`getReceiptFiles`, `getBatchProperties`, `getShelfLifeForItems`, `companySettings`. Renders `<Outlet/>`.
@@ -129,7 +133,8 @@ the service-role client + Kysely `db.transaction()`, and branch on `sourceDocume
- **post-receipt** handles `Purchase Order`, `Inbound Transfer`, `Rental Agreement` (returns each
ticked unit through `returnRentalUnit` and moves its `fixedAsset.locationId` to the receipt's
location; `post-receipt/rental-agreement.ts`), and `Sales Return Order`
- (customer RMA re-entry at original outbound cost, entities to On Hold). PO path: inserts `itemLedger`
+ (customer RMA re-entry at original outbound cost, entities to On Hold). The PO, transfer and RMA branches skip a
+ line received at 0 — it books no `itemLedger`, cost layer or journal line. PO path: inserts `itemLedger`
(entry types `Positive/Negative Adjmt.` by sign), GR/IR + inventory `journalLine`s for every
company (the journal is Provisional before the accounting cutover, Posted after it), advances PO line `quantityReceived`/`receivedComplete` and PO `status`,
flips tracked entities to `Available` (**`On Hold` if the item has a Receipt-usage inspection
diff --git a/apps/erp/app/modules/inventory/ui/Receipts/ReceiptHeader.tsx b/apps/erp/app/modules/inventory/ui/Receipts/ReceiptHeader.tsx
index 96763c7e2f..b374e3274f 100644
--- a/apps/erp/app/modules/inventory/ui/Receipts/ReceiptHeader.tsx
+++ b/apps/erp/app/modules/inventory/ui/Receipts/ReceiptHeader.tsx
@@ -8,6 +8,9 @@ import {
DropdownMenuItem,
DropdownMenuSeparator,
MENU_ITEM_SHORTCUTS,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
useDisclosure
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
@@ -174,14 +177,31 @@ const ReceiptHeader = () => {
</Button>
))}
{!isPosted && !isVoided && (
- <Button
- variant="primary"
- onClick={postModal.onOpen}
- isDisabled={!canPost || !permissions.is("employee")}
- leftIcon={<LuCheckCheck />}
- >
- <Trans>Post</Trans>
- </Button>
+ // A disabled button fires no pointer events, so the span is the
+ // trigger. Every line can start at 0 (receipt quantities start
+ // at zero), which leaves Post disabled with no other hint.
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <span>
+ <Button
+ variant="primary"
+ onClick={postModal.onOpen}
+ isDisabled={!canPost || !permissions.is("employee")}
+ leftIcon={<LuCheckCheck />}
+ >
+ <Trans>Post</Trans>
+ </Button>
+ </span>
+ </TooltipTrigger>
+ {!canPost && (
+ <TooltipContent>
+ <Trans>
+ Enter a received quantity, or tick a unit, on at least one
+ line.
+ </Trans>
+ </TooltipContent>
+ )}
+ </Tooltip>
)}
</>
}
diff --git a/apps/erp/app/routes/x+/settings+/inventory.tsx b/apps/erp/app/routes/x+/settings+/inventory.tsx
index a90510db60..cd42ab357b 100644
--- a/apps/erp/app/routes/x+/settings+/inventory.tsx
+++ b/apps/erp/app/routes/x+/settings+/inventory.tsx
@@ -240,22 +240,33 @@ export default function InventorySettingsRoute() {
}
}, [fetcher.data?.message, fetcher.data?.success]);
+ const toggleFetcher = useFetcher<typeof action>();
+
const receiptQuantitiesStartAtZero = useSavedToggle(
- fetcher,
+ toggleFetcher,
"receiptQuantitiesStartAtZero",
companySettings.receiptQuantitiesStartAtZero
);
const handleReceiptQuantitiesStartAtZeroToggle = useCallback(
(checked: boolean) => {
- fetcher.submit(
+ toggleFetcher.submit(
{ intent: "receiptQuantitiesStartAtZero", enabled: checked.toString() },
{ method: "POST" }
);
},
- [fetcher]
+ [toggleFetcher]
);
+ useEffect(() => {
+ if (toggleFetcher.data?.success === true && toggleFetcher?.data?.message) {
+ toast.success(toggleFetcher.data.message);
+ }
+ if (toggleFetcher.data?.success === false && toggleFetcher?.data?.message) {
+ toast.error(toggleFetcher.data.message);
+ }
+ }, [toggleFetcher.data?.message, toggleFetcher.data?.success]);
+
return (
<ScrollArea className="w-full h-[calc(100dvh-var(--topbar-height)-var(--content-inset))]">
<SettingsPage className="gap-4">
@@ -347,7 +358,7 @@ export default function InventorySettingsRoute() {
) : (
<Trans>
Enable to make receivers enter the quantity on each line
- instead of confirming the ordered amount.
+ instead of confirming the quantity still to receive.
</Trans>
)}
</span>
@@ -355,7 +366,7 @@ export default function InventorySettingsRoute() {
<Switch
checked={receiptQuantitiesStartAtZero}
onCheckedChange={handleReceiptQuantitiesStartAtZeroToggle}
- disabled={fetcher.state !== "idle"}
+ disabled={toggleFetcher.state !== "idle"}
/>
</HStack>
</CardContent>
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index fcf4b542be..6ece43a176 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -8827,8 +8827,8 @@ msgstr "Ermöglichen Sie die Konfiguration steuerlicher Abschreibungsmethoden f
msgid "Enable to generate IDs and descriptions for raw materials."
msgstr "Aktivieren Sie diese Option, um IDs und Beschreibungen für Rohstoffe zu generieren."
-msgid "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
-msgstr "Aktivieren Sie diese Option, um Empfänger die Menge auf jeder Position eingeben zu lassen, anstatt die bestellte Menge zu bestätigen."
+msgid "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
+msgstr "Ermöglichen Sie Empfängern, die Menge in jeder Position einzugeben, anstatt die noch zu empfangende Menge zu bestätigen."
msgid "Enable to require an authenticator app before anyone can open this company."
msgstr "Aktivieren, um eine Authentifizierungs-App zu erfordern, bevor jemand dieses Unternehmen öffnen kann."
@@ -8960,6 +8960,9 @@ msgstr "Geben Sie eine Menge zwischen 1 und {0} ein."
msgid "Enter a reason to take the unit out of service"
msgstr "Geben Sie einen Grund an, um die Einheit außer Betrieb zu nehmen"
+msgid "Enter a received quantity, or tick a unit, on at least one line."
+msgstr "Geben Sie auf mindestens einer Position eine empfangene Menge ein oder wählen Sie eine Einheit."
+
msgid "Enter a web address, such as https://example.com"
msgstr "Geben Sie eine Webadresse ein, z. B. https://example.com"
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index 5a34e4b8f6..c05082533c 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -8827,8 +8827,8 @@ msgstr "Enable to configure tax-specific depreciation methods on asset classes (
msgid "Enable to generate IDs and descriptions for raw materials."
msgstr "Enable to generate IDs and descriptions for raw materials."
-msgid "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
-msgstr "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
+msgid "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
+msgstr "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
msgid "Enable to require an authenticator app before anyone can open this company."
msgstr "Enable to require an authenticator app before anyone can open this company."
@@ -8960,6 +8960,9 @@ msgstr "Enter a quantity between 1 and {0}."
msgid "Enter a reason to take the unit out of service"
msgstr "Enter a reason to take the unit out of service"
+msgid "Enter a received quantity, or tick a unit, on at least one line."
+msgstr "Enter a received quantity, or tick a unit, on at least one line."
+
msgid "Enter a web address, such as https://example.com"
msgstr "Enter a web address, such as https://example.com"
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index 6c1d66a314..88bc803fc9 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -8827,8 +8827,8 @@ msgstr "Habilitar para configurar métodos de depreciación específicos de impu
msgid "Enable to generate IDs and descriptions for raw materials."
msgstr "Habilitar para generar IDs y descripciones para materias primas."
-msgid "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
-msgstr "Habilitar para que los receptores ingresen la cantidad en cada línea en lugar de confirmar la cantidad pedida."
+msgid "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
+msgstr "Permitir que los receptores ingresen la cantidad en cada línea en lugar de confirmar la cantidad por recibir."
msgid "Enable to require an authenticator app before anyone can open this company."
msgstr "Habilitar para requerir una aplicación autenticadora antes de que alguien pueda abrir esta empresa."
@@ -8960,6 +8960,9 @@ msgstr "Ingrese una cantidad entre 1 y {0}."
msgid "Enter a reason to take the unit out of service"
msgstr "Ingrese una razón para retirar la unidad del servicio"
+msgid "Enter a received quantity, or tick a unit, on at least one line."
+msgstr "Ingresa una cantidad recibida, o marca una unidad, en al menos una línea."
+
msgid "Enter a web address, such as https://example.com"
msgstr "Ingrese una dirección web, por ejemplo https://example.com"
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index 22d0ea0203..715faa9de4 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -8827,8 +8827,8 @@ msgstr "Activez pour configurer les méthodes d'amortissement spécifiques aux i
msgid "Enable to generate IDs and descriptions for raw materials."
msgstr "Activez pour générer des identifiants et des descriptions pour les matières premières."
-msgid "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
-msgstr "Activez cette option pour que les réceptionnaires saisissent la quantité sur chaque ligne au lieu de confirmer la quantité commandée."
+msgid "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
+msgstr "Permettre aux réceptionnaires de saisir la quantité sur chaque ligne au lieu de confirmer la quantité à réceptionner."
msgid "Enable to require an authenticator app before anyone can open this company."
msgstr "Activez pour exiger une application d'authentification avant que quiconque puisse ouvrir cette société."
@@ -8960,6 +8960,9 @@ msgstr "Entrez une quantité entre 1 et {0}."
msgid "Enter a reason to take the unit out of service"
msgstr "Entrez une raison pour retirer l'unité du service"
+msgid "Enter a received quantity, or tick a unit, on at least one line."
+msgstr "Saisissez une quantité reçue ou cochez une unité sur au moins une ligne."
+
msgid "Enter a web address, such as https://example.com"
msgstr "Entrez une adresse web, par exemple https://example.com"
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index 4269b8db29..162ef7b480 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -8827,8 +8827,8 @@ msgstr "परिसंपत्ति वर्गों पर कर-वि
msgid "Enable to generate IDs and descriptions for raw materials."
msgstr "कच्चे माल के लिए ID और विवरण उत्पन्न करने के लिए सक्षम करें।"
-msgid "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
-msgstr "प्राप्तकर्ताओं को प्रत्येक पंक्ति पर मात्रा दर्ज करने के लिए सक्षम करें, ऑर्डर की मात्रा की पुष्टि करने के बजाय।"
+msgid "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
+msgstr "प्राप्तकर्ताओं को अभी प्राप्त करने के लिए मात्रा की पुष्टि करने के बजाय, प्रत्येक पंक्ति पर मात्रा दर्ज करने में सक्षम करें।"
msgid "Enable to require an authenticator app before anyone can open this company."
msgstr "कोई भी इस कंपनी को खोलने से पहले प्रमाणकर्ता ऐप की आवश्यकता होने के लिए सक्षम करें।"
@@ -8960,6 +8960,9 @@ msgstr "1 और {0} के बीच मात्रा दर्ज करे
msgid "Enter a reason to take the unit out of service"
msgstr "इकाई को सेवा से बाहर निकालने का कारण दर्ज करें"
+msgid "Enter a received quantity, or tick a unit, on at least one line."
+msgstr "कम से कम एक पंक्ति पर एक प्राप्त मात्रा दर्ज करें, या एक इकाई को चिह्नित करें।"
+
msgid "Enter a web address, such as https://example.com"
msgstr "वेब पता दर्ज करें, जैसे https://example.com"
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index ab368bc10a..c25120cc1e 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -8827,8 +8827,8 @@ msgstr "Abilita la configurazione di Metodi di ammortamento specifici per le tas
msgid "Enable to generate IDs and descriptions for raw materials."
msgstr "Abilita per generare ID e descrizioni per le materie prime."
-msgid "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
-msgstr "Abilita i riceventi a inserire la quantità su ogni riga invece di confermare la quantità ordinata."
+msgid "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
+msgstr "Abilita i ricevitori a inserire la quantità su ogni riga invece di confermare la quantità da ricevere."
msgid "Enable to require an authenticator app before anyone can open this company."
msgstr "Attiva per richiedere un'app autenticatore prima che chiunque possa aprire questa azienda."
@@ -8960,6 +8960,9 @@ msgstr "Inserisci una quantità tra 1 e {0}."
msgid "Enter a reason to take the unit out of service"
msgstr "Inserisci un motivo per mettere l'unità fuori servizio"
+msgid "Enter a received quantity, or tick a unit, on at least one line."
+msgstr "Inserisci una quantità ricevuta o spunta un'unità su almeno una riga."
+
msgid "Enter a web address, such as https://example.com"
msgstr "Inserisci un indirizzo web, ad esempio https://example.com"
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index 445debf616..fb00e69fbe 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -8827,8 +8827,8 @@ msgstr "税固有の減価償却方法を資産クラスで設定するために
msgid "Enable to generate IDs and descriptions for raw materials."
msgstr "有効にして、原材料のIDと説明を生成します。"
-msgid "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
-msgstr "発注済数量の確認ではなく、各明細で受け取り者が数量を入力するようにします。"
+msgid "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
+msgstr "受け取り担当者が入荷待ち数量を確認する代わりに、各明細の数量を入力できるようにする。"
msgid "Enable to require an authenticator app before anyone can open this company."
msgstr "この会社を開く前に誰でも認証器アプリが必須となるように有効にします。"
@@ -8960,6 +8960,9 @@ msgstr "1~{0}の数量を入力してください。"
msgid "Enter a reason to take the unit out of service"
msgstr "ユニットを使用停止にする理由を入力"
+msgid "Enter a received quantity, or tick a unit, on at least one line."
+msgstr "少なくとも1つの明細で、受取数量を入力するか個をチェックしてください。"
+
msgid "Enter a web address, such as https://example.com"
msgstr "Webアドレスを入力してください(例: https://example.com)"
diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.po
index 04f1e23aaf..da22890191 100644
--- a/packages/locale/locales/ko/erp.po
+++ b/packages/locale/locales/ko/erp.po
@@ -8827,8 +8827,8 @@ msgstr "자산 클래스에 세무 전용 감가상각 방법(예: MACRS, 가속
msgid "Enable to generate IDs and descriptions for raw materials."
msgstr "원자재에 대한 ID와 설명을 자동 생성하려면 활성화하세요."
-msgid "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
-msgstr "각 라인의 발주 수량을 확인하는 대신 수령자가 수량을 입력하도록 하려면 활성화하세요"
+msgid "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
+msgstr "각 라인에서 입고 대기 수량을 확인하는 대신 수량을 입력하도록 활성화합니다."
msgid "Enable to require an authenticator app before anyone can open this company."
msgstr "누구든 이 회사를 열기 전에 인증기 앱이 필요하려면 활성화합니다."
@@ -8960,6 +8960,9 @@ msgstr "1과 {0} 사이의 수량을 입력하세요."
msgid "Enter a reason to take the unit out of service"
msgstr "장비를 운영 중단하는 이유를 입력하세요"
+msgid "Enter a received quantity, or tick a unit, on at least one line."
+msgstr "최소한 하나의 라인에 수량을 입력하거나 개를 체크하세요."
+
msgid "Enter a web address, such as https://example.com"
msgstr "웹 주소를 입력하세요(예: https://example.com)"
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index 6772383d44..18229279f9 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -8827,8 +8827,8 @@ msgstr "Włącz konfigurację metod amortyzacji specyficznych dla podatków w kl
msgid "Enable to generate IDs and descriptions for raw materials."
msgstr "Włącz, aby generować identyfikatory i opisy dla surowców."
-msgid "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
-msgstr "Włącz, aby odbiorcy wpisali Ilość na każdej Pozycji zamiast potwierdzać Ilość zamówioną."
+msgid "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
+msgstr "Włącz, aby pracownicy wpisywali ilość na każdej pozycji zamiast potwierdzenia ilości do przyjęcia."
msgid "Enable to require an authenticator app before anyone can open this company."
msgstr "Włącz, aby wymagać aplikacji uwierzytelniającej, zanim ktokolwiek będzie mógł otworzyć tę firmę."
@@ -8960,6 +8960,9 @@ msgstr "Wprowadź ilość między 1 a {0}."
msgid "Enter a reason to take the unit out of service"
msgstr "Podaj powód wycofania jednostki z eksploatacji"
+msgid "Enter a received quantity, or tick a unit, on at least one line."
+msgstr "Wpisz ilość na co najmniej jednej pozycji lub zaznacz sztukę."
+
msgid "Enter a web address, such as https://example.com"
msgstr "Wprowadź adres internetowy, np. https://example.com"
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index d45e0f3ae6..0635524e82 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -8827,8 +8827,8 @@ msgstr "Ativar para configurar métodos de depreciação específicos de imposto
msgid "Enable to generate IDs and descriptions for raw materials."
msgstr "Ativar para gerar IDs e descrições para matérias-primas."
-msgid "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
-msgstr "Ativar para fazer os recebedores digitarem a quantidade em cada linha em vez de confirmar a quantidade pedida."
+msgid "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
+msgstr "Ativar para que os receptores insiram a quantidade em cada linha em vez de confirmar a quantidade ainda a receber."
msgid "Enable to require an authenticator app before anyone can open this company."
msgstr "Ativar para exigir um aplicativo autenticador antes que alguém possa abrir esta empresa."
@@ -8960,6 +8960,9 @@ msgstr "Digite uma quantidade entre 1 e {0}."
msgid "Enter a reason to take the unit out of service"
msgstr "Digite um motivo para remover a unidade do serviço"
+msgid "Enter a received quantity, or tick a unit, on at least one line."
+msgstr "Insira uma quantidade recebida ou marque uma unidade em pelo menos uma linha."
+
msgid "Enter a web address, such as https://example.com"
msgstr "Insira um endereço web, por exemplo https://example.com"
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index 20fab9b611..bb6d570fd5 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -8827,8 +8827,8 @@ msgstr "Включите, чтобы настроить налоговые ме
msgid "Enable to generate IDs and descriptions for raw materials."
msgstr "Включите для создания идентификаторов и описаний для сырья."
-msgid "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
-msgstr "Включите, чтобы получатели вводили количество на каждой строке вместо подтверждения заказанного объема."
+msgid "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
+msgstr "Разрешить приемщикам вводить количество для каждой строки вместо подтверждения количества, ожидающего приемки."
msgid "Enable to require an authenticator app before anyone can open this company."
msgstr "Включите, чтобы требовать приложение-аутентификатор перед открытием этой организации."
@@ -8960,6 +8960,9 @@ msgstr "Введите количество от 1 до {0}."
msgid "Enter a reason to take the unit out of service"
msgstr "Введите причину вывода единицы из эксплуатации"
+msgid "Enter a received quantity, or tick a unit, on at least one line."
+msgstr "Введите полученное количество или отметьте единицу по крайней мере на одной строке."
+
msgid "Enter a web address, such as https://example.com"
msgstr "Введите веб-адрес, например https://example.com"
diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.po
index 77c47d40f0..aae4685b06 100644
--- a/packages/locale/locales/tr/erp.po
+++ b/packages/locale/locales/tr/erp.po
@@ -8827,8 +8827,8 @@ msgstr "Varlık sınıfları için vergiye özgü amortisman yöntemlerini yapı
msgid "Enable to generate IDs and descriptions for raw materials."
msgstr "Hammaddeler için ID'ler ve açıklamalar oluşturmayı etkinleştir."
-msgid "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
-msgstr "Alıcıların sipariş edilen miktarı onaylamak yerine her satırdaki miktarı girmelerini etkinleştirin."
+msgid "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
+msgstr "Alıcıların her satırda miktarı girmelerini, Mal kabul bekleyen miktarını onaylamak yerine etkinleştirin."
msgid "Enable to require an authenticator app before anyone can open this company."
msgstr "Herhangi birinin bu şirketi açabilmesi için kimlik doğrulaması uygulaması gerektirmek için etkinleştirin."
@@ -8960,6 +8960,9 @@ msgstr "1 ile {0} arasında bir miktar girin."
msgid "Enter a reason to take the unit out of service"
msgstr "Üniteyi hizmet dışı bırakmak için bir neden girin"
+msgid "Enter a received quantity, or tick a unit, on at least one line."
+msgstr "En az bir satırda miktarı girin veya bir Adet'i işaretleyin."
+
msgid "Enter a web address, such as https://example.com"
msgstr "Bir web adresi girin, örneğin https://example.com"
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index 281db07ab2..1a8d80ac67 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -8827,8 +8827,8 @@ msgstr "启用以在资产类别上配置特定于税收的折旧方法(例如
msgid "Enable to generate IDs and descriptions for raw materials."
msgstr "启用以为原材料生成ID和描述。"
-msgid "Enable to make receivers enter the quantity on each line instead of confirming the ordered amount."
-msgstr "启用此选项可让接收人在每一行输入数量,而不是确认订购数量。"
+msgid "Enable to make receivers enter the quantity on each line instead of confirming the quantity still to receive."
+msgstr "启用收货员在每一行输入实际收货数量,而不是仅确认待收货数量。"
msgid "Enable to require an authenticator app before anyone can open this company."
msgstr "启用以要求在任何人打开此公司之前使用身份验证器应用程序。"
@@ -8960,6 +8960,9 @@ msgstr "请输入 1 至 {0} 之间的数量。"
msgid "Enter a reason to take the unit out of service"
msgstr "输入停用该设备的原因"
+msgid "Enter a received quantity, or tick a unit, on at least one line."
+msgstr "请在至少一行上输入收货数量或勾选一个件。"
+
msgid "Enter a web address, such as https://example.com"
msgstr "请输入网址,例如 https://example.com"
diff --git a/packages/server-functions/src/receipt-quantities-start-at-zero.test.ts b/packages/server-functions/src/receipt-quantities-start-at-zero.test.ts
index 5aa05cf5d8..fcf8e6a863 100644
--- a/packages/server-functions/src/receipt-quantities-start-at-zero.test.ts
+++ b/packages/server-functions/src/receipt-quantities-start-at-zero.test.ts
@@ -176,3 +176,195 @@ databaseTest(
}
}
);
+
+databaseTest(
+ "with the setting on, transfer and sales return receipts start at 0",
+ async () => {
+ const f = await alwaysPostFixture();
+ try {
+ await setStartAtZero(f, true);
+ const warehouseTransferId = `${f.prefix}-transfer-blind`;
+ const salesReturnOrderId = `${f.prefix}-rma-blind`;
+ await seed(f, async (trx) => {
+ await trx
+ .insertInto("warehouseTransfer")
+ .values({
+ id: warehouseTransferId,
+ transferId: "WT-BLIND",
+ fromLocationId: f.otherLocationId,
+ toLocationId: f.locationId,
+ status: "To Receive",
+ companyId: f.companyId,
+ createdBy: USER
+ })
+ .execute();
+ await trx
+ .insertInto("warehouseTransferLine")
+ .values({
+ transferId: warehouseTransferId,
+ itemId: f.partId,
+ quantity: 5,
+ shippedQuantity: 5,
+ fromLocationId: f.otherLocationId,
+ toLocationId: f.locationId,
+ companyId: f.companyId,
+ createdBy: USER
+ })
+ .execute();
+ await trx
+ .insertInto("salesReturnOrder")
+ .values({
+ id: salesReturnOrderId,
+ salesReturnOrderId: "RMA-BLIND",
+ customerId: f.customerId,
+ currencyCode: "USD",
+ orderDate: f.today,
+ locationId: f.locationId,
+ status: "To Receive",
+ companyId: f.companyId,
+ createdBy: USER
+ })
+ .execute();
+ await trx
+ .insertInto("salesReturnOrderLine")
+ .values({
+ salesReturnOrderId,
+ itemId: f.partId,
+ quantity: 2,
+ companyId: f.companyId,
+ createdBy: USER
+ })
+ .execute();
+ });
+
+ const transferReceipt = unwrap(
+ await create(f.ctx, {
+ type: "receiptFromInboundTransfer",
+ warehouseTransferId
+ })
+ );
+ const returnReceipt = unwrap(
+ await create(f.ctx, {
+ type: "receiptFromSalesReturnOrder",
+ salesReturnOrderId,
+ locationId: f.locationId
+ })
+ );
+
+ for (const [receiptId, outstanding] of [
+ [transferReceipt.id, 5],
+ [returnReceipt.id, 2]
+ ] as const) {
+ const lines = await receiptLines(f, receiptId);
+ expect(
+ lines.map((l) => [
+ Number(l.receivedQuantity),
+ Number(l.outstandingQuantity)
+ ])
+ ).toEqual([[0, outstanding]]);
+ }
+ } finally {
+ await f.cleanup();
+ }
+ }
+);
+
+databaseTest(
+ "with the setting on, a purchase order's fixed-asset line starts unticked",
+ async () => {
+ const f = await alwaysPostFixture();
+ try {
+ await setStartAtZero(f, true);
+ const purchaseOrderId = `${f.prefix}-po-asset`;
+ await seed(f, async (trx) => {
+ const filler = f.account("filler");
+ const assetClass = await trx
+ .insertInto("fixedAssetClass")
+ .values({
+ name: `${f.prefix} machinery`,
+ assetAccountId: filler,
+ accumulatedDepreciationAccountId: filler,
+ depreciationExpenseAccountId: filler,
+ writeOffAccountId: filler,
+ writeDownAccountId: filler,
+ lossOnDisposalAccountId: filler,
+ gainOnDisposalAccountId: filler,
+ companyId: f.companyId,
+ createdBy: USER
+ })
+ .returning("id")
+ .executeTakeFirstOrThrow();
+ const asset = await trx
+ .insertInto("fixedAsset")
+ .values({
+ fixedAssetId: `${f.prefix}-FA`,
+ name: "CNC machining center",
+ fixedAssetClassId: assetClass.id,
+ companyId: f.companyId,
+ createdBy: USER
+ })
+ .returning("id")
+ .executeTakeFirstOrThrow();
+ const interaction = await trx
+ .insertInto("supplierInteraction")
+ .values({ supplierId: f.supplierId, companyId: f.companyId })
+ .returning("id")
+ .executeTakeFirstOrThrow();
+ await trx
+ .insertInto("purchaseOrder")
+ .values({
+ id: purchaseOrderId,
+ purchaseOrderId: "PO-ASSET",
+ supplierId: f.supplierId,
+ supplierInteractionId: interaction.id,
+ currencyCode: "USD",
+ exchangeRate: 1,
+ companyId: f.companyId,
+ createdBy: USER
+ })
+ .execute();
+ await trx
+ .insertInto("purchaseOrderDelivery")
+ .values({
+ id: purchaseOrderId,
+ locationId: f.locationId,
+ companyId: f.companyId
+ })
+ .execute();
+ await trx
+ .insertInto("purchaseOrderLine")
+ .values({
+ purchaseOrderId,
+ purchaseOrderLineType: "Fixed Asset",
+ assetId: asset.id,
+ purchaseQuantity: 1,
+ supplierUnitPrice: 1000,
+ exchangeRate: 1,
+ conversionFactor: 1,
+ locationId: f.locationId,
+ companyId: f.companyId,
+ createdBy: USER
+ })
+ .execute();
+ });
+
+ const receipt = unwrap(
+ await create(f.ctx, {
+ type: "receiptFromPurchaseOrder",
+ purchaseOrderId,
+ locationId: f.locationId
+ })
+ );
+
+ const assetLines = await f.db
+ .selectFrom("receiptFixedAssetLine")
+ .select("received")
+ .where("receiptId", "=", receipt.id)
+ .where("companyId", "=", f.companyId)
+ .execute();
+ expect(assetLines.map((l) => l.received)).toEqual([false]);
+ } finally {
+ await f.cleanup();
+ }
+ }
+);