* refactor!: remove ecommerce item group field check Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!: remove `e_commerce` directory Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!: remove `get_context` from `item_group` https://frappeframework.com/docs/v14/user/en/guides/portal-development/context Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!: remove related `./templates` Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!(navbar): remove wishlist (ecommerce) Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!(js): remove js from scripts Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!: remove `www/all-products` Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!: remove pages and js Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!: remove js/customer_reviews Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!(portal utils): remove shopping cart debtor account Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!: remove e_commerce events from hooks Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!(web): remove e_commerce js from bundle Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!(setup): remove shopping cart setup Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!: remove pages Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor(item): remove website item button Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!(payment request): remove `on_payment_authorized` Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!: @staticmethod `get_gateway_details` to avoid monkey patching, in custom apps https://discuss.erpnext.com/t/how-to-override-method-in-frappe/28786/36 Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!(pages): remove product page Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!(homepage): do not setup website items Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor(workspace): remove link to ecommerce settings Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!(www): remove shop-by-category Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!(homepage): remove featured product Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor: remove products in homepage Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor(homepage): remove explore button Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor: remove products fields from homepage Signed-off-by: Sabu Siyad <hello@ssiyad.com> * Revert "refactor!: @staticmethod `get_gateway_details`" This reverts commit 561bcd96680a930bb92627869502d9346b10611b. Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!: remove payment gateway e_commerce import Signed-off-by: Sabu Siyad <hello@ssiyad.com> * chore: pre-commit Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!: pass `party` into `get_price` Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor: move `get_item_codes_by_attributes` to `utilities/product` Signed-off-by: Sabu Siyad <hello@ssiyad.com> * refactor!(quotation): input customer group Signed-off-by: Sabu Siyad <hello@ssiyad.com> * chore: pre-commit * refactor: remove custom `navbar_items.html` * refactor!(item): remove `published_in_website` * refactor: move `validate_duplicate_website_item` before rename * test: remove `test_shopping_cart_without_website_item` * chore: add doctype drop patch * refactor: removed website item related code * refactor: removed shopping_cart code * refactor: removed e-commerce related patches * refactor: removed website related fields from item group * fix: patch create_asset_depreciation_schedules_from_assets, KeyError: '0K BU64 AUY' --------- Signed-off-by: Sabu Siyad <hello@ssiyad.com> Co-authored-by: Rohit Waghchaure <rohitw1991@gmail.com>
64 lines
2.0 KiB
Python
64 lines
2.0 KiB
Python
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
|
# License: GNU General Public License v3. See license.txt
|
|
|
|
import frappe
|
|
from frappe import _
|
|
|
|
|
|
def get_context(context):
|
|
context.no_cache = 1
|
|
context.show_sidebar = True
|
|
context.doc = frappe.get_doc(frappe.form_dict.doctype, frappe.form_dict.name)
|
|
if hasattr(context.doc, "set_indicator"):
|
|
context.doc.set_indicator()
|
|
|
|
context.parents = frappe.form_dict.parents
|
|
context.title = frappe.form_dict.name
|
|
context.payment_ref = frappe.db.get_value(
|
|
"Payment Request", {"reference_name": frappe.form_dict.name}, "name"
|
|
)
|
|
|
|
default_print_format = frappe.db.get_value(
|
|
"Property Setter",
|
|
dict(property="default_print_format", doc_type=frappe.form_dict.doctype),
|
|
"value",
|
|
)
|
|
if default_print_format:
|
|
context.print_format = default_print_format
|
|
else:
|
|
context.print_format = "Standard"
|
|
|
|
if not frappe.has_website_permission(context.doc):
|
|
frappe.throw(_("Not Permitted"), frappe.PermissionError)
|
|
|
|
context.available_loyalty_points = 0.0
|
|
if context.doc.get("customer"):
|
|
# check for the loyalty program of the customer
|
|
customer_loyalty_program = frappe.db.get_value(
|
|
"Customer", context.doc.customer, "loyalty_program"
|
|
)
|
|
|
|
if customer_loyalty_program:
|
|
from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
|
|
get_loyalty_program_details_with_points,
|
|
)
|
|
|
|
loyalty_program_details = get_loyalty_program_details_with_points(
|
|
context.doc.customer, customer_loyalty_program
|
|
)
|
|
context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points"))
|
|
|
|
context.show_pay_button = frappe.db.get_single_value("Buying Settings", "show_pay_button")
|
|
context.show_make_pi_button = False
|
|
if context.doc.get("supplier"):
|
|
# show Make Purchase Invoice button based on permission
|
|
context.show_make_pi_button = frappe.has_permission("Purchase Invoice", "create")
|
|
|
|
|
|
def get_attachments(dt, dn):
|
|
return frappe.get_all(
|
|
"File",
|
|
fields=["name", "file_name", "file_url", "is_private"],
|
|
filters={"attached_to_name": dn, "attached_to_doctype": dt, "is_private": 0},
|
|
)
|