mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 03:29:16 +00:00
fix: user not able to view product (#21740)
This commit is contained in:
@@ -10,14 +10,16 @@ from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings
|
|||||||
from erpnext.utilities.product import get_price, get_qty_in_stock, get_non_stock_item_status
|
from erpnext.utilities.product import get_price, get_qty_in_stock, get_non_stock_item_status
|
||||||
|
|
||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def get_product_info_for_website(item_code):
|
def get_product_info_for_website(item_code, skip_quotation_creation=False):
|
||||||
"""get product price / stock info for website"""
|
"""get product price / stock info for website"""
|
||||||
|
|
||||||
cart_settings = get_shopping_cart_settings()
|
cart_settings = get_shopping_cart_settings()
|
||||||
if not cart_settings.enabled:
|
if not cart_settings.enabled:
|
||||||
return frappe._dict()
|
return frappe._dict()
|
||||||
|
|
||||||
cart_quotation = _get_cart_quotation()
|
cart_quotation = frappe._dict()
|
||||||
|
if not skip_quotation_creation:
|
||||||
|
cart_quotation = _get_cart_quotation()
|
||||||
|
|
||||||
price = get_price(
|
price = get_price(
|
||||||
item_code,
|
item_code,
|
||||||
@@ -51,7 +53,7 @@ def get_product_info_for_website(item_code):
|
|||||||
|
|
||||||
def set_product_info_for_website(item):
|
def set_product_info_for_website(item):
|
||||||
"""set product price uom for website"""
|
"""set product price uom for website"""
|
||||||
product_info = get_product_info_for_website(item.item_code)
|
product_info = get_product_info_for_website(item.item_code, skip_quotation_creation=True)
|
||||||
|
|
||||||
if product_info:
|
if product_info:
|
||||||
item.update(product_info)
|
item.update(product_info)
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ class Item(WebsiteGenerator):
|
|||||||
|
|
||||||
def set_shopping_cart_data(self, context):
|
def set_shopping_cart_data(self, context):
|
||||||
from erpnext.shopping_cart.product_info import get_product_info_for_website
|
from erpnext.shopping_cart.product_info import get_product_info_for_website
|
||||||
context.shopping_cart = get_product_info_for_website(self.name)
|
context.shopping_cart = get_product_info_for_website(self.name, skip_quotation_creation=True)
|
||||||
|
|
||||||
def add_default_uom_in_conversion_factor_table(self):
|
def add_default_uom_in_conversion_factor_table(self):
|
||||||
uom_conv_list = [d.uom for d in self.get("uoms")]
|
uom_conv_list = [d.uom for d in self.get("uoms")]
|
||||||
|
|||||||
Reference in New Issue
Block a user