2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 23:00:56 +00:00

fix(ux): prevent creation of a few entrytypes

This commit is contained in:
18alantom 2023-03-15 11:19:24 +05:30
parent 6719c070e1
commit f94ae5c2d2
5 changed files with 11 additions and 2 deletions

View File

@ -2,6 +2,7 @@
"name": "Account",
"label": "Account",
"naming": "manual",
"create": false,
"isSingle": false,
"isTree": true,
"fields": [

View File

@ -1,6 +1,7 @@
{
"name": "AccountingLedgerEntry",
"label": "Accounting Ledger Entry",
"create": false,
"isSingle": false,
"isChild": false,
"naming": "autoincrement",

View File

@ -1,6 +1,7 @@
{
"name": "StockLedgerEntry",
"label": "Stock Ledger Entry",
"create": false,
"isSingle": false,
"isChild": false,
"naming": "autoincrement",

View File

@ -107,7 +107,7 @@ export type Naming = 'autoincrement' | 'random' | 'numberSeries' | 'manual';
export interface Schema {
name: string; // Table name
label: string; // Translateable UI facing name
fields: Field[]; // Maps to database columns
fields: Field[]; // Maps to database columns
isTree?: boolean; // Used for nested set, eg for Chart of Accounts
extends?: string; // Value points to an Abstract schema. Indicates Subclass schema
isChild?: boolean; // Indicates a child table, i.e table with "parent" FK column
@ -117,7 +117,8 @@ export interface Schema {
isSubmittable?: boolean; // For transactional types, values considered only after submit
keywordFields?: string[]; // Used to get fields that are to be used for search.
quickEditFields?: string[]; // Used to get fields for the quickEditForm
linkDisplayField?:string;// Display field if inline editable
linkDisplayField?:string; // Display field if inline editable
create?: boolean // Whether the user can create an entry from the ListView
naming?: Naming; // Used for assigning name, default is 'random' else 'numberSeries' if present
titleField?: string; // Main display field
removeFields?: string[]; // Used by the builder to remove fields.

View File

@ -10,6 +10,7 @@
:schema-name="schemaName"
/>
<Button
v-if="canCreate"
:icon="true"
type="primary"
@click="makeNewDoc"
@ -40,6 +41,7 @@
</div>
</template>
<script>
import { thisExpression } from '@babel/types';
import Button from 'src/components/Button.vue';
import ExportWizard from 'src/components/ExportWizard.vue';
import FilterDropdown from 'src/components/FilterDropdown.vue';
@ -160,6 +162,9 @@ export default {
fields() {
return fyo.schemaMap[this.schemaName].fields;
},
canCreate() {
return fyo.schemaMap[this.schemaName].create !== false;
},
},
};