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: disable payment dropdown based on invoice status and permissions

naveenkash2d61e400a755
diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx
index 85f9e77596..50d2c13f81 100644
--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx
+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceHeader.tsx
@@ -164,6 +164,10 @@ const SalesInvoiceHeader = () => {
);
};
+ const IS_PAYMENT_DROPDOWN_DISABLED =
+ ["Voided", "Draft", "Pending"].includes(salesInvoice.status ?? "") ||
+ !permissions.can("update", "invoicing");
+
return (
<>
<div className="flex flex-shrink-0 items-center justify-between p-2 bg-card border-b h-[50px] overflow-x-auto scrollbar-hide">
@@ -314,14 +318,13 @@ const SalesInvoiceHeader = () => {
</Button>
)}
<DropdownMenu>
- <DropdownMenuTrigger asChild>
+ <DropdownMenuTrigger
+ asChild
+ disabled={IS_PAYMENT_DROPDOWN_DISABLED}
+ >
<Button
variant="secondary"
- isDisabled={
- ["Voided", "Draft", "Pending"].includes(
- salesInvoice.status ?? ""
- ) || !permissions.can("update", "invoicing")
- }
+ isDisabled={IS_PAYMENT_DROPDOWN_DISABLED}
leftIcon={<LuDollarSign />}
rightIcon={<LuChevronDown />}
>