refactor!: drop ecommerce in favor of webshop (#33265)

* 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>
This commit is contained in:
Sabu Siyad
2023-10-17 17:05:44 +05:30
committed by GitHub
parent 9d687ca6e9
commit f900a78995
160 changed files with 630 additions and 15222 deletions

View File

@@ -19,12 +19,3 @@ frappe.ui.form.on('Homepage', {
});
},
});
frappe.ui.form.on('Homepage Featured Product', {
view: function(frm, cdt, cdn) {
var child= locals[cdt][cdn];
if (child.item_code && child.route) {
window.open('/' + child.route, '_blank');
}
}
});

View File

@@ -15,10 +15,7 @@
"description",
"hero_image",
"slideshow",
"hero_section",
"products_section",
"products_url",
"products"
"hero_section"
],
"fields": [
{
@@ -86,30 +83,11 @@
"fieldtype": "Link",
"label": "Homepage Section",
"options": "Homepage Section"
},
{
"fieldname": "products_section",
"fieldtype": "Section Break",
"label": "Products"
},
{
"default": "/all-products",
"fieldname": "products_url",
"fieldtype": "Data",
"label": "URL for \"All Products\""
},
{
"description": "Products to be shown on website homepage",
"fieldname": "products",
"fieldtype": "Table",
"label": "Products",
"options": "Homepage Featured Product",
"width": "40px"
}
],
"issingle": 1,
"links": [],
"modified": "2021-02-18 13:29:29.531639",
"modified": "2022-12-19 21:10:29.127277",
"modified_by": "Administrator",
"module": "Portal",
"name": "Homepage",
@@ -138,6 +116,7 @@
],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"title_field": "company",
"track_changes": 1
}

View File

@@ -12,26 +12,3 @@ class Homepage(Document):
if not self.description:
self.description = frappe._("This is an example website auto-generated from ERPNext")
delete_page_cache("home")
def setup_items(self):
for d in frappe.get_all(
"Website Item",
fields=["name", "item_name", "description", "website_image", "route"],
filters={"published": 1},
limit=3,
):
doc = frappe.get_doc("Website Item", d.name)
if not doc.route:
# set missing route
doc.save()
self.append(
"products",
dict(
item_code=d.name,
item_name=d.item_name,
description=d.description,
image=d.website_image,
route=d.route,
),
)

View File

@@ -1,118 +0,0 @@
{
"actions": [],
"autoname": "hash",
"creation": "2016-04-22 05:57:06.261401",
"doctype": "DocType",
"document_type": "Document",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"item_code",
"col_break1",
"item_name",
"view",
"section_break_5",
"description",
"column_break_7",
"image",
"thumbnail",
"route"
],
"fields": [
{
"bold": 1,
"fieldname": "item_code",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Item",
"oldfieldname": "item_code",
"oldfieldtype": "Link",
"options": "Website Item",
"print_width": "150px",
"reqd": 1,
"search_index": 1,
"width": "150px"
},
{
"fieldname": "col_break1",
"fieldtype": "Column Break"
},
{
"fetch_from": "item_code.item_name",
"fetch_if_empty": 1,
"fieldname": "item_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Item Name",
"oldfieldname": "item_name",
"oldfieldtype": "Data",
"print_hide": 1,
"print_width": "150",
"read_only": 1,
"reqd": 1,
"width": "150"
},
{
"fieldname": "view",
"fieldtype": "Button",
"in_list_view": 1,
"label": "View"
},
{
"collapsible": 1,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"label": "Details"
},
{
"fetch_from": "item_code.web_long_description",
"fieldname": "description",
"fieldtype": "Text Editor",
"in_filter": 1,
"in_list_view": 1,
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
"width": "300px"
},
{
"fieldname": "column_break_7",
"fieldtype": "Column Break"
},
{
"fetch_from": "item_code.website_image",
"fetch_if_empty": 1,
"fieldname": "image",
"fieldtype": "Attach Image",
"label": "Image"
},
{
"fetch_from": "item_code.thumbnail",
"fieldname": "thumbnail",
"fieldtype": "Attach Image",
"hidden": 1,
"label": "Thumbnail"
},
{
"fetch_from": "item_code.route",
"fieldname": "route",
"fieldtype": "Small Text",
"label": "route",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-02-18 13:05:50.669311",
"modified_by": "Administrator",
"module": "Portal",
"name": "Homepage Featured Product",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC"
}

View File

@@ -1,9 +0,0 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from frappe.model.document import Document
class HomepageFeaturedProduct(Document):
pass

View File

@@ -1,10 +1,4 @@
import frappe
from frappe.utils.nestedset import get_root_of
from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import (
get_shopping_cart_settings,
)
from erpnext.e_commerce.shopping_cart.cart import get_debtors_account
def set_default_role(doc, method):
@@ -56,26 +50,7 @@ def create_customer_or_supplier():
party = frappe.new_doc(doctype)
fullname = frappe.utils.get_fullname(user)
if doctype == "Customer":
cart_settings = get_shopping_cart_settings()
if cart_settings.enable_checkout:
debtors_account = get_debtors_account(cart_settings)
else:
debtors_account = ""
party.update(
{
"customer_name": fullname,
"customer_type": "Individual",
"customer_group": cart_settings.default_customer_group,
"territory": get_root_of("Territory"),
}
)
if debtors_account:
party.update({"accounts": [{"company": cart_settings.company, "account": debtors_account}]})
else:
if not doctype == "Customer":
party.update(
{
"supplier_name": fullname,