mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
Shopping cart addresses management (#11657)
This commit is contained in:
@@ -34,12 +34,15 @@ def get_cart_quotation(doc=None):
|
|||||||
|
|
||||||
addresses = get_address_docs(party=party)
|
addresses = get_address_docs(party=party)
|
||||||
|
|
||||||
|
if not doc.customer_address and addresses:
|
||||||
|
update_cart_address("customer_address", addresses[0].name)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"doc": decorate_quotation_doc(doc),
|
"doc": decorate_quotation_doc(doc),
|
||||||
"shipping_addresses": [{"name": address.name, "display": address.display}
|
"shipping_addresses": [{"name": address.name, "display": address.display}
|
||||||
for address in addresses if address.address_type == "Shipping"],
|
for address in addresses],
|
||||||
"billing_addresses": [{"name": address.name, "display": address.display}
|
"billing_addresses": [{"name": address.name, "display": address.display}
|
||||||
for address in addresses if address.address_type == "Billing"],
|
for address in addresses],
|
||||||
"shipping_rules": get_applicable_shipping_rules(party)
|
"shipping_rules": get_applicable_shipping_rules(party)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,9 +50,8 @@ def get_cart_quotation(doc=None):
|
|||||||
def place_order():
|
def place_order():
|
||||||
quotation = _get_cart_quotation()
|
quotation = _get_cart_quotation()
|
||||||
quotation.company = frappe.db.get_value("Shopping Cart Settings", None, "company")
|
quotation.company = frappe.db.get_value("Shopping Cart Settings", None, "company")
|
||||||
for fieldname in ["customer_address", "shipping_address_name"]:
|
if not quotation.get("customer_address"):
|
||||||
if not quotation.get(fieldname):
|
throw(_("{0} is required").format(_(quotation.meta.get_label("customer_address"))))
|
||||||
throw(_("{0} is required").format(quotation.meta.get_label(fieldname)))
|
|
||||||
|
|
||||||
quotation.flags.ignore_permissions = True
|
quotation.flags.ignore_permissions = True
|
||||||
quotation.submit()
|
quotation.submit()
|
||||||
|
|||||||
Reference in New Issue
Block a user