Merge branch 'develop' into currency-exchange-settings

This commit is contained in:
Dany Robert
2021-12-07 22:36:36 +05:30
committed by GitHub
138 changed files with 2395 additions and 1630 deletions

View File

@@ -12,6 +12,10 @@ frappe.ui.form.on("Company", {
}
});
}
frm.call('check_if_transactions_exist').then(r => {
frm.toggle_enable("default_currency", (!r.message));
});
},
setup: function(frm) {
erpnext.company.setup_queries(frm);
@@ -87,9 +91,6 @@ frappe.ui.form.on("Company", {
frappe.dynamic_link = {doc: frm.doc, fieldname: 'name', doctype: 'Company'}
frm.toggle_enable("default_currency", (frm.doc.__onload &&
!frm.doc.__onload.transactions_exist));
if (frappe.perm.has_perm("Cost Center", 0, 'read')) {
frm.add_custom_button(__('Cost Centers'), function() {
frappe.set_route('Tree', 'Cost Center', {'company': frm.doc.name});

View File

@@ -22,8 +22,8 @@ class Company(NestedSet):
def onload(self):
load_address_and_contact(self, "company")
self.get("__onload")["transactions_exist"] = self.check_if_transactions_exist()
@frappe.whitelist()
def check_if_transactions_exist(self):
exists = False
for doctype in ["Sales Invoice", "Delivery Note", "Sales Order", "Quotation",

View File

@@ -303,7 +303,6 @@ def set_more_defaults():
def update_selling_defaults():
selling_settings = frappe.get_doc("Selling Settings")
selling_settings.set_default_customer_group_and_territory()
selling_settings.cust_master_name = "Customer Name"
selling_settings.so_required = "No"
selling_settings.dn_required = "No"

View File

@@ -53,6 +53,7 @@ def before_tests():
frappe.db.set_value("Stock Settings", None, "auto_insert_price_list_rate_if_missing", 0)
enable_all_roles_and_domains()
set_defaults_for_tests()
frappe.db.commit()
@@ -140,6 +141,14 @@ def enable_all_roles_and_domains():
[d.name for d in domains])
add_all_roles_to('Administrator')
def set_defaults_for_tests():
from frappe.utils.nestedset import get_root_of
selling_settings = frappe.get_single("Selling Settings")
selling_settings.customer_group = get_root_of("Customer Group")
selling_settings.territory = get_root_of("Territory")
selling_settings.save()
def insert_record(records):
for r in records:

View File

@@ -10,7 +10,7 @@
"idx": 0,
"label": "ERPNext Settings",
"links": [],
"modified": "2021-10-26 21:32:55.323591",
"modified": "2021-11-05 21:32:55.323591",
"modified_by": "Administrator",
"module": "Setup",
"name": "ERPNext Settings",
@@ -123,6 +123,13 @@
"label": "Products Settings",
"link_to": "Products Settings",
"type": "DocType"
},
{
"doc_view": "",
"icon": "crm",
"label": "CRM Settings",
"link_to": "CRM Settings",
"type": "DocType"
}
],
"title": "ERPNext Settings"