mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 05:09:11 +00:00
fix: Website Items with same Item name unhandled, thumbnails missing
- Use naming series for Website Item. There could be two items with same name and different item code - Fix: Website Item Page view breaks if cart is disabled - Fix: thumbnails not created for Website Items after patch - Fix: ‘Request for Quote’ button & cart summary not visible if checkout is disabled
This commit is contained in:
@@ -33,6 +33,15 @@ class WebsiteItem(WebsiteGenerator):
|
||||
no_cache=1
|
||||
)
|
||||
|
||||
def autoname(self):
|
||||
# use naming series to accomodate items with same name (different item code)
|
||||
from erpnext.setup.doctype.naming_series.naming_series import get_default_naming_series
|
||||
from frappe.model.naming import make_autoname
|
||||
|
||||
naming_series = get_default_naming_series("Website Item")
|
||||
if not self.name and naming_series:
|
||||
self.name = make_autoname(naming_series, doc=self)
|
||||
|
||||
def onload(self):
|
||||
super(WebsiteItem, self).onload()
|
||||
|
||||
@@ -137,7 +146,7 @@ class WebsiteItem(WebsiteGenerator):
|
||||
|
||||
def make_thumbnail(self):
|
||||
"""Make a thumbnail of `website_image`"""
|
||||
if frappe.flags.in_import or frappe.flags.in_migrate:
|
||||
if frappe.flags.in_import:
|
||||
return
|
||||
|
||||
import requests.exceptions
|
||||
@@ -210,7 +219,7 @@ class WebsiteItem(WebsiteGenerator):
|
||||
|
||||
self.get_product_details_section(context)
|
||||
|
||||
if settings.enable_reviews:
|
||||
if settings.get("enable_reviews"):
|
||||
reviews_data = get_item_reviews(self.name)
|
||||
context.update(reviews_data)
|
||||
context.reviews = context.reviews[:4]
|
||||
|
||||
@@ -23,7 +23,11 @@ def get_product_info_for_website(item_code, skip_quotation_creation=False):
|
||||
|
||||
cart_settings = get_shopping_cart_settings()
|
||||
if not cart_settings.enabled:
|
||||
return frappe._dict()
|
||||
# return settings even if cart is disabled
|
||||
return frappe._dict({
|
||||
"product_info": {},
|
||||
"cart_settings": cart_settings
|
||||
})
|
||||
|
||||
cart_quotation = frappe._dict()
|
||||
if not skip_quotation_creation:
|
||||
|
||||
Reference in New Issue
Block a user