frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
21.83k stars 7.33k forks source link

Error in module 'erpnext.regional.south_africa.setup during initial setup of ERPNext V13 #27849

Closed johnlongland closed 2 years ago

johnlongland commented 3 years ago

Description of the issue

Just after fresh V13 install and before any transactions or configuration is done , there is an error in the error_log

Context information (for bug reports)

Tried various installation methods ( manual and script ) to see if that has an effect but all installation method yields the same result

Output of bench version

(erpnext 13.12.0
frappe 13.12.0
)

Steps to reproduce the issue

  1. Install V13 ERPNext
  2. Log in as Administrator and enter all info .. country, currency, company, language etc
  3. ERPNext completes its own setting up
  4. Without entering any other transactions or configurations, there is an error on the error_log

Observed result

Error on error_log

Expected result

No error in the error_log

Stacktrace / full error message

(Traceback (most recent call last):
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/erpnext/erpnext/setup/setup_wizard/operations/taxes_setup.py", line 110, in update_regional_tax_settings
    frappe.get_attr(module_name)(country, company)
  File "/home/<ERPNEXT-USER>/frappe-bench/apps/frappe/frappe/__init__.py", line 1190, in get_attr
    return getattr(get_module(modulename), methodname)
AttributeError: module 'erpnext.regional.south_africa.setup' has no attribute 'update_regional_tax_settings')

Additional information

When I install a fresh V13 server but set the country as India, the error does not occur Running on Digital Ocean droplet 2 CPU 4G-RAM

OS version / distribution, ERPNext install method, etc. node -v && npm -v && python3 -V && pip3 -V && yarn -v v12.22.6 6.14.15 Python 3.8.10 pip 21.2.4 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8) 1.22.15

Ubuntu 20.04 LTS Server version: 10.4.21-MariaDB-

franzos commented 2 years ago

We're seeing something similar:

erpnext - upstream/version-13
frappe - upstream/version-13

This usually happens on quotes, sales orders and the likes.

Traceback (most recent call last):
  File "apps/erpnext/erpnext/setup/setup_wizard/operations/taxes_setup.py", line 109, in update_regional_tax_settings
    frappe.get_attr(module_name)(country, company)
  File "apps/frappe/frappe/__init__.py", line 1199, in get_attr
    return getattr(get_module(modulename), methodname)
AttributeError: module 'erpnext.regional.germany.setup' has no attribute 'update_regional_tax_settings'

Country is set to Germany.

EDIT

It looks like taxes_setup.py only checks whether the path exists:

def update_regional_tax_settings(country, company):
    path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(country))
    if os.path.exists(path.encode("utf-8")): # <--------------
        try:
            module_name = "erpnext.regional.{0}.setup.update_regional_tax_settings".format(frappe.scrub(country))
            frappe.get_attr(module_name)(country, company)
        except Exception as e:
            # Log error and ignore if failed to setup regional tax settings
            frappe.log_error()
            pass

Link

tjomtek commented 2 years ago

For South Africa ensure that the company "VAT Setting" is added after fresh install SAVatSettings

stale[bot] commented 2 years ago

This issue has been automatically marked as inactive because it has not had recent activity and it wasn't validated by maintainer team. It will be closed within a week if no further activity occurs.