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.

refactor: remove currencyCode from customerPayment, supplierPayment, quotePayment, salesOrderPayment, and purchaseOrderPayment

Rob Carrington3c2896932a77
diff --git a/apps/carbon/app/modules/invoicing/invoicing.service.ts b/apps/carbon/app/modules/invoicing/invoicing.service.ts
index 037560a3e7..25b57c9a1d 100644
--- a/apps/carbon/app/modules/invoicing/invoicing.service.ts
+++ b/apps/carbon/app/modules/invoicing/invoicing.service.ts
@@ -124,7 +124,7 @@ export async function upsertPurchaseInvoice(
if (supplierPayment.error) return supplierPayment;
- const { currencyCode, paymentTermId } = supplierPayment.data;
+ const { paymentTermId } = supplierPayment.data;
const invoice = await client
.from("purchaseInvoice")
@@ -133,7 +133,7 @@ export async function upsertPurchaseInvoice(
...purchaseInvoice,
invoiceSupplierId:
purchaseInvoice.invoiceSupplierId ?? purchaseInvoice.supplierId ?? "",
- currencyCode: purchaseInvoice.currencyCode ?? currencyCode ?? "USD",
+ currencyCode: purchaseInvoice.currencyCode ?? "USD",
paymentTermId: purchaseInvoice.paymentTermId ?? paymentTermId,
},
])
diff --git a/apps/carbon/app/modules/purchasing/purchasing.models.ts b/apps/carbon/app/modules/purchasing/purchasing.models.ts
index ca7ec8d8db..77885af620 100644
--- a/apps/carbon/app/modules/purchasing/purchasing.models.ts
+++ b/apps/carbon/app/modules/purchasing/purchasing.models.ts
@@ -1,7 +1,6 @@
import { z } from "zod";
import { zfd } from "zod-form-data";
import { address, contact } from "~/types/validators";
-import { currencyCodes } from "../accounting";
export const purchaseOrderLineType = [
"Part",
@@ -153,7 +152,6 @@ export const purchaseOrderPaymentValidator = z.object({
invoiceSupplierContactId: zfd.text(z.string().optional()),
paymentTermId: zfd.text(z.string().optional()),
paymentComplete: zfd.checkbox(),
- currencyCode: z.enum(currencyCodes).optional(),
});
export const purchaseOrderReleaseValidator = z
@@ -198,7 +196,6 @@ export const supplierPaymentValidator = z.object({
invoiceSupplierLocationId: zfd.text(z.string().optional()),
invoiceSupplierContactId: zfd.text(z.string().optional()),
paymentTermId: zfd.text(z.string().optional()),
- currencyCode: zfd.text(z.string().optional()),
});
export const supplierProcessValidator = z.object({
diff --git a/apps/carbon/app/modules/purchasing/purchasing.service.ts b/apps/carbon/app/modules/purchasing/purchasing.service.ts
index 2494ee6b9e..ca6582c402 100644
--- a/apps/carbon/app/modules/purchasing/purchasing.service.ts
+++ b/apps/carbon/app/modules/purchasing/purchasing.service.ts
@@ -828,7 +828,6 @@ export async function upsertPurchaseOrder(
if (supplierShipping.error) return supplierShipping;
const {
- currencyCode,
paymentTermId,
invoiceSupplierId,
invoiceSupplierContactId,
@@ -861,7 +860,6 @@ export async function upsertPurchaseOrder(
client.from("purchaseOrderPayment").insert([
{
id: purchaseOrderId,
- currencyCode: currencyCode ?? "USD",
invoiceSupplierId: invoiceSupplierId,
invoiceSupplierContactId: invoiceSupplierContactId,
invoiceSupplierLocationId: invoiceSupplierLocationId,
diff --git a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderPaymentForm.tsx b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderPaymentForm.tsx
index 0359eecee1..eddf20ee32 100644
--- a/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderPaymentForm.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderPaymentForm.tsx
@@ -10,7 +10,6 @@ import { useState } from "react";
import type { z } from "zod";
import {
Boolean,
- Currency,
CustomFormFields,
Hidden,
PaymentTerm,
@@ -65,7 +64,6 @@ const PurchaseOrderPaymentForm = ({
/>
<PaymentTerm name="paymentTermId" label="Payment Terms" />
- <Currency name="currencyCode" label="Currency" />
<Boolean name="paymentComplete" label="Payment Complete" />
<CustomFormFields table="purchaseOrderPayment" />
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierPaymentForm.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierPaymentForm.tsx
index 88caf481c7..8c5e451945 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierPaymentForm.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierPaymentForm.tsx
@@ -10,7 +10,6 @@ import {
import { useState } from "react";
import type { z } from "zod";
import {
- Currency,
CustomFormFields,
Hidden,
Submit,
@@ -64,7 +63,6 @@ const SupplierPaymentForm = ({ initialValues }: SupplierPaymentFormProps) => {
/>
<PaymentTerm name="paymentTermId" label="Payment Term" />
- <Currency name="currencyCode" label="Currency" />
<CustomFormFields table="supplierPayment" />
</div>
</CardContent>
diff --git a/apps/carbon/app/modules/sales/sales.models.ts b/apps/carbon/app/modules/sales/sales.models.ts
index a03512efc7..ab5228fd5f 100644
--- a/apps/carbon/app/modules/sales/sales.models.ts
+++ b/apps/carbon/app/modules/sales/sales.models.ts
@@ -52,7 +52,6 @@ export const customerPaymentValidator = z.object({
invoiceCustomerLocationId: zfd.text(z.string().optional()),
invoiceCustomerContactId: zfd.text(z.string().optional()),
paymentTermId: zfd.text(z.string().optional()),
- currencyCode: zfd.text(z.string().optional()),
});
export const customerShippingValidator = z.object({
@@ -464,7 +463,6 @@ export const quotePaymentValidator = z.object({
invoiceCustomerLocationId: zfd.text(z.string().optional()),
invoiceCustomerContactId: zfd.text(z.string().optional()),
paymentTermId: zfd.text(z.string().optional()),
- currencyCode: z.enum(currencyCodes).optional(),
});
export const quoteShipmentValidator = z.object({
diff --git a/apps/carbon/app/modules/sales/sales.service.ts b/apps/carbon/app/modules/sales/sales.service.ts
index 117178d322..68988ab5d4 100644
--- a/apps/carbon/app/modules/sales/sales.service.ts
+++ b/apps/carbon/app/modules/sales/sales.service.ts
@@ -1502,7 +1502,6 @@ export async function upsertQuote(
if (customerShipping.error) return customerShipping;
const {
- currencyCode,
paymentTermId,
invoiceCustomerId,
invoiceCustomerContactId,
@@ -1536,7 +1535,6 @@ export async function upsertQuote(
client.from("quotePayment").insert([
{
id: quoteId,
- currencyCode: currencyCode ?? "USD",
invoiceCustomerId: invoiceCustomerId,
invoiceCustomerContactId: invoiceCustomerContactId,
invoiceCustomerLocationId: invoiceCustomerLocationId,
@@ -1909,7 +1907,6 @@ export async function upsertSalesOrder(
if (customerShipping.error) return customerShipping;
const {
- currencyCode,
paymentTermId,
invoiceCustomerId,
invoiceCustomerContactId,
@@ -1942,7 +1939,6 @@ export async function upsertSalesOrder(
client.from("salesOrderPayment").insert([
{
id: salesOrderId,
- currencyCode: currencyCode ?? "USD",
invoiceCustomerId: invoiceCustomerId,
invoiceCustomerContactId: invoiceCustomerContactId,
invoiceCustomerLocationId: invoiceCustomerLocationId,
diff --git a/apps/carbon/app/modules/sales/ui/Customer/CustomerPaymentForm.tsx b/apps/carbon/app/modules/sales/ui/Customer/CustomerPaymentForm.tsx
index dd9063abb7..4b3b604dd5 100644
--- a/apps/carbon/app/modules/sales/ui/Customer/CustomerPaymentForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Customer/CustomerPaymentForm.tsx
@@ -10,7 +10,6 @@ import {
import { useState } from "react";
import type { z } from "zod";
import {
- Currency,
CustomFormFields,
Customer,
CustomerContact,
@@ -64,7 +63,6 @@ const CustomerPaymentForm = ({ initialValues }: CustomerPaymentFormProps) => {
/>
<PaymentTerm name="paymentTermId" label="Payment Term" />
- <Currency name="currencyCode" label="Currency" />
<CustomFormFields table="customerPayment" />
</div>
</CardContent>
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuotePaymentForm.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuotePaymentForm.tsx
index 075679db35..95fac27dd8 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuotePaymentForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuotePaymentForm.tsx
@@ -11,7 +11,6 @@ import { useParams } from "@remix-run/react";
import { useState } from "react";
import type { z } from "zod";
import {
- Currency,
Customer,
CustomerContact,
CustomerLocation,
@@ -76,7 +75,6 @@ const QuotePaymentForm = ({ initialValues }: QuotePaymentFormProps) => {
/>
<PaymentTerm name="paymentTermId" label="Payment Term" />
- <Currency name="currencyCode" label="Currency" />
</div>
</CardContent>
<CardFooter>
diff --git a/apps/carbon/app/routes/x+/customer+/$customerId.payments.tsx b/apps/carbon/app/routes/x+/customer+/$customerId.payments.tsx
index e10105f2b1..f5c7d94513 100644
--- a/apps/carbon/app/routes/x+/customer+/$customerId.payments.tsx
+++ b/apps/carbon/app/routes/x+/customer+/$customerId.payments.tsx
@@ -85,7 +85,6 @@ export default function CustomerPaymentRoute() {
invoiceCustomerContactId: customerPayment?.invoiceCustomerContactId ?? "",
invoiceCustomerLocationId: customerPayment?.invoiceCustomerLocationId ?? "",
paymentTermId: customerPayment?.paymentTermId ?? "",
- currencyCode: customerPayment?.currencyCode ?? "",
};
return <CustomerPaymentForm initialValues={initialValues} />;
diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.payment.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.payment.tsx
index c71b66c97f..e00c813fee 100644
--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.payment.tsx
+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.payment.tsx
@@ -99,7 +99,6 @@ export default function PurchaseOrderPaymentRoute() {
purchaseOrderPayment.invoiceSupplierContactId ?? undefined,
paymentTermId: purchaseOrderPayment.paymentTermId ?? undefined,
paymentComplete: purchaseOrderPayment.paymentComplete ?? undefined,
- currencyCode: (purchaseOrderPayment.currencyCode ?? "USD") as "USD",
...getCustomFields(purchaseOrderPayment.customFields),
};
diff --git a/apps/carbon/app/routes/x+/quote+/$quoteId.details.tsx b/apps/carbon/app/routes/x+/quote+/$quoteId.details.tsx
index ed6134c18c..63b05ad450 100644
--- a/apps/carbon/app/routes/x+/quote+/$quoteId.details.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$quoteId.details.tsx
@@ -120,7 +120,6 @@ export default function QuoteDetailsRoute() {
quoteData?.payment.invoiceCustomerLocationId ?? "",
invoiceCustomerContactId: quoteData?.payment.invoiceCustomerContactId ?? "",
paymentTermId: quoteData?.payment.paymentTermId ?? "",
- currencyCode: quoteData?.payment.currencyCode as "USD",
};
return (
diff --git a/apps/carbon/app/routes/x+/supplier+/$supplierId.payments.tsx b/apps/carbon/app/routes/x+/supplier+/$supplierId.payments.tsx
index 2559ba6a22..a4b9f3cba3 100644
--- a/apps/carbon/app/routes/x+/supplier+/$supplierId.payments.tsx
+++ b/apps/carbon/app/routes/x+/supplier+/$supplierId.payments.tsx
@@ -87,7 +87,6 @@ export default function SupplierPaymentRoute() {
invoiceSupplierContactId: supplierPayment?.invoiceSupplierContactId ?? "",
invoiceSupplierLocationId: supplierPayment?.invoiceSupplierLocationId ?? "",
paymentTermId: supplierPayment?.paymentTermId ?? "",
- currencyCode: supplierPayment?.currencyCode ?? "",
...getCustomFields(supplierPayment?.customFields),
};
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index 70ca460038..84a1e7d36c 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -2025,9 +2025,6 @@ export default {
{
$ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentComplete",
},
- {
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.purchaseOrderPayment.companyId",
},
@@ -2117,9 +2114,6 @@ export default {
{
$ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentComplete",
},
- {
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.purchaseOrderPayment.companyId",
},
@@ -2163,9 +2157,6 @@ export default {
{
$ref: "#/parameters/rowFilter.purchaseOrderPayment.paymentComplete",
},
- {
- $ref: "#/parameters/rowFilter.purchaseOrderPayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.purchaseOrderPayment.companyId",
},
@@ -2571,9 +2562,6 @@ export default {
{
$ref: "#/parameters/rowFilter.customerPayment.paymentTermId",
},
- {
- $ref: "#/parameters/rowFilter.customerPayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.customerPayment.companyId",
},
@@ -2657,9 +2645,6 @@ export default {
{
$ref: "#/parameters/rowFilter.customerPayment.paymentTermId",
},
- {
- $ref: "#/parameters/rowFilter.customerPayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.customerPayment.companyId",
},
@@ -2697,9 +2682,6 @@ export default {
{
$ref: "#/parameters/rowFilter.customerPayment.paymentTermId",
},
- {
- $ref: "#/parameters/rowFilter.customerPayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.customerPayment.companyId",
},
@@ -3336,9 +3318,6 @@ export default {
{
$ref: "#/parameters/rowFilter.supplierPayment.paymentTermId",
},
- {
- $ref: "#/parameters/rowFilter.supplierPayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.supplierPayment.companyId",
},
@@ -3425,9 +3404,6 @@ export default {
{
$ref: "#/parameters/rowFilter.supplierPayment.paymentTermId",
},
- {
- $ref: "#/parameters/rowFilter.supplierPayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.supplierPayment.companyId",
},
@@ -3468,9 +3444,6 @@ export default {
{
$ref: "#/parameters/rowFilter.supplierPayment.paymentTermId",
},
- {
- $ref: "#/parameters/rowFilter.supplierPayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.supplierPayment.companyId",
},
@@ -14421,9 +14394,6 @@ export default {
{
$ref: "#/parameters/rowFilter.quotePayment.paymentTermId",
},
- {
- $ref: "#/parameters/rowFilter.quotePayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.quotePayment.companyId",
},
@@ -14510,9 +14480,6 @@ export default {
{
$ref: "#/parameters/rowFilter.quotePayment.paymentTermId",
},
- {
- $ref: "#/parameters/rowFilter.quotePayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.quotePayment.companyId",
},
@@ -14553,9 +14520,6 @@ export default {
{
$ref: "#/parameters/rowFilter.quotePayment.paymentTermId",
},
- {
- $ref: "#/parameters/rowFilter.quotePayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.quotePayment.companyId",
},
@@ -15804,9 +15768,6 @@ export default {
{
$ref: "#/parameters/rowFilter.salesOrderPayment.paymentComplete",
},
- {
- $ref: "#/parameters/rowFilter.salesOrderPayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.salesOrderPayment.companyId",
},
@@ -15896,9 +15857,6 @@ export default {
{
$ref: "#/parameters/rowFilter.salesOrderPayment.paymentComplete",
},
- {
- $ref: "#/parameters/rowFilter.salesOrderPayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.salesOrderPayment.companyId",
},
@@ -15942,9 +15900,6 @@ export default {
{
$ref: "#/parameters/rowFilter.salesOrderPayment.paymentComplete",
},
- {
- $ref: "#/parameters/rowFilter.salesOrderPayment.currencyCode",
- },
{
$ref: "#/parameters/rowFilter.salesOrderPayment.companyId",
},
@@ -36951,7 +36906,7 @@ export default {
type: "object",
},
purchaseOrderPayment: {
- required: ["id", "paymentComplete", "currencyCode", "companyId"],
+ required: ["id", "paymentComplete", "companyId"],
properties: {
id: {
description: "Note:\nThis is a Primary Key.<pk/>",
@@ -36987,11 +36942,6 @@ export default {
format: "boolean",
type: "boolean",
},
- currencyCode: {
- default: "USD",
- format: "text",
- type: "string",
- },
companyId: {
format: "text",
type: "string",
@@ -37267,10 +37217,6 @@ export default {
format: "text",
type: "string",
},
- currencyCode: {
- format: "text",
- type: "string",
- },
companyId: {
description:
"Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
@@ -37542,10 +37488,6 @@ export default {
format: "text",
type: "string",
},
- currencyCode: {
- format: "text",
- type: "string",
- },
companyId: {
description:
"Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
@@ -42910,7 +42852,7 @@ export default {
type: "object",
},
quotePayment: {
- required: ["id", "currencyCode", "companyId"],
+ required: ["id", "companyId"],
properties: {
id: {
description: "Note:\nThis is a Primary Key.<pk/>",
@@ -42941,11 +42883,6 @@ export default {
format: "text",
type: "string",
},
- currencyCode: {
- default: "USD",
- format: "text",
- type: "string",
- },
companyId: {
description:
"Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
@@ -43602,7 +43539,7 @@ export default {
type: "object",
},
salesOrderPayment: {
- required: ["id", "paymentComplete", "currencyCode", "companyId"],
+ required: ["id", "paymentComplete", "companyId"],
properties: {
id: {
description: "Note:\nThis is a Primary Key.<pk/>",
@@ -43638,11 +43575,6 @@ export default {
format: "boolean",
type: "boolean",
},
- currencyCode: {
- default: "USD",
- format: "text",
- type: "string",
- },
companyId: {
description:
"Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
@@ -52929,13 +52861,6 @@ export default {
in: "query",
type: "string",
},
- "rowFilter.purchaseOrderPayment.currencyCode": {
- name: "currencyCode",
- required: false,
- format: "text",
- in: "query",
- type: "string",
- },
"rowFilter.purchaseOrderPayment.companyId": {
name: "companyId",
required: false,
@@ -53329,13 +53254,6 @@ export default {
in: "query",
type: "string",
},
- "rowFilter.customerPayment.currencyCode": {
- name: "currencyCode",
- required: false,
- format: "text",
- in: "query",
- type: "string",
- },
"rowFilter.customerPayment.companyId": {
name: "companyId",
required: false,
@@ -53680,13 +53598,6 @@ export default {
in: "query",
type: "string",
},
- "rowFilter.supplierPayment.currencyCode": {
- name: "currencyCode",
- required: false,
- format: "text",
- in: "query",
- type: "string",
- },
"rowFilter.supplierPayment.companyId": {
name: "companyId",
required: false,
@@ -60698,13 +60609,6 @@ export default {
in: "query",
type: "string",
},
- "rowFilter.quotePayment.currencyCode": {
- name: "currencyCode",
- required: false,
- format: "text",
- in: "query",
- type: "string",
- },
"rowFilter.quotePayment.companyId": {
name: "companyId",
required: false,
@@ -61566,13 +61470,6 @@ export default {
in: "query",
type: "string",
},
- "rowFilter.salesOrderPayment.currencyCode": {
- name: "currencyCode",
- required: false,
- format: "text",
- in: "query",
- type: "string",
- },
"rowFilter.salesOrderPayment.companyId": {
name: "companyId",
required: false,
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 48855e1b34..f4260cac51 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -3393,7 +3393,6 @@ export type Database = {
customerPayment: {
Row: {
companyId: string
- currencyCode: string | null
customerId: string
invoiceCustomerContactId: string | null
invoiceCustomerId: string | null
@@ -3404,7 +3403,6 @@ export type Database = {
}
Insert: {
companyId: string
- currencyCode?: string | null
customerId: string
invoiceCustomerContactId?: string | null
invoiceCustomerId?: string | null
@@ -3415,7 +3413,6 @@ export type Database = {
}
Update: {
companyId?: string
- currencyCode?: string | null
customerId?: string
invoiceCustomerContactId?: string | null
invoiceCustomerId?: string | null
@@ -3453,20 +3450,6 @@ export type Database = {
referencedRelation: "integrations"
referencedColumns: ["companyId"]
},
- {
- foreignKeyName: "customerPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currencies"
- referencedColumns: ["code", "companyId"]
- },
- {
- foreignKeyName: "customerPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currency"
- referencedColumns: ["code", "companyId"]
- },
{
foreignKeyName: "customerPayment_customerId_fkey"
columns: ["customerId"]
@@ -13472,7 +13455,6 @@ export type Database = {
purchaseOrderPayment: {
Row: {
companyId: string
- currencyCode: string
customFields: Json | null
id: string
invoiceSupplierContactId: string | null
@@ -13485,7 +13467,6 @@ export type Database = {
}
Insert: {
companyId: string
- currencyCode?: string
customFields?: Json | null
id: string
invoiceSupplierContactId?: string | null
@@ -13498,7 +13479,6 @@ export type Database = {
}
Update: {
companyId?: string
- currencyCode?: string
customFields?: Json | null
id?: string
invoiceSupplierContactId?: string | null
@@ -13510,20 +13490,6 @@ export type Database = {
updatedBy?: string | null
}
Relationships: [
- {
- foreignKeyName: "purchaseOrderPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currencies"
- referencedColumns: ["code", "companyId"]
- },
- {
- foreignKeyName: "purchaseOrderPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currency"
- referencedColumns: ["code", "companyId"]
- },
{
foreignKeyName: "purchaseOrderPayment_id_fkey"
columns: ["id"]
@@ -15529,7 +15495,6 @@ export type Database = {
quotePayment: {
Row: {
companyId: string
- currencyCode: string
customFields: Json | null
id: string
invoiceCustomerContactId: string | null
@@ -15541,7 +15506,6 @@ export type Database = {
}
Insert: {
companyId: string
- currencyCode?: string
customFields?: Json | null
id: string
invoiceCustomerContactId?: string | null
@@ -15553,7 +15517,6 @@ export type Database = {
}
Update: {
companyId?: string
- currencyCode?: string
customFields?: Json | null
id?: string
invoiceCustomerContactId?: string | null
@@ -15592,20 +15555,6 @@ export type Database = {
referencedRelation: "integrations"
referencedColumns: ["companyId"]
},
- {
- foreignKeyName: "quotePayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currencies"
- referencedColumns: ["code", "companyId"]
- },
- {
- foreignKeyName: "quotePayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currency"
- referencedColumns: ["code", "companyId"]
- },
{
foreignKeyName: "quotePayment_id_fkey"
columns: ["id"]
@@ -16855,7 +16804,6 @@ export type Database = {
salesOrderPayment: {
Row: {
companyId: string
- currencyCode: string
customFields: Json | null
id: string
invoiceCustomerContactId: string | null
@@ -16868,7 +16816,6 @@ export type Database = {
}
Insert: {
companyId: string
- currencyCode?: string
customFields?: Json | null
id: string
invoiceCustomerContactId?: string | null
@@ -16881,7 +16828,6 @@ export type Database = {
}
Update: {
companyId?: string
- currencyCode?: string
customFields?: Json | null
id?: string
invoiceCustomerContactId?: string | null
@@ -16921,20 +16867,6 @@ export type Database = {
referencedRelation: "integrations"
referencedColumns: ["companyId"]
},
- {
- foreignKeyName: "salesOrderPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currencies"
- referencedColumns: ["code", "companyId"]
- },
- {
- foreignKeyName: "salesOrderPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currency"
- referencedColumns: ["code", "companyId"]
- },
{
foreignKeyName: "salesOrderPayment_id_fkey"
columns: ["id"]
@@ -19601,7 +19533,6 @@ export type Database = {
supplierPayment: {
Row: {
companyId: string
- currencyCode: string | null
customFields: Json | null
invoiceSupplierContactId: string | null
invoiceSupplierId: string | null
@@ -19613,7 +19544,6 @@ export type Database = {
}
Insert: {
companyId: string
- currencyCode?: string | null
customFields?: Json | null
invoiceSupplierContactId?: string | null
invoiceSupplierId?: string | null
@@ -19625,7 +19555,6 @@ export type Database = {
}
Update: {
companyId?: string
- currencyCode?: string | null
customFields?: Json | null
invoiceSupplierContactId?: string | null
invoiceSupplierId?: string | null
@@ -19664,20 +19593,6 @@ export type Database = {
referencedRelation: "integrations"
referencedColumns: ["companyId"]
},
- {
- foreignKeyName: "supplierPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currencies"
- referencedColumns: ["code", "companyId"]
- },
- {
- foreignKeyName: "supplierPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currency"
- referencedColumns: ["code", "companyId"]
- },
{
foreignKeyName: "supplierPayment_invoiceSupplierContactId_fkey"
columns: ["invoiceSupplierContactId"]
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 48855e1b34..f4260cac51 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -3393,7 +3393,6 @@ export type Database = {
customerPayment: {
Row: {
companyId: string
- currencyCode: string | null
customerId: string
invoiceCustomerContactId: string | null
invoiceCustomerId: string | null
@@ -3404,7 +3403,6 @@ export type Database = {
}
Insert: {
companyId: string
- currencyCode?: string | null
customerId: string
invoiceCustomerContactId?: string | null
invoiceCustomerId?: string | null
@@ -3415,7 +3413,6 @@ export type Database = {
}
Update: {
companyId?: string
- currencyCode?: string | null
customerId?: string
invoiceCustomerContactId?: string | null
invoiceCustomerId?: string | null
@@ -3453,20 +3450,6 @@ export type Database = {
referencedRelation: "integrations"
referencedColumns: ["companyId"]
},
- {
- foreignKeyName: "customerPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currencies"
- referencedColumns: ["code", "companyId"]
- },
- {
- foreignKeyName: "customerPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currency"
- referencedColumns: ["code", "companyId"]
- },
{
foreignKeyName: "customerPayment_customerId_fkey"
columns: ["customerId"]
@@ -13472,7 +13455,6 @@ export type Database = {
purchaseOrderPayment: {
Row: {
companyId: string
- currencyCode: string
customFields: Json | null
id: string
invoiceSupplierContactId: string | null
@@ -13485,7 +13467,6 @@ export type Database = {
}
Insert: {
companyId: string
- currencyCode?: string
customFields?: Json | null
id: string
invoiceSupplierContactId?: string | null
@@ -13498,7 +13479,6 @@ export type Database = {
}
Update: {
companyId?: string
- currencyCode?: string
customFields?: Json | null
id?: string
invoiceSupplierContactId?: string | null
@@ -13510,20 +13490,6 @@ export type Database = {
updatedBy?: string | null
}
Relationships: [
- {
- foreignKeyName: "purchaseOrderPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currencies"
- referencedColumns: ["code", "companyId"]
- },
- {
- foreignKeyName: "purchaseOrderPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currency"
- referencedColumns: ["code", "companyId"]
- },
{
foreignKeyName: "purchaseOrderPayment_id_fkey"
columns: ["id"]
@@ -15529,7 +15495,6 @@ export type Database = {
quotePayment: {
Row: {
companyId: string
- currencyCode: string
customFields: Json | null
id: string
invoiceCustomerContactId: string | null
@@ -15541,7 +15506,6 @@ export type Database = {
}
Insert: {
companyId: string
- currencyCode?: string
customFields?: Json | null
id: string
invoiceCustomerContactId?: string | null
@@ -15553,7 +15517,6 @@ export type Database = {
}
Update: {
companyId?: string
- currencyCode?: string
customFields?: Json | null
id?: string
invoiceCustomerContactId?: string | null
@@ -15592,20 +15555,6 @@ export type Database = {
referencedRelation: "integrations"
referencedColumns: ["companyId"]
},
- {
- foreignKeyName: "quotePayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currencies"
- referencedColumns: ["code", "companyId"]
- },
- {
- foreignKeyName: "quotePayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currency"
- referencedColumns: ["code", "companyId"]
- },
{
foreignKeyName: "quotePayment_id_fkey"
columns: ["id"]
@@ -16855,7 +16804,6 @@ export type Database = {
salesOrderPayment: {
Row: {
companyId: string
- currencyCode: string
customFields: Json | null
id: string
invoiceCustomerContactId: string | null
@@ -16868,7 +16816,6 @@ export type Database = {
}
Insert: {
companyId: string
- currencyCode?: string
customFields?: Json | null
id: string
invoiceCustomerContactId?: string | null
@@ -16881,7 +16828,6 @@ export type Database = {
}
Update: {
companyId?: string
- currencyCode?: string
customFields?: Json | null
id?: string
invoiceCustomerContactId?: string | null
@@ -16921,20 +16867,6 @@ export type Database = {
referencedRelation: "integrations"
referencedColumns: ["companyId"]
},
- {
- foreignKeyName: "salesOrderPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currencies"
- referencedColumns: ["code", "companyId"]
- },
- {
- foreignKeyName: "salesOrderPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currency"
- referencedColumns: ["code", "companyId"]
- },
{
foreignKeyName: "salesOrderPayment_id_fkey"
columns: ["id"]
@@ -19601,7 +19533,6 @@ export type Database = {
supplierPayment: {
Row: {
companyId: string
- currencyCode: string | null
customFields: Json | null
invoiceSupplierContactId: string | null
invoiceSupplierId: string | null
@@ -19613,7 +19544,6 @@ export type Database = {
}
Insert: {
companyId: string
- currencyCode?: string | null
customFields?: Json | null
invoiceSupplierContactId?: string | null
invoiceSupplierId?: string | null
@@ -19625,7 +19555,6 @@ export type Database = {
}
Update: {
companyId?: string
- currencyCode?: string | null
customFields?: Json | null
invoiceSupplierContactId?: string | null
invoiceSupplierId?: string | null
@@ -19664,20 +19593,6 @@ export type Database = {
referencedRelation: "integrations"
referencedColumns: ["companyId"]
},
- {
- foreignKeyName: "supplierPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currencies"
- referencedColumns: ["code", "companyId"]
- },
- {
- foreignKeyName: "supplierPayment_currencyCode_fkey"
- columns: ["currencyCode", "companyId"]
- isOneToOne: false
- referencedRelation: "currency"
- referencedColumns: ["code", "companyId"]
- },
{
foreignKeyName: "supplierPayment_invoiceSupplierContactId_fkey"
columns: ["invoiceSupplierContactId"]
diff --git a/packages/database/supabase/migrations/20241010193506_quote-order-presentation-currency.sql b/packages/database/supabase/migrations/20241010193506_quote-order-presentation-currency.sql
index df702e0e02..21cfcff43a 100644
--- a/packages/database/supabase/migrations/20241010193506_quote-order-presentation-currency.sql
+++ b/packages/database/supabase/migrations/20241010193506_quote-order-presentation-currency.sql
@@ -97,4 +97,11 @@ CREATE OR REPLACE VIEW "purchaseOrders" WITH(SECURITY_INVOKER=true) AS
LEFT JOIN "shippingTerm" st ON st."id" = pd."shippingTermId"
LEFT JOIN "purchaseOrderPayment" pp ON pp."id" = p."id"
LEFT JOIN "paymentTerm" pt ON pt."id" = pp."paymentTermId"
- LEFT JOIN "location" l ON l."id" = pd."locationId";
\ No newline at end of file
+ LEFT JOIN "location" l ON l."id" = pd."locationId";
+
+-- Remove currencyCode from customerPayment, supplierPayment, quotePayment, salesOrderPayment, and purchaseOrderPayment
+ALTER TABLE "customerPayment" DROP COLUMN "currencyCode";
+ALTER TABLE "supplierPayment" DROP COLUMN "currencyCode";
+ALTER TABLE "quotePayment" DROP COLUMN "currencyCode";
+ALTER TABLE "salesOrderPayment" DROP COLUMN "currencyCode";
+ALTER TABLE "purchaseOrderPayment" DROP COLUMN "currencyCode";
\ No newline at end of file