Shopping Cart - Uncaught Server Exception

Just updated to ERPNext 11.1.24 - get the following errors with Shopping Cart Function

  • When customer first attempts to place order - it requires address to be entered (which is ok)
  • When Customer (with address populated and tickmarked) adds item to Cart - it does not allow to place order unless a quote is submitted - with Error Lead does not exist for new customer (even though price is per price list and price rule)…
  • After quote is submitted if customer clicks on Place Order - it says Address does not exist

If customer refreshes webpage - gets below server exception and cart is empty.
If customer tries to order again - new quote is needed (lead does not exist) and / or error - that address does not exist

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 45, in render
data = render_page_by_language(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 142, in render_page_by_language
return render_page(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 158, in render_page
return build(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 165, in build
return build_page(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 181, in build_page
html = frappe.render_template(context.source, context)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/jinja.py”, line 79, in render_template
throw(title=“Jinja Template Error”, msg=“

{template}
{tb}
”.format(template=template, tb=get_traceback()))
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 352, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 338, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 311, in _raise_exception
raise raise_exception(msg)
ValidationError:
{% extends “templates/web.html” %}

{% block title %} {{ _(“Shopping Cart”) }} {% endblock %}

{% block header %}

{{ _(“My Cart”) }}

{% endblock %}

{% block script %}

{% endblock %}

{% block header_actions %}
{% if doc.items %}

{{ _(“Place Order”) }}
{% endif %}
{% endblock %}

{% block page_content %}

{% from “templates/includes/macros.html” import item_name_and_description %}

{{ _("Item") }}
{{ _("Qty") }}
{{ _("Subtotal") }}
{% if doc.items %}
{% include "templates/includes/cart/cart_items.html" %}
{% else %}

{{ _("Cart is Empty") }}

{% endif %}
{% if doc.items %}
{% include "templates/includes/order/order_taxes.html" %}
	{% if doc.tc_name %}
		<div class="cart-terms" style="display: none;" title={{doc.tc_name}}>
			{{doc.tc_name}}
			{{doc.terms}}
		</div>
		<div class="cart-link">
			<a href="#" onclick="show_terms();return false;">*{{ _("Terms and Conditions") }}</a>
		</div>
	{% endif %}

	<div class="cart-addresses">
	{% include "templates/includes/cart/cart_address.html" %}
	</div>

	<p class="cart-footer text-right">
	<button class="btn btn-primary btn-place-order btn-sm" type="button">
	{{ _("Place Order") }}</button></p>
	{% endif %}
</div>

{% endblock %}

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/jinja.py”, line 77, in render_template
return get_jenv().from_string(template).render(context)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “”, line 1, in top-level template code
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 6, in top-level template code
{%- if page_or_generator==“Generator” %}source-type=“Generator” data-doctype=“{{ doctype }}”{% endif %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/base.html”, line 38, in top-level template code
{% block body %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/base.html”, line 64, in block “body”
{% block content %}{% endblock %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 41, in block “content”
{% if self.header_actions() %}
File “”, line 13, in block “header_actions”
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 430, in getattr
return getattr(obj, attribute)
UndefinedError: ‘doc’ is undefined

Sorry for the issue.

Fixing via fix: check quotation_to param while creating customer against cart order by saurabh6790 · Pull Request #17453 · frappe/erpnext · GitHub

1 Like

Fixing via fix: data pulling based on quotation_to and party_name by saurabh6790 · Pull Request #17455 · frappe/erpnext · GitHub