chore: Removing Item's Website section & references

- Removed old onboarding slide json and `create_onboarding_docs` methods
- Removed website sections from Item master
- Removed references to item website fields
- Shifted Item doctype website methods to Website Item
- Removed WebsiteGenerator from Item doctype
- Website Items in Homepage Products section
- Removed redundant code from item_group.py
- Fix: Item field filters won’t appear in website
This commit is contained in:
marination 2021-02-19 12:50:01 +05:30
parent eef9cf152f
commit 025574d9b5
28 changed files with 139 additions and 1161 deletions

View File

@ -41,9 +41,7 @@ def test_create_test_data():
"selling_cost_center": "Main - _TC", "selling_cost_center": "Main - _TC",
"income_account": "Sales - _TC" "income_account": "Sales - _TC"
}], }],
"show_in_website": 1,
"route":"-test-tesla-car", "route":"-test-tesla-car",
"website_warehouse": "Stores - _TC"
}) })
item.insert() item.insert()
# create test item price # create test item price

View File

@ -128,28 +128,6 @@ class Supplier(TransactionBase):
if frappe.defaults.get_global_default('supp_master_name') == 'Supplier Name': if frappe.defaults.get_global_default('supp_master_name') == 'Supplier Name':
frappe.db.set(self, "supplier_name", newdn) frappe.db.set(self, "supplier_name", newdn)
def create_onboarding_docs(self, args):
company = frappe.defaults.get_defaults().get('company') or \
frappe.db.get_single_value('Global Defaults', 'default_company')
for i in range(1, args.get('max_count')):
supplier = args.get('supplier_name_' + str(i))
if supplier:
try:
doc = frappe.get_doc({
'doctype': self.doctype,
'supplier_name': supplier,
'supplier_group': _('Local'),
'company': company
}).insert()
if args.get('supplier_email_' + str(i)):
from erpnext.selling.doctype.customer.customer import create_contact
create_contact(supplier, 'Supplier',
doc.name, args.get('supplier_email_' + str(i)))
except frappe.NameError:
pass
@frappe.whitelist() @frappe.whitelist()
@frappe.validate_and_sanitize_search_inputs @frappe.validate_and_sanitize_search_inputs
def get_supplier_primary_contact(doctype, txt, searchfield, start, page_len, filters): def get_supplier_primary_contact(doctype, txt, searchfield, start, page_len, filters):

View File

@ -1,49 +0,0 @@
{
"add_more_button": 1,
"app": "ERPNext",
"creation": "2019-11-15 14:45:32.626641",
"docstatus": 0,
"doctype": "Onboarding Slide",
"domains": [],
"help_links": [
{
"label": "Learn More",
"video_id": "zsrrVDk6VBs"
}
],
"idx": 0,
"image_src": "",
"is_completed": 0,
"max_count": 3,
"modified": "2019-12-09 17:54:18.452038",
"modified_by": "Administrator",
"name": "Add A Few Suppliers",
"owner": "Administrator",
"ref_doctype": "Supplier",
"slide_desc": "",
"slide_fields": [
{
"align": "",
"fieldname": "supplier_name",
"fieldtype": "Data",
"label": "Supplier Name",
"placeholder": "",
"reqd": 1
},
{
"align": "",
"fieldtype": "Column Break",
"reqd": 0
},
{
"align": "",
"fieldname": "supplier_email",
"fieldtype": "Data",
"label": "Supplier Email",
"reqd": 1
}
],
"slide_order": 50,
"slide_title": "Add A Few Suppliers",
"slide_type": "Create"
}

View File

@ -264,9 +264,8 @@ def generate_keyed_value_combinations(args):
def copy_attributes_to_variant(item, variant): def copy_attributes_to_variant(item, variant):
# copy non no-copy fields # copy non no-copy fields
exclude_fields = ["naming_series", "item_code", "item_name", "show_in_website", 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"]
"has_variants", "attributes"]
if item.variant_based_on=='Manufacturer': if item.variant_based_on=='Manufacturer':
# don't copy manufacturer values if based on part no # don't copy manufacturer values if based on part no

View File

@ -54,7 +54,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -138,7 +137,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -220,7 +218,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -302,7 +299,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -384,7 +380,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -466,7 +461,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -548,7 +542,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -630,7 +623,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -712,7 +704,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -794,7 +785,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -876,7 +866,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -958,7 +947,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -1040,7 +1028,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -1122,7 +1109,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -1204,7 +1190,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -1286,7 +1271,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -1368,7 +1352,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -1450,7 +1433,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -1532,7 +1514,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -1614,7 +1595,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -1696,7 +1676,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -1778,7 +1757,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -1860,7 +1838,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -1942,7 +1919,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -2024,7 +2000,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -2106,7 +2081,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -2188,7 +2162,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -2270,7 +2243,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -2352,7 +2324,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -2434,7 +2405,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -2516,7 +2486,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -2598,7 +2567,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -2680,7 +2648,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -2762,7 +2729,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -2844,7 +2810,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -2926,7 +2891,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -3008,7 +2972,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -3092,7 +3055,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -3174,7 +3136,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -3256,7 +3217,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -3338,7 +3298,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -3420,7 +3379,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -3502,7 +3460,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -3584,7 +3541,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -3666,7 +3622,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -3748,7 +3703,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -3830,7 +3784,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -3912,7 +3865,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -3994,7 +3946,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -4076,7 +4027,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -4158,7 +4108,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -4240,7 +4189,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -4322,7 +4270,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -4404,7 +4351,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -4486,7 +4432,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -4568,7 +4513,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -4650,7 +4594,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -4732,7 +4675,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -4814,7 +4756,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -4896,7 +4837,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -4978,7 +4918,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -5060,7 +4999,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,
@ -5142,7 +5080,6 @@
"safety_stock": 0.0, "safety_stock": 0.0,
"selling_cost_center": null, "selling_cost_center": null,
"serial_no_series": null, "serial_no_series": null,
"show_in_website": 0,
"show_variant_in_website": 0, "show_variant_in_website": 0,
"slideshow": null, "slideshow": null,
"standard_rate": 0.0, "standard_rate": 0.0,

