2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 23:00:56 +00:00
books/schemas
18alantom 7023ce2171 fix: allow account creation from tax
- prevent random strings when manual naming
- set naming
2022-09-15 14:23:13 +05:30
..
app fix: allow account creation from tax 2022-09-15 14:23:13 +05:30
core fix: allow account creation from tax 2022-09-15 14:23:13 +05:30
meta incr: refactor core.ts to use schema !meta 2022-05-23 16:18:21 +05:30
regional incr: search improvements 2022-05-23 16:18:22 +05:30
tests fix: address issue, create filters 2022-05-23 16:18:23 +05:30
index.ts fix: get Invoice settings to render and work 2022-05-23 16:18:22 +05:30
README.md chore: shift readme stuff into a readme 2022-05-23 16:18:22 +05:30
schemas.ts fix: simplify configfile updation 2022-07-20 14:14:36 +05:30
types.ts incr: add filter prop on Field 2022-07-30 16:06:14 +05:30

Schema

Main purpose of this is to describe the shape of the models' table in the database. But there is some irrelevant information in the schemas with respect to this goal. This is information is allowed as long as it is not dynamic, which is impossible anyways as the files are data (.json, not .js)

If any field has to have a dynamic value, it should be added to the controller file by the same name, check the books/models subdirectory for this.

There are a few types of schemas:

  • Regional: Schemas that are in the '../regional' subdirectories these can be of any of the below types.
  • Abstract: Schemas that are not used as they are but only after they are extended by Stub schemas. Indentified by the isAbstract field
  • Subclass: Schemas that have an "extends" field on them, the value of which points to an Abstract schema.
  • Complete: Schemas which are neither abstract nor stub.

For more detail on the meta structure of the schema check books/schemas/types.ts.

Final Schema

This is the schema which is used by the database and app code and is built by combining the above types of schemas.

The order in which a schema is built is:

  1. Build Regional schemas by overriding the fields and other properties of the non regional variants.
  2. Combine Subclass schemas with Abstract schemas to get complete schemas.

Note: if a Regional schema is not present as a non regional variant it's used as it is.

Additional Notes

In all the schemas, the "name" field/column is the primary key. If it isn't explicitly added, the schema builder will add it in.

The following schema fields will be implicitly translated by the frontend: "label", "description", and "placeholder", irrespective of nesting.