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

Inconsistent Method Resolution Order (MRO) in TimeSeriesSelectorReportView in views.py line 213 #47

Open
im-nihal opened this issue Dec 11, 2023 · 2 comments

Comments

@im-nihal
Copy link

Issue:

I think the class TimeSeriesSelectorReportView in django-erp-framework/erp_framework/reporting/views.py inherits from both UserPassesTestMixin and ReportViewBase in the wrong order. This results in a TypeError: Cannot create a consistent method resolution order (MRO) for bases error when attempting to runserver or migration.

Observed Behavior:

When running python manage.py migrate, the following error occurs:

Traceback (most recent call last):
...
..
..
...
File "/home/gedion/Desktop/ERP/virt/src/django-erp-framework/erp_framework/reporting/views.py", line 213, in <module>
class TimeSeriesSelectorReportView(UserPassesTestMixin, ReportViewBase):
TypeError: Cannot create a consistent method resolution order (MRO) for bases UserPassesTestMixin, ReportViewBase

Screenshot from 2023-12-11 17-26-25

Expected Behavior:
runserver and Migrations should run successfully without encountering any errors.

Proposed Solution:
The order of inheritance in TimeSeriesSelectorReportView should be reversed:

class TimeSeriesSelectorReportView(ReportViewBase, UserPassesTestMixin):

Screenshot from 2023-12-11 17-27-35

This ensures that methods from ReportViewBase are prioritized over those from UserPassesTestMixin, resolving the MRO conflict and allowing to the server and migrations to run successfully.

Additional Notes:
This issue was identified during development of the my-shop project.
The proposed solution was tested and confirmed to resolve the error.
This appears to be a bug in the django-erp-framework package.

Desired Outcome:
The developers of django-erp-framework address this bug in a future release. The documentation for django-erp-framework is updated to reflect the correct order of inheritance for TimeSeriesSelectorReportView.

@RamezIssac
Copy link
Owner

Thank you for the report !
I will check and get back to you

@serg-it
Copy link

serg-it commented Jan 22, 2024

Hi,
Class ReportViewBase inherits from UserPassesTestMixin that's why in class TimeSeriesSelectorReportView enough delete mixin UserPassesTestMixin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants