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

Error creating Website Item from Item using Publish in Website #177

Open
casesolved-co-uk opened this issue Jul 5, 2024 · 0 comments
Open

Comments

@casesolved-co-uk
Copy link

casesolved-co-uk commented Jul 5, 2024

Creation of Website Item references route field on the Item Group which has been removed in the refactor.

@ssiyad

cstr(frappe.db.get_value("Item Group", self.item_group, "route"))

Caused by: frappe/erpnext#33265

EDIT: Caused by setup.install.after_install failing to run on install

Workaround

bench --site <site> execute webshop.setup.install.after_install

version-15

App Versions

{
	"erpnext": "15.22.2",
	"frappe": "15.26.0",
	"hrms": "15.14.1",
	"payments": "0.0.1",
	"webshop": "0.0.1"
}

Route

Form/Item/AEA003A

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 110, in application
    response = frappe.api.handle(request)
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1768, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/webshop/webshop/webshop/doctype/website_item/website_item.py", line 542, in make_website_item
    website_item.save()
  File "apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 359, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 291, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1091, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
  File "apps/webshop/webshop/webshop/doctype/website_item/website_item.py", line 56, in validate
    super(WebsiteItem, self).validate()
  File "apps/frappe/frappe/website/website_generator.py", line 36, in validate
    self.set_route()
  File "apps/frappe/frappe/website/website_generator.py", line 40, in set_route
    self.route = self.make_route()
  File "apps/webshop/webshop/webshop/doctype/website_item/website_item.py", line 112, in make_route
    cstr(frappe.db.get_value("Item Group", self.item_group, "route"))
  File "apps/frappe/frappe/database/database.py", line 519, in get_value
    result = self.get_values(
  File "apps/frappe/frappe/database/database.py", line 623, in get_values
    out = self._get_values_from_table(
  File "apps/frappe/frappe/database/database.py", line 896, in _get_values_from_table
    return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
  File "apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
    result = frappe.db.sql(query, params, *args, **kwargs)  # nosemgrep
  File "apps/frappe/frappe/database/database.py", line 234, in sql
    self._cursor.execute(query, values)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 153, in execute
    result = self._query(query)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 558, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 822, in _read_query_result
    result.read()
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 1200, in read
    first_packet = self.connection._read_packet()
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 772, in _read_packet
    packet.raise_for_error()
  File "env/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "env/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1054, "Unknown column 'route' in 'field list'")

Request Data

{
	"type": "POST",
	"args": {
		"doc": REDACTED
	},
	"freeze": true,
	"freeze_message": "Publishing Item ...",
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/webshop.webshop.doctype.website_item.website_item.make_website_item",
	"request_id": null
}

Response Data

{
	"exception": "pymysql.err.OperationalError: (1054, \"Unknown column 'route' in 'field list'\")",
	"exc_type": "OperationalError",
	"_exc_source": "webshop (app)"
}
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

1 participant