Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor history to be Tenancy object #455

Open
6 tasks
jon-nfc opened this issue Dec 26, 2024 · 0 comments
Open
6 tasks

Refactor history to be Tenancy object #455

jon-nfc opened this issue Dec 26, 2024 · 0 comments

Comments

@jon-nfc
Copy link
Member

jon-nfc commented Dec 26, 2024

The history model is not a tenancy object. due to this there is no filtering by organization can be done.

Details

Adjust the history model so that it is a tenancy model. The model only requires that it contain an organization field.

This cant be done by simply importing the TenancyObject abstract class, as this class also includes the history saving feature. Thought will need to be placed into how this will be done so as not to create a recursive loop.

Migration

This change will require a migration in addition to the migration to add the field. The migration will need to conduct the following in order so as to change the model to be a Tenancy Model:

  • add the organization field with type int
  • iterate over the entire history table fetching the history entry item using item_class if parent_class does not exist
  • with the found history entry item, add its organization.id to the history table organization field for that row
  • add another migration that sets the organization field as a pk field for the organization model

Links

Requirements

  • has organization field
  • permissions can be by org
  • If the history entry item does not exist, remove it
  • Model delete signal which will remove history entries on parent model delete
    if no parent item, then use item_class

Tasks

  • ☑️ remove test_view_different_organizaiton_denied test case from functional test cases HistoryPermissionsAPI
    app/core/tests/functional/test_history/test_history_viewset.py
    This test case post the changes above, will once again be required as the model will be a Tenancy object.
@jon-nfc jon-nfc moved this to Backlog in Centurion ERP Dec 26, 2024
@jon-nfc jon-nfc moved this from Backlog to Blocked in Centurion ERP Dec 26, 2024
jon-nfc added a commit that referenced this issue Dec 26, 2024
this model is not a tenancy model yet. See #455 for details

ref: #442 #454 #455
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Blocked
Development

No branches or pull requests

1 participant