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: make costs and price columns numeric(16,5)

Brad Barbin4b3c26d3c64a
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx b/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
index 282ba9c673..2e5fb8ac70 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
@@ -240,7 +240,9 @@ const JobProperties = () => {
onChange={(value) => {
onUpdate("itemId", value?.value ?? null);
}}
- onTypeChange={setType}
+ onTypeChange={(value) => {
+ setType(value as MethodItemType);
+ }}
/>
</ValidatedForm>
<ValidatedForm
diff --git a/apps/erp/app/modules/purchasing/types.ts b/apps/erp/app/modules/purchasing/types.ts
index 46e9411242..f850579e00 100644
--- a/apps/erp/app/modules/purchasing/types.ts
+++ b/apps/erp/app/modules/purchasing/types.ts
@@ -5,7 +5,7 @@ import type {
getPurchaseOrders,
getSupplier,
getSupplierContacts,
- getSupplierInteractionByQuote,
+ getSupplierInteraction,
getSupplierLocations,
getSupplierProcessesBySupplier,
getSupplierQuoteLinePricesByQuoteId,
@@ -51,7 +51,7 @@ export type SupplierContact = NonNullable<
>[number];
export type SupplierInteraction = NonNullable<
- Awaited<ReturnType<typeof getSupplierInteractionByQuote>>["data"]
+ Awaited<ReturnType<typeof getSupplierInteraction>>["data"]
>;
export type SupplierLocation = NonNullable<
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteMaterialForm.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteMaterialForm.tsx
index 0e6013c609..406a1751e8 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteMaterialForm.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteMaterialForm.tsx
@@ -79,8 +79,9 @@ const QuoteMaterialForm = ({
quantity: initialValues.quantity ?? 1,
});
- const onTypeChange = (value: MethodItemType) => {
- setItemType(value);
+ const onTypeChange = (value: MethodItemType | "Item") => {
+ if (value === itemType) return;
+ setItemType(value as MethodItemType);
setItemData({
itemId: "",
itemReadableId: "",
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteToOrderDrawer.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteToOrderDrawer.tsx
index 21c4198f96..f1cf310847 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteToOrderDrawer.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteToOrderDrawer.tsx
@@ -722,11 +722,11 @@ const LinePricingOptions = ({
? overridePricing.convertedNetUnitPrice *
overridePricing.quantity +
(overridePricing.convertedShippingCost ?? 0) +
- overridePricing.convertedAddOn
+ (overridePricing.convertedAddOn ?? 0)
: overridePricing.netUnitPrice *
overridePricing.quantity +
(overridePricing.shippingCost ?? 0) +
- overridePricing.addOn
+ (overridePricing.addOn ?? 0)
)}
</Td>
</Tr>
diff --git a/apps/erp/app/routes/x+/accounting+/categories.$categoryId.tsx b/apps/erp/app/routes/x+/accounting+/categories.$categoryId.tsx
index 1f7d6f8674..1047ab6721 100644
--- a/apps/erp/app/routes/x+/accounting+/categories.$categoryId.tsx
+++ b/apps/erp/app/routes/x+/accounting+/categories.$categoryId.tsx
@@ -15,7 +15,7 @@ import { getCustomFields, setCustomFields } from "~/utils/form";
import { getParams, path } from "~/utils/path";
export async function loader({ request, params }: LoaderFunctionArgs) {
- const { client } = await requirePermissions(request, {
+ const { client, companyId } = await requirePermissions(request, {
view: "accounting",
role: "employee",
});
@@ -23,7 +23,11 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const { categoryId } = params;
if (!categoryId) throw notFound("Invalid categoryId");
- const accountCategory = await getAccountCategory(client, categoryId);
+ const accountCategory = await getAccountCategory(
+ client,
+ categoryId,
+ companyId
+ );
if (accountCategory.error) {
throw redirect(
path.to.accountingCategories,
diff --git a/apps/erp/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx b/apps/erp/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx
index 73df65b4b8..2a827b1ece 100644
--- a/apps/erp/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx
+++ b/apps/erp/app/routes/x+/purchase-invoice+/$invoiceId.details.tsx
@@ -121,7 +121,7 @@ export default function PurchaseInvoiceBasicRoute() {
<Await resolve={invoiceData.files}>
{(resolvedFiles) => (
<SupplierInteractionDocuments
- interaction={invoiceData.interaction}
+ interactionId={invoiceData.interaction.id}
attachments={resolvedFiles}
id={invoiceId}
type="Purchase Invoice"
diff --git a/apps/erp/app/routes/x+/purchase-order+/$orderId.status.tsx b/apps/erp/app/routes/x+/purchase-order+/$orderId.status.tsx
index 2a498ca09a..3337be07dc 100644
--- a/apps/erp/app/routes/x+/purchase-order+/$orderId.status.tsx
+++ b/apps/erp/app/routes/x+/purchase-order+/$orderId.status.tsx
@@ -1,7 +1,6 @@
import { assertIsPost, error, success } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
-import { getLocalTimeZone, now } from "@internationalized/date";
import type { ActionFunctionArgs } from "@vercel/remix";
import { redirect } from "@vercel/remix";
import {
@@ -38,15 +37,6 @@ export async function action({ request, params }: ActionFunctionArgs) {
assignee: ["Closed"].includes(status) ? null : undefined,
updatedBy: userId,
}),
- client
- .from("supplierInteraction")
- .update({
- purchaseOrderCompletedDate:
- status !== "Draft"
- ? now(getLocalTimeZone()).toAbsoluteString()
- : null,
- })
- .eq("purchaseOrderId", id),
]);
if (update.error) {
throw redirect(
diff --git a/apps/erp/app/routes/x+/supplier-quote+/$id.details.tsx b/apps/erp/app/routes/x+/supplier-quote+/$id.details.tsx
index efcbb044d8..d21523ad43 100644
--- a/apps/erp/app/routes/x+/supplier-quote+/$id.details.tsx
+++ b/apps/erp/app/routes/x+/supplier-quote+/$id.details.tsx
@@ -112,7 +112,7 @@ export default function SupplierQuoteDetailsRoute() {
<Await resolve={routeData.files}>
{(resolvedFiles) => (
<SupplierInteractionDocuments
- interaction={routeData.interaction}
+ interactionId={routeData.interaction.id}
attachments={resolvedFiles}
id={id}
type="Supplier Quote"