fix(human_resources): Correct history link generation and add docs
ref: #722 #707 fixes #710
This commit is contained in:
8
.github/ISSUE_TEMPLATE/new_model.md
vendored
8
.github/ISSUE_TEMPLATE/new_model.md
vendored
@ -44,7 +44,13 @@ Describe in detail the following:
|
||||
> - Two words are not to contain a space char, `\s`. It is to be replaced with an underscore `_`
|
||||
> - As much as practical, keep the tag as close to the model name as possible
|
||||
|
||||
- [ ] 📝 New [History model](https://nofusscomputing.com/projects/centurion_erp/development/core/model_history/) created
|
||||
- [ ] 📝 New [History model](https://nofusscomputing.com/projects/centurion_erp/development/core/model_history/) created
|
||||
|
||||
- Sub-Models **_ONLY_**
|
||||
|
||||
- [ ] Model class variable `history_app_label` set to correct application label
|
||||
|
||||
- [ ] Model class variable `history_model_name` set to correct model label
|
||||
|
||||
- [ ] 📓 New [Notes model](https://nofusscomputing.com/projects/centurion_erp/development/core/model_notes/) created
|
||||
- [ ] 🆕 Model Created
|
||||
|
@ -154,6 +154,17 @@ table_fields: list = [
|
||||
|
||||
Adding History to a model is a simple process. Please see the [Model History](./core/model_history.md) docs.
|
||||
|
||||
In the case the model you are creating is inherited from another model, (a non-abstrct model), you may need to add the following variables to the inherited class so that the model link works:
|
||||
|
||||
- `history_app_label` The application label for the model in question
|
||||
|
||||
- `history_model_name` The model name for the model in question.
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
If you created a model called employee in the human_resources app, which is a sub-model that inherits from `Contact`, `Person` then `Entity`. In this case the `Entity` model is where the history is derived, which would create link `/access/entity/<pk>/history`. This link is incorrect. adding variables `history_app_label = 'human_resources'` and `history_model_name = 'Emplyee'` to the `Employee` model class; will now create a valid link, `/human_resources/employee/<pk>/history`.
|
||||
|
||||
|
||||
## Tests
|
||||
|
||||
|
Reference in New Issue
Block a user