V12 - Add shipping rule and shopping cart errors

AttributeError: ‘tuple’ object has no attribute ‘get’

I see this in inspect element after I add a shipping rule for fixed rate

tested on official ERPNext virtual box image. setup basic product, setup fixed rate shipping rule. added product to cart and errors on screen.

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 57, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 21, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 56, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1036, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/shopping_cart/cart.py”, line 135, in update_cart
context = get_cart_quotation(quotation)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/shopping_cart/cart.py”, line 48, in get_cart_quotation
“shipping_rules”: get_applicable_shipping_rules(party),
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/shopping_cart/cart.py”, line 509, in get_applicable_shipping_rules
return [[rule, rule_label_map.get(rule)] for rule in shipping_rules]
AttributeError: ‘tuple’ object has no attribute ‘get’

@rmehta I’ve been evaluating version 12 since launch day and trying to setup a basic ecommerce site for testing as a basic test case.

If I could open a dialogue with the erpnext team to present my findings.

Uncaught Server Exception
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/jinja.py”, line 78, in render_template
return get_jenv().from_string(template).render(context)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/asyncsupport.py”, line 76, in render
return original_render(self, *args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/_compat.py”, line 37, in reraise
raise value.with_traceback(tb)
File “”, line 1, in top-level template code
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 1, in top-level template code
{% extends base_template_path %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/base.html”, line 68, in top-level template code
{% block content %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 60, in block “content”
{{ main_content() }}
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/sandbox.py”, line 438, in call
return __context.call(__obj, *args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/runtime.py”, line 579, in _invoke
rv = self._func(*arguments)
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 15, in template
{% block page_container %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 22, in block “page_container”
{% if self.header_actions() %}
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/sandbox.py”, line 438, in call
return __context.call(__obj, *args, **kwargs)
File “”, line 15, in block “header_actions”
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/sandbox.py”, line 385, in getattr
value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: ‘doc’ is undefined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 48, in render
data = render_page_by_language(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 152, in render_page_by_language
return render_page(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 168, in render_page
return build(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 175, in build
return build_page(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 191, in build_page
html = frappe.render_template(context.source, context)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/jinja.py”, line 80, 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 360, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 346, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 315, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError:
{% extends “templates/web.html” %}

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

{% block header %}

{{ _(“Shopping Cart”) }}

{% endblock %}

{% block header_actions %}
{% if doc.items and cart_settings.enable_checkout %}

{{ _(“Place Order”) }}

{% endif %}
{% if doc.items and not cart_settings.enable_checkout %}

{{ _(“Request for Quotation”) }}

{% endif %}
{% endblock %}

{% block page_content %}

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

{% if doc.items %}
<table class="table table-bordered mt-3">
	<thead>
		<tr>
			<th width="60%">{{ _('Item') }}</th>
			<th width="20%" class="text-right">{{ _('Quantity') }}</th>
			{% if cart_settings.enable_checkout %}
			<th width="20%" class="text-right">{{ _('Subtotal') }}</th>
			{% endif %}
		</tr>
	</thead>
	<tbody class="cart-items">
		{% include "templates/includes/cart/cart_items.html" %}
	</tbody>
	{% if cart_settings.enable_checkout %}
	<tfoot class="cart-tax-items">
		{% include "templates/includes/order/order_taxes.html" %}
	</tfoot>
	{% endif %}
</table>
{% else %}
<p class="text-muted">{{ _('Your cart is Empty') }}</p>
{% endif %}

{% if doc.items %}
{% if doc.tc_name %}
	<div class="terms-and-conditions-link">
		<a href class="link-terms-and-conditions" data-terms-name="{{ doc.tc_name }}">
			{{ _("Terms and Conditions") }}
		</a>
		<script>
			frappe.ready(() => {
				$('.link-terms-and-conditions').click((e) => {
					e.preventDefault();
					const $link = $(e.target);
					const terms_name = $link.attr('data-terms-name');
					show_terms_and_conditions(terms_name);
				})
			});
			function show_terms_and_conditions(terms_name) {
				frappe.call('erpnext.shopping_cart.cart.get_terms_and_conditions', { terms_name })
				.then(r => {
					frappe.msgprint({
						title: terms_name,
						message: r.message
					});
				});
			}
		</script>
	</div>
{% endif %}

{% if cart_settings.enable_checkout %}
<div class="cart-addresses mt-5">
{% include "templates/includes/cart/cart_address.html" %}
</div>
{% endif %}
{% endif %}
{% if cart_settings.enable_checkout %} {{ _('See past orders') }} {% else %} {{ _('See past quotations') }} {% endif %}

{% endblock %}

{% block base_scripts %}

{% endblock %}

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/jinja.py”, line 78, in render_template
return get_jenv().from_string(template).render(context)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/asyncsupport.py”, line 76, in render
return original_render(self, *args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/_compat.py”, line 37, in reraise
raise value.with_traceback(tb)
File “”, line 1, in top-level template code
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 1, in top-level template code
{% extends base_template_path %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/base.html”, line 68, in top-level template code
{% block content %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 60, in block “content”
{{ main_content() }}
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/sandbox.py”, line 438, in call
return __context.call(__obj, *args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/runtime.py”, line 579, in _invoke
rv = self._func(*arguments)
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 15, in template
{% block page_container %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 22, in block “page_container”
{% if self.header_actions() %}
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/sandbox.py”, line 438, in call
return __context.call(__obj, *args, **kwargs)
File “”, line 15, in block “header_actions”
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/jinja2/sandbox.py”, line 385, in getattr
value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: ‘doc’ is undefined

this is what shows on the shopping cart page if you add a shipping rule on a fresh install.