test: Website Item (Item full page)

- Tests for website item. Desk tests and portal tests
- Allow guests on method `get_offer_details`
- Fetch stock details only if `show_stock_availability` is enabled
- Validation for duplicate web items on item merge
- Separate method for `validate_properties_before_merge`
- Common error title and exception `DataValidationError` for merge validations on Item
This commit is contained in:
marination
2021-08-09 13:25:13 +05:30
parent 3fd929c4ee
commit 4d254a7ad3
10 changed files with 416 additions and 45 deletions

View File

@@ -143,17 +143,17 @@ def get_item_for_list_in_html(context):
def get_parent_item_groups(item_group_name, from_item=False):
base_nav_page = {"name": frappe._("Shop by Category"), "route":"/shop-by-category"}
base_nav_page = {"name": _("Shop by Category"), "route":"/shop-by-category"}
if from_item and frappe.request.environ.get("HTTP_REFERER"):
# base page after 'Home' will vary on Item page
last_page = frappe.request.environ["HTTP_REFERER"].split('/')[-1]
if last_page and last_page in ("shop-by-category", "all-products"):
base_nav_page_title = " ".join(last_page.split("-")).title()
base_nav_page = {"name": frappe._(base_nav_page_title), "route":"/"+last_page}
base_nav_page = {"name": _(base_nav_page_title), "route":"/"+last_page}
base_parents = [
{"name": frappe._("Home"), "route":"/"},
{"name": _("Home"), "route":"/"},
base_nav_page,
]