Merge pull request #30820 from deepeshgarg007/erpnext_setup_cleanup
chore: Remove domains from setup wizard
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 0f7c13f..e30289a 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -824,29 +824,6 @@
}
},
- // Healthcare
- patient: function(frm) {
- if (frappe.boot.active_domains.includes("Healthcare")){
- if(frm.doc.patient){
- frappe.call({
- method: "frappe.client.get_value",
- args:{
- doctype: "Patient",
- filters: {
- "name": frm.doc.patient
- },
- fieldname: "customer"
- },
- callback:function(r) {
- if(r && r.message.customer){
- frm.set_value("customer", r.message.customer);
- }
- }
- });
- }
- }
- },
-
project: function(frm) {
if (frm.doc.project) {
frm.events.add_timesheet_data(frm, {
@@ -976,25 +953,6 @@
if (frm.doc.is_debit_note) {
frm.set_df_property('return_against', 'label', __('Adjustment Against'));
}
-
- if (frappe.boot.active_domains.includes("Healthcare")) {
- frm.set_df_property("patient", "hidden", 0);
- frm.set_df_property("patient_name", "hidden", 0);
- frm.set_df_property("ref_practitioner", "hidden", 0);
- if (cint(frm.doc.docstatus==0) && cur_frm.page.current_view_name!=="pos" && !frm.doc.is_return) {
- frm.add_custom_button(__('Healthcare Services'), function() {
- get_healthcare_services_to_invoice(frm);
- },__("Get Items From"));
- frm.add_custom_button(__('Prescriptions'), function() {
- get_drugs_to_invoice(frm);
- },__("Get Items From"));
- }
- }
- else {
- frm.set_df_property("patient", "hidden", 1);
- frm.set_df_property("patient_name", "hidden", 1);
- frm.set_df_property("ref_practitioner", "hidden", 1);
- }
},
create_invoice_discounting: function(frm) {
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 5f0e5f7..066249b 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -80,13 +80,6 @@
"Holiday List",
]
-domains = {
- "Distribution": "erpnext.domains.distribution",
- "Manufacturing": "erpnext.domains.manufacturing",
- "Retail": "erpnext.domains.retail",
- "Services": "erpnext.domains.services",
-}
-
website_generators = ["Item Group", "Website Item", "BOM", "Sales Partner", "Job Opening"]
website_context = {
diff --git a/erpnext/loan_management/loan_common.js b/erpnext/loan_management/loan_common.js
index 43980ff..247e30b 100644
--- a/erpnext/loan_management/loan_common.js
+++ b/erpnext/loan_management/loan_common.js
@@ -3,11 +3,6 @@
frappe.ui.form.on(cur_frm.doctype, {
refresh: function(frm) {
- if (!frappe.boot.active_domains.includes("Non Profit")) {
- frm.set_df_property('applicant_type', 'options', ['Employee', 'Customer']);
- frm.refresh_field('applicant_type');
- }
-
if (['Loan Disbursement', 'Loan Repayment', 'Loan Interest Accrual', 'Loan Write Off'].includes(frm.doc.doctype)
&& frm.doc.docstatus > 0) {
diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js
index 2173c2d..9288f51 100644
--- a/erpnext/public/js/setup_wizard.js
+++ b/erpnext/public/js/setup_wizard.js
@@ -13,36 +13,6 @@
erpnext.setup.slides_settings = [
{
- // Domain
- name: 'domain',
- title: __('Select your Domains'),
- fields: [
- {
- fieldname: 'domains',
- label: __('Domains'),
- fieldtype: 'MultiCheck',
- options: [
- { "label": __("Distribution"), "value": "Distribution" },
- { "label": __("Manufacturing"), "value": "Manufacturing" },
- { "label": __("Retail"), "value": "Retail" },
- { "label": __("Services"), "value": "Services" },
- { "label": __("Healthcare (beta)"), "value": "Healthcare" },
- { "label": __("Non Profit (beta)"), "value": "Non Profit" }
- ], reqd: 1
- },
- ],
- // help: __('Select the nature of your business.'),
- validate: function () {
- if (this.values.domains.length === 0) {
- frappe.msgprint(__("Please select at least one domain."));
- return false;
- }
- frappe.setup.domains = this.values.domains;
- return true;
- },
- },
-
- {
// Brand
name: 'brand',
icon: "fa fa-bookmark",
diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json
index 370a327..cc62a2a 100644
--- a/erpnext/setup/doctype/company/company.json
+++ b/erpnext/setup/doctype/company/company.json
@@ -147,9 +147,8 @@
},
{
"fieldname": "domain",
- "fieldtype": "Link",
- "label": "Domain",
- "options": "Domain"
+ "fieldtype": "Data",
+ "label": "Domain"
},
{
"fieldname": "parent_company",
@@ -748,7 +747,7 @@
"image_field": "company_logo",
"is_tree": 1,
"links": [],
- "modified": "2022-01-25 10:33:16.826067",
+ "modified": "2022-04-27 10:33:16.826067",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",
diff --git a/erpnext/setup/setup_wizard/operations/company_setup.py b/erpnext/setup/setup_wizard/operations/company_setup.py
index 36dd661..aadc989 100644
--- a/erpnext/setup/setup_wizard/operations/company_setup.py
+++ b/erpnext/setup/setup_wizard/operations/company_setup.py
@@ -30,7 +30,6 @@
"country": args.get("country"),
"create_chart_of_accounts_based_on": "Standard Template",
"chart_of_accounts": args.get("chart_of_accounts"),
- "domain": args.get("domains")[0],
}
).insert()
diff --git a/erpnext/setup/setup_wizard/operations/defaults_setup.py b/erpnext/setup/setup_wizard/operations/defaults_setup.py
index 07321ed..ea077986 100644
--- a/erpnext/setup/setup_wizard/operations/defaults_setup.py
+++ b/erpnext/setup/setup_wizard/operations/defaults_setup.py
@@ -26,9 +26,6 @@
system_settings.email_footer_address = args.get("company_name")
system_settings.save()
- domain_settings = frappe.get_single("Domain Settings")
- domain_settings.set_active_domains(args.get("domains"))
-
stock_settings = frappe.get_doc("Stock Settings")
stock_settings.item_naming_by = "Item Code"
stock_settings.valuation_method = "FIFO"
diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py
index d979ad1..4235e1f 100644
--- a/erpnext/setup/setup_wizard/operations/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py
@@ -43,13 +43,6 @@
def install(country=None):
records = [
- # domains
- {"doctype": "Domain", "domain": "Distribution"},
- {"doctype": "Domain", "domain": "Manufacturing"},
- {"doctype": "Domain", "domain": "Retail"},
- {"doctype": "Domain", "domain": "Services"},
- {"doctype": "Domain", "domain": "Healthcare"},
- {"doctype": "Domain", "domain": "Non Profit"},
# ensure at least an empty Address Template exists for this Country
{"doctype": "Address Template", "country": country},
# item group
@@ -789,7 +782,6 @@
frappe.db.set_value("Stock Settings", None, "email_footer_address", args.get("company_name"))
set_global_defaults(args)
- set_active_domains(args)
update_stock_settings()
update_shopping_cart_settings(args)
@@ -813,10 +805,6 @@
global_defaults.save()
-def set_active_domains(args):
- frappe.get_single("Domain Settings").set_active_domains(args.get("domains"))
-
-
def update_stock_settings():
stock_settings = frappe.get_doc("Stock Settings")
stock_settings.item_naming_by = "Item Code"
diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py
index 4cae519..bd86a5b 100644
--- a/erpnext/setup/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/setup_wizard/setup_wizard.py
@@ -36,7 +36,6 @@
"tasks": [
{"fn": setup_defaults, "args": args, "fail_msg": _("Failed to setup defaults")},
{"fn": stage_four, "args": args, "fail_msg": _("Failed to create website")},
- {"fn": set_active_domains, "args": args, "fail_msg": _("Failed to add Domain")},
],
},
{
@@ -84,8 +83,3 @@
setup_defaults(args)
stage_four(args)
fin(args)
-
-
-def set_active_domains(args):
- domain_settings = frappe.get_single("Domain Settings")
- domain_settings.set_active_domains(args.get("domains"))
diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py
index e848dfe..b3ff439 100644
--- a/erpnext/setup/utils.py
+++ b/erpnext/setup/utils.py
@@ -33,10 +33,8 @@
"email": "test@erpnext.com",
"password": "test",
"chart_of_accounts": "Standard",
- "domains": ["Manufacturing"],
}
)
- _enable_all_domains()
frappe.db.sql("delete from `tabLeave Allocation`")
frappe.db.sql("delete from `tabLeave Application`")
@@ -131,17 +129,9 @@
def enable_all_roles_and_domains():
"""enable all roles and domain for testing"""
- _enable_all_domains()
_enable_all_roles_for_admin()
-def _enable_all_domains():
- domains = frappe.get_all("Domain", pluck="name")
- if not domains:
- return
- frappe.get_single("Domain Settings").set_active_domains(domains)
-
-
def _enable_all_roles_for_admin():
from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
diff --git a/erpnext/tests/server/agriculture.txt b/erpnext/tests/server/agriculture.txt
deleted file mode 100644
index 29dc9ab..0000000
--- a/erpnext/tests/server/agriculture.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-Disease
-Crop
-Crop Cycle
-Soil Texture
\ No newline at end of file
diff --git a/erpnext/tests/test_woocommerce.py b/erpnext/tests/test_woocommerce.py
deleted file mode 100644
index 663464b..0000000
--- a/erpnext/tests/test_woocommerce.py
+++ /dev/null
@@ -1,152 +0,0 @@
-import os
-import time
-import unittest
-
-import frappe
-import requests
-
-from erpnext.erpnext_integrations.connectors.woocommerce_connection import order
-
-
-class TestWoocommerce(unittest.TestCase):
- def setUp(self):
-
- woo_settings = frappe.get_doc("Woocommerce Settings")
- if not woo_settings.secret:
- woo_settings.secret = "ec434676aa1de0e502389f515c38f89f653119ab35e9117c7a79e576"
- woo_settings.woocommerce_server_url = "https://woocommerce.mntechnique.com/"
- woo_settings.api_consumer_key = "ck_fd43ff5756a6abafd95fadb6677100ce95a758a1"
- woo_settings.api_consumer_secret = "cs_94360a1ad7bef7fa420a40cf284f7b3e0788454e"
- woo_settings.enable_sync = 1
- woo_settings.company = "_Test Company"
- woo_settings.tax_account = "Sales Expenses - _TC"
- woo_settings.f_n_f_account = "Expenses - _TC"
- woo_settings.creation_user = "Administrator"
- woo_settings.save(ignore_permissions=True)
-
- def test_sales_order_for_woocommerce(self):
- frappe.flags.woocomm_test_order_data = {
- "id": 75,
- "parent_id": 0,
- "number": "74",
- "order_key": "wc_order_5aa1281c2dacb",
- "created_via": "checkout",
- "version": "3.3.3",
- "status": "processing",
- "currency": "INR",
- "date_created": "2018-03-08T12:10:04",
- "date_created_gmt": "2018-03-08T12:10:04",
- "date_modified": "2018-03-08T12:10:04",
- "date_modified_gmt": "2018-03-08T12:10:04",
- "discount_total": "0.00",
- "discount_tax": "0.00",
- "shipping_total": "150.00",
- "shipping_tax": "0.00",
- "cart_tax": "0.00",
- "total": "649.00",
- "total_tax": "0.00",
- "prices_include_tax": False,
- "customer_id": 12,
- "customer_ip_address": "103.54.99.5",
- "customer_user_agent": "mozilla\\/5.0 (x11; linux x86_64) applewebkit\\/537.36 (khtml, like gecko) chrome\\/64.0.3282.186 safari\\/537.36",
- "customer_note": "",
- "billing": {
- "first_name": "Tony",
- "last_name": "Stark",
- "company": "_Test Company",
- "address_1": "Mumbai",
- "address_2": "",
- "city": "Dadar",
- "state": "MH",
- "postcode": "123",
- "country": "IN",
- "email": "tony@gmail.com",
- "phone": "123457890",
- },
- "shipping": {
- "first_name": "Tony",
- "last_name": "Stark",
- "company": "",
- "address_1": "Mumbai",
- "address_2": "",
- "city": "Dadar",
- "state": "MH",
- "postcode": "123",
- "country": "IN",
- },
- "payment_method": "cod",
- "payment_method_title": "Cash on delivery",
- "transaction_id": "",
- "date_paid": "",
- "date_paid_gmt": "",
- "date_completed": "",
- "date_completed_gmt": "",
- "cart_hash": "8e76b020d5790066496f244860c4703f",
- "meta_data": [],
- "line_items": [
- {
- "id": 80,
- "name": "Marvel",
- "product_id": 56,
- "variation_id": 0,
- "quantity": 1,
- "tax_class": "",
- "subtotal": "499.00",
- "subtotal_tax": "0.00",
- "total": "499.00",
- "total_tax": "0.00",
- "taxes": [],
- "meta_data": [],
- "sku": "",
- "price": 499,
- }
- ],
- "tax_lines": [],
- "shipping_lines": [
- {
- "id": 81,
- "method_title": "Flat rate",
- "method_id": "flat_rate:1",
- "total": "150.00",
- "total_tax": "0.00",
- "taxes": [],
- "meta_data": [{"id": 623, "key": "Items", "value": "Marvel × 1"}],
- }
- ],
- "fee_lines": [],
- "coupon_lines": [],
- "refunds": [],
- }
- order()
-
- self.assertTrue(frappe.get_value("Customer", {"woocommerce_email": "tony@gmail.com"}))
- self.assertTrue(frappe.get_value("Item", {"woocommerce_id": 56}))
- self.assertTrue(frappe.get_value("Sales Order", {"woocommerce_id": 75}))
- frappe.flags.woocomm_test_order_data = {}
-
-
-def emulate_request():
- # Emulate Woocommerce Request
- headers = {
- "X-Wc-Webhook-Event": "created",
- "X-Wc-Webhook-Signature": "h1SjzQMPwd68MF5bficeFq20/RkQeRLsb9AVCUz/rLs=",
- }
- # Emulate Request Data
- data = """{"id":74,"parent_id":0,"number":"74","order_key":"wc_order_5aa1281c2dacb","created_via":"checkout","version":"3.3.3","status":"processing","currency":"INR","date_created":"2018-03-08T12:10:04","date_created_gmt":"2018-03-08T12:10:04","date_modified":"2018-03-08T12:10:04","date_modified_gmt":"2018-03-08T12:10:04","discount_total":"0.00","discount_tax":"0.00","shipping_total":"150.00","shipping_tax":"0.00","cart_tax":"0.00","total":"649.00","total_tax":"0.00","prices_include_tax":false,"customer_id":12,"customer_ip_address":"103.54.99.5","customer_user_agent":"mozilla\\/5.0 (x11; linux x86_64) applewebkit\\/537.36 (khtml, like gecko) chrome\\/64.0.3282.186 safari\\/537.36","customer_note":"","billing":{"first_name":"Tony","last_name":"Stark","company":"Woocommerce","address_1":"Mumbai","address_2":"","city":"Dadar","state":"MH","postcode":"123","country":"IN","email":"tony@gmail.com","phone":"123457890"},"shipping":{"first_name":"Tony","last_name":"Stark","company":"","address_1":"Mumbai","address_2":"","city":"Dadar","state":"MH","postcode":"123","country":"IN"},"payment_method":"cod","payment_method_title":"Cash on delivery","transaction_id":"","date_paid":null,"date_paid_gmt":null,"date_completed":null,"date_completed_gmt":null,"cart_hash":"8e76b020d5790066496f244860c4703f","meta_data":[],"line_items":[{"id":80,"name":"Marvel","product_id":56,"variation_id":0,"quantity":1,"tax_class":"","subtotal":"499.00","subtotal_tax":"0.00","total":"499.00","total_tax":"0.00","taxes":[],"meta_data":[],"sku":"","price":499}],"tax_lines":[],"shipping_lines":[{"id":81,"method_title":"Flat rate","method_id":"flat_rate:1","total":"150.00","total_tax":"0.00","taxes":[],"meta_data":[{"id":623,"key":"Items","value":"Marvel × 1"}]}],"fee_lines":[],"coupon_lines":[],"refunds":[]}"""
-
- # Build URL
- port = frappe.get_site_config().webserver_port or "8000"
-
- if os.environ.get("CI"):
- host = "localhost"
- else:
- host = frappe.local.site
-
- url = "http://{site}:{port}/api/method/erpnext.erpnext_integrations.connectors.woocommerce_connection.order".format(
- site=host, port=port
- )
-
- r = requests.post(url=url, headers=headers, data=data)
-
- time.sleep(5)
- return r
diff --git a/erpnext/tests/ui_test_bulk_transaction_processing.py b/erpnext/tests/ui_test_bulk_transaction_processing.py
deleted file mode 100644
index a0dc76d..0000000
--- a/erpnext/tests/ui_test_bulk_transaction_processing.py
+++ /dev/null
@@ -1,21 +0,0 @@
-import frappe
-
-from erpnext.bulk_transaction.doctype.bulk_transaction_logger.test_bulk_transaction_logger import (
- create_company,
- create_customer,
- create_item,
- create_so,
-)
-
-
-@frappe.whitelist()
-def create_records():
- create_company()
- create_customer()
- create_item()
-
- gd = frappe.get_doc("Global Defaults")
- gd.set("default_company", "Test Bulk")
- gd.save()
- frappe.clear_cache()
- create_so()
diff --git a/erpnext/tests/ui_test_helpers.py b/erpnext/tests/ui_test_helpers.py
deleted file mode 100644
index 44834c8..0000000
--- a/erpnext/tests/ui_test_helpers.py
+++ /dev/null
@@ -1,75 +0,0 @@
-import frappe
-from frappe.utils import getdate
-
-
-@frappe.whitelist()
-def create_employee_records():
- create_company()
- create_missing_designation()
-
- frappe.db.sql("DELETE FROM tabEmployee WHERE company='Test Org Chart'")
-
- emp1 = create_employee("Test Employee 1", "CEO")
- emp2 = create_employee("Test Employee 2", "CTO")
- emp3 = create_employee("Test Employee 3", "Head of Marketing and Sales", emp1)
- emp4 = create_employee("Test Employee 4", "Project Manager", emp2)
- emp5 = create_employee("Test Employee 5", "Engineer", emp2)
- emp6 = create_employee("Test Employee 6", "Analyst", emp3)
- emp7 = create_employee("Test Employee 7", "Software Developer", emp4)
-
- employees = [emp1, emp2, emp3, emp4, emp5, emp6, emp7]
- return employees
-
-
-@frappe.whitelist()
-def get_employee_records():
- return frappe.db.get_list(
- "Employee", filters={"company": "Test Org Chart"}, pluck="name", order_by="name"
- )
-
-
-def create_company():
- company = frappe.db.exists("Company", "Test Org Chart")
- if not company:
- company = (
- frappe.get_doc(
- {
- "doctype": "Company",
- "company_name": "Test Org Chart",
- "country": "India",
- "default_currency": "INR",
- }
- )
- .insert()
- .name
- )
-
- return company
-
-
-def create_employee(first_name, designation, reports_to=None):
- employee = frappe.db.exists("Employee", {"first_name": first_name, "designation": designation})
- if not employee:
- employee = (
- frappe.get_doc(
- {
- "doctype": "Employee",
- "first_name": first_name,
- "company": "Test Org Chart",
- "gender": "Female",
- "date_of_birth": getdate("08-12-1998"),
- "date_of_joining": getdate("01-01-2021"),
- "designation": designation,
- "reports_to": reports_to,
- }
- )
- .insert()
- .name
- )
-
- return employee
-
-
-def create_missing_designation():
- if not frappe.db.exists("Designation", "CTO"):
- frappe.get_doc({"doctype": "Designation", "designation_name": "CTO"}).insert()