Models
Models within Centurion ERP are how the data is structured within the database. This page contains documentation pertinent to the development of the models for use with Centurion ERP.
All models within Centurion ERP are what we call a "Tenancy Object." A tenancy object is a model that takes advantage of the multi-tenancy features of Centurion ERP.
Requirements
All models must meet the following requirements:
-
inherits from
app.access.models.TenancyObject
Tip
There is no requirement to include class
app.core.mixin.history_save.SaveHistory
for inheritence as this class is already included within classapp.access.models.TenancyObject
.Note
If there is a specific use case for the object not to be a tenancy object, this will need to be discussed with a maintainer.
-
class has
__str__
method defined to return that is used to return a default value if no field is specified. -
Fields are initialized with the following parameters:
-
verbose_name
-
help_text
-
-
No
queryset
is to return data that the user has not got access to. see queryset() -
Single Field validation is conducted if required.
Requirement
Multi-field validation, or validation that requires access to multiple fields must be done within the form class.
-
contains a
Meta
sub-class with following parameters:verbose_name_plural
-
If creating a new model, function
access.functions.permissions.permission_queryset()
has been updated to display the models permission(s)
Checklist
This section details the additional items that may need to be done when adding a new model:
-
If the model is a primary model, add it to model reference rendering in
app/core/lib/markdown_plugins/model_reference.py
functiontag_html
-
If the model is a primary model, add it to the model link slash command in
app/core/lib/slash_commands/linked_model.py
functioncommand_linked_model
History
Currently the adding of history to a model is a manual process. edit the file located at core.views.history
and within View.get_object
add the model to the switch
statement.
Tests
The following Unit test cases exists for models:
Info
If you add a feature you will have to write the test cases for that feature if they are not covered by existing test cases.
Docs to clean up
Note
The below documentation is still to be developed. As such what is written below may be incorrect.
for items that have a parent item, modification will need to be made to the mixin by adding the relevant check and setting the relevant keys.
About:
This page forms part of our Project Centurion ERP.
Page Metadata
Version: ToDo: place files short git commit hereDate Created: 2024-07-14
Date Edited: 2024-09-20
Contribution:
Would You like to contribute to our Centurion ERP project? You can assist in the following ways:
- Edit This Page If there is a mistake or a way you can improve it.
- Add a Page to the Manual if you would like to add an item to our manual
- Raise an Issue if there is something about this page you would like to improve, and git is unfamiliar to you.
ToDo: Add the page list of contributors