View File

@ -2,7 +2,18 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Website Item', { frappe.ui.form.on('Website Item', {
// refresh: function(frm) { image: function() {
refresh_field("image_view");
},
// } copy_from_item_group: function(frm) {
return frm.call({
doc: frm.doc,
method: "copy_specification_from_item_group"
});
},
set_meta_tags(frm) {
frappe.utils.set_meta_tag(frm.doc.route);
}
}); });

View File

@ -271,7 +271,7 @@
"image_field": "image", "image_field": "image",
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2021-02-12 16:49:42.275517", "modified": "2021-02-18 13:23:18.286883",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "E-commerce", "module": "E-commerce",
"name": "Website Item", "name": "Website Item",
@ -290,9 +290,10 @@
"write": 1 "write": 1
} }
], ],
"search_fields": "item_code, item_name ,item_group",
"show_name_in_global_search": 1, "show_name_in_global_search": 1,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "web_item_name", "title_field": "item_name",
"track_changes": 1 "track_changes": 1
} }

View File

@ -7,15 +7,12 @@ import frappe
import json import json
import itertools import itertools
from frappe import _ from frappe import _
from six import iteritems
from frappe.website.doctype.website_slideshow.website_slideshow import \
get_slideshow
from frappe.website.render import clear_cache from frappe.website.render import clear_cache
from frappe.website.website_generator import WebsiteGenerator from frappe.website.website_generator import WebsiteGenerator
from frappe.utils import cstr, random_string, cint from frappe.utils import cstr, random_string, cint, flt
from erpnext.setup.doctype.item_group.item_group import get_parent_item_groups from erpnext.setup.doctype.item_group.item_group import (get_parent_item_groups, invalidate_cache_for)
class WebsiteItem(WebsiteGenerator): class WebsiteItem(WebsiteGenerator):
website = frappe._dict( website = frappe._dict(
@ -39,7 +36,13 @@ class WebsiteItem(WebsiteGenerator):
self.make_thumbnail() self.make_thumbnail()
self.publish_unpublish_desk_item(publish=True) self.publish_unpublish_desk_item(publish=True)
if not self.get("__islocal"):
self.old_website_item_groups = frappe.db.sql_list("""select item_group
from `tabWebsite Item Group`
where parentfield='website_item_groups' and parenttype='Item' and parent=%s""", self.name)
def on_update(self): def on_update(self):
invalidate_cache_for_web_item(self)
self.update_template_item() self.update_template_item()
def on_trash(self): def on_trash(self):
@ -69,10 +72,9 @@ class WebsiteItem(WebsiteGenerator):
# show template # show template
template_item = frappe.get_doc("Item", self.variant_of) template_item = frappe.get_doc("Item", self.variant_of)
if not template_item.published: if not template_item.published_in_website:
template_item.published = 1
template_item.flags.ignore_permissions = True template_item.flags.ignore_permissions = True
template_item.save() make_website_item(template_item)
def validate_website_image(self): def validate_website_image(self):
if frappe.flags.in_import: if frappe.flags.in_import:
@ -160,7 +162,6 @@ class WebsiteItem(WebsiteGenerator):
self.thumbnail = file_doc.thumbnail_url self.thumbnail = file_doc.thumbnail_url
def get_context(self, context): def get_context(self, context):
print(context)
context.show_search = True context.show_search = True
context.search_link = '/search' context.search_link = '/search'
@ -174,7 +175,6 @@ class WebsiteItem(WebsiteGenerator):
self.set_disabled_attributes(context) self.set_disabled_attributes(context)
self.set_metatags(context) self.set_metatags(context)
self.set_shopping_cart_data(context) self.set_shopping_cart_data(context)
print("IN WEB ITEM")
return context return context
@ -317,6 +317,28 @@ class WebsiteItem(WebsiteGenerator):
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.item_code, skip_quotation_creation=True) context.shopping_cart = get_product_info_for_website(self.item_code, skip_quotation_creation=True)
def copy_specification_from_item_group(self):
self.set("website_specifications", [])
if self.item_group:
for label, desc in frappe.db.get_values("Item Website Specification",
{"parent": self.item_group}, ["label", "description"]):
row = self.append("website_specifications")
row.label = label
row.description = desc
def invalidate_cache_for_web_item(doc):
from erpnext.stock.doctype.item.item import invalidate_item_variants_cache_for_website
invalidate_cache_for(doc, doc.item_group)
website_item_groups = list(set((doc.get("old_website_item_groups") or [])
+ [d.item_group for d in doc.get({"doctype": "Website Item Group"}) if d.item_group]))
for item_group in website_item_groups:
invalidate_cache_for(doc, item_group)
invalidate_item_variants_cache_for_website(doc)
@frappe.whitelist() @frappe.whitelist()
def make_website_item(doc): def make_website_item(doc):
if not doc: if not doc:

View File

@ -77,7 +77,7 @@ domains = {
'Services': 'erpnext.domains.services', 'Services': 'erpnext.domains.services',
} }
website_generators = ["Item Group", "Item", "BOM", "Sales Partner", website_generators = ["Item Group", "Website Item", "BOM", "Sales Partner",
"Job Opening", "Student Admission"] "Job Opening", "Student Admission"]
website_context = { website_context = {

View File

@ -3,9 +3,9 @@
frappe.ui.form.on('Homepage', { frappe.ui.form.on('Homepage', {
setup: function(frm) { setup: function(frm) {
frm.fields_dict["products"].grid.get_field("item_code").get_query = function(){ frm.fields_dict["products"].grid.get_field("item").get_query = function(){
return { return {
filters: {'show_in_website': 1} filters: {'published': 1}
} }
} }
}, },
@ -21,11 +21,10 @@ frappe.ui.form.on('Homepage', {
}); });
frappe.ui.form.on('Homepage Featured Product', { frappe.ui.form.on('Homepage Featured Product', {
view: function(frm, cdt, cdn){ view: function(frm, cdt, cdn){
var child= locals[cdt][cdn] var child= locals[cdt][cdn]
if(child.item_code && frm.doc.products_url){ if(child.item_code && child.route){
window.location.href = frm.doc.products_url + '/' + encodeURIComponent(child.item_code); window.open('/' + child.route, '_blank');
} }
} }
}); });

View File

@ -1,518 +1,143 @@
{ {
"allow_copy": 0, "actions": [],
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "",
"beta": 1, "beta": 1,
"creation": "2016-04-22 05:27:52.109319", "creation": "2016-04-22 05:27:52.109319",
"custom": 0,
"docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "Setup", "document_type": "Setup",
"editable_grid": 0,
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [
"company",
"hero_section_based_on",
"column_break_2",
"title",
"section_break_4",
"tag_line",
"description",
"hero_image",
"slideshow",
"hero_section",
"products_section",
"products_url",
"products"
],
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "company", "fieldname": "company",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 0,
"label": "Company", "label": "Company",
"length": 0,
"no_copy": 0,
"options": "Company", "options": "Company",
"permlevel": 0, "reqd": 1
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "hero_section_based_on", "fieldname": "hero_section_based_on",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Hero Section Based On", "label": "Hero Section Based On",
"length": 0, "options": "Default\nSlideshow\nHomepage Section"
"no_copy": 0,
"options": "Default\nSlideshow\nHomepage Section",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_2", "fieldname": "column_break_2",
"fieldtype": "Column Break", "fieldtype": "Column Break"
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fieldname": "title", "fieldname": "title",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "label": "Title"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Title",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fieldname": "section_break_4", "fieldname": "section_break_4",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "label": "Hero Section"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Hero Section",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.hero_section_based_on === 'Default'", "depends_on": "eval:doc.hero_section_based_on === 'Default'",
"description": "Company Tagline for website homepage", "description": "Company Tagline for website homepage",
"fieldname": "tag_line", "fieldname": "tag_line",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 0,
"label": "Tag Line", "label": "Tag Line",
"length": 0, "reqd": 1
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.hero_section_based_on === 'Default'", "depends_on": "eval:doc.hero_section_based_on === 'Default'",
"description": "Company Description for website homepage", "description": "Company Description for website homepage",
"fieldname": "description", "fieldname": "description",
"fieldtype": "Text", "fieldtype": "Text",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 0,
"label": "Description", "label": "Description",
"length": 0, "reqd": 1
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.hero_section_based_on === 'Default'", "depends_on": "eval:doc.hero_section_based_on === 'Default'",
"fieldname": "hero_image", "fieldname": "hero_image",
"fieldtype": "Attach Image", "fieldtype": "Attach Image",
"hidden": 0, "label": "Hero Image"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Hero Image",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.hero_section_based_on === 'Slideshow'", "depends_on": "eval:doc.hero_section_based_on === 'Slideshow'",
"description": "",
"fieldname": "slideshow", "fieldname": "slideshow",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Homepage Slideshow", "label": "Homepage Slideshow",
"length": 0, "options": "Website Slideshow"
"no_copy": 0,
"options": "Website Slideshow",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.hero_section_based_on === 'Homepage Section'", "depends_on": "eval:doc.hero_section_based_on === 'Homepage Section'",
"fieldname": "hero_section", "fieldname": "hero_section",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Homepage Section", "label": "Homepage Section",
"length": 0, "options": "Homepage Section"
"no_copy": 0,
"options": "Homepage Section",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fieldname": "products_section", "fieldname": "products_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "label": "Products"
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Products",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0, "default": "/all-products",
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "/products",
"fieldname": "products_url", "fieldname": "products_url",
"fieldtype": "Data", "fieldtype": "Data",
"hidden": 0, "label": "URL for \"All Products\""
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "URL for \"All Products\"",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}, },
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "Products to be shown on website homepage", "description": "Products to be shown on website homepage",
"fieldname": "products", "fieldname": "products",
"fieldtype": "Table", "fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Products", "label": "Products",
"length": 0,
"no_copy": 0,
"options": "Homepage Featured Product", "options": "Homepage Featured Product",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0,
"width": "40px" "width": "40px"
} }
], ],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 1, "issingle": 1,
"istable": 0, "links": [],
"max_attachments": 0, "modified": "2021-02-18 13:29:29.531639",
"modified": "2019-03-02 23:12:59.676202",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Portal", "module": "Portal",
"name": "Homepage", "name": "Homepage",
"name_case": "",
"owner": "Administrator", "owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 0,
"cancel": 0,
"create": 1, "create": 1,
"delete": 1, "delete": 1,
"email": 1, "email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 0,
"role": "System Manager", "role": "System Manager",
"set_user_permissions": 0,
"share": 1, "share": 1,
"submit": 0,
"write": 1 "write": 1
}, },
{ {
"amend": 0,
"cancel": 0,
"create": 1, "create": 1,
"delete": 1, "delete": 1,
"email": 1, "email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1, "print": 1,
"read": 1, "read": 1,
"report": 0,
"role": "Administrator", "role": "Administrator",
"set_user_permissions": 0,
"share": 1, "share": 1,
"submit": 0,
"write": 1 "write": 1
} }
], ],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "company", "title_field": "company",
"track_changes": 1, "track_changes": 1
"track_seen": 0,
"track_views": 0
} }

