fix: Sider and Patches
- Sider fixes - Deleted patches that worked as per old schema - Cleared instances of web fields linked to Item master
This commit is contained in:
@@ -193,7 +193,7 @@ class WebsiteItem(WebsiteGenerator):
|
|||||||
# load variants
|
# load variants
|
||||||
# also used in set_attribute_context
|
# also used in set_attribute_context
|
||||||
context.variants = frappe.get_all("Item",
|
context.variants = frappe.get_all("Item",
|
||||||
filters={"variant_of": self.name, "show_variant_in_website": 1},
|
filters={"variant_of": self.name, "published_in_website": 1},
|
||||||
order_by="name asc")
|
order_by="name asc")
|
||||||
|
|
||||||
variant = frappe.form_dict.variant
|
variant = frappe.form_dict.variant
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ erpnext.ProductGrid = class {
|
|||||||
html += me.get_image_html(item, title);
|
html += me.get_image_html(item, title);
|
||||||
html += me.get_card_body_html(item, title, me.settings);
|
html += me.get_card_body_html(item, title, me.settings);
|
||||||
html += `</div></div>`;
|
html += `</div></div>`;
|
||||||
})
|
});
|
||||||
|
|
||||||
let $product_wrapper = this.products_section;
|
let $product_wrapper = this.products_section;
|
||||||
$product_wrapper.append(html);
|
$product_wrapper.append(html);
|
||||||
@@ -36,7 +36,7 @@ erpnext.ProductGrid = class {
|
|||||||
get_image_html(item, title) {
|
get_image_html(item, title) {
|
||||||
let image = item.website_image || item.image;
|
let image = item.website_image || item.image;
|
||||||
|
|
||||||
if(image) {
|
if (image) {
|
||||||
return `
|
return `
|
||||||
<div class="card-img-container">
|
<div class="card-img-container">
|
||||||
<a href="/${ item.route || '#' }" style="text-decoration: none;">
|
<a href="/${ item.route || '#' }" style="text-decoration: none;">
|
||||||
@@ -85,11 +85,11 @@ erpnext.ProductGrid = class {
|
|||||||
<div class="product-title">
|
<div class="product-title">
|
||||||
${ title || '' }
|
${ title || '' }
|
||||||
`;
|
`;
|
||||||
if (item.in_stock) {
|
if (item.in_stock && settings.show_stock_availability) {
|
||||||
title_html += `<span class="indicator ${ item.in_stock } card-indicator"></span>`;
|
title_html += `<span class="indicator ${ item.in_stock } card-indicator"></span>`;
|
||||||
}
|
}
|
||||||
title_html += `</div></a>`;
|
title_html += `</div></a>`;
|
||||||
return title_html
|
return title_html;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_wishlist_icon(item) {
|
get_wishlist_icon(item) {
|
||||||
@@ -145,4 +145,4 @@ erpnext.ProductGrid = class {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
@@ -27,7 +27,7 @@ erpnext.ProductList = class {
|
|||||||
html += me.get_image_html(item, title);
|
html += me.get_image_html(item, title);
|
||||||
html += me.get_row_body_html(item, title, me.settings);
|
html += me.get_row_body_html(item, title, me.settings);
|
||||||
html += `</div>`;
|
html += `</div>`;
|
||||||
})
|
});
|
||||||
|
|
||||||
let $product_wrapper = this.products_section;
|
let $product_wrapper = this.products_section;
|
||||||
$product_wrapper.append(html);
|
$product_wrapper.append(html);
|
||||||
@@ -36,7 +36,7 @@ erpnext.ProductList = class {
|
|||||||
get_image_html(item, title) {
|
get_image_html(item, title) {
|
||||||
let image = item.website_image || item.image;
|
let image = item.website_image || item.image;
|
||||||
|
|
||||||
if(image) {
|
if (image) {
|
||||||
return `
|
return `
|
||||||
<div class="col-2 border text-center rounded product-image" style="overflow: hidden; max-height: 200px;">
|
<div class="col-2 border text-center rounded product-image" style="overflow: hidden; max-height: 200px;">
|
||||||
<a class="product-link product-list-link" href="/${ item.route || '#' }">
|
<a class="product-link product-list-link" href="/${ item.route || '#' }">
|
||||||
@@ -74,7 +74,7 @@ erpnext.ProductList = class {
|
|||||||
</a>
|
</a>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
if (item.in_stock) {
|
if (item.in_stock && settings.show_stock_availability) {
|
||||||
title_html += `<span class="indicator ${ item.in_stock } card-indicator"></span>`;
|
title_html += `<span class="indicator ${ item.in_stock } card-indicator"></span>`;
|
||||||
}
|
}
|
||||||
title_html += `</div>`;
|
title_html += `</div>`;
|
||||||
@@ -92,7 +92,7 @@ erpnext.ProductList = class {
|
|||||||
return title_html;
|
return title_html;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_item_details(item, settings) {
|
get_item_details(item) {
|
||||||
let details = `
|
let details = `
|
||||||
<p class="product-code">
|
<p class="product-code">
|
||||||
Item Code : ${ item.item_code }
|
Item Code : ${ item.item_code }
|
||||||
@@ -104,7 +104,7 @@ erpnext.ProductList = class {
|
|||||||
${ item.formatted_price || '' }
|
${ item.formatted_price || '' }
|
||||||
`;
|
`;
|
||||||
|
|
||||||
if(item.formatted_mrp) {
|
if (item.formatted_mrp) {
|
||||||
details += `
|
details += `
|
||||||
<small class="ml-1 text-muted">
|
<small class="ml-1 text-muted">
|
||||||
<s>${ item.formatted_mrp }</s>
|
<s>${ item.formatted_mrp }</s>
|
||||||
@@ -155,4 +155,4 @@ erpnext.ProductList = class {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
};
|
||||||
@@ -14,7 +14,7 @@ erpnext.ProductView = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prepare_view_toggler() {
|
prepare_view_toggler() {
|
||||||
if(!$("#list").length || !$("#image-view").length) {
|
if (!$("#list").length || !$("#image-view").length) {
|
||||||
this.render_view_toggler();
|
this.render_view_toggler();
|
||||||
this.bind_view_toggler_actions();
|
this.bind_view_toggler_actions();
|
||||||
this.set_view_state();
|
this.set_view_state();
|
||||||
@@ -109,13 +109,13 @@ erpnext.ProductView = class {
|
|||||||
attribute_filters: attribute_filters,
|
attribute_filters: attribute_filters,
|
||||||
item_group: this.item_group,
|
item_group: this.item_group,
|
||||||
start: filters.start || null
|
start: filters.start || null
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
add_paging_section(settings) {
|
add_paging_section(settings) {
|
||||||
$(".product-paging-area").remove();
|
$(".product-paging-area").remove();
|
||||||
|
|
||||||
if(this.products) {
|
if (this.products) {
|
||||||
let paging_html = `
|
let paging_html = `
|
||||||
<div class="row product-paging-area mt-5">
|
<div class="row product-paging-area mt-5">
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
@@ -126,13 +126,13 @@ erpnext.ProductView = class {
|
|||||||
let start = query_params.start ? cint(JSON.parse(query_params.start)) : 0;
|
let start = query_params.start ? cint(JSON.parse(query_params.start)) : 0;
|
||||||
let page_length = settings.products_per_page || 0;
|
let page_length = settings.products_per_page || 0;
|
||||||
|
|
||||||
if(start > 0) {
|
if (start > 0) {
|
||||||
paging_html += `
|
paging_html += `
|
||||||
<button class="btn btn-default btn-prev" data-start="${ start - page_length }" style="float: left">
|
<button class="btn btn-default btn-prev" data-start="${ start - page_length }" style="float: left">
|
||||||
${ __("Prev") }
|
${ __("Prev") }
|
||||||
</button>`;
|
</button>`;
|
||||||
}
|
}
|
||||||
if(this.products.length > page_length || this.products.length == page_length) {
|
if (this.products.length > page_length || this.products.length == page_length) {
|
||||||
paging_html += `
|
paging_html += `
|
||||||
<button class="btn btn-default btn-next" data-start="${ start + page_length }">
|
<button class="btn btn-default btn-next" data-start="${ start + page_length }">
|
||||||
${ __("Next") }
|
${ __("Next") }
|
||||||
@@ -171,7 +171,7 @@ erpnext.ProductView = class {
|
|||||||
|
|
||||||
$("#products-grid-area").addClass("hidden");
|
$("#products-grid-area").addClass("hidden");
|
||||||
$("#products-list-area").removeClass("hidden");
|
$("#products-list-area").removeClass("hidden");
|
||||||
})
|
});
|
||||||
|
|
||||||
$("#image-view").click(function() {
|
$("#image-view").click(function() {
|
||||||
let $btn = $(this);
|
let $btn = $(this);
|
||||||
@@ -246,7 +246,7 @@ erpnext.ProductView = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render_item_sub_categories(categories) {
|
render_item_sub_categories(categories) {
|
||||||
if(categories) {
|
if (categories) {
|
||||||
let sub_group_html = `
|
let sub_group_html = `
|
||||||
<div class="sub-category-container">
|
<div class="sub-category-container">
|
||||||
<div class="heading"> ${ __('Sub Categories') } </div>
|
<div class="heading"> ${ __('Sub Categories') } </div>
|
||||||
@@ -262,10 +262,10 @@ erpnext.ProductView = class {
|
|||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
`;
|
`;
|
||||||
})
|
});
|
||||||
sub_group_html += `</div>`;
|
sub_group_html += `</div>`;
|
||||||
|
|
||||||
$("#product-listing").prepend(sub_group_html);
|
$("#product-listing").prepend(sub_group_html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
@@ -143,7 +143,6 @@ def create_item_code(amazon_item_json, sku):
|
|||||||
item.description = amazon_item_json.Product.AttributeSets.ItemAttributes.Title
|
item.description = amazon_item_json.Product.AttributeSets.ItemAttributes.Title
|
||||||
item.brand = new_brand
|
item.brand = new_brand
|
||||||
item.manufacturer = new_manufacturer
|
item.manufacturer = new_manufacturer
|
||||||
item.web_long_description = amazon_item_json.Product.AttributeSets.ItemAttributes.Title
|
|
||||||
|
|
||||||
item.image = amazon_item_json.Product.AttributeSets.ItemAttributes.SmallImage.URL
|
item.image = amazon_item_json.Product.AttributeSets.ItemAttributes.SmallImage.URL
|
||||||
|
|
||||||
|
|||||||
@@ -239,11 +239,8 @@ execute:frappe.delete_doc_if_exists("DocType", "Shopping Cart Price List")
|
|||||||
execute:frappe.delete_doc_if_exists("DocType", "Shopping Cart Taxes and Charges Master")
|
execute:frappe.delete_doc_if_exists("DocType", "Shopping Cart Taxes and Charges Master")
|
||||||
|
|
||||||
erpnext.patches.v6_4.set_user_in_contact
|
erpnext.patches.v6_4.set_user_in_contact
|
||||||
erpnext.patches.v6_4.make_image_thumbnail #2015-10-20
|
|
||||||
erpnext.patches.v6_5.show_in_website_for_template_item
|
|
||||||
erpnext.patches.v6_4.fix_expense_included_in_valuation
|
erpnext.patches.v6_4.fix_expense_included_in_valuation
|
||||||
execute:frappe.delete_doc_if_exists("Report", "Item-wise Last Purchase Rate")
|
execute:frappe.delete_doc_if_exists("Report", "Item-wise Last Purchase Rate")
|
||||||
erpnext.patches.v6_6.fix_website_image
|
|
||||||
erpnext.patches.v6_6.remove_fiscal_year_from_leave_allocation
|
erpnext.patches.v6_6.remove_fiscal_year_from_leave_allocation
|
||||||
execute:frappe.delete_doc_if_exists("DocType", "Stock UOM Replace Utility")
|
execute:frappe.delete_doc_if_exists("DocType", "Stock UOM Replace Utility")
|
||||||
erpnext.patches.v6_8.make_webform_standard #2015-11-23
|
erpnext.patches.v6_8.make_webform_standard #2015-11-23
|
||||||
@@ -363,7 +360,6 @@ erpnext.patches.v7_1.set_budget_against_as_cost_center
|
|||||||
erpnext.patches.v7_1.set_currency_exchange_date
|
erpnext.patches.v7_1.set_currency_exchange_date
|
||||||
erpnext.patches.v7_1.set_sales_person_status
|
erpnext.patches.v7_1.set_sales_person_status
|
||||||
erpnext.patches.v7_1.repost_stock_for_deleted_bins_for_merging_items
|
erpnext.patches.v7_1.repost_stock_for_deleted_bins_for_merging_items
|
||||||
erpnext.patches.v7_2.update_website_for_variant
|
|
||||||
erpnext.patches.v7_2.update_assessment_modules
|
erpnext.patches.v7_2.update_assessment_modules
|
||||||
erpnext.patches.v7_2.update_doctype_status
|
erpnext.patches.v7_2.update_doctype_status
|
||||||
erpnext.patches.v7_2.update_salary_slips
|
erpnext.patches.v7_2.update_salary_slips
|
||||||
|
|||||||
@@ -3,4 +3,3 @@ import frappe
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
frappe.db.sql("update `tabItem` set end_of_life='2099-12-31' where ifnull(end_of_life, '0000-00-00')='0000-00-00'")
|
frappe.db.sql("update `tabItem` set end_of_life='2099-12-31' where ifnull(end_of_life, '0000-00-00')='0000-00-00'")
|
||||||
frappe.db.sql("update `tabItem` set website_image = image where ifnull(website_image, '') = 'attach_files:'")
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
from __future__ import print_function, unicode_literals
|
|
||||||
import frappe
|
|
||||||
|
|
||||||
def execute():
|
|
||||||
frappe.reload_doctype("File")
|
|
||||||
frappe.reload_doctype("Item")
|
|
||||||
for item in frappe.get_all("Item", fields=("name", "website_image", "thumbnail")):
|
|
||||||
if item.website_image and not item.thumbnail:
|
|
||||||
item_doc = frappe.get_doc("Item", item.name)
|
|
||||||
try:
|
|
||||||
item_doc.make_thumbnail()
|
|
||||||
if item_doc.thumbnail:
|
|
||||||
item_doc.db_set("thumbnail", item_doc.thumbnail, update_modified=False)
|
|
||||||
except Exception:
|
|
||||||
print("Unable to make thumbnail for {0}".format(item.website_image.encode("utf-8")))
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
import frappe
|
|
||||||
import frappe.website.render
|
|
||||||
|
|
||||||
def execute():
|
|
||||||
for item_code in frappe.db.sql_list("""select distinct variant_of from `tabItem`
|
|
||||||
where variant_of is not null and variant_of !='' and show_in_website=1"""):
|
|
||||||
|
|
||||||
item = frappe.get_doc("Item", item_code)
|
|
||||||
item.db_set("show_in_website", 1, update_modified=False)
|
|
||||||
|
|
||||||
item.make_route()
|
|
||||||
item.db_set("route", item.route, update_modified=False)
|
|
||||||
|
|
||||||
frappe.website.render.clear_cache()
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
from __future__ import print_function, unicode_literals
|
|
||||||
import frappe
|
|
||||||
from frappe.utils import encode
|
|
||||||
|
|
||||||
def execute():
|
|
||||||
"""Fix the File records created via item.py even if the website_image file didn't exist"""
|
|
||||||
for item in frappe.db.sql_list("""select name from `tabItem`
|
|
||||||
where website_image is not null and website_image != ''
|
|
||||||
and website_image like '/files/%'
|
|
||||||
and exists (
|
|
||||||
select name from `tabFile`
|
|
||||||
where attached_to_doctype='Item'
|
|
||||||
and attached_to_name=`tabItem`.name
|
|
||||||
and file_url=`tabItem`.website_image
|
|
||||||
and (file_name is null or file_name = '')
|
|
||||||
)"""):
|
|
||||||
|
|
||||||
item = frappe.get_doc("Item", item)
|
|
||||||
file = frappe.get_doc("File", {
|
|
||||||
"attached_to_doctype": "Item",
|
|
||||||
"attached_to_name": item.name,
|
|
||||||
"file_url": item.website_image
|
|
||||||
})
|
|
||||||
|
|
||||||
try:
|
|
||||||
file.validate_file()
|
|
||||||
except IOError:
|
|
||||||
print(encode(item.website_image), "does not exist")
|
|
||||||
file.delete()
|
|
||||||
item.db_set("website_image", None, update_modified=False)
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
from __future__ import unicode_literals
|
|
||||||
import frappe
|
|
||||||
|
|
||||||
def execute():
|
|
||||||
# variant must have show_in_website = 0
|
|
||||||
frappe.reload_doctype('Item')
|
|
||||||
frappe.db.sql('''
|
|
||||||
update tabItem set
|
|
||||||
show_variant_in_website = 1,
|
|
||||||
show_in_website = 0
|
|
||||||
where
|
|
||||||
show_in_website=1
|
|
||||||
and ifnull(variant_of, "")!=""''')
|
|
||||||
@@ -11,7 +11,6 @@ from frappe.website.website_generator import WebsiteGenerator
|
|||||||
from frappe.website.render import clear_cache
|
from frappe.website.render import clear_cache
|
||||||
from frappe.website.doctype.website_slideshow.website_slideshow import get_slideshow
|
from frappe.website.doctype.website_slideshow.website_slideshow import get_slideshow
|
||||||
from six.moves.urllib.parse import quote
|
from six.moves.urllib.parse import quote
|
||||||
from erpnext.e_commerce.product_query import ProductQuery
|
|
||||||
from erpnext.e_commerce.filters import ProductFiltersBuilder
|
from erpnext.e_commerce.filters import ProductFiltersBuilder
|
||||||
|
|
||||||
class ItemGroup(NestedSet, WebsiteGenerator):
|
class ItemGroup(NestedSet, WebsiteGenerator):
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ frappe.ui.form.on('Item Variant Settings', {
|
|||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
const allow_fields = [];
|
const allow_fields = [];
|
||||||
const exclude_fields = ["naming_series", "item_code", "item_name", "published_in_website",
|
const exclude_fields = ["naming_series", "item_code", "item_name", "published_in_website",
|
||||||
"show_variant_in_website", "opening_stock", "variant_of", "valuation_rate"];
|
"opening_stock", "variant_of", "valuation_rate"];
|
||||||
|
|
||||||
frappe.model.with_doctype('Item', () => {
|
frappe.model.with_doctype('Item', () => {
|
||||||
frappe.get_meta('Item').fields.forEach(d => {
|
frappe.get_meta('Item').fields.forEach(d => {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class ItemVariantSettings(Document):
|
|||||||
exclude_fields = {"naming_series", "item_code", "item_name", "published_in_website",
|
exclude_fields = {"naming_series", "item_code", "item_name", "published_in_website",
|
||||||
"standard_rate", "opening_stock", "image", "description",
|
"standard_rate", "opening_stock", "image", "description",
|
||||||
"variant_of", "valuation_rate", "description", "barcodes",
|
"variant_of", "valuation_rate", "description", "barcodes",
|
||||||
"has_variants", "attributes"}
|
"has_variants", "attributes"}
|
||||||
|
|
||||||
for d in fields:
|
for d in fields:
|
||||||
if not d.no_copy and d.fieldname not in exclude_fields and \
|
if not d.no_copy and d.fieldname not in exclude_fields and \
|
||||||
|
|||||||
Reference in New Issue
Block a user