diff --git a/src/pages/JournalEntryForm.vue b/src/pages/JournalEntryForm.vue
deleted file mode 100644
index bc884acb..00000000
--- a/src/pages/JournalEntryForm.vue
+++ /dev/null
@@ -1,269 +0,0 @@
-
-
-
-
-
-
-
- {{ group.group }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- doc.set('numberSeries', value)"
- :read-only="!doc.notInserted || doc.submitted"
- />
- doc.set('date', value)"
- :read-only="doc.submitted"
- />
- doc.set('entryType', value)"
- :read-only="doc.submitted"
- />
- doc.set('referenceNumber', value)"
- :read-only="doc.submitted"
- />
- doc.set('referenceDate', value)"
- :read-only="doc.submitted"
- />
- doc.set('attachment', value)"
- :read-only="doc?.submitted"
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
doc.set('userRemark', value)"
- :read-only="doc.submitted"
- />
-
-
-
-
-
{{ t`Total Debit` }}
-
{{ totalDebit }}
-
-
-
-
{{ t`Total Credit` }}
-
{{ totalCredit }}
-
-
-
-
-
-
-
-
diff --git a/src/router.ts b/src/router.ts
index d9e6aaad..987de9d4 100644
--- a/src/router.ts
+++ b/src/router.ts
@@ -1,22 +1,21 @@
import { ModelNameEnum } from 'models/types';
import ChartOfAccounts from 'src/pages/ChartOfAccounts.vue';
+import CommonForm from 'src/pages/CommonForm/CommonForm.vue';
import Dashboard from 'src/pages/Dashboard/Dashboard.vue';
-import ImportWizard from 'src/pages/ImportWizard.vue';
import GeneralForm from 'src/pages/GeneralForm.vue';
import GetStarted from 'src/pages/GetStarted.vue';
+import ImportWizard from 'src/pages/ImportWizard.vue';
import InvoiceForm from 'src/pages/InvoiceForm.vue';
-import JournalEntryForm from 'src/pages/JournalEntryForm.vue';
import ListView from 'src/pages/ListView/ListView.vue';
import PrintView from 'src/pages/PrintView/PrintView.vue';
import QuickEditForm from 'src/pages/QuickEditForm.vue';
-import CommonForm from 'src/pages/CommonForm/CommonForm.vue';
import Report from 'src/pages/Report.vue';
import Settings from 'src/pages/Settings/Settings.vue';
import {
createRouter,
createWebHistory,
RouteLocationRaw,
- RouteRecordRaw,
+ RouteRecordRaw
} from 'vue-router';
function getGeneralFormItems(): RouteRecordRaw[] {
@@ -46,6 +45,7 @@ function getGeneralFormItems(): RouteRecordRaw[] {
function getCommonFormItems(): RouteRecordRaw[] {
return [
+ ModelNameEnum.JournalEntry,
ModelNameEnum.Payment,
ModelNameEnum.StockMovement,
ModelNameEnum.Item,
@@ -82,25 +82,6 @@ const routes: RouteRecordRaw[] = [
},
...getGeneralFormItems(),
...getCommonFormItems(),
- {
- path: '/edit/JournalEntry/:name',
- name: 'JournalEntryForm',
- components: {
- default: JournalEntryForm,
- edit: QuickEditForm,
- },
- props: {
- default: (route) => {
- // for sidebar item active state
- route.params.schemaName = 'JournalEntry';
- return {
- schemaName: 'JournalEntry',
- name: route.params.name,
- };
- },
- edit: (route) => route.query,
- },
- },
{
path: '/edit/:schemaName/:name',
name: 'InvoiceForm',
From d946c960a07f7f3c4bdf12bfd0ba75717f881e8d Mon Sep 17 00:00:00 2001
From: 18alantom <2.alan.tom@gmail.com>
Date: Tue, 21 Feb 2023 12:12:06 +0530
Subject: [PATCH 7/7] incr: move Shipments and PRec to common form - remove
GeneralForm.vue
---
models/inventory/StockTransfer.ts | 16 +-
schemas/app/inventory/PurchaseReceipt.json | 22 +-
schemas/app/inventory/Shipment.json | 23 +-
schemas/app/inventory/StockTransfer.json | 51 +++-
schemas/types.ts | 1 +
src/pages/CommonForm/CommonForm.vue | 1 -
src/pages/GeneralForm.vue | 320 ---------------------
src/router.ts | 31 +-
8 files changed, 80 insertions(+), 385 deletions(-)
delete mode 100644 src/pages/GeneralForm.vue
diff --git a/models/inventory/StockTransfer.ts b/models/inventory/StockTransfer.ts
index ae0f992b..fce4f61e 100644
--- a/models/inventory/StockTransfer.ts
+++ b/models/inventory/StockTransfer.ts
@@ -1,7 +1,13 @@
import { Fyo, t } from 'fyo';
import { Attachment } from 'fyo/core/types';
import { Doc } from 'fyo/model/doc';
-import { Action, DefaultMap, FiltersMap, FormulaMap } from 'fyo/model/types';
+import {
+ Action,
+ DefaultMap,
+ FiltersMap,
+ FormulaMap,
+ HiddenMap,
+} from 'fyo/model/types';
import { ValidationError } from 'fyo/utils/errors';
import { Defaults } from 'models/baseModels/Defaults/Defaults';
import { Invoice } from 'models/baseModels/Invoice/Invoice';
@@ -33,6 +39,14 @@ export abstract class StockTransfer extends Transfer {
},
};
+ hidden: HiddenMap = {
+ backReference: () =>
+ !(this.backReference || !(this.isSubmitted || this.isCancelled)),
+ terms: () => !(this.terms || !(this.isSubmitted || this.isCancelled)),
+ attachment: () =>
+ !(this.attachment || !(this.isSubmitted || this.isCancelled)),
+ };
+
static defaults: DefaultMap = {
numberSeries: (doc) => getNumberSeries(doc.schemaName, doc.fyo),
terms: (doc) => {
diff --git a/schemas/app/inventory/PurchaseReceipt.json b/schemas/app/inventory/PurchaseReceipt.json
index 33fcebfa..7b051053 100644
--- a/schemas/app/inventory/PurchaseReceipt.json
+++ b/schemas/app/inventory/PurchaseReceipt.json
@@ -5,14 +5,6 @@
"naming": "numberSeries",
"showTitle": true,
"fields": [
- {
- "fieldname": "items",
- "label": "Items",
- "fieldtype": "Table",
- "target": "PurchaseReceiptItem",
- "required": true,
- "edit": true
- },
{
"fieldname": "numberSeries",
"label": "Number Series",
@@ -20,14 +12,24 @@
"target": "NumberSeries",
"create": true,
"required": true,
- "default": "PREC-"
+ "default": "PREC-",
+ "section": "Default"
},
{
"fieldname": "backReference",
"label": "Back Reference",
"fieldtype": "Link",
"target": "PurchaseInvoice",
- "readOnly": true
+ "readOnly": true,
+ "section": "References"
+ },
+ {
+ "fieldname": "items",
+ "label": "Items",
+ "fieldtype": "Table",
+ "target": "PurchaseReceiptItem",
+ "required": true,
+ "edit": true
}
],
"keywordFields": ["name", "party"]
diff --git a/schemas/app/inventory/Shipment.json b/schemas/app/inventory/Shipment.json
index 10df12dd..242a0d64 100644
--- a/schemas/app/inventory/Shipment.json
+++ b/schemas/app/inventory/Shipment.json
@@ -5,14 +5,6 @@
"naming": "numberSeries",
"showTitle": true,
"fields": [
- {
- "fieldname": "items",
- "label": "Items",
- "fieldtype": "Table",
- "target": "ShipmentItem",
- "required": true,
- "edit": true
- },
{
"fieldname": "numberSeries",
"label": "Number Series",
@@ -20,14 +12,25 @@
"target": "NumberSeries",
"create": true,
"required": true,
- "default": "SHPM-"
+ "default": "SHPM-",
+ "section": "Default"
},
{
"fieldname": "backReference",
"label": "Back Reference",
"fieldtype": "Link",
"target": "SalesInvoice",
- "readOnly": true
+ "readOnly": true,
+ "section": "References"
+ },
+ {
+ "fieldname": "items",
+ "label": "Items",
+ "fieldtype": "Table",
+ "target": "ShipmentItem",
+ "required": true,
+ "edit": true,
+ "section": "Items"
}
],
"keywordFields": ["name", "party"]
diff --git a/schemas/app/inventory/StockTransfer.json b/schemas/app/inventory/StockTransfer.json
index c2fa869a..de7f15c2 100644
--- a/schemas/app/inventory/StockTransfer.json
+++ b/schemas/app/inventory/StockTransfer.json
@@ -11,13 +11,13 @@
"fieldname": "name",
"fieldtype": "Data",
"required": true,
- "readOnly": true
+ "readOnly": true,
+ "section": "Default"
},
{
- "fieldname": "date",
- "label": "Date",
- "fieldtype": "Datetime",
- "required": true
+ "abstract": true,
+ "fieldname": "numberSeries",
+ "section": "Default"
},
{
"fieldname": "party",
@@ -25,25 +25,46 @@
"fieldtype": "Link",
"target": "Party",
"create": true,
- "required": true
+ "required": true,
+ "section": "Default"
},
{
- "fieldname": "terms",
- "label": "Notes",
- "placeholder": "Add transfer terms",
- "fieldtype": "Text"
+ "fieldname": "date",
+ "label": "Date",
+ "fieldtype": "Datetime",
+ "required": true,
+ "section": "Default"
},
{
- "fieldname": "attachment",
- "placeholder": "Add attachment",
- "label": "Attachment",
- "fieldtype": "Attachment"
+ "abstract": true,
+ "fieldname": "items",
+ "section": "Items"
},
{
"fieldname": "grandTotal",
"label": "Grand Total",
"fieldtype": "Currency",
- "readOnly": true
+ "readOnly": true,
+ "section": "Items"
+ },
+ {
+ "fieldname": "terms",
+ "label": "Notes",
+ "placeholder": "Add transfer terms",
+ "fieldtype": "Text",
+ "section": "References"
+ },
+ {
+ "fieldname": "attachment",
+ "placeholder": "Add attachment",
+ "label": "Attachment",
+ "fieldtype": "Attachment",
+ "section": "References"
+ },
+ {
+ "abstract": true,
+ "fieldname": "backReference",
+ "section": "References"
}
],
"keywordFields": ["name", "party"]
diff --git a/schemas/types.ts b/schemas/types.ts
index ef028b26..f542bdf3 100644
--- a/schemas/types.ts
+++ b/schemas/types.ts
@@ -66,6 +66,7 @@ export interface BaseField {
computed?: boolean; // Computed values are not stored in the database.
section?: string; // UI Facing config, for grouping by sections
tab?: string; // UI Facing config, for grouping by tabs
+ abstract?: string; // Uused to mark the location of a field in an Abstract schema
}
export type SelectOption = { value: string; label: string };
diff --git a/src/pages/CommonForm/CommonForm.vue b/src/pages/CommonForm/CommonForm.vue
index c3a48031..f40b4e20 100644
--- a/src/pages/CommonForm/CommonForm.vue
+++ b/src/pages/CommonForm/CommonForm.vue
@@ -289,7 +289,6 @@ export default defineComponent({
},
async onValueChange(field: Field, value: DocValue) {
const { fieldname } = field;
- console.log(fieldname, value);
delete this.errors[fieldname];
try {
diff --git a/src/pages/GeneralForm.vue b/src/pages/GeneralForm.vue
deleted file mode 100644
index ed92a0b1..00000000
--- a/src/pages/GeneralForm.vue
+++ /dev/null
@@ -1,320 +0,0 @@
-
-
-
-
-
- doc.addItem(name)"
- />
-
-
- {{ group.group }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- doc.set('party', value, true)"
- @new-doc="(party) => doc.set('party', party.name, true)"
- :read-only="doc?.submitted"
- />
- doc.set('date', value)"
- :read-only="doc?.submitted"
- />
- doc.set('numberSeries', value)"
- :read-only="!doc.notInserted || doc?.submitted"
- />
-
- doc.set('attachment', value)"
- :read-only="doc?.submitted"
- />
-
-
-
-
-
doc.set('items', value)"
- @editrow="toggleQuickEditDoc"
- :read-only="doc?.submitted"
- />
-
-
-
-
-
-
-
-
- doc.set('terms', value)"
- :read-only="doc?.submitted"
- />
-
-
-
-
-
{{ t`Grand Total` }}
-
{{ formattedValue('grandTotal') }}
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/router.ts b/src/router.ts
index 987de9d4..73d4370b 100644
--- a/src/router.ts
+++ b/src/router.ts
@@ -2,7 +2,6 @@ import { ModelNameEnum } from 'models/types';
import ChartOfAccounts from 'src/pages/ChartOfAccounts.vue';
import CommonForm from 'src/pages/CommonForm/CommonForm.vue';
import Dashboard from 'src/pages/Dashboard/Dashboard.vue';
-import GeneralForm from 'src/pages/GeneralForm.vue';
import GetStarted from 'src/pages/GetStarted.vue';
import ImportWizard from 'src/pages/ImportWizard.vue';
import InvoiceForm from 'src/pages/InvoiceForm.vue';
@@ -15,36 +14,13 @@ import {
createRouter,
createWebHistory,
RouteLocationRaw,
- RouteRecordRaw
+ RouteRecordRaw,
} from 'vue-router';
-function getGeneralFormItems(): RouteRecordRaw[] {
- return [ModelNameEnum.Shipment, ModelNameEnum.PurchaseReceipt].map(
- (schemaName) => {
- return {
- path: `/edit/${schemaName}/:name`,
- name: `${schemaName}Form`,
- components: {
- default: GeneralForm,
- edit: QuickEditForm,
- },
- props: {
- default: (route) => {
- route.params.schemaName = schemaName;
- return {
- schemaName,
- name: route.params.name,
- };
- },
- edit: (route) => route.query,
- },
- };
- }
- );
-}
-
function getCommonFormItems(): RouteRecordRaw[] {
return [
+ ModelNameEnum.Shipment,
+ ModelNameEnum.PurchaseReceipt,
ModelNameEnum.JournalEntry,
ModelNameEnum.Payment,
ModelNameEnum.StockMovement,
@@ -80,7 +56,6 @@ const routes: RouteRecordRaw[] = [
path: '/get-started',
component: GetStarted,
},
- ...getGeneralFormItems(),
...getCommonFormItems(),
{
path: '/edit/:schemaName/:name',