View File

@ -17,7 +17,7 @@ class Homepage(Document):
def setup_items(self): def setup_items(self):
for d in frappe.get_all('Item', fields=['name', 'item_name', 'description', 'image'], for d in frappe.get_all('Item', fields=['name', 'item_name', 'description', 'image'],
filters={'show_in_website': 1}, limit=3): filters={'published_in_website': 1}, limit=3):
doc = frappe.get_doc('Item', d.name) doc = frappe.get_doc('Item', d.name)
if not doc.route: if not doc.route:

View File

@ -25,10 +25,10 @@
"fieldtype": "Link", "fieldtype": "Link",
"in_filter": 1, "in_filter": 1,
"in_list_view": 1, "in_list_view": 1,
"label": "Item Code", "label": "Item",
"oldfieldname": "item_code", "oldfieldname": "item_code",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Item", "options": "Website Item",
"print_width": "150px", "print_width": "150px",
"reqd": 1, "reqd": 1,
"search_index": 1, "search_index": 1,
@ -63,7 +63,7 @@
"collapsible": 1, "collapsible": 1,
"fieldname": "section_break_5", "fieldname": "section_break_5",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Description" "label": "Details"
}, },
{ {
"fetch_from": "item_code.web_long_description", "fetch_from": "item_code.web_long_description",
@ -89,12 +89,14 @@
"label": "Image" "label": "Image"
}, },
{ {
"fetch_from": "item_code.thumbnail",
"fieldname": "thumbnail", "fieldname": "thumbnail",
"fieldtype": "Attach Image", "fieldtype": "Attach Image",
"hidden": 1, "hidden": 1,
"label": "Thumbnail" "label": "Thumbnail"
}, },
{ {
"fetch_from": "item_code.route",
"fieldname": "route", "fieldname": "route",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"label": "route", "label": "route",
@ -104,7 +106,7 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2020-08-25 15:27:49.573537", "modified": "2021-02-18 13:05:50.669311",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Portal", "module": "Portal",
"name": "Homepage Featured Product", "name": "Homepage Featured Product",

View File

@ -1,76 +1,32 @@
{ {
"allow_copy": 0, "actions": [],
"allow_events_in_timeline": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2019-01-01 13:04:54.479079", "creation": "2019-01-01 13:04:54.479079",
"custom": 0,
"docstatus": 0,
"doctype": "DocType", "doctype": "DocType",
"document_type": "",
"editable_grid": 1, "editable_grid": 1,
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [
"attribute"
],
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "attribute", "fieldname": "attribute",
"fieldtype": "Link", "fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1, "in_list_view": 1,
"in_standard_filter": 0,
"label": "Attribute", "label": "Attribute",
"length": 0,
"no_copy": 0,
"options": "Item Attribute", "options": "Item Attribute",
"permlevel": 0, "reqd": 1
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
} }
], ],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "links": [],
"modified": "2019-01-01 13:04:59.715572", "modified": "2021-02-18 13:18:57.810536",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Portal", "module": "Portal",
"name": "Website Attribute", "name": "Website Attribute",
"name_case": "",
"owner": "Administrator", "owner": "Administrator",
"permissions": [], "permissions": [],
"quick_entry": 1, "quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"track_changes": 1, "track_changes": 1
"track_seen": 0,
"track_views": 0
} }

