mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-10 10:57:52 +00:00
[Feature] Changelog / Edit History (#13069)
* Initial app scaffolding * Skeleton for AuditLogTable * Add UI table * Add audit history panel to admin center * Add auditing for models in the 'company' app * Gate API access of user staff status * Display item history in UI * Track 'attachment' history * Track 'parameter' changes * Audit support for "common" models * Track changed for "build" models * Track history for "order" models: - PurchaseOrder - SalesOrder - SalesOrderShipment - ReturnOrder Also track changes against LineItem and ExtraLineItem objects * Register custom admin class * Support Part history * BomItem changes * Fix for BulkCreateMixin * Tweak unit tests * Use Viewset * Adjust error code behavior * Setting to keep summary entries * Refactor helper for middlewares * Tweak unit tests * Fixes for ModelInformationDict * Track pricing changes * Add model type filter for auditlog table * Specify filter field type * Hide HistoryPanel if auding is disabled * add docs * Add "--summary" option to export_records task * Playwright tests * Track task responsible for data changes * Updated unit tests * record changes to global settings * Update docs * Ensure values are stringified * Fix for globalsetting * Patch unit test * Tweak playwright tests * playwright test fix * use main branch for demo data * Update CHANGELOG
This commit is contained in:
1 parent
cdb3b1ecf7
commit
c475e9bfcf
91 files changed
+7753
-102
No files matched your search
@@ -91,6 +91,9 @@ with open(gen_base.joinpath('inventree_report_context.json'), encoding='utf-8')
|
||||
# User permission roles
|
||||
with open(gen_base.joinpath('inventree_roles.json'), encoding='utf-8') as f:
|
||||
ROLES = json.load(f)
|
||||
# Audited models
|
||||
with open(gen_base.joinpath('inventree_audited_models.json'), encoding='utf-8') as f:
|
||||
AUDITED_MODELS = json.load(f)
|
||||
|
||||
|
||||
def get_repo_url(raw=False):
|
||||
@@ -495,6 +498,32 @@ def define_env(env):
|
||||
|
||||
return ret_data
|
||||
|
||||
@env.macro
|
||||
def audited_models():
|
||||
"""Render a markdown table of the models which are recorded in the audit log.
|
||||
|
||||
The table is built directly from `docs/generated/inventree_audited_models.json`
|
||||
(produced by the `export_audited_models` management command, sourced from
|
||||
the models which implement `InvenTreeAuditMixin`), so it can never drift out
|
||||
of sync with the models actually audited in the source code.
|
||||
"""
|
||||
global AUDITED_MODELS
|
||||
|
||||
ret_data = '| Category | Model | Model Type | Parent | Notes |\n'
|
||||
ret_data += '| --- | --- | --- | --- | --- |\n'
|
||||
|
||||
for model in AUDITED_MODELS:
|
||||
parent = model['parent']
|
||||
notes = model['parent_note']
|
||||
|
||||
if fields := model['include_fields']:
|
||||
fields = ', '.join(f'`{field}`' for field in fields)
|
||||
notes = f'Only the following fields are recorded: {fields}'
|
||||
|
||||
ret_data += f'| {model["app"]} | {model["name"]} | `{model["model_type"]}` | {parent} | {notes} |\n'
|
||||
|
||||
return ret_data
|
||||
|
||||
@env.macro
|
||||
def report_context(type_: Literal['models', 'base'], model: str):
|
||||
"""Extract information on a particular report context."""
|
||||
|
||||
Reference in new issue
Block a user