[minor] [fix] cart
This commit is contained in:
parent
c8b2a9d654
commit
7c96dc1783
@ -93,7 +93,7 @@ def update_cart(item_code, qty, with_items=False):
|
|||||||
set_cart_count(quotation)
|
set_cart_count(quotation)
|
||||||
|
|
||||||
context = get_cart_quotation(quotation)
|
context = get_cart_quotation(quotation)
|
||||||
|
|
||||||
if cint(with_items):
|
if cint(with_items):
|
||||||
return {
|
return {
|
||||||
"items": frappe.render_template("templates/includes/cart/cart_items.html",
|
"items": frappe.render_template("templates/includes/cart/cart_items.html",
|
||||||
@ -106,12 +106,12 @@ def update_cart(item_code, qty, with_items=False):
|
|||||||
'name': quotation.name,
|
'name': quotation.name,
|
||||||
'shopping_cart_menu': get_shopping_cart_menu(context)
|
'shopping_cart_menu': get_shopping_cart_menu(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_shopping_cart_menu(context=None):
|
def get_shopping_cart_menu(context=None):
|
||||||
if not context:
|
if not context:
|
||||||
context = get_cart_quotation()
|
context = get_cart_quotation()
|
||||||
|
|
||||||
return frappe.render_template('templates/includes/cart/cart_dropdown.html', context)
|
return frappe.render_template('templates/includes/cart/cart_dropdown.html', context)
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
@ -307,6 +307,8 @@ def get_party(user=None):
|
|||||||
return frappe.get_doc(party_doctype, party)
|
return frappe.get_doc(party_doctype, party)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
if not cart_settings.enabled:
|
||||||
|
return None
|
||||||
customer = frappe.new_doc("Customer")
|
customer = frappe.new_doc("Customer")
|
||||||
fullname = get_fullname(user)
|
fullname = get_fullname(user)
|
||||||
customer.update({
|
customer.update({
|
||||||
@ -368,6 +370,9 @@ def get_address_docs(doctype=None, txt=None, filters=None, limit_start=0, limit_
|
|||||||
if not party:
|
if not party:
|
||||||
party = get_party()
|
party = get_party()
|
||||||
|
|
||||||
|
if not party:
|
||||||
|
return []
|
||||||
|
|
||||||
address_docs = frappe.db.sql("""select * from `tabAddress`
|
address_docs = frappe.db.sql("""select * from `tabAddress`
|
||||||
where `{0}`=%s order by name limit {1}, {2}""".format(party.doctype.lower(),
|
where `{0}`=%s order by name limit {1}, {2}""".format(party.doctype.lower(),
|
||||||
limit_start, limit_page_length), party.name,
|
limit_start, limit_page_length), party.name,
|
||||||
|
Loading…
Reference in New Issue
Block a user