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

Improve demo data #2 #36635

Closed
4 of 6 tasks
ankush opened this issue Aug 14, 2023 · 0 comments · Fixed by #36804
Closed
4 of 6 tasks

Improve demo data #2 #36635

ankush opened this issue Aug 14, 2023 · 0 comments · Fixed by #36804
Assignees

Comments

@ankush
Copy link
Member

ankush commented Aug 14, 2023

Errors observed depending on configurations:

  • Please mention Round Off Account in Company
  • HSN/SAC Code is required. Please enter a valid HSN/SAC code.
  • Could not find Parent Item Group: All Item Groups
  • Please set default Stock Received But Not Billed in Company XXX (Demo)
  • Please set Account in Warehouse Stores - ED or Default Inventory Account in
  • Date 01-01-2024 is not in any active Fiscal Year for (Demo)
Traceback (most recent call last):
  File "apps/erpnext/erpnext/setup/demo.py", line 26, in setup_demo_data
    make_transactions(company)
  File "apps/erpnext/erpnext/setup/demo.py", line 106, in make_transactions
    convert_order_to_invoices()
  File "apps/erpnext/erpnext/setup/demo.py", line 153, in convert_order_to_invoices
    invoice.submit()
  File "apps/frappe/frappe/model/document.py", line 1026, in submit
    return self._submit()
           ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1005, in _submit
    return self.save()
           ^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 329, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 351, in _save
    return self.insert()
           ^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 305, in insert
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1111, in run_post_save_methods
    self.run_method("on_submit")
  File "apps/frappe/frappe/model/document.py", line 935, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1306, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1288, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 932, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 514, in on_submit
    self.make_gl_entries()
  File "apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 527, in make_gl_entries
    gl_entries = self.get_gl_entries()
                 ^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 578, in get_gl_entries
    self.make_precision_loss_gl_entry(gl_entries)
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 978, in make_precision_loss_gl_entry
    round_off_account, round_off_cost_center = get_round_off_account_and_cost_center(
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/general_ledger.py", line 551, in get_round_off_account_and_cost_center
    frappe.throw(_("Please mention Round Off Account in Company"))
  File "apps/frappe/frappe/__init__.py", line 546, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 518, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 467, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: Please mention Round Off Account in Company
Traceback (most recent call last):
  File "apps/erpnext/erpnext/setup/demo.py", line 25, in setup_demo_data
    process_masters()
  File "apps/erpnext/erpnext/setup/demo.py", line 89, in process_masters
    create_demo_record(item)
  File "apps/erpnext/erpnext/setup/demo.py", line 93, in create_demo_record
    frappe.get_doc(doctype).insert(ignore_permissions=True)
  File "apps/frappe/frappe/model/document.py", line 282, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1071, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 935, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1306, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1290, in runner
    add_to_return_value(self, f(self, method, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/india_compliance/india_compliance/gst_india/overrides/item.py", line 9, in validate
    validate_hsn_code(doc)
  File "apps/india_compliance/india_compliance/gst_india/overrides/item.py", line 18, in validate_hsn_code
    _validate_hsn_code(doc.gst_hsn_code)
  File "apps/india_compliance/india_compliance/gst_india/doctype/gst_hsn_code/gst_hsn_code.py", line 52, in validate_hsn_code
    frappe.throw(
  File "apps/frappe/frappe/__init__.py", line 546, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 518, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 467, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.MandatoryError: HSN/SAC Code is required. Please enter a valid HSN/SAC code.
Traceback (most recent call last):
  File "apps/erpnext/erpnext/setup/demo.py", line 26, in setup_demo_data
    make_transactions(company)
  File "apps/erpnext/erpnext/setup/demo.py", line 98, in make_transactions
    start_date = get_fiscal_year(date=getdate())[1]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 30, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/utils.py", line 56, in get_fiscal_year
    fiscal_years = get_fiscal_years(
                   ^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/utils.py", line 142, in get_fiscal_years
    raise FiscalYearError(error_msg)
erpnext.accounts.utils.FiscalYearError: Date 12-08-2023 is not in any active Fiscal Year
Traceback (most recent call last):
  File "apps/erpnext/erpnext/setup/demo.py", line 25, in setup_demo_data
    process_masters()
  File "apps/erpnext/erpnext/setup/demo.py", line 89, in process_masters
    create_demo_record(item)
  File "apps/erpnext/erpnext/setup/demo.py", line 93, in create_demo_record
    frappe.get_doc(doctype).insert(ignore_permissions=True)
  File "apps/frappe/frappe/model/document.py", line 274, in insert
    self._validate_links()
  File "apps/frappe/frappe/model/document.py", line 903, in _validate_links
    frappe.throw(_("Could not find {0}").format(msg), frappe.LinkValidationError)
  File "apps/frappe/frappe/__init__.py", line 546, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 518, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 467, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.LinkValidationError: Could not find Parent Item Group: All Item Groups
Traceback (most recent call last):
  File "apps/erpnext/erpnext/setup/demo.py", line 26, in setup_demo_data
    make_transactions(company)
  File "apps/erpnext/erpnext/setup/demo.py", line 106, in make_transactions
    convert_order_to_invoices()
  File "apps/erpnext/erpnext/setup/demo.py", line 145, in convert_order_to_invoices
    invoice = make_purchase_invoice(order.name)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 30, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py", line 543, in make_purchase_invoice
    return get_mapped_purchase_invoice(source_name, target_doc)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py", line 608, in get_mapped_purchase_invoice
    doc = get_mapped_doc(
          ^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/mapper.py", line 148, in get_mapped_doc
    postprocess(source_doc, target_doc)
  File "apps/erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py", line 560, in postprocess
    set_missing_values(source, target)
  File "apps/erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py", line 492, in set_missing_values
    target.run_method("set_missing_values")
  File "apps/frappe/frappe/model/document.py", line 935, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1306, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1288, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 932, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 168, in set_missing_values
    super(PurchaseInvoice, self).set_missing_values(for_validate)
  File "apps/erpnext/erpnext/controllers/buying_controller.py", line 151, in set_missing_values
    self.set_missing_item_details(for_validate)
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 622, in set_missing_item_details
    self.set_expense_account(for_validate)
  File "apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 266, in set_expense_account
    stock_not_billed_account = self.get_company_default("stock_received_but_not_billed")
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 1504, in get_company_default
    return get_company_default(self.company, fieldname, ignore_validation=ignore_validation)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 30, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/utils.py", line 806, in get_company_default
    throw(
  File "apps/frappe/frappe/__init__.py", line 546, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 518, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 467, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: Please set default Stock Received But Not Billed in Company XXX (Demo)
Traceback (most recent call last):
  File "apps/erpnext/erpnext/setup/demo.py", line 26, in setup_demo_data
    make_transactions(company)
  File "apps/erpnext/erpnext/setup/demo.py", line 106, in make_transactions
    convert_order_to_invoices()
  File "apps/erpnext/erpnext/setup/demo.py", line 153, in convert_order_to_invoices
    invoice.submit()
  File "apps/frappe/frappe/model/document.py", line 1026, in submit
    return self._submit()
           ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1005, in _submit
    return self.save()
           ^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 329, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 351, in _save
    return self.insert()
           ^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 282, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1074, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 935, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1306, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1288, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 932, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 91, in validate
    super(PurchaseInvoice, self).validate()
  File "apps/erpnext/erpnext/controllers/buying_controller.py", line 31, in validate
    super(BuyingController, self).validate()
  File "apps/erpnext/erpnext/controllers/subcontracting_controller.py", line 56, in validate
    super(SubcontractingController, self).validate()
  File "apps/erpnext/erpnext/controllers/stock_controller.py", line 45, in validate
    super(StockController, self).validate()
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 152, in validate
    self.set_missing_values(for_validate=True)
  File "apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 168, in set_missing_values
    super(PurchaseInvoice, self).set_missing_values(for_validate)
  File "apps/erpnext/erpnext/controllers/buying_controller.py", line 151, in set_missing_values
    self.set_missing_item_details(for_validate)
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 622, in set_missing_item_details
    self.set_expense_account(for_validate)
  File "apps/erpnext/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py", line 277, in set_expense_account
    warehouse_account = get_warehouse_account_map(self.company)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/stock/__init__.py", line 40, in get_warehouse_account_map
    d.account = get_warehouse_account(d, warehouse_account)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/stock/__init__.py", line 87, in get_warehouse_account
    frappe.throw(
  File "apps/frappe/frappe/__init__.py", line 546, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 518, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 467, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.ValidationError: Please set Account in Warehouse Stores - ED or Default Inventory Account in Company (Demo)
Traceback (most recent call last):
  File "apps/erpnext/erpnext/setup/demo.py", line 26, in setup_demo_data
    make_transactions(company)
  File "apps/erpnext/erpnext/setup/demo.py", line 106, in make_transactions
    convert_order_to_invoices()
  File "apps/erpnext/erpnext/setup/demo.py", line 153, in convert_order_to_invoices
    invoice.submit()
  File "apps/frappe/frappe/model/document.py", line 1026, in submit
    return self._submit()
           ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1005, in _submit
    return self.save()
           ^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 329, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 351, in _save
    return self.insert()
           ^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 305, in insert
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1111, in run_post_save_methods
    self.run_method("on_submit")
  File "apps/frappe/frappe/model/document.py", line 935, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1306, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1288, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 932, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py", line 256, in on_submit
    self.update_stock_ledger()
  File "apps/erpnext/erpnext/controllers/selling_controller.py", line 495, in update_stock_ledger
    sl_entries.append(self.get_sle_for_source_warehouse(d))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/controllers/selling_controller.py", line 509, in get_sle_for_source_warehouse
    sle = self.get_sl_entries(
          ^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/controllers/stock_controller.py", line 442, in get_sl_entries
    "fiscal_year": get_fiscal_year(self.posting_date, company=self.company)[0],
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 30, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/utils.py", line 56, in get_fiscal_year
    fiscal_years = get_fiscal_years(
                   ^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/accounts/utils.py", line 142, in get_fiscal_years
    raise FiscalYearError(error_msg)
erpnext.accounts.utils.FiscalYearError: Date 01-01-2024 is not in any active Fiscal Year for <strong>(Demo)</strong>
ankush added a commit to ankush/erpnext that referenced this issue Aug 14, 2023
This is translated according to user language, so "All Item Groups" might not
exist on site.

The code already finds root item group without doing anything.

towards frappe#36635
ankush added a commit that referenced this issue Aug 14, 2023
This is translated according to user language, so "All Item Groups" might not
exist on site.

The code already finds root item group without doing anything.

towards #36635
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants