mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
Merge branch 'develop' into so-mr-wo-back-update
This commit is contained in:
@@ -66,26 +66,24 @@ class ItemVariantsCacheManager:
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
# join with Website Item
|
# Get Variants and tehir Attributes that are not disabled
|
||||||
item_variants_data = frappe.get_all(
|
iva = frappe.qb.DocType("Item Variant Attribute")
|
||||||
'Item Variant Attribute',
|
item = frappe.qb.DocType("Item")
|
||||||
{'variant_of': parent_item_code},
|
query = (
|
||||||
['parent', 'attribute', 'attribute_value'],
|
frappe.qb.from_(iva)
|
||||||
order_by='name',
|
.join(item).on(item.name == iva.parent)
|
||||||
as_list=1
|
.select(
|
||||||
)
|
iva.parent, iva.attribute, iva.attribute_value
|
||||||
|
).where(
|
||||||
disabled_items = set(
|
(iva.variant_of == parent_item_code)
|
||||||
[i.name for i in frappe.db.get_all('Item', {'disabled': 1})]
|
& (item.disabled == 0)
|
||||||
|
).orderby(iva.name)
|
||||||
)
|
)
|
||||||
|
item_variants_data = query.run()
|
||||||
|
|
||||||
attribute_value_item_map = frappe._dict()
|
attribute_value_item_map = frappe._dict()
|
||||||
item_attribute_value_map = frappe._dict()
|
item_attribute_value_map = frappe._dict()
|
||||||
|
|
||||||
# dont consider variants that are disabled
|
|
||||||
# pull all other variants
|
|
||||||
item_variants_data = [r for r in item_variants_data if r[0] not in disabled_items]
|
|
||||||
|
|
||||||
for row in item_variants_data:
|
for row in item_variants_data:
|
||||||
item_code, attribute, attribute_value = row
|
item_code, attribute, attribute_value = row
|
||||||
# (attr, value) => [item1, item2]
|
# (attr, value) => [item1, item2]
|
||||||
@@ -124,4 +122,7 @@ def build_cache(item_code):
|
|||||||
def enqueue_build_cache(item_code):
|
def enqueue_build_cache(item_code):
|
||||||
if frappe.cache().hget('item_cache_build_in_progress', item_code):
|
if frappe.cache().hget('item_cache_build_in_progress', item_code):
|
||||||
return
|
return
|
||||||
frappe.enqueue(build_cache, item_code=item_code, queue='long')
|
frappe.enqueue(
|
||||||
|
"erpnext.e_commerce.variant_selector.item_variants_cache.build_cache",
|
||||||
|
item_code=item_code, queue='long'
|
||||||
|
)
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ class TestVariantSelector(ERPNextTestCase):
|
|||||||
})
|
})
|
||||||
|
|
||||||
make_web_item_price(item_code="Test-Tshirt-Temp-S-R", price_list_rate=100)
|
make_web_item_price(item_code="Test-Tshirt-Temp-S-R", price_list_rate=100)
|
||||||
|
|
||||||
|
frappe.local.shopping_cart_settings = None # clear cached settings values
|
||||||
next_values = get_next_attribute_and_values(
|
next_values = get_next_attribute_and_values(
|
||||||
"Test-Tshirt-Temp",
|
"Test-Tshirt-Temp",
|
||||||
selected_attributes={"Test Size": "Small", "Test Colour": "Red"}
|
selected_attributes={"Test Size": "Small", "Test Colour": "Red"}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from frappe.utils import call_hook_method, cint, flt, get_url
|
|||||||
|
|
||||||
|
|
||||||
class GoCardlessSettings(Document):
|
class GoCardlessSettings(Document):
|
||||||
supported_currencies = ["EUR", "DKK", "GBP", "SEK"]
|
supported_currencies = ["EUR", "DKK", "GBP", "SEK", "AUD", "NZD", "CAD", "USD"]
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.initialize_client()
|
self.initialize_client()
|
||||||
@@ -80,7 +80,7 @@ class GoCardlessSettings(Document):
|
|||||||
|
|
||||||
def validate_transaction_currency(self, currency):
|
def validate_transaction_currency(self, currency):
|
||||||
if currency not in self.supported_currencies:
|
if currency not in self.supported_currencies:
|
||||||
frappe.throw(_("Please select another payment method. Stripe does not support transactions in currency '{0}'").format(currency))
|
frappe.throw(_("Please select another payment method. Go Cardless does not support transactions in currency '{0}'").format(currency))
|
||||||
|
|
||||||
def get_payment_url(self, **kwargs):
|
def get_payment_url(self, **kwargs):
|
||||||
return get_url("./integrations/gocardless_checkout?{0}".format(urlencode(kwargs)))
|
return get_url("./integrations/gocardless_checkout?{0}".format(urlencode(kwargs)))
|
||||||
|
|||||||
@@ -545,7 +545,7 @@ $.extend(erpnext.item, {
|
|||||||
let selected_attributes = {};
|
let selected_attributes = {};
|
||||||
me.multiple_variant_dialog.$wrapper.find('.form-column').each((i, col) => {
|
me.multiple_variant_dialog.$wrapper.find('.form-column').each((i, col) => {
|
||||||
if(i===0) return;
|
if(i===0) return;
|
||||||
let attribute_name = $(col).find('label').html();
|
let attribute_name = $(col).find('label').html().trim();
|
||||||
selected_attributes[attribute_name] = [];
|
selected_attributes[attribute_name] = [];
|
||||||
let checked_opts = $(col).find('.checkbox input');
|
let checked_opts = $(col).find('.checkbox input');
|
||||||
checked_opts.each((i, opt) => {
|
checked_opts.each((i, opt) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user