diff --git a/erpnext/e_commerce/doctype/website_item/website_item.py b/erpnext/e_commerce/doctype/website_item/website_item.py index 14c2f891beb..071838fb6be 100644 --- a/erpnext/e_commerce/doctype/website_item/website_item.py +++ b/erpnext/e_commerce/doctype/website_item/website_item.py @@ -193,7 +193,7 @@ class WebsiteItem(WebsiteGenerator): # load variants # also used in set_attribute_context context.variants = frappe.get_all("Item", - filters={"variant_of": self.name, "show_variant_in_website": 1}, + filters={"variant_of": self.name, "published_in_website": 1}, order_by="name asc") variant = frappe.form_dict.variant diff --git a/erpnext/e_commerce/product_grid.js b/erpnext/e_commerce/product_grid.js index 638f01701b7..8712a201a19 100644 --- a/erpnext/e_commerce/product_grid.js +++ b/erpnext/e_commerce/product_grid.js @@ -27,7 +27,7 @@ erpnext.ProductGrid = class { html += me.get_image_html(item, title); html += me.get_card_body_html(item, title, me.settings); html += ``; - }) + }); let $product_wrapper = this.products_section; $product_wrapper.append(html); @@ -36,7 +36,7 @@ erpnext.ProductGrid = class { get_image_html(item, title) { let image = item.website_image || item.image; - if(image) { + if (image) { return `
@@ -85,11 +85,11 @@ erpnext.ProductGrid = class {
${ title || '' } `; - if (item.in_stock) { + if (item.in_stock && settings.show_stock_availability) { title_html += ``; } title_html += `
`; - return title_html + return title_html; } get_wishlist_icon(item) { @@ -145,4 +145,4 @@ erpnext.ProductGrid = class { `; } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/erpnext/e_commerce/product_list.js b/erpnext/e_commerce/product_list.js index e693f1e24ca..2836c3acc16 100644 --- a/erpnext/e_commerce/product_list.js +++ b/erpnext/e_commerce/product_list.js @@ -27,7 +27,7 @@ erpnext.ProductList = class { html += me.get_image_html(item, title); html += me.get_row_body_html(item, title, me.settings); html += `
`; - }) + }); let $product_wrapper = this.products_section; $product_wrapper.append(html); @@ -36,7 +36,7 @@ erpnext.ProductList = class { get_image_html(item, title) { let image = item.website_image || item.image; - if(image) { + if (image) { return `
@@ -74,7 +74,7 @@ erpnext.ProductList = class { `; - if (item.in_stock) { + if (item.in_stock && settings.show_stock_availability) { title_html += ``; } title_html += `
`; @@ -92,7 +92,7 @@ erpnext.ProductList = class { return title_html; } - get_item_details(item, settings) { + get_item_details(item) { let details = `

Item Code : ${ item.item_code } @@ -104,7 +104,7 @@ erpnext.ProductList = class { ${ item.formatted_price || '' } `; - if(item.formatted_mrp) { + if (item.formatted_mrp) { details += ` ${ item.formatted_mrp } @@ -155,4 +155,4 @@ erpnext.ProductList = class { } } -} +}; \ No newline at end of file diff --git a/erpnext/e_commerce/product_view.js b/erpnext/e_commerce/product_view.js index 923bdb12720..f6727cacc5d 100644 --- a/erpnext/e_commerce/product_view.js +++ b/erpnext/e_commerce/product_view.js @@ -14,7 +14,7 @@ erpnext.ProductView = class { } prepare_view_toggler() { - if(!$("#list").length || !$("#image-view").length) { + if (!$("#list").length || !$("#image-view").length) { this.render_view_toggler(); this.bind_view_toggler_actions(); this.set_view_state(); @@ -109,13 +109,13 @@ erpnext.ProductView = class { attribute_filters: attribute_filters, item_group: this.item_group, start: filters.start || null - } + }; } add_paging_section(settings) { $(".product-paging-area").remove(); - if(this.products) { + if (this.products) { let paging_html = `

@@ -126,13 +126,13 @@ erpnext.ProductView = class { let start = query_params.start ? cint(JSON.parse(query_params.start)) : 0; let page_length = settings.products_per_page || 0; - if(start > 0) { + if (start > 0) { paging_html += ` `; } - if(this.products.length > page_length || this.products.length == page_length) { + if (this.products.length > page_length || this.products.length == page_length) { paging_html += `
`; $("#product-listing").prepend(sub_group_html); } } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py index 148c1a6a166..cf44fc472ad 100644 --- a/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py +++ b/erpnext/erpnext_integrations/doctype/amazon_mws_settings/amazon_methods.py @@ -143,7 +143,6 @@ def create_item_code(amazon_item_json, sku): item.description = amazon_item_json.Product.AttributeSets.ItemAttributes.Title item.brand = new_brand item.manufacturer = new_manufacturer - item.web_long_description = amazon_item_json.Product.AttributeSets.ItemAttributes.Title item.image = amazon_item_json.Product.AttributeSets.ItemAttributes.SmallImage.URL diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 7fb38678f35..165b0ca3df0 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -239,11 +239,8 @@ execute:frappe.delete_doc_if_exists("DocType", "Shopping Cart Price List") execute:frappe.delete_doc_if_exists("DocType", "Shopping Cart Taxes and Charges Master") erpnext.patches.v6_4.set_user_in_contact -erpnext.patches.v6_4.make_image_thumbnail #2015-10-20 -erpnext.patches.v6_5.show_in_website_for_template_item erpnext.patches.v6_4.fix_expense_included_in_valuation execute:frappe.delete_doc_if_exists("Report", "Item-wise Last Purchase Rate") -erpnext.patches.v6_6.fix_website_image erpnext.patches.v6_6.remove_fiscal_year_from_leave_allocation execute:frappe.delete_doc_if_exists("DocType", "Stock UOM Replace Utility") erpnext.patches.v6_8.make_webform_standard #2015-11-23 @@ -363,7 +360,6 @@ erpnext.patches.v7_1.set_budget_against_as_cost_center erpnext.patches.v7_1.set_currency_exchange_date erpnext.patches.v7_1.set_sales_person_status erpnext.patches.v7_1.repost_stock_for_deleted_bins_for_merging_items -erpnext.patches.v7_2.update_website_for_variant erpnext.patches.v7_2.update_assessment_modules erpnext.patches.v7_2.update_doctype_status erpnext.patches.v7_2.update_salary_slips diff --git a/erpnext/patches/v5_0/item_patches.py b/erpnext/patches/v5_0/item_patches.py index e223e09f5b7..ac2864db504 100644 --- a/erpnext/patches/v5_0/item_patches.py +++ b/erpnext/patches/v5_0/item_patches.py @@ -3,4 +3,3 @@ import frappe def execute(): frappe.db.sql("update `tabItem` set end_of_life='2099-12-31' where ifnull(end_of_life, '0000-00-00')='0000-00-00'") - frappe.db.sql("update `tabItem` set website_image = image where ifnull(website_image, '') = 'attach_files:'") diff --git a/erpnext/patches/v6_4/make_image_thumbnail.py b/erpnext/patches/v6_4/make_image_thumbnail.py deleted file mode 100644 index 2c86e8af864..00000000000 --- a/erpnext/patches/v6_4/make_image_thumbnail.py +++ /dev/null @@ -1,15 +0,0 @@ -from __future__ import print_function, unicode_literals -import frappe - -def execute(): - frappe.reload_doctype("File") - frappe.reload_doctype("Item") - for item in frappe.get_all("Item", fields=("name", "website_image", "thumbnail")): - if item.website_image and not item.thumbnail: - item_doc = frappe.get_doc("Item", item.name) - try: - item_doc.make_thumbnail() - if item_doc.thumbnail: - item_doc.db_set("thumbnail", item_doc.thumbnail, update_modified=False) - except Exception: - print("Unable to make thumbnail for {0}".format(item.website_image.encode("utf-8"))) diff --git a/erpnext/patches/v6_5/show_in_website_for_template_item.py b/erpnext/patches/v6_5/show_in_website_for_template_item.py deleted file mode 100644 index af6e8304d67..00000000000 --- a/erpnext/patches/v6_5/show_in_website_for_template_item.py +++ /dev/null @@ -1,15 +0,0 @@ -from __future__ import unicode_literals -import frappe -import frappe.website.render - -def execute(): - for item_code in frappe.db.sql_list("""select distinct variant_of from `tabItem` - where variant_of is not null and variant_of !='' and show_in_website=1"""): - - item = frappe.get_doc("Item", item_code) - item.db_set("show_in_website", 1, update_modified=False) - - item.make_route() - item.db_set("route", item.route, update_modified=False) - - frappe.website.render.clear_cache() diff --git a/erpnext/patches/v6_6/fix_website_image.py b/erpnext/patches/v6_6/fix_website_image.py deleted file mode 100644 index cc3e2d852c4..00000000000 --- a/erpnext/patches/v6_6/fix_website_image.py +++ /dev/null @@ -1,32 +0,0 @@ -from __future__ import print_function, unicode_literals -import frappe -from frappe.utils import encode - -def execute(): - """Fix the File records created via item.py even if the website_image file didn't exist""" - for item in frappe.db.sql_list("""select name from `tabItem` - where website_image is not null and website_image != '' - and website_image like '/files/%' - and exists ( - select name from `tabFile` - where attached_to_doctype='Item' - and attached_to_name=`tabItem`.name - and file_url=`tabItem`.website_image - and (file_name is null or file_name = '') - )"""): - - item = frappe.get_doc("Item", item) - file = frappe.get_doc("File", { - "attached_to_doctype": "Item", - "attached_to_name": item.name, - "file_url": item.website_image - }) - - try: - file.validate_file() - except IOError: - print(encode(item.website_image), "does not exist") - file.delete() - item.db_set("website_image", None, update_modified=False) - - diff --git a/erpnext/patches/v7_2/update_website_for_variant.py b/erpnext/patches/v7_2/update_website_for_variant.py deleted file mode 100644 index e8eef6e7da1..00000000000 --- a/erpnext/patches/v7_2/update_website_for_variant.py +++ /dev/null @@ -1,13 +0,0 @@ -from __future__ import unicode_literals -import frappe - -def execute(): - # variant must have show_in_website = 0 - frappe.reload_doctype('Item') - frappe.db.sql(''' - update tabItem set - show_variant_in_website = 1, - show_in_website = 0 - where - show_in_website=1 - and ifnull(variant_of, "")!=""''') \ 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 fd22d94b67d..d4f40676fc3 100644 --- a/erpnext/setup/doctype/item_group/item_group.py +++ b/erpnext/setup/doctype/item_group/item_group.py @@ -11,7 +11,6 @@ from frappe.website.website_generator import WebsiteGenerator from frappe.website.render import clear_cache from frappe.website.doctype.website_slideshow.website_slideshow import get_slideshow from six.moves.urllib.parse import quote -from erpnext.e_commerce.product_query import ProductQuery from erpnext.e_commerce.filters import ProductFiltersBuilder class ItemGroup(NestedSet, WebsiteGenerator): diff --git a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js index 87d82e0fd63..2afa9109a7f 100644 --- a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js +++ b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.js @@ -5,7 +5,7 @@ frappe.ui.form.on('Item Variant Settings', { setup: function(frm) { const allow_fields = []; const exclude_fields = ["naming_series", "item_code", "item_name", "published_in_website", - "show_variant_in_website", "opening_stock", "variant_of", "valuation_rate"]; + "opening_stock", "variant_of", "valuation_rate"]; frappe.model.with_doctype('Item', () => { frappe.get_meta('Item').fields.forEach(d => { diff --git a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.py b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.py index 949f21b2eb6..714a89f749e 100644 --- a/erpnext/stock/doctype/item_variant_settings/item_variant_settings.py +++ b/erpnext/stock/doctype/item_variant_settings/item_variant_settings.py @@ -16,7 +16,7 @@ class ItemVariantSettings(Document): exclude_fields = {"naming_series", "item_code", "item_name", "published_in_website", "standard_rate", "opening_stock", "image", "description", "variant_of", "valuation_rate", "description", "barcodes", - "has_variants", "attributes"} + "has_variants", "attributes"} for d in fields: if not d.no_copy and d.fieldname not in exclude_fields and \