RamezIssac/django-erp-framework

I have error in sample_erp tutorial document!

Opened this issue · 5 comments

Greetings
I am a newbie in Python.
I followed the guide,
when I click on keys: [Clients][Expense][Products][Sales]
I have a error occurs!!
OR Key in left side .
Although all the data I entered in sample_erp was saved in admin.
All the add buttons work fine and then the error message comes.

`

TypeError at /sample_erp/expense/

__init__() takes 14 positional arguments but 15 were given
Request Method: GET
http://127.0.0.1:8000/sample_erp/expense/
4.1.1
TypeError
init() takes 14 positional arguments but 15 were given
G:\Ra-system_ERP\ERP_APP\env\lib\site-packages\django\contrib\admin\options.py, line 834, in get_changelist_instance
ra.admin.admin.changelist_view
G:\Ra-system_ERP\ERP_APP\env\Scripts\python.exe
3.8.3
['G:\Ra-system_ERP\ERP_APP', 'C:\Users\Morteza\AppData\Local\Programs\Python\Python38\python38.zip', 'C:\Users\Morteza\AppData\Local\Programs\Python\Python38\DLLs', 'C:\Users\Morteza\AppData\Local\Programs\Python\Python38\lib', 'C:\Users\Morteza\AppData\Local\Programs\Python\Python38', 'G:\Ra-system_ERP\ERP_APP\env', 'G:\Ra-system_ERP\ERP_APP\env\lib\site-packages']
Wed, 28 Sep 2022 18:32:52 +0000
`

`


  • G:\Ra-system_ERP\ERP_APP\env\lib\site-packages\ra\admin\admin.py
    , line 343, in wrapper
    1.                 return self.admin_site.admin_view(view)(*args, **kwargs)
    Local vars
    Variable Value
    args (<WSGIRequest: GET '/sample_erp/expense/'>,)
    kwargs {}
    self <ExpenseAdmin: model=Expense site=RaAdminSite(name='ra_admin')>
    view <bound method EntityAdmin.changelist_view of <ExpenseAdmin: model=Expense site=RaAdminSite(name='ra_admin')>>

You’re seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard page generated by the handler for this status code.

`

`

  • G:\Ra-system_ERP\ERP_APP\env\lib\site-packages\ra\admin\admin.py, line 324, in changelist_view
    1.         return super(EntityAdmin, self).changelist_view(request, extra_context)
    Local vars
    Variable Value
    class <class 'ra.admin.admin.EntityAdmin'>
    extra_context {'description': None}
    request <WSGIRequest: GET '/sample_erp/expense/'>
    self <ExpenseAdmin: model=Expense site=RaAdminSite(name='ra_admin')>

`

`

  • G:\Ra-system_ERP\ERP_APP\env\lib\site-packages\reversion\admin.py, line 235, in changelist_view
    1.             return super().changelist_view(request, context)
    Local vars
    Variable Value
    class <class 'reversion.admin.VersionAdmin'>
    context {'description': None, 'has_change_permission': True}
    extra_context {'description': None}
    request <WSGIRequest: GET '/sample_erp/expense/'>
    self <ExpenseAdmin: model=Expense site=RaAdminSite(name='ra_admin')>

`

Got hit with the exact same issue.

I'm new to Django and RA framework too but I suspect it might be something to do with the addition of search_help_text in Django 4.1

get_changelist_instance() has the positional argument self.search_help_text on line 848 (django/contrib/admin/options.py) which is not reflected in the RaChangeList() class.

I found that adding search_help_text to the end of the positional arguments on line 83 and 87 of ra/admin/admin.py cleared the error (added it to both init and super).

As I've said I'm new to this too so I have no clue yet why (or if) this only seems to affect the sample_erp tutorial

Hopefully the whole RA framework will be updated to work with Django 4 but adding the argument above seemed to workaround this specific error.

A new version is released with this, and much more, fixed and added

I also have a problem with the sample_erp

In the models.py file

from django.db import models
from erp_framework.base.models import EntityModel, TransactionModel, TransactionItemModel, QuantitativeTransactionItemModel
from erp_framework.base.registry import register_doc_type
from django.utils.translation import gettext_lazy as _

What is this from erp_framework.base.registry import register_doc_type

There is no registry.py file in the base folder.

Can you help on this?
Thanks.

Hello , Thanks for reporting @ShopCartz
The sample ERP tutorial will be revised as there are some big changes in the codebase.

You can skip the doc type registry, i will post here once i push the documentation updates.

Let me know if you face other issues .

Similar issue with Docs. I've commented out the registry bit but when I attempt makemigrations I get.

from erp_framework.admin.admin import erp_framework_site, EntityAdmin #, TransactionAdmin, TransactionItemAdmin
ImportError: cannot import name 'erp_framework_site' from 'erp_framework.admin.admin' (/home/myuser/apps/myproject/env/lib/python3.10/site-packages/erp_framework/admin/admin.py)

This in admin.py
from erp_framework.admin.admin import erp_framework_site

Django 4.2 Python 3.10

Really looking forward to getting ERP going. Looks awesome.