diff --git a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py index bf8c014a5b..b27f4eb503 100644 --- a/erpnext/accounts/doctype/coupon_code/test_coupon_code.py +++ b/erpnext/accounts/doctype/coupon_code/test_coupon_code.py @@ -41,9 +41,7 @@ def test_create_test_data(): "selling_cost_center": "Main - _TC", "income_account": "Sales - _TC" }], - "show_in_website": 1, "route":"-test-tesla-car", - "website_warehouse": "Stores - _TC" }) item.insert() # create test item price diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py index 0ab01712e3..1a34be063b 100644 --- a/erpnext/buying/doctype/supplier/supplier.py +++ b/erpnext/buying/doctype/supplier/supplier.py @@ -128,28 +128,6 @@ class Supplier(TransactionBase): if frappe.defaults.get_global_default('supp_master_name') == 'Supplier Name': frappe.db.set(self, "supplier_name", newdn) - def create_onboarding_docs(self, args): - company = frappe.defaults.get_defaults().get('company') or \ - frappe.db.get_single_value('Global Defaults', 'default_company') - - for i in range(1, args.get('max_count')): - supplier = args.get('supplier_name_' + str(i)) - if supplier: - try: - doc = frappe.get_doc({ - 'doctype': self.doctype, - 'supplier_name': supplier, - 'supplier_group': _('Local'), - 'company': company - }).insert() - - if args.get('supplier_email_' + str(i)): - from erpnext.selling.doctype.customer.customer import create_contact - create_contact(supplier, 'Supplier', - doc.name, args.get('supplier_email_' + str(i))) - except frappe.NameError: - pass - @frappe.whitelist() @frappe.validate_and_sanitize_search_inputs def get_supplier_primary_contact(doctype, txt, searchfield, start, page_len, filters): diff --git a/erpnext/buying/onboarding_slide/add_a_few_suppliers/add_a_few_suppliers.json b/erpnext/buying/onboarding_slide/add_a_few_suppliers/add_a_few_suppliers.json deleted file mode 100644 index ce3d8cfb7b..0000000000 --- a/erpnext/buying/onboarding_slide/add_a_few_suppliers/add_a_few_suppliers.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "add_more_button": 1, - "app": "ERPNext", - "creation": "2019-11-15 14:45:32.626641", - "docstatus": 0, - "doctype": "Onboarding Slide", - "domains": [], - "help_links": [ - { - "label": "Learn More", - "video_id": "zsrrVDk6VBs" - } - ], - "idx": 0, - "image_src": "", - "is_completed": 0, - "max_count": 3, - "modified": "2019-12-09 17:54:18.452038", - "modified_by": "Administrator", - "name": "Add A Few Suppliers", - "owner": "Administrator", - "ref_doctype": "Supplier", - "slide_desc": "", - "slide_fields": [ - { - "align": "", - "fieldname": "supplier_name", - "fieldtype": "Data", - "label": "Supplier Name", - "placeholder": "", - "reqd": 1 - }, - { - "align": "", - "fieldtype": "Column Break", - "reqd": 0 - }, - { - "align": "", - "fieldname": "supplier_email", - "fieldtype": "Data", - "label": "Supplier Email", - "reqd": 1 - } - ], - "slide_order": 50, - "slide_title": "Add A Few Suppliers", - "slide_type": "Create" -} \ No newline at end of file diff --git a/erpnext/controllers/item_variant.py b/erpnext/controllers/item_variant.py index 1b56ae9d4d..6935fd7ab4 100644 --- a/erpnext/controllers/item_variant.py +++ b/erpnext/controllers/item_variant.py @@ -264,9 +264,8 @@ def generate_keyed_value_combinations(args): def copy_attributes_to_variant(item, variant): # copy non no-copy fields - exclude_fields = ["naming_series", "item_code", "item_name", "show_in_website", - "show_variant_in_website", "opening_stock", "variant_of", "valuation_rate", - "has_variants", "attributes"] + exclude_fields = ["naming_series", "item_code", "item_name", "published_in_website", + "opening_stock", "variant_of", "valuation_rate"] if item.variant_based_on=='Manufacturer': # don't copy manufacturer values if based on part no diff --git a/erpnext/demo/data/drug_list.json b/erpnext/demo/data/drug_list.json index e91c30d199..c7c06c946d 100644 --- a/erpnext/demo/data/drug_list.json +++ b/erpnext/demo/data/drug_list.json @@ -54,7 +54,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -138,7 +137,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -220,7 +218,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -302,7 +299,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -384,7 +380,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -466,7 +461,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -548,7 +542,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -630,7 +623,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -712,7 +704,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -794,7 +785,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -876,7 +866,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -958,7 +947,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -1040,7 +1028,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -1122,7 +1109,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -1204,7 +1190,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -1286,7 +1271,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -1368,7 +1352,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -1450,7 +1433,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -1532,7 +1514,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -1614,7 +1595,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -1696,7 +1676,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -1778,7 +1757,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -1860,7 +1838,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -1942,7 +1919,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -2024,7 +2000,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -2106,7 +2081,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -2188,7 +2162,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -2270,7 +2243,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -2352,7 +2324,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -2434,7 +2405,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -2516,7 +2486,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -2598,7 +2567,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -2680,7 +2648,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -2762,7 +2729,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -2844,7 +2810,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -2926,7 +2891,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -3008,7 +2972,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -3092,7 +3055,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -3174,7 +3136,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -3256,7 +3217,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -3338,7 +3298,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -3420,7 +3379,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -3502,7 +3460,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -3584,7 +3541,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -3666,7 +3622,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -3748,7 +3703,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -3830,7 +3784,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -3912,7 +3865,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -3994,7 +3946,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -4076,7 +4027,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -4158,7 +4108,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -4240,7 +4189,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -4322,7 +4270,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -4404,7 +4351,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -4486,7 +4432,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -4568,7 +4513,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -4650,7 +4594,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -4732,7 +4675,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -4814,7 +4756,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -4896,7 +4837,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -4978,7 +4918,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -5060,7 +4999,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, @@ -5142,7 +5080,6 @@ "safety_stock": 0.0, "selling_cost_center": null, "serial_no_series": null, - "show_in_website": 0, "show_variant_in_website": 0, "slideshow": null, "standard_rate": 0.0, diff --git a/erpnext/e_commerce/doctype/website_item/website_item.js b/erpnext/e_commerce/doctype/website_item/website_item.js index ecea74bc78..0d8a51e1de 100644 --- a/erpnext/e_commerce/doctype/website_item/website_item.js +++ b/erpnext/e_commerce/doctype/website_item/website_item.js @@ -2,7 +2,18 @@ // For license information, please see license.txt frappe.ui.form.on('Website Item', { - // refresh: function(frm) { + image: function() { + refresh_field("image_view"); + }, - // } + copy_from_item_group: function(frm) { + return frm.call({ + doc: frm.doc, + method: "copy_specification_from_item_group" + }); + }, + + set_meta_tags(frm) { + frappe.utils.set_meta_tag(frm.doc.route); + } }); diff --git a/erpnext/e_commerce/doctype/website_item/website_item.json b/erpnext/e_commerce/doctype/website_item/website_item.json index 02717eae14..3a2990639b 100644 --- a/erpnext/e_commerce/doctype/website_item/website_item.json +++ b/erpnext/e_commerce/doctype/website_item/website_item.json @@ -271,7 +271,7 @@ "image_field": "image", "index_web_pages_for_search": 1, "links": [], - "modified": "2021-02-12 16:49:42.275517", + "modified": "2021-02-18 13:23:18.286883", "modified_by": "Administrator", "module": "E-commerce", "name": "Website Item", @@ -290,9 +290,10 @@ "write": 1 } ], + "search_fields": "item_code, item_name ,item_group", "show_name_in_global_search": 1, "sort_field": "modified", "sort_order": "DESC", - "title_field": "web_item_name", + "title_field": "item_name", "track_changes": 1 } \ No newline at end of file diff --git a/erpnext/e_commerce/doctype/website_item/website_item.py b/erpnext/e_commerce/doctype/website_item/website_item.py index 55436f257d..51983ffd27 100644 --- a/erpnext/e_commerce/doctype/website_item/website_item.py +++ b/erpnext/e_commerce/doctype/website_item/website_item.py @@ -7,15 +7,12 @@ import frappe import json import itertools from frappe import _ -from six import iteritems -from frappe.website.doctype.website_slideshow.website_slideshow import \ - get_slideshow from frappe.website.render import clear_cache from frappe.website.website_generator import WebsiteGenerator -from frappe.utils import cstr, random_string, cint +from frappe.utils import cstr, random_string, cint, flt -from erpnext.setup.doctype.item_group.item_group import get_parent_item_groups +from erpnext.setup.doctype.item_group.item_group import (get_parent_item_groups, invalidate_cache_for) class WebsiteItem(WebsiteGenerator): website = frappe._dict( @@ -39,7 +36,13 @@ class WebsiteItem(WebsiteGenerator): self.make_thumbnail() self.publish_unpublish_desk_item(publish=True) + if not self.get("__islocal"): + self.old_website_item_groups = frappe.db.sql_list("""select item_group + from `tabWebsite Item Group` + where parentfield='website_item_groups' and parenttype='Item' and parent=%s""", self.name) + def on_update(self): + invalidate_cache_for_web_item(self) self.update_template_item() def on_trash(self): @@ -69,10 +72,9 @@ class WebsiteItem(WebsiteGenerator): # show template template_item = frappe.get_doc("Item", self.variant_of) - if not template_item.published: - template_item.published = 1 + if not template_item.published_in_website: template_item.flags.ignore_permissions = True - template_item.save() + make_website_item(template_item) def validate_website_image(self): if frappe.flags.in_import: @@ -160,7 +162,6 @@ class WebsiteItem(WebsiteGenerator): self.thumbnail = file_doc.thumbnail_url def get_context(self, context): - print(context) context.show_search = True context.search_link = '/search' @@ -174,7 +175,6 @@ class WebsiteItem(WebsiteGenerator): self.set_disabled_attributes(context) self.set_metatags(context) self.set_shopping_cart_data(context) - print("IN WEB ITEM") return context @@ -317,6 +317,28 @@ class WebsiteItem(WebsiteGenerator): from erpnext.shopping_cart.product_info import get_product_info_for_website context.shopping_cart = get_product_info_for_website(self.item_code, skip_quotation_creation=True) + def copy_specification_from_item_group(self): + self.set("website_specifications", []) + if self.item_group: + for label, desc in frappe.db.get_values("Item Website Specification", + {"parent": self.item_group}, ["label", "description"]): + row = self.append("website_specifications") + row.label = label + row.description = desc + +def invalidate_cache_for_web_item(doc): + from erpnext.stock.doctype.item.item import invalidate_item_variants_cache_for_website + + invalidate_cache_for(doc, doc.item_group) + + website_item_groups = list(set((doc.get("old_website_item_groups") or []) + + [d.item_group for d in doc.get({"doctype": "Website Item Group"}) if d.item_group])) + + for item_group in website_item_groups: + invalidate_cache_for(doc, item_group) + + invalidate_item_variants_cache_for_website(doc) + @frappe.whitelist() def make_website_item(doc): if not doc: diff --git a/erpnext/hooks.py b/erpnext/hooks.py index d0142d3d0d..735103678e 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -77,7 +77,7 @@ domains = { 'Services': 'erpnext.domains.services', } -website_generators = ["Item Group", "Item", "BOM", "Sales Partner", +website_generators = ["Item Group", "Website Item", "BOM", "Sales Partner", "Job Opening", "Student Admission"] website_context = { diff --git a/erpnext/portal/doctype/homepage/homepage.js b/erpnext/portal/doctype/homepage/homepage.js index c7c66e0055..ea34bb17e5 100644 --- a/erpnext/portal/doctype/homepage/homepage.js +++ b/erpnext/portal/doctype/homepage/homepage.js @@ -3,9 +3,9 @@ frappe.ui.form.on('Homepage', { setup: function(frm) { - frm.fields_dict["products"].grid.get_field("item_code").get_query = function(){ + frm.fields_dict["products"].grid.get_field("item").get_query = function(){ return { - filters: {'show_in_website': 1} + filters: {'published': 1} } } }, @@ -21,11 +21,10 @@ 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 && frm.doc.products_url){ - window.location.href = frm.doc.products_url + '/' + encodeURIComponent(child.item_code); + if(child.item_code && child.route){ + window.open('/' + child.route, '_blank'); } } }); diff --git a/erpnext/portal/doctype/homepage/homepage.json b/erpnext/portal/doctype/homepage/homepage.json index ad27278dc6..73f816d4d4 100644 --- a/erpnext/portal/doctype/homepage/homepage.json +++ b/erpnext/portal/doctype/homepage/homepage.json @@ -1,518 +1,143 @@ { - "allow_copy": 0, - "allow_events_in_timeline": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "autoname": "", + "actions": [], "beta": 1, "creation": "2016-04-22 05:27:52.109319", - "custom": 0, - "docstatus": 0, "doctype": "DocType", "document_type": "Setup", - "editable_grid": 0, "engine": "InnoDB", + "field_order": [ + "company", + "hero_section_based_on", + "column_break_2", + "title", + "section_break_4", + "tag_line", + "description", + "hero_image", + "slideshow", + "hero_section", + "products_section", + "products_url", + "products" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "company", "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, "in_list_view": 1, - "in_standard_filter": 0, "label": "Company", - "length": 0, - "no_copy": 0, "options": "Company", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "reqd": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "hero_section_based_on", "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "Hero Section Based On", - "length": 0, - "no_copy": 0, - "options": "Default\nSlideshow\nHomepage Section", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "options": "Default\nSlideshow\nHomepage Section" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "fieldname": "column_break_2", - "fieldtype": "Column Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "fieldtype": "Column Break" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", "fieldname": "title", "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Title", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "label": "Title" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", "fieldname": "section_break_4", "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Hero Section", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "label": "Hero Section" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "depends_on": "eval:doc.hero_section_based_on === 'Default'", "description": "Company Tagline for website homepage", "fieldname": "tag_line", "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, "in_list_view": 1, - "in_standard_filter": 0, "label": "Tag Line", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "reqd": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "depends_on": "eval:doc.hero_section_based_on === 'Default'", "description": "Company Description for website homepage", "fieldname": "description", "fieldtype": "Text", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, "in_list_view": 1, - "in_standard_filter": 0, "label": "Description", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "reqd": 1 }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "depends_on": "eval:doc.hero_section_based_on === 'Default'", "fieldname": "hero_image", "fieldtype": "Attach Image", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Hero Image", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "label": "Hero Image" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "depends_on": "eval:doc.hero_section_based_on === 'Slideshow'", - "description": "", "fieldname": "slideshow", "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "Homepage Slideshow", - "length": 0, - "no_copy": 0, - "options": "Website Slideshow", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "options": "Website Slideshow" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "depends_on": "eval:doc.hero_section_based_on === 'Homepage Section'", "fieldname": "hero_section", "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "Homepage Section", - "length": 0, - "no_copy": 0, - "options": "Homepage Section", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "options": "Homepage Section" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "depends_on": "", "fieldname": "products_section", "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Products", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "label": "Products" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "default": "/products", + "default": "/all-products", "fieldname": "products_url", "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "URL for \"All Products\"", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "label": "URL for \"All Products\"" }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, "description": "Products to be shown on website homepage", "fieldname": "products", "fieldtype": "Table", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, "label": "Products", - "length": 0, - "no_copy": 0, "options": "Homepage Featured Product", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0, "width": "40px" } ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, "issingle": 1, - "istable": 0, - "max_attachments": 0, - "modified": "2019-03-02 23:12:59.676202", + "links": [], + "modified": "2021-02-18 13:29:29.531639", "modified_by": "Administrator", "module": "Portal", "name": "Homepage", - "name_case": "", "owner": "Administrator", "permissions": [ { - "amend": 0, - "cancel": 0, "create": 1, "delete": 1, "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, "print": 1, "read": 1, - "report": 0, "role": "System Manager", - "set_user_permissions": 0, "share": 1, - "submit": 0, "write": 1 }, { - "amend": 0, - "cancel": 0, "create": 1, "delete": 1, "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, "print": 1, "read": 1, - "report": 0, "role": "Administrator", - "set_user_permissions": 0, "share": 1, - "submit": 0, "write": 1 } ], - "quick_entry": 0, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, "sort_field": "modified", "sort_order": "DESC", "title_field": "company", - "track_changes": 1, - "track_seen": 0, - "track_views": 0 + "track_changes": 1 } \ No newline at end of file diff --git a/erpnext/portal/doctype/homepage/homepage.py b/erpnext/portal/doctype/homepage/homepage.py index 7eeaf4b80a..4477011817 100644 --- a/erpnext/portal/doctype/homepage/homepage.py +++ b/erpnext/portal/doctype/homepage/homepage.py @@ -17,7 +17,7 @@ class Homepage(Document): def setup_items(self): for d in frappe.get_all('Item', fields=['name', 'item_name', 'description', 'image'], - filters={'show_in_website': 1}, limit=3): + filters={'published_in_website': 1}, limit=3): doc = frappe.get_doc('Item', d.name) if not doc.route: diff --git a/erpnext/portal/doctype/homepage_featured_product/homepage_featured_product.json b/erpnext/portal/doctype/homepage_featured_product/homepage_featured_product.json index 01c32efec9..63789e35b5 100644 --- a/erpnext/portal/doctype/homepage_featured_product/homepage_featured_product.json +++ b/erpnext/portal/doctype/homepage_featured_product/homepage_featured_product.json @@ -25,10 +25,10 @@ "fieldtype": "Link", "in_filter": 1, "in_list_view": 1, - "label": "Item Code", + "label": "Item", "oldfieldname": "item_code", "oldfieldtype": "Link", - "options": "Item", + "options": "Website Item", "print_width": "150px", "reqd": 1, "search_index": 1, @@ -63,7 +63,7 @@ "collapsible": 1, "fieldname": "section_break_5", "fieldtype": "Section Break", - "label": "Description" + "label": "Details" }, { "fetch_from": "item_code.web_long_description", @@ -89,12 +89,14 @@ "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", @@ -104,7 +106,7 @@ "index_web_pages_for_search": 1, "istable": 1, "links": [], - "modified": "2020-08-25 15:27:49.573537", + "modified": "2021-02-18 13:05:50.669311", "modified_by": "Administrator", "module": "Portal", "name": "Homepage Featured Product", diff --git a/erpnext/portal/doctype/website_attribute/website_attribute.json b/erpnext/portal/doctype/website_attribute/website_attribute.json index 2874dc432c..eed33ec10e 100644 --- a/erpnext/portal/doctype/website_attribute/website_attribute.json +++ b/erpnext/portal/doctype/website_attribute/website_attribute.json @@ -1,76 +1,32 @@ { - "allow_copy": 0, - "allow_events_in_timeline": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 0, - "creation": "2019-01-01 13:04:54.479079", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", + "actions": [], + "creation": "2019-01-01 13:04:54.479079", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "attribute" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "attribute", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Attribute", - "length": 0, - "no_copy": 0, - "options": "Item Attribute", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "fieldname": "attribute", + "fieldtype": "Link", + "in_list_view": 1, + "label": "Attribute", + "options": "Item Attribute", + "reqd": 1 } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2019-01-01 13:04:59.715572", - "modified_by": "Administrator", - "module": "Portal", - "name": "Website Attribute", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1, - "track_seen": 0, - "track_views": 0 + ], + "istable": 1, + "links": [], + "modified": "2021-02-18 13:18:57.810536", + "modified_by": "Administrator", + "module": "Portal", + "name": "Website Attribute", + "owner": "Administrator", + "permissions": [], + "quick_entry": 1, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1 } \ No newline at end of file diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index 7adf2cd909..3f60801c6e 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -294,30 +294,6 @@ class Customer(TransactionBase): .format(frappe.bold(self.customer_name)) ) - def create_onboarding_docs(self, args): - defaults = frappe.defaults.get_defaults() - company = defaults.get('company') or \ - frappe.db.get_single_value('Global Defaults', 'default_company') - - for i in range(1, args.get('max_count')): - customer = args.get('customer_name_' + str(i)) - if customer: - try: - doc = frappe.get_doc({ - 'doctype': self.doctype, - 'customer_name': customer, - 'customer_type': 'Company', - 'customer_group': _('Commercial'), - 'territory': defaults.get('country'), - 'company': company - }).insert() - - if args.get('customer_email_' + str(i)): - create_contact(customer, self.doctype, - doc.name, args.get("customer_email_" + str(i))) - except frappe.NameError: - pass - def create_contact(contact, party_type, party, email): """Create contact based on given contact name""" contact = contact.split(' ') diff --git a/erpnext/selling/onboarding_slide/add_a_few_customers/add_a_few_customers.json b/erpnext/selling/onboarding_slide/add_a_few_customers/add_a_few_customers.json deleted file mode 100644 index 92d00bcb38..0000000000 --- a/erpnext/selling/onboarding_slide/add_a_few_customers/add_a_few_customers.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "add_more_button": 1, - "app": "ERPNext", - "creation": "2019-11-15 14:44:10.065014", - "docstatus": 0, - "doctype": "Onboarding Slide", - "domains": [], - "help_links": [ - { - "label": "Learn More", - "video_id": "zsrrVDk6VBs" - } - ], - "idx": 0, - "image_src": "", - "is_completed": 0, - "max_count": 3, - "modified": "2019-12-09 17:54:01.686006", - "modified_by": "Administrator", - "name": "Add A Few Customers", - "owner": "Administrator", - "ref_doctype": "Customer", - "slide_desc": "", - "slide_fields": [ - { - "align": "", - "fieldname": "customer_name", - "fieldtype": "Data", - "label": "Customer Name", - "placeholder": "", - "reqd": 1 - }, - { - "align": "", - "fieldtype": "Column Break", - "reqd": 0 - }, - { - "align": "", - "fieldname": "customer_email", - "fieldtype": "Data", - "label": "Email ID", - "reqd": 1 - } - ], - "slide_order": 40, - "slide_title": "Add A Few Customers", - "slide_type": "Create" -} \ No newline at end of file diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py index 3965d82751..d19e1897fc 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -138,85 +138,6 @@ class ItemGroup(NestedSet, WebsiteGenerator): from erpnext.stock.doctype.item.item import validate_item_default_company_links validate_item_default_company_links(self.item_group_defaults) -@frappe.whitelist(allow_guest=True) -def get_product_list_for_group(product_group=None, start=0, limit=10, search=None): - if product_group: - item_group = frappe.get_cached_doc('Item Group', product_group) - if item_group.is_group: - # return child item groups if the type is of "Is Group" - return get_child_groups_for_list_in_html(item_group, start, limit, search) - - child_groups = ", ".join(frappe.db.escape(i[0]) for i in get_child_groups(product_group)) - - # base query - query = """select I.name, I.item_name, I.item_code, I.route, I.image, I.website_image, I.thumbnail, I.item_group, - I.description, I.web_long_description as website_description, I.is_stock_item, - case when (S.actual_qty - S.reserved_qty) > 0 then 1 else 0 end as in_stock, I.website_warehouse, - I.has_batch_no - from `tabItem` I - left join tabBin S on I.item_code = S.item_code and I.website_warehouse = S.warehouse - where I.show_in_website = 1 - and I.disabled = 0 - and (I.end_of_life is null or I.end_of_life='0000-00-00' or I.end_of_life > %(today)s) - and (I.variant_of = '' or I.variant_of is null) - and (I.item_group in ({child_groups}) - or I.name in (select parent from `tabWebsite Item Group` where item_group in ({child_groups}))) - """.format(child_groups=child_groups) - # search term condition - if search: - query += """ and (I.web_long_description like %(search)s - or I.item_name like %(search)s - or I.name like %(search)s)""" - search = "%" + cstr(search) + "%" - - query += """order by I.weightage desc, in_stock desc, I.modified desc limit %s, %s""" % (cint(start), cint(limit)) - - data = frappe.db.sql(query, {"product_group": product_group,"search": search, "today": nowdate()}, as_dict=1) - data = adjust_qty_for_expired_items(data) - - if cint(frappe.db.get_single_value("E Commerce Settings", "enabled")): - for item in data: - set_product_info_for_website(item) - - return data - -def get_child_groups_for_list_in_html(item_group, start, limit, search): - search_filters = None - if search_filters: - search_filters = [ - dict(name = ('like', '%{}%'.format(search))), - dict(description = ('like', '%{}%'.format(search))) - ] - data = frappe.db.get_all('Item Group', - fields = ['name', 'route', 'description', 'image'], - filters = dict( - show_in_website = 1, - parent_item_group = item_group.name, - lft = ('>', item_group.lft), - rgt = ('<', item_group.rgt), - ), - or_filters = search_filters, - order_by = 'weightage desc, name asc', - start = start, - limit = limit - ) - - return data - -def adjust_qty_for_expired_items(data): - adjusted_data = [] - - for item in data: - if item.get('has_batch_no') and item.get('website_warehouse'): - stock_qty_dict = get_qty_in_stock( - item.get('name'), 'website_warehouse', item.get('website_warehouse')) - qty = stock_qty_dict.stock_qty[0][0] if stock_qty_dict.stock_qty else 0 - item['in_stock'] = 1 if qty else 0 - adjusted_data.append(item) - - return adjusted_data - - def get_child_groups(item_group_name): item_group = frappe.get_doc("Item Group", item_group_name) return frappe.db.sql("""select name @@ -245,14 +166,6 @@ def get_item_for_list_in_html(context): return frappe.get_template(products_template).render(context) -def get_group_item_count(item_group): - child_groups = ", ".join('"' + i[0] + '"' for i in get_child_groups(item_group)) - return frappe.db.sql("""select count(*) from `tabItem` - where docstatus = 0 and show_in_website = 1 - and (item_group in (%s) - or name in (select parent from `tabWebsite Item Group` - where item_group in (%s))) """ % (child_groups, child_groups))[0][0] - def get_parent_item_groups(item_group_name): base_parents = [ diff --git a/erpnext/setup/onboarding_slide/welcome_back_to_erpnext!/welcome_back_to_erpnext!.json b/erpnext/setup/onboarding_slide/welcome_back_to_erpnext!/welcome_back_to_erpnext!.json deleted file mode 100644 index f00dc947d2..0000000000 --- a/erpnext/setup/onboarding_slide/welcome_back_to_erpnext!/welcome_back_to_erpnext!.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "add_more_button": 0, - "app": "ERPNext", - "creation": "2019-12-04 19:21:39.995776", - "docstatus": 0, - "doctype": "Onboarding Slide", - "domains": [], - "help_links": [], - "idx": 0, - "image_src": "", - "is_completed": 0, - "max_count": 3, - "modified": "2019-12-09 17:53:53.849953", - "modified_by": "Administrator", - "name": "Welcome back to ERPNext!", - "owner": "Administrator", - "slide_desc": "
Let's continue where you left from!
", - "slide_fields": [], - "slide_module": "Setup", - "slide_order": 0, - "slide_title": "Welcome back to ERPNext!", - "slide_type": "Continue" -} \ No newline at end of file diff --git a/erpnext/setup/onboarding_slide/welcome_to_erpnext!/welcome_to_erpnext!.json b/erpnext/setup/onboarding_slide/welcome_to_erpnext!/welcome_to_erpnext!.json deleted file mode 100644 index 37eb67b1d7..0000000000 --- a/erpnext/setup/onboarding_slide/welcome_to_erpnext!/welcome_to_erpnext!.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "add_more_button": 0, - "app": "ERPNext", - "creation": "2019-11-26 17:01:26.671859", - "docstatus": 0, - "doctype": "Onboarding Slide", - "domains": [], - "help_links": [], - "idx": 0, - "image_src": "", - "is_completed": 0, - "max_count": 0, - "modified": "2019-12-22 21:26:28.414597", - "modified_by": "Administrator", - "name": "Welcome to ERPNext!", - "owner": "Administrator", - "slide_desc": "