fix: Sider and CI

- Incorrect path and Settings in price_list.py import due to merge
- Extra space removed in website_item.py
- Changed client side namespace to `erpnext.e_commerce.*`
This commit is contained in:
marination 2021-08-26 19:14:10 +05:30
parent 6b2b9dcee2
commit 1bb135b2d3
8 changed files with 22 additions and 22 deletions

View File

@ -286,7 +286,7 @@ class WebsiteItem(WebsiteGenerator):
# make an attribute-value map for easier access in templates
variant.attribute_map = frappe._dict(
{ attr.attribute : attr.value for attr in variant.attributes}
{attr.attribute : attr.value for attr in variant.attributes}
)
for attr in variant.attributes:

View File

@ -168,11 +168,13 @@ class TestProductDataEngine(unittest.TestCase):
filter_engine = ProductFiltersBuilder()
attribute_filter = filter_engine.get_attribute_filters()[0]
attribute = attribute_filter.item_attribute_values[0]
attributes = attribute_filter.item_attribute_values
attribute_values = [d.attribute_value for d in attributes]
self.assertEqual(attribute_filter.name, "Test Size")
self.assertEqual(len(attribute_filter.item_attribute_values), 1)
self.assertEqual(attribute.attribute_value, "Large")
self.assertGreater(len(attribute_values), 0)
self.assertIn("Large", attribute_values)
def test_product_list_with_attribute_filter(self):
"Test if attribute filters are applied correctly."

View File

@ -2,8 +2,8 @@
// License: GNU General Public License v3. See license.txt
// shopping cart
frappe.provide("e_commerce.shopping_cart");
var shopping_cart = e_commerce.shopping_cart;
frappe.provide("erpnext.e_commerce.shopping_cart");
var shopping_cart = erpnext.e_commerce.shopping_cart;
var getParams = function (url) {
var params = [];
@ -192,7 +192,7 @@ $.extend(shopping_cart, {
$btn.parent().find('.cart-indicator').removeClass('hidden');
const item_code = $btn.data('item-code');
e_commerce.shopping_cart.update_cart({
erpnext.e_commerce.shopping_cart.update_cart({
item_code,
qty: 1
});

View File

@ -1,8 +1,8 @@
frappe.provide("e_commerce.wishlist");
var wishlist = e_commerce.wishlist;
frappe.provide("erpnext.e_commerce.wishlist");
var wishlist = erpnext.e_commerce.wishlist;
frappe.provide("e_commerce.shopping_cart");
var shopping_cart = e_commerce.shopping_cart;
frappe.provide("erpnext.e_commerce.shopping_cart");
var shopping_cart = erpnext.e_commerce.shopping_cart;
$.extend(wishlist, {
set_wishlist_count: function() {
@ -98,7 +98,7 @@ $.extend(wishlist, {
}
let success_action = function() {
e_commerce.wishlist.set_wishlist_count();
erpnext.e_commerce.wishlist.set_wishlist_count();
};
if ($wish_icon.hasClass('wished')) {

View File

@ -36,14 +36,12 @@ class PriceList(Document):
(self.currency, cint(self.buying), cint(self.selling), self.name))
def check_impact_on_shopping_cart(self):
"Check if Price List currency change impacts Shopping Cart."
from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import (
validate_cart_settings,
)
"Check if Price List currency change impacts E Commerce Cart."
from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import validate_cart_settings
doc_before_save = self.get_doc_before_save()
currency_changed = self.currency != doc_before_save.currency
affects_cart = self.name == frappe.get_cached_value("Shopping Cart Settings", None, "price_list")
affects_cart = self.name == frappe.get_cached_value("E Commerce Settings", None, "price_list")
if currency_changed and affects_cart:
validate_cart_settings()

View File

@ -247,7 +247,7 @@ class ItemConfigure {
const additional_notes = Object.keys(this.range_values || {}).map(attribute => {
return `${attribute}: ${this.range_values[attribute]}`;
}).join('\n');
e_commerce.shopping_cart.update_cart({
erpnext.e_commerce.shopping_cart.update_cart({
item_code,
additional_notes,
qty: 1

View File

@ -4,8 +4,8 @@
// js inside blog page
// shopping cart
frappe.provide("e_commerce.shopping_cart");
var shopping_cart = e_commerce.shopping_cart;
frappe.provide("erpnext.e_commerce.shopping_cart");
var shopping_cart = erpnext.e_commerce.shopping_cart;
$.extend(shopping_cart, {
show_error: function(title, text) {

View File

@ -20,8 +20,8 @@ $(() => {
}
bind_card_actions() {
e_commerce.shopping_cart.bind_add_to_cart_action();
e_commerce.wishlist.bind_wishlist_action();
erpnext.e_commerce.shopping_cart.bind_add_to_cart_action();
erpnext.e_commerce.wishlist.bind_wishlist_action();
}
}