View File

@ -294,30 +294,6 @@ class Customer(TransactionBase):
.format(frappe.bold(self.customer_name)) .format(frappe.bold(self.customer_name))
) )
def create_onboarding_docs(self, args):
defaults = frappe.defaults.get_defaults()
company = defaults.get('company') or \
frappe.db.get_single_value('Global Defaults', 'default_company')
for i in range(1, args.get('max_count')):
customer = args.get('customer_name_' + str(i))
if customer:
try:
doc = frappe.get_doc({
'doctype': self.doctype,
'customer_name': customer,
'customer_type': 'Company',
'customer_group': _('Commercial'),
'territory': defaults.get('country'),
'company': company
}).insert()
if args.get('customer_email_' + str(i)):
create_contact(customer, self.doctype,
doc.name, args.get("customer_email_" + str(i)))
except frappe.NameError:
pass
def create_contact(contact, party_type, party, email): def create_contact(contact, party_type, party, email):
"""Create contact based on given contact name""" """Create contact based on given contact name"""
contact = contact.split(' ') contact = contact.split(' ')

View File

@ -1,49 +0,0 @@
{
"add_more_button": 1,
"app": "ERPNext",
"creation": "2019-11-15 14:44:10.065014",
"docstatus": 0,
"doctype": "Onboarding Slide",
"domains": [],
"help_links": [
{
"label": "Learn More",
"video_id": "zsrrVDk6VBs"
}
],
"idx": 0,
"image_src": "",
"is_completed": 0,
"max_count": 3,
"modified": "2019-12-09 17:54:01.686006",
"modified_by": "Administrator",
"name": "Add A Few Customers",
"owner": "Administrator",
"ref_doctype": "Customer",
"slide_desc": "",
"slide_fields": [
{
"align": "",
"fieldname": "customer_name",
"fieldtype": "Data",
"label": "Customer Name",
"placeholder": "",
"reqd": 1
},
{
"align": "",
"fieldtype": "Column Break",
"reqd": 0
},
{
"align": "",
"fieldname": "customer_email",
"fieldtype": "Data",
"label": "Email ID",
"reqd": 1
}
],
"slide_order": 40,
"slide_title": "Add A Few Customers",
"slide_type": "Create"
}

View File

@ -138,85 +138,6 @@ class ItemGroup(NestedSet, WebsiteGenerator):
from erpnext.stock.doctype.item.item import validate_item_default_company_links from erpnext.stock.doctype.item.item import validate_item_default_company_links
validate_item_default_company_links(self.item_group_defaults) validate_item_default_company_links(self.item_group_defaults)
@frappe.whitelist(allow_guest=True)
def get_product_list_for_group(product_group=None, start=0, limit=10, search=None):
if product_group:
item_group = frappe.get_cached_doc('Item Group', product_group)
if item_group.is_group:
# return child item groups if the type is of "Is Group"
return get_child_groups_for_list_in_html(item_group, start, limit, search)
child_groups = ", ".join(frappe.db.escape(i[0]) for i in get_child_groups(product_group))
# base query
query = """select I.name, I.item_name, I.item_code, I.route, I.image, I.website_image, I.thumbnail, I.item_group,
I.description, I.web_long_description as website_description, I.is_stock_item,
case when (S.actual_qty - S.reserved_qty) > 0 then 1 else 0 end as in_stock, I.website_warehouse,
I.has_batch_no
from `tabItem` I
left join tabBin S on I.item_code = S.item_code and I.website_warehouse = S.warehouse
where I.show_in_website = 1
and I.disabled = 0
and (I.end_of_life is null or I.end_of_life='0000-00-00' or I.end_of_life > %(today)s)
and (I.variant_of = '' or I.variant_of is null)
and (I.item_group in ({child_groups})
or I.name in (select parent from `tabWebsite Item Group` where item_group in ({child_groups})))
""".format(child_groups=child_groups)
# search term condition
if search:
query += """ and (I.web_long_description like %(search)s
or I.item_name like %(search)s
or I.name like %(search)s)"""
search = "%" + cstr(search) + "%"
query += """order by I.weightage desc, in_stock desc, I.modified desc limit %s, %s""" % (cint(start), cint(limit))
data = frappe.db.sql(query, {"product_group": product_group,"search": search, "today": nowdate()}, as_dict=1)
data = adjust_qty_for_expired_items(data)
if cint(frappe.db.get_single_value("E Commerce Settings", "enabled")):
for item in data:
set_product_info_for_website(item)
return data
def get_child_groups_for_list_in_html(item_group, start, limit, search):
search_filters = None
if search_filters:
search_filters = [
dict(name = ('like', '%{}%'.format(search))),
dict(description = ('like', '%{}%'.format(search)))
]
data = frappe.db.get_all('Item Group',
fields = ['name', 'route', 'description', 'image'],
filters = dict(
show_in_website = 1,
parent_item_group = item_group.name,
lft = ('>', item_group.lft),
rgt = ('<', item_group.rgt),
),
or_filters = search_filters,
order_by = 'weightage desc, name asc',
start = start,
limit = limit
)
return data
def adjust_qty_for_expired_items(data):
adjusted_data = []
for item in data:
if item.get('has_batch_no') and item.get('website_warehouse'):
stock_qty_dict = get_qty_in_stock(
item.get('name'), 'website_warehouse', item.get('website_warehouse'))
qty = stock_qty_dict.stock_qty[0][0] if stock_qty_dict.stock_qty else 0
item['in_stock'] = 1 if qty else 0
adjusted_data.append(item)
return adjusted_data
def get_child_groups(item_group_name): def get_child_groups(item_group_name):
item_group = frappe.get_doc("Item Group", item_group_name) item_group = frappe.get_doc("Item Group", item_group_name)
return frappe.db.sql("""select name return frappe.db.sql("""select name
@ -245,14 +166,6 @@ def get_item_for_list_in_html(context):
return frappe.get_template(products_template).render(context) return frappe.get_template(products_template).render(context)
def get_group_item_count(item_group):
child_groups = ", ".join('"' + i[0] + '"' for i in get_child_groups(item_group))
return frappe.db.sql("""select count(*) from `tabItem`
where docstatus = 0 and show_in_website = 1
and (item_group in (%s)
or name in (select parent from `tabWebsite Item Group`
where item_group in (%s))) """ % (child_groups, child_groups))[0][0]
def get_parent_item_groups(item_group_name): def get_parent_item_groups(item_group_name):
base_parents = [ base_parents = [

View File

@ -1,23 +0,0 @@
{
"add_more_button": 0,
"app": "ERPNext",
"creation": "2019-12-04 19:21:39.995776",
"docstatus": 0,
"doctype": "Onboarding Slide",
"domains": [],
"help_links": [],
"idx": 0,
"image_src": "",
"is_completed": 0,
"max_count": 3,
"modified": "2019-12-09 17:53:53.849953",
"modified_by": "Administrator",
"name": "Welcome back to ERPNext!",
"owner": "Administrator",
"slide_desc": "<p>Let's continue where you left from!</p>",
"slide_fields": [],
"slide_module": "Setup",
"slide_order": 0,
"slide_title": "Welcome back to ERPNext!",
"slide_type": "Continue"
}

View File

@ -1,23 +0,0 @@
{
"add_more_button": 0,
"app": "ERPNext",
"creation": "2019-11-26 17:01:26.671859",
"docstatus": 0,
"doctype": "Onboarding Slide",
"domains": [],
"help_links": [],
"idx": 0,
"image_src": "",
"is_completed": 0,
"max_count": 0,
"modified": "2019-12-22 21:26:28.414597",
"modified_by": "Administrator",
"name": "Welcome to ERPNext!",
"owner": "Administrator",
"slide_desc": "<div class=\"text center\">Setting up an ERP can be overwhelming. But don't worry, we have got your back! This wizard will help you onboard to ERPNext in a short time!</div>",
"slide_fields": [],
"slide_module": "Setup",
"slide_order": 1,
"slide_title": "Welcome to ERPNext!",
"slide_type": "Information"
}

View File

@ -48,8 +48,7 @@ class ProductFiltersBuilder:
values = [d.name for d in frappe.get_all(doctype, filters)] values = [d.name for d in frappe.get_all(doctype, filters)]
# Remove None # Remove None
if None in values: if None in values: values.remove(None)
values.remove(None)
if values: if values:
filter_data.append([df, values]) filter_data.append([df, values])

View File

@ -111,7 +111,7 @@ class ProductSearch(FullTextSearch):
) )
def get_all_published_items(): def get_all_published_items():
return frappe.get_all("Item", filters={"variant_of": "", "show_in_website": 1},pluck="name") return frappe.get_all("Website Item", filters={"variant_of": "", "published": 1}, pluck="item_code")
def update_index_for_path(path): def update_index_for_path(path):
search = ProductSearch(INDEX_NAME) search = ProductSearch(INDEX_NAME)

View File

@ -91,7 +91,7 @@ frappe.ui.form.on("Item", {
erpnext.toggle_naming_series(); erpnext.toggle_naming_series();
} }
if(!frm.doc.published_in_website) { if (!frm.doc.published_in_website) {
frm.add_custom_button(__("Publish in Website"), function() { frm.add_custom_button(__("Publish in Website"), function() {
frappe.call({ frappe.call({
method: "erpnext.e_commerce.doctype.website_item.website_item.make_website_item", method: "erpnext.e_commerce.doctype.website_item.website_item.make_website_item",
@ -205,25 +205,8 @@ frappe.ui.form.on("Item", {
} }
}, },
copy_from_item_group: function(frm) {
return frm.call({
doc: frm.doc,
method: "copy_specification_from_item_group"
});
},
has_variants: function(frm) { has_variants: function(frm) {
erpnext.item.toggle_attributes(frm); erpnext.item.toggle_attributes(frm);
},
show_in_website: function(frm) {
if (frm.doc.default_warehouse && !frm.doc.website_warehouse){
frm.set_value("website_warehouse", frm.doc.default_warehouse);
}
},
set_meta_tags(frm) {
frappe.utils.set_meta_tag(frm.doc.route);
} }
}); });

View File

@ -116,24 +116,6 @@
"customer_code", "customer_code",
"default_item_manufacturer", "default_item_manufacturer",
"default_manufacturer_part_no", "default_manufacturer_part_no",
"website_section",
"published_in_website",
"show_in_website",
"show_variant_in_website",
"route",
"weightage",
"slideshow",
"website_image",
"website_image_alt",
"cb72",
"website_warehouse",
"website_item_groups",
"set_meta_tags",
"sb72",
"copy_from_item_group",
"website_specifications",
"web_long_description",
"website_content",
"total_projected_qty", "total_projected_qty",
"hub_publishing_sb", "hub_publishing_sb",
"publish_in_hub", "publish_in_hub",
@ -869,119 +851,6 @@
"no_copy": 1, "no_copy": 1,
"print_hide": 1 "print_hide": 1
}, },
{
"collapsible": 1,
"depends_on": "eval:!doc.is_fixed_asset",
"fieldname": "website_section",
"fieldtype": "Section Break",
"label": "Website",
"options": "fa fa-globe"
},
{
"default": "0",
"depends_on": "eval:!doc.variant_of",
"fieldname": "show_in_website",
"fieldtype": "Check",
"label": "Show in Website",
"search_index": 1
},
{
"default": "0",
"depends_on": "variant_of",
"fieldname": "show_variant_in_website",
"fieldtype": "Check",
"label": "Show in Website (Variant)",
"search_index": 1
},
{
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"fieldname": "route",
"fieldtype": "Small Text",
"label": "Route",
"no_copy": 1
},
{
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"description": "Items with higher weightage will be shown higher",
"fieldname": "weightage",
"fieldtype": "Int",
"label": "Weightage"
},
{
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"description": "Show a slideshow at the top of the page",
"fieldname": "slideshow",
"fieldtype": "Link",
"label": "Slideshow",
"options": "Website Slideshow"
},
{
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"description": "Item Image (if not slideshow)",
"fieldname": "website_image",
"fieldtype": "Attach",
"label": "Website Image"
},
{
"fieldname": "cb72",
"fieldtype": "Column Break"
},
{
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"description": "Show \"In Stock\" or \"Not in Stock\" based on stock available in this warehouse.",
"fieldname": "website_warehouse",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Website Warehouse",
"options": "Warehouse"
},
{
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"description": "List this Item in multiple groups on the website.",
"fieldname": "website_item_groups",
"fieldtype": "Table",
"label": "Website Item Groups",
"options": "Website Item Group"
},
{
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"fieldname": "set_meta_tags",
"fieldtype": "Button",
"label": "Set Meta Tags"
},
{
"collapsible": 1,
"collapsible_depends_on": "website_specifications",
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"fieldname": "sb72",
"fieldtype": "Section Break",
"label": "Website Specifications"
},
{
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"fieldname": "copy_from_item_group",
"fieldtype": "Button",
"label": "Copy From Item Group"
},
{
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"fieldname": "website_specifications",
"fieldtype": "Table",
"label": "Website Specifications",
"options": "Item Website Specification"
},
{
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"fieldname": "web_long_description",
"fieldtype": "Text Editor",
"label": "Website Description"
},
{
"description": "You can use any valid Bootstrap 4 markup in this field. It will be shown on your Item Page.",
"fieldname": "website_content",
"fieldtype": "HTML Editor",
"label": "Website Content"
},
{ {
"fieldname": "total_projected_qty", "fieldname": "total_projected_qty",
"fieldtype": "Float", "fieldtype": "Float",
@ -1057,24 +926,8 @@
"fieldtype": "Data", "fieldtype": "Data",
"label": "Default Manufacturer Part No", "label": "Default Manufacturer Part No",
"read_only": 1 "read_only": 1
},
{
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"fieldname": "website_image_alt",
"fieldtype": "Data",
"label": "Image Description"
},
{
"default": "0",
"fieldname": "published_in_website",
"fieldtype": "Check",
"label": "Published in Website",
"no_copy": 1,
"read_only": 1,
"search_index": 1
} }
], ],
"has_web_view": 1,
"icon": "fa fa-tag", "icon": "fa fa-tag",
"idx": 2, "idx": 2,
"image_field": "image", "image_field": "image",

View File

@ -22,6 +22,7 @@ from frappe.utils import (
) )
from frappe.utils.html_utils import clean_html from frappe.utils.html_utils import clean_html
from frappe.website.utils import clear_cache from frappe.website.utils import clear_cache
from frappe.model.document import Document
from frappe.website.website_generator import WebsiteGenerator from frappe.website.website_generator import WebsiteGenerator
import erpnext import erpnext
@ -51,17 +52,8 @@ class InvalidBarcode(frappe.ValidationError):
pass pass
class Item(WebsiteGenerator): class Item(Document):
website = frappe._dict(
page_title_field="item_name",
condition_field="show_in_website",
template="templates/generators/item/item.html",
no_cache=1
)
def onload(self): def onload(self):
super(Item, self).onload()
self.set_onload('stock_exists', self.stock_ledger_created()) self.set_onload('stock_exists', self.stock_ledger_created())
self.set_asset_naming_series() self.set_asset_naming_series()
@ -102,8 +94,6 @@ class Item(WebsiteGenerator):
self.set_opening_stock() self.set_opening_stock()
def validate(self): def validate(self):
super(Item, self).validate()
if not self.item_name: if not self.item_name:
self.item_name = self.item_code self.item_name = self.item_code
@ -143,9 +133,6 @@ class Item(WebsiteGenerator):
if not self.is_new(): if not self.is_new():
self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group") self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group")
self.old_website_item_groups = frappe.db.sql_list("""select item_group
from `tabWebsite Item Group`
where parentfield='website_item_groups' and parenttype='Item' and parent=%s""", self.name)
def on_update(self): def on_update(self):
invalidate_cache_for_item(self) invalidate_cache_for_item(self)
@ -485,16 +472,6 @@ class Item(WebsiteGenerator):
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", existing_allow_negative_stock) frappe.db.set_value("Stock Settings", None, "allow_negative_stock", existing_allow_negative_stock)
frappe.db.auto_commit_on_many_writes = 0 frappe.db.auto_commit_on_many_writes = 0
@frappe.whitelist()
def copy_specification_from_item_group(self):
self.set("website_specifications", [])
if self.item_group:
for label, desc in frappe.db.get_values("Item Website Specification",
{"parent": self.item_group}, ["label", "description"]):
row = self.append("website_specifications")
row.label = label
row.description = desc
def update_bom_item_desc(self): def update_bom_item_desc(self):
if self.is_new(): if self.is_new():
return return
@ -768,46 +745,6 @@ class Item(WebsiteGenerator):
if not enabled: if not enabled:
frappe.msgprint(msg=_("You have to enable auto re-order in Stock Settings to maintain re-order levels."), title=_("Enable Auto Re-Order"), indicator="orange") frappe.msgprint(msg=_("You have to enable auto re-order in Stock Settings to maintain re-order levels."), title=_("Enable Auto Re-Order"), indicator="orange")
def create_onboarding_docs(self, args):
company = frappe.defaults.get_defaults().get('company') or \
frappe.db.get_single_value('Global Defaults', 'default_company')
for i in range(1, args.get('max_count')):
item = args.get('item_' + str(i))
if item:
default_warehouse = ''
default_warehouse = frappe.db.get_value('Warehouse', filters={
'warehouse_name': _('Finished Goods'),
'company': company
})
try:
frappe.get_doc({
'doctype': self.doctype,
'item_code': item,
'item_name': item,
'description': item,
'is_sales_item': 1,
'is_purchase_item': 1,
'is_stock_item': 1,
'item_group': _('Products'),
'stock_uom': _(args.get('item_uom_' + str(i))),
'item_defaults': [{
'default_warehouse': default_warehouse,
'company': company
}]
}).insert()
except frappe.NameError:
pass
else:
if args.get('item_price_' + str(i)):
item_price = flt(args.get('item_price_' + str(i)))
price_list_name = frappe.db.get_value('Price List', {'selling': 1})
make_item_price(item, price_list_name, item_price)
price_list_name = frappe.db.get_value('Price List', {'buying': 1})
make_item_price(item, price_list_name, item_price)
def make_item_price(item, price_list_name, item_price): def make_item_price(item, price_list_name, item_price):
frappe.get_doc({ frappe.get_doc({
@ -924,12 +861,6 @@ def get_last_purchase_details(item_code, doc_name=None, conversion_rate=1.0):
def invalidate_cache_for_item(doc): def invalidate_cache_for_item(doc):
invalidate_cache_for(doc, doc.item_group) invalidate_cache_for(doc, doc.item_group)
website_item_groups = list(set((doc.get("old_website_item_groups") or [])
+ [d.item_group for d in doc.get({"doctype": "Website Item Group"}) if d.item_group]))
for item_group in website_item_groups:
invalidate_cache_for(doc, item_group)
if doc.get("old_item_group") and doc.get("old_item_group") != doc.item_group: if doc.get("old_item_group") and doc.get("old_item_group") != doc.item_group:
invalidate_cache_for(doc, doc.old_item_group) invalidate_cache_for(doc, doc.old_item_group)
@ -940,9 +871,10 @@ def invalidate_item_variants_cache_for_website(doc):
from erpnext.portal.product_configurator.item_variants_cache import ItemVariantsCacheManager from erpnext.portal.product_configurator.item_variants_cache import ItemVariantsCacheManager
item_code = None item_code = None
if doc.has_variants and doc.show_in_website: is_web_item = doc.get("published_in_website") or doc.get("published")
item_code = doc.name if doc.has_variants and is_web_item:
elif doc.variant_of and frappe.db.get_value('Item', doc.variant_of, 'show_in_website'): item_code = doc.item_code
elif doc.variant_of and frappe.db.get_value('Item', doc.variant_of, 'published_in_website'):
item_code = doc.variant_of item_code = doc.variant_of
if item_code: if item_code:

View File

@ -40,9 +40,7 @@
"conversion_factor": 10.0 "conversion_factor": 10.0
} }
], ],
"stock_uom": "_Test UOM", "stock_uom": "_Test UOM"
"show_in_website": 1,
"website_warehouse": "_Test Warehouse - _TC"
}, },
{ {
"description": "_Test Item 2", "description": "_Test Item 2",
@ -56,8 +54,6 @@
"item_group": "_Test Item Group", "item_group": "_Test Item Group",
"item_name": "_Test Item 2", "item_name": "_Test Item 2",
"stock_uom": "_Test UOM", "stock_uom": "_Test UOM",
"show_in_website": 1,
"website_warehouse": "_Test Warehouse - _TC",
"gst_hsn_code": "999800", "gst_hsn_code": "999800",
"opening_stock": 10, "opening_stock": 10,
"valuation_rate": 100, "valuation_rate": 100,
@ -311,8 +307,7 @@
"warehouse_reorder_level": 20, "warehouse_reorder_level": 20,
"warehouse_reorder_qty": 20 "warehouse_reorder_qty": 20
} }
], ]
"show_in_website": 1
}, },
{ {
"description": "_Test Item 1", "description": "_Test Item 1",
@ -344,9 +339,7 @@
"warehouse_reorder_qty": 20 "warehouse_reorder_qty": 20
} }
], ],
"stock_uom": "_Test UOM", "stock_uom": "_Test UOM"
"show_in_website": 1,
"website_warehouse": "_Test Warehouse Group-C1 - _TC"
}, },
{ {
"description": "_Test Item With Item Tax Template", "description": "_Test Item With Item Tax Template",

View File

@ -7,9 +7,8 @@ frappe.ui.form.on('Item Variant Settings', {
const existing_fields = frm.doc.fields.map(row => row.field_name); const existing_fields = frm.doc.fields.map(row => row.field_name);
const exclude_fields = [...existing_fields, "naming_series", "item_code", "item_name", const exclude_fields = [...existing_fields, "naming_series", "item_code", "item_name",
"show_in_website", "show_variant_in_website", "standard_rate", "opening_stock", "image", "published_in_website", "standard_rate", "opening_stock", "image",
"variant_of", "valuation_rate", "barcodes", "website_image", "thumbnail", "variant_of", "valuation_rate", "barcodes", "has_variants", "attributes"];
"website_specifiations", "web_long_description", "has_variants", "attributes"];
const exclude_field_types = ['HTML', 'Section Break', 'Column Break', 'Button', 'Read Only']; const exclude_field_types = ['HTML', 'Section Break', 'Column Break', 'Button', 'Read Only'];

View File

@ -1,9 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt # For license information, please see license.txt
from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
@ -15,7 +13,7 @@ class ItemVariantSettings(Document):
def set_default_fields(self): def set_default_fields(self):
self.fields = [] self.fields = []
fields = frappe.get_meta('Item').fields fields = frappe.get_meta('Item').fields
exclude_fields = {"naming_series", "item_code", "item_name", "show_in_website", exclude_fields = {"naming_series", "item_code", "item_name", "published_in_website",
"show_variant_in_website", "standard_rate", "opening_stock", "image", "description", "show_variant_in_website", "standard_rate", "opening_stock", "image", "description",
"variant_of", "valuation_rate", "description", "barcodes", "variant_of", "valuation_rate", "description", "barcodes",
"website_image", "thumbnail", "website_specifiations", "web_long_description", "website_image", "thumbnail", "website_specifiations", "web_long_description",

View File

@ -1,52 +0,0 @@
{
"add_more_button": 1,
"app": "ERPNext",
"creation": "2019-11-15 14:41:12.007359",
"docstatus": 0,
"doctype": "Onboarding Slide",
"domains": [],
"help_links": [],
"idx": 0,
"image_src": "",
"is_completed": 0,
"max_count": 3,
"modified": "2019-12-09 17:54:09.602885",
"modified_by": "Administrator",
"name": "Add A Few Products You Buy Or Sell",
"owner": "Administrator",
"ref_doctype": "Item",
"slide_desc": "",
"slide_fields": [
{
"align": "",
"fieldname": "item",
"fieldtype": "Data",
"label": "Item",
"placeholder": "Product Name",
"reqd": 1
},
{
"align": "",
"fieldname": "item_price",
"fieldtype": "Currency",
"label": "Item Price",
"reqd": 1
},
{
"align": "",
"fieldtype": "Column Break",
"reqd": 0
},
{
"align": "",
"fieldname": "uom",
"fieldtype": "Link",
"label": "UOM",
"options": "UOM",
"reqd": 1
}
],
"slide_order": 30,
"slide_title": "Add A Few Products You Buy Or Sell",
"slide_type": "Create"
}