diff --git a/packages/server/src/database/seeds/core/20190423085242_seed_accounts.ts b/packages/server/src/database/seeds/core/20190423085242_seed_accounts.ts index eff86978f..e5e39dba9 100644 --- a/packages/server/src/database/seeds/core/20190423085242_seed_accounts.ts +++ b/packages/server/src/database/seeds/core/20190423085242_seed_accounts.ts @@ -3,17 +3,17 @@ import AccountsData from '../data/accounts'; export default class SeedAccounts extends TenantSeeder { /** - * Seeds initial accounts to the organization. + * Seeds initial accounts to the organization. */ up(knex) { - const data = AccountsData.map((account) => { - return { - ...account, - name: this.i18n.__(account.name), - description: this.i18n.__(account.description), - currencyCode: this.tenant.metadata.baseCurrency, - }; - }); + const data = AccountsData.map((account) => ({ + ...account, + name: this.i18n.__(account.name), + description: this.i18n.__(account.description), + currencyCode: this.tenant.metadata.baseCurrency, + seededAt: new Date(), + }) +); return knex('accounts').then(async () => { // Inserts seed entries. return knex('accounts').insert(data); diff --git a/packages/webapp/src/hooks/query/bills.tsx b/packages/webapp/src/hooks/query/bills.tsx index 4abf97610..828621d89 100644 --- a/packages/webapp/src/hooks/query/bills.tsx +++ b/packages/webapp/src/hooks/query/bills.tsx @@ -37,6 +37,9 @@ const commonInvalidateQueries = (queryClient) => { // Invalidate item warehouses. queryClient.invalidateQueries(t.ITEM_WAREHOUSES_LOCATION); + + // Invalidate mutate base currency abilities. + queryClient.invalidateQueries(t.ORGANIZATION_MUTATE_BASE_CURRENCY_ABILITIES); }; /** diff --git a/packages/webapp/src/hooks/query/cashflowAccounts.tsx b/packages/webapp/src/hooks/query/cashflowAccounts.tsx index c7cc5d58b..f91593762 100644 --- a/packages/webapp/src/hooks/query/cashflowAccounts.tsx +++ b/packages/webapp/src/hooks/query/cashflowAccounts.tsx @@ -22,6 +22,9 @@ const commonInvalidateQueries = (queryClient) => { // Invalidate financial reports. queryClient.invalidateQueries(t.FINANCIAL_REPORT); queryClient.invalidateQueries(t.CASH_FLOW_TRANSACTION); + + // Invalidate mutate base currency abilities. + queryClient.invalidateQueries(t.ORGANIZATION_MUTATE_BASE_CURRENCY_ABILITIES); }; /** diff --git a/packages/webapp/src/hooks/query/creditNote.tsx b/packages/webapp/src/hooks/query/creditNote.tsx index dfacc8348..99cfd535d 100644 --- a/packages/webapp/src/hooks/query/creditNote.tsx +++ b/packages/webapp/src/hooks/query/creditNote.tsx @@ -43,6 +43,9 @@ const commonInvalidateQueries = (queryClient) => { // Invalidate financial reports. queryClient.invalidateQueries(t.FINANCIAL_REPORT); + + // Invalidate mutate base currency abilities. + queryClient.invalidateQueries(t.ORGANIZATION_MUTATE_BASE_CURRENCY_ABILITIES); }; /** diff --git a/packages/webapp/src/hooks/query/customers.tsx b/packages/webapp/src/hooks/query/customers.tsx index e6c543802..771a49926 100644 --- a/packages/webapp/src/hooks/query/customers.tsx +++ b/packages/webapp/src/hooks/query/customers.tsx @@ -27,6 +27,9 @@ const commonInvalidateQueries = (queryClient) => { queryClient.invalidateQueries(t.SALE_INVOICE_SMS_DETAIL); queryClient.invalidateQueries(t.SALE_RECEIPT_SMS_DETAIL); queryClient.invalidateQueries(t.PAYMENT_RECEIVE_SMS_DETAIL); + + // Invalidate mutate base currency abilities. + queryClient.invalidateQueries(t.ORGANIZATION_MUTATE_BASE_CURRENCY_ABILITIES); }; // Customers response selector. diff --git a/packages/webapp/src/hooks/query/expenses.tsx b/packages/webapp/src/hooks/query/expenses.tsx index 28d7bbbce..5292dbcd1 100644 --- a/packages/webapp/src/hooks/query/expenses.tsx +++ b/packages/webapp/src/hooks/query/expenses.tsx @@ -30,6 +30,9 @@ const commonInvalidateQueries = (queryClient) => { // Invalidate landed cost. queryClient.invalidateQueries(t.LANDED_COST); queryClient.invalidateQueries(t.LANDED_COST_TRANSACTION); + + // Invalidate mutate base currency abilities. + queryClient.invalidateQueries(t.ORGANIZATION_MUTATE_BASE_CURRENCY_ABILITIES); }; const transformExpenses = (response) => ({ diff --git a/packages/webapp/src/hooks/query/inventoryAdjustments.tsx b/packages/webapp/src/hooks/query/inventoryAdjustments.tsx index b1c9afb65..7e7e53732 100644 --- a/packages/webapp/src/hooks/query/inventoryAdjustments.tsx +++ b/packages/webapp/src/hooks/query/inventoryAdjustments.tsx @@ -20,6 +20,9 @@ const commonInvalidateQueries = (queryClient) => { // Invalidate financial reports. queryClient.invalidateQueries(t.FINANCIAL_REPORT); + + // Invalidate mutate base currency abilities. + queryClient.invalidateQueries(t.ORGANIZATION_MUTATE_BASE_CURRENCY_ABILITIES); }; /** diff --git a/packages/webapp/src/hooks/query/invoices.tsx b/packages/webapp/src/hooks/query/invoices.tsx index 6967c52f1..13009042c 100644 --- a/packages/webapp/src/hooks/query/invoices.tsx +++ b/packages/webapp/src/hooks/query/invoices.tsx @@ -38,6 +38,9 @@ const commonInvalidateQueries = (queryClient) => { // Invalidate item warehouses. queryClient.invalidateQueries(t.ITEM_WAREHOUSES_LOCATION); + + // Invalidate mutate base currency abilities. + queryClient.invalidateQueries(t.ORGANIZATION_MUTATE_BASE_CURRENCY_ABILITIES); }; /** diff --git a/packages/webapp/src/hooks/query/receipts.tsx b/packages/webapp/src/hooks/query/receipts.tsx index 6e2a28b3a..907cfc8af 100644 --- a/packages/webapp/src/hooks/query/receipts.tsx +++ b/packages/webapp/src/hooks/query/receipts.tsx @@ -33,6 +33,9 @@ const commonInvalidateQueries = (queryClient) => { // Invalidate the settings. queryClient.invalidateQueries([t.SETTING, t.SETTING_RECEIPTS]); + + // Invalidate mutate base currency abilities. + queryClient.invalidateQueries(t.ORGANIZATION_MUTATE_BASE_CURRENCY_ABILITIES); }; /** diff --git a/packages/webapp/src/hooks/query/types.tsx b/packages/webapp/src/hooks/query/types.tsx index 511ddccb4..c557228db 100644 --- a/packages/webapp/src/hooks/query/types.tsx +++ b/packages/webapp/src/hooks/query/types.tsx @@ -1,7 +1,7 @@ // @ts-nocheck const Authentication = { - AUTH_METADATA_PAGE: 'AUTH_META_PAGE' -} + AUTH_METADATA_PAGE: 'AUTH_META_PAGE', +}; const ACCOUNTS = { ACCOUNT: 'ACCOUNT', @@ -220,6 +220,10 @@ const DASHBOARD = { DASHBOARD_META: 'DASHBOARD_META', }; +const ORGANIZATION = { + ORGANIZATION_MUTATE_BASE_CURRENCY_ABILITIES: 'ORGANIZATION_MUTATE_BASE_CURRENCY_ABILITIES', +}; + export default { ...Authentication, ...ACCOUNTS, @@ -252,4 +256,5 @@ export default { ...WAREHOUSE_TRANSFERS, ...BRANCHES, ...DASHBOARD, + ...ORGANIZATION, }; diff --git a/packages/webapp/src/hooks/query/vendorCredit.tsx b/packages/webapp/src/hooks/query/vendorCredit.tsx index a385ed1b4..48e424099 100644 --- a/packages/webapp/src/hooks/query/vendorCredit.tsx +++ b/packages/webapp/src/hooks/query/vendorCredit.tsx @@ -42,6 +42,9 @@ const commonInvalidateQueries = (queryClient) => { // Invalidate financial reports. queryClient.invalidateQueries(t.FINANCIAL_REPORT); + + // Invalidate mutate base currency abilities. + queryClient.invalidateQueries(t.ORGANIZATION_MUTATE_BASE_CURRENCY_ABILITIES); }; /** diff --git a/packages/webapp/src/hooks/query/vendors.tsx b/packages/webapp/src/hooks/query/vendors.tsx index 7716d918d..be67edd2e 100644 --- a/packages/webapp/src/hooks/query/vendors.tsx +++ b/packages/webapp/src/hooks/query/vendors.tsx @@ -16,6 +16,9 @@ const commonInvalidateQueries = (queryClient) => { // Invalidate financial reports. queryClient.invalidateQueries(t.FINANCIAL_REPORT); + + // Invalidate mutate base currency abilities. + queryClient.invalidateQueries(t.ORGANIZATION_MUTATE_BASE_CURRENCY_ABILITIES); }; // Transformes vendors response. diff --git a/packages/webapp/src/lang/en/index.json b/packages/webapp/src/lang/en/index.json index 58201574f..6b93f700e 100644 --- a/packages/webapp/src/lang/en/index.json +++ b/packages/webapp/src/lang/en/index.json @@ -292,12 +292,12 @@ "once_delete_this_exchange_rate_you_will_able_to_restore_it": "Once you delete this exchange rate, you won't be able to restore it later. Are you sure you want to delete this exchange rate?", "once_delete_these_exchange_rates_you_will_not_able_restore_them": "Once you delete these exchange rates, you won't be able to retrieve them later. Are you sure you want to delete them?", "once_delete_this_item_category_you_will_able_to_restore_it": "Once you delete this category, you won't be able to restore it later. Are you sure you want to delete this item?", - "select_business_location": "Select Business Location", - "select_base_currency": "Select base currency", - "select_fiscal_year": "Select fiscal year", - "select_language": "Select Language", + "select_business_location": "Select Business Location...", + "select_base_currency": "Select Base Currency...", + "select_fiscal_year": "Select Fiscal Year...", + "select_language": "Select Language...", "select_date_format": "Select Date Format", - "select_time_zone": "Select Time Zone", + "select_time_zone": "Select Time Zone...", "select_currency": "Select Currency", "once_delete_this_currency_you_will_able_to_restore_it": "Once you delete this currency, you won't be able to restore it later. Are you sure you want to delete this item?", "select_parent_category": "Select Parent Category",