Successfully consolidated three audit modules into a single spp_audit module:
spp_audit_log(base module - core audit log and rule engine)spp_audit_post(extension - parent-child hierarchy and message posting)spp_audit_config(extension - create_rules() helper and default data)
spp_audit/
├── __init__.py
├── __manifest__.py
├── models/
│ ├── __init__.py
│ ├── spp_audit_log.py # Merged: base + post extensions
│ ├── spp_audit_rule.py # Merged: base + post + config
│ └── group.py # Copied unchanged
├── views/
│ ├── spp_audit_log_views.xml # Copied with updated XML IDs
│ └── spp_audit_rule_views.xml # Merged: base form + parent-child fields
├── security/
│ ├── privileges.xml # Updated XML IDs
│ ├── audit_security.xml # Updated XML IDs and references
│ └── ir.model.access.csv # Updated group references
├── data/
│ └── audit_rule_data.xml # Copied unchanged
├── tools/
│ ├── __init__.py
│ └── decorator.py # Copied unchanged
├── tests/
│ ├── __init__.py
│ └── test_spp_audit_rule.py # Copied unchanged
└── static/
└── description/ # Copied unchanged
Combined dependencies from all three modules:
- Base: base, mail, spp_registry_membership, spp_security
- Post: (same as base)
- Config: spp_programs, spp_service_points
Result: All dependencies unified in single manifest
Merged features:
- Base model from spp_audit_log (lines 1-124)
- Parent-child functionality from spp_audit_post:
parent_data_htmlfieldparent_model_idfieldparent_res_ids_strfieldlog_tofieldcreate()method override for message posting_parent_get_content()method_compute_parent_data_html()method_compute_log_to()method
Merged features:
- Base model from spp_audit_log (fields, methods, decorators)
- Parent-child hierarchy from spp_audit_post:
_parent_name = "parent_id"_parent_store = Trueparent_idfieldchild_idsfieldis_mail_threadfieldfield_idfieldfield_id_domainfieldparent_pathfield_check_model_id_field_id()constraint_compute_field_id_domain()methodget_most_parent()method- Enhanced
get_audit_log_vals()method
create_rules()helper method from spp_audit_config
Merged into single form:
- Base form fields
- Parent-child fields directly in form (not as inheritance):
parent_idfield before namefield_idfield after log optionschild_idsnotebook page with related rules list
Updated XML IDs:
spp_audit_log.group_audit_log_manager→spp_audit.group_managerspp_audit_log.privilege_audit_log_manager→spp_audit.privilege_audit_manager- Access rights now reference
spp_audit.group_manager
Fixed mismatch in create_rules() method where parameter names didn't match field
names:
- Changed
"view_logs"to"is_view_logs" - Changed
"log_create"to"is_log_create" - Changed
"log_write"to"is_log_write" - Changed
"log_unlink"to"is_log_unlink"
models/group.py- Group member names computationtools/decorator.py- Audit decorator for method patchingtests/test_spp_audit_rule.py- Unit testsdata/audit_rule_data.xml- Default audit rulesstatic/description/*- Icons and documentation
All references updated from:
spp_audit_log.*→spp_audit.*- Menu IDs, group IDs, privilege IDs all use
spp_auditprefix
- spp_audit_post used
_inherit = "spp.audit.log"→ Now merged directly into base model - spp_audit_post used
_inherit = "spp.audit.rule"→ Now merged directly into base model - spp_audit_config used
_inherit = "spp.audit.rule"→ create_rules() merged into base model
- Original: Base form + XML inheritance patch from spp_audit_post
- Consolidated: Single unified form with all fields
- base
- spp_registry_membership
- spp_security
- spp_programs
- spp_service_points
Any module that previously depended on spp_audit_log, spp_audit_post, or
spp_audit_config will need to update their dependencies to spp_audit.
- Update
dependsin manifest.py fromspp_audit_logtospp_audit - Update any XML ID references:
spp_audit_log.group_audit_log_manager→spp_audit.group_managerspp_audit_log.menu_root→spp_audit.menu_rootspp_audit_log.spp_audit_rule_form→spp_audit.spp_audit_rule_form
No data migration should be needed as:
- Model names remain unchanged (
spp.audit.log,spp.audit.rule) - Field names remain unchanged
- Only XML IDs and module names changed
- Unit Tests: Run existing test_spp_audit_rule.py
- Integration Tests: Verify audit rules creation from data file
- Feature Tests:
- Test basic audit logging (create/write/unlink)
- Test parent-child audit relationships
- Test message posting to parent records
- Test create_rules() helper method
- UI Tests:
- Verify audit rule form displays correctly
- Verify related rules notebook on parent rules
- Verify audit log display
- Simplified Dependencies: One module instead of three
- Reduced Complexity: No inheritance chains to follow
- Better Performance: No additional module loading overhead
- Easier Maintenance: All related code in one place
- Clearer Architecture: Single source of truth for audit functionality
All files created successfully:
- 20 files total (excluding pycache)
- 3 Python model files
- 2 view XML files
- 3 security files
- 1 data file
- 2 tool files
- 1 test file
- 4 static resource files
- 3 init.py files
- 1 manifest.py file