AttributeError: 'Quotation' object has no attribute 'customer' in v14.3.1

I’m exploring the e-commerce capabilities of erpnext and I’m having an issue with customers viewing their quotations after submitting.

A customer will add items to their cart, click “Request for Quote”. The quote actually gets submitted but then it redirects the customer to the quotation page, which results in this:

Traceback (most recent call last):
  File "apps/frappe/frappe/website/serve.py", line 18, in get_response
    response = renderer_instance.render()
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 78, in render
    html = self.get_html()
  File "apps/frappe/frappe/website/utils.py", line 510, in cache_html_decorator
    html = func(*args, **kwargs)
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 89, in get_html
    self.update_context()
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 157, in update_context
    data = self.run_pymodule_method("get_context")
  File "apps/frappe/frappe/website/page_renderers/template_page.py", line 219, in run_pymodule_method
    return method(self.context)
  File "apps/erpnext/erpnext/templates/pages/order.py", line 43, in get_context
    "Customer", context.doc.customer, "loyalty_program"
AttributeError: 'Quotation' object has no attribute 'customer'

I was able to fix the problem by editing apps/erpnext/erpnext/templates/pages/order.py and restarting the app.

"Customer", context.doc.customer_name, "loyalty_program"

I have the same issue. Did you open a merge request on GitHub? I think your change could be interesting to be added into the main code base.

Btw, could you share what you changed in the file please? :slight_smile:

Looks like it was fixed in version 14.14.0. With this commit.

I’ll upgrade my version of ERPNext and keep you updated

Edit: running bench update fixed the issues.

This issue still remains, or reappeared, in v15.

The fix still applies.

# check for the loyalty program of the customer
customer_loyalty_program = frappe.db.get_value(
	#"Customer", context.doc.customer, "loyalty_program"
	# ->
	"Customer", context.doc.customer_name, "loyalty_program"
)
loyalty_program_details = get_loyalty_program_details_with_points(
	#context.doc.customer, customer_loyalty_program
	# ->
	context.doc.customer_name, customer_loyalty_program
)

Just pulled erpnext app. Reviewing, if the issue was fixed, sadens me, because the file, and even the line(s) in question, were changed, without applying the fix…