feat(setup): adding selling buying filter in terms and conditions
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js
index 10f127a..5e94118 100755
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.js
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js
@@ -8,6 +8,10 @@
return { filters: { selling: 1 } };
});
+ frm.set_query("tc_name", function() {
+ return { filters: { selling: 1 } };
+ });
+
erpnext.queries.setup_queries(frm, "Warehouse", function() {
return erpnext.queries.warehouse(frm.doc);
});
diff --git a/erpnext/hr/doctype/job_offer/job_offer.js b/erpnext/hr/doctype/job_offer/job_offer.js
index 1ee35af..c3d83c4 100755
--- a/erpnext/hr/doctype/job_offer/job_offer.js
+++ b/erpnext/hr/doctype/job_offer/job_offer.js
@@ -4,6 +4,12 @@
frappe.provide("erpnext.job_offer");
frappe.ui.form.on("Job Offer", {
+ onload: function (frm) {
+ frm.set_query("select_terms", function() {
+ return { filters: { hr: 1 } };
+ });
+ },
+
select_terms: function (frm) {
erpnext.utils.get_terms(frm.doc.select_terms, frm.doc, function (r) {
if (!r.exc) {
diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.js b/erpnext/manufacturing/doctype/blanket_order/blanket_order.js
index 89efb93..d1bef3f 100644
--- a/erpnext/manufacturing/doctype/blanket_order/blanket_order.js
+++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order.js
@@ -2,6 +2,10 @@
// For license information, please see license.txt
frappe.ui.form.on('Blanket Order', {
+ onload: function(frm) {
+ frm.trigger('set_tc_name_filter');
+ },
+
setup: function(frm) {
frm.add_fetch("customer", "customer_name", "customer_name");
frm.add_fetch("supplier", "supplier_name", "supplier_name");
@@ -44,4 +48,23 @@
}
});
},
+
+ set_tc_name_filter: function(frm) {
+ if (frm.doc.blanket_order_type === 'Selling'){
+ frm.set_query("tc_name", function() {
+ return { filters: { selling: 1 } };
+ });
+ }
+ if (frm.doc.blanket_order_type === 'Purchasing'){
+ frm.set_query("tc_name", function() {
+ return { filters: { buying: 1 } };
+ });
+ }
+ },
+
+ blanket_order_type: function (frm) {
+ frm.trigger('set_tc_name_filter');
+ }
});
+
+
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 72db8ad..bd41c7e 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -615,3 +615,4 @@
erpnext.patches.v12_0.set_quotation_status
erpnext.patches.v12_0.set_priority_for_support
erpnext.patches.v12_0.delete_priority_property_setter
+erpnext.patches.v12_0.add_default_buying_selling_terms_in_company
diff --git a/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py b/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py
new file mode 100644
index 0000000..484f81a
--- /dev/null
+++ b/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py
@@ -0,0 +1,19 @@
+# Copyright (c) 2019, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+
+import frappe
+from frappe.model.utils.rename_field import rename_field
+
+def execute():
+ frappe.reload_doc("setup", "doctype", "company")
+ if frappe.db.has_column('Company', 'default_terms'):
+ rename_field('Company', "default_terms", "default_selling_terms")
+
+ for company in frappe.get_all("Company", ["name", "default_selling_terms", "default_buying_terms"]):
+ if company.default_selling_terms and not company.default_buying_terms:
+ frappe.db.set_value("Company", company.name, "default_buying_terms", company.default_selling_terms)
+
+ frappe.reload_doc("setup", "doctype", "terms_and_conditions")
+ frappe.db.sql("update `tabTerms and Conditions` set selling=1, buying=1, hr=1")
diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js
index 97c823d..824b8d9 100644
--- a/erpnext/public/js/controllers/buying.js
+++ b/erpnext/public/js/controllers/buying.js
@@ -61,6 +61,14 @@
});
}
+ if(this.frm.fields_dict.tc_name) {
+ this.frm.set_query("tc_name", function() {
+ return{
+ filters: { 'buying': 1 }
+ }
+ });
+ }
+
me.frm.set_query('supplier', erpnext.queries.supplier);
me.frm.set_query('contact_person', erpnext.queries.contact_query);
me.frm.set_query('supplier_address', erpnext.queries.address_query);
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index a3ecea1..11fdb8b 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -585,8 +585,17 @@
me.frm.set_value("letter_head", company_doc.default_letter_head);
}
}
- if (company_doc.default_terms && me.frm.doc.doctype != "Purchase Invoice" && frappe.meta.has_field(me.frm.doc.doctype, "tc_name")) {
- me.frm.set_value("tc_name", company_doc.default_terms);
+ let selling_doctypes_for_tc = ["Sales Invoice", "Quotation", "Sales Order", "Delivery Note"];
+ if (company_doc.default_selling_terms && frappe.meta.has_field(me.frm.doc.doctype, "tc_name") &&
+ selling_doctypes_for_tc.indexOf(me.frm.doc.doctype) != -1) {
+ me.frm.set_value("tc_name", company_doc.default_selling_terms);
+ }
+ let buying_doctypes_for_tc = ["Request for Quotation", "Supplier Quotation", "Purchase Order",
+ "Material Request", "Purchase Receipt"];
+ // Purchase Invoice is excluded as per issue #3345
+ if (company_doc.default_buying_terms && frappe.meta.has_field(me.frm.doc.doctype, "tc_name") &&
+ buying_doctypes_for_tc.indexOf(me.frm.doc.doctype) != -1) {
+ me.frm.set_value("tc_name", company_doc.default_buying_terms);
}
frappe.run_serially([
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 9bae58b..00efb4f 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -59,6 +59,12 @@
});
}
+ if(this.frm.fields_dict.tc_name) {
+ this.frm.set_query("tc_name", function() {
+ return { filters: { selling: 1 } };
+ });
+ }
+
if(!this.frm.fields_dict["items"]) {
return;
}
diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js
index 1e6056e..313de67 100644
--- a/erpnext/setup/doctype/company/company.js
+++ b/erpnext/setup/doctype/company/company.js
@@ -17,6 +17,14 @@
filters: {"is_group": 1}
}
});
+
+ frm.set_query("default_selling_terms", function() {
+ return { filters: { selling: 1 } };
+ });
+
+ frm.set_query("default_buying_terms", function() {
+ return { filters: { buying: 1 } };
+ });
},
company_name: function(frm) {
diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json
index bb652ca..bc34189 100644
--- a/erpnext/setup/doctype/company/company.json
+++ b/erpnext/setup/doctype/company/company.json
@@ -1,769 +1,776 @@
{
- "allow_import": 1,
- "allow_rename": 1,
- "autoname": "field:company_name",
- "creation": "2013-04-10 08:35:39",
- "description": "Legal Entity / Subsidiary with a separate Chart of Accounts belonging to the Organization.",
- "doctype": "DocType",
- "document_type": "Setup",
- "engine": "InnoDB",
- "field_order": [
- "details",
- "company_name",
- "abbr",
- "change_abbr",
- "is_group",
- "cb0",
- "domain",
- "parent_company",
- "charts_section",
- "default_currency",
- "default_letter_head",
- "default_holiday_list",
- "default_finance_book",
- "standard_working_hours",
- "default_terms",
- "default_warehouse_for_sales_return",
- "column_break_10",
- "country",
- "create_chart_of_accounts_based_on",
- "chart_of_accounts",
- "existing_company",
- "tax_id",
- "date_of_establishment",
- "sales_settings",
- "monthly_sales_target",
- "sales_monthly_history",
- "column_break_goals",
- "transactions_annual_history",
- "total_monthly_sales",
- "default_settings",
- "default_bank_account",
- "default_cash_account",
- "default_receivable_account",
- "round_off_account",
- "round_off_cost_center",
- "write_off_account",
- "discount_allowed_account",
- "discount_received_account",
- "exchange_gain_loss_account",
- "unrealized_exchange_gain_loss_account",
- "column_break0",
- "allow_account_creation_against_child_company",
- "default_payable_account",
- "default_employee_advance_account",
- "default_expense_account",
- "default_income_account",
- "default_deferred_revenue_account",
- "default_deferred_expense_account",
- "default_payroll_payable_account",
- "default_expense_claim_payable_account",
- "section_break_22",
- "cost_center",
- "column_break_26",
- "credit_limit",
- "payment_terms",
- "auto_accounting_for_stock_settings",
- "enable_perpetual_inventory",
- "default_inventory_account",
- "stock_adjustment_account",
- "column_break_32",
- "stock_received_but_not_billed",
- "expenses_included_in_valuation",
- "fixed_asset_depreciation_settings",
- "accumulated_depreciation_account",
- "depreciation_expense_account",
- "series_for_depreciation_entry",
- "expenses_included_in_asset_valuation",
- "column_break_40",
- "disposal_account",
- "depreciation_cost_center",
- "capital_work_in_progress_account",
- "asset_received_but_not_billed",
- "budget_detail",
- "exception_budget_approver_role",
- "company_info",
- "company_logo",
- "date_of_incorporation",
- "address_html",
- "date_of_commencement",
- "phone_no",
- "fax",
- "email",
- "website",
- "column_break1",
- "company_description",
- "registration_info",
- "registration_details",
- "delete_company_transactions",
- "lft",
- "rgt",
- "old_parent"
- ],
- "fields": [
- {
- "fieldname": "details",
- "fieldtype": "Section Break",
- "oldfieldtype": "Section Break"
- },
- {
- "fieldname": "company_name",
- "fieldtype": "Data",
- "label": "Company",
- "oldfieldname": "company_name",
- "oldfieldtype": "Data",
- "reqd": 1,
- "unique": 1
- },
- {
- "fieldname": "abbr",
- "fieldtype": "Data",
- "label": "Abbr",
- "oldfieldname": "abbr",
- "oldfieldtype": "Data",
- "reqd": 1
- },
- {
- "depends_on": "eval:!doc.__islocal && in_list(frappe.user_roles, \"System Manager\")",
- "fieldname": "change_abbr",
- "fieldtype": "Button",
- "label": "Change Abbreviation"
- },
- {
- "bold": 1,
- "default": "0",
- "fieldname": "is_group",
- "fieldtype": "Check",
- "label": "Is Group"
- },
- {
- "fieldname": "default_finance_book",
- "fieldtype": "Link",
- "label": "Default Finance Book",
- "options": "Finance Book"
- },
- {
- "fieldname": "cb0",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "domain",
- "fieldtype": "Link",
- "label": "Domain",
- "options": "Domain"
- },
- {
- "fieldname": "parent_company",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Parent Company",
- "options": "Company"
- },
- {
- "fieldname": "company_logo",
- "fieldtype": "Attach Image",
- "hidden": 1,
- "label": "Company Logo"
- },
- {
- "fieldname": "company_description",
- "fieldtype": "Text Editor",
- "label": "Company Description"
- },
- {
- "collapsible": 1,
- "fieldname": "sales_settings",
- "fieldtype": "Section Break",
- "label": "Sales Settings"
- },
- {
- "fieldname": "sales_monthly_history",
- "fieldtype": "Small Text",
- "hidden": 1,
- "label": "Sales Monthly History",
- "no_copy": 1,
- "read_only": 1
- },
- {
- "fieldname": "transactions_annual_history",
- "fieldtype": "Code",
- "hidden": 1,
- "label": "Transactions Annual History",
- "no_copy": 1,
- "read_only": 1
- },
- {
- "fieldname": "monthly_sales_target",
- "fieldtype": "Currency",
- "label": "Monthly Sales Target",
- "options": "default_currency"
- },
- {
- "fieldname": "column_break_goals",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "total_monthly_sales",
- "fieldtype": "Currency",
- "label": "Total Monthly Sales",
- "no_copy": 1,
- "options": "default_currency",
- "read_only": 1
- },
- {
- "fieldname": "charts_section",
- "fieldtype": "Section Break",
- "label": "Default Values"
- },
- {
- "fieldname": "default_currency",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Currency",
- "options": "Currency",
- "reqd": 1
- },
- {
- "fieldname": "default_letter_head",
- "fieldtype": "Link",
- "label": "Default Letter Head",
- "options": "Letter Head"
- },
- {
- "fieldname": "default_holiday_list",
- "fieldtype": "Link",
- "label": "Default Holiday List",
- "options": "Holiday List"
- },
- {
- "fieldname": "standard_working_hours",
- "fieldtype": "Float",
- "label": "Standard Working Hours"
- },
- {
- "fieldname": "default_terms",
- "fieldtype": "Link",
- "label": "Default Terms",
- "options": "Terms and Conditions"
- },
- {
- "fieldname": "default_warehouse_for_sales_return",
- "fieldtype": "Link",
- "label": "Default warehouse for Sales Return",
- "options": "Warehouse"
- },
- {
- "fieldname": "column_break_10",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "country",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Country",
- "options": "Country",
- "reqd": 1
- },
- {
- "fieldname": "create_chart_of_accounts_based_on",
- "fieldtype": "Select",
- "label": "Create Chart Of Accounts Based On",
- "options": "\nStandard Template\nExisting Company"
- },
- {
- "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Standard Template\"",
- "fieldname": "chart_of_accounts",
- "fieldtype": "Select",
- "label": "Chart Of Accounts Template",
- "no_copy": 1
- },
- {
- "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Existing Company\"",
- "fieldname": "existing_company",
- "fieldtype": "Link",
- "label": "Existing Company ",
- "no_copy": 1,
- "options": "Company"
- },
- {
- "fieldname": "tax_id",
- "fieldtype": "Data",
- "label": "Tax ID"
- },
- {
- "fieldname": "date_of_establishment",
- "fieldtype": "Date",
- "label": "Date of Establishment"
- },
- {
- "fieldname": "default_settings",
- "fieldtype": "Section Break",
- "label": "Accounts Settings",
- "oldfieldtype": "Section Break"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_bank_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Bank Account",
- "no_copy": 1,
- "oldfieldname": "default_bank_account",
- "oldfieldtype": "Link",
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_cash_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Cash Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_receivable_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Receivable Account",
- "no_copy": 1,
- "oldfieldname": "receivables_group",
- "oldfieldtype": "Link",
- "options": "Account"
- },
- {
- "fieldname": "round_off_account",
- "fieldtype": "Link",
- "label": "Round Off Account",
- "options": "Account"
- },
- {
- "fieldname": "round_off_cost_center",
- "fieldtype": "Link",
- "label": "Round Off Cost Center",
- "options": "Cost Center"
- },
- {
- "fieldname": "write_off_account",
- "fieldtype": "Link",
- "label": "Write Off Account",
- "options": "Account"
- },
- {
- "fieldname": "discount_allowed_account",
- "fieldtype": "Link",
- "label": "Discount Allowed Account",
- "options": "Account"
- },
- {
- "fieldname": "discount_received_account",
- "fieldtype": "Link",
- "label": "Discount Received Account",
- "options": "Account"
- },
- {
- "fieldname": "exchange_gain_loss_account",
- "fieldtype": "Link",
- "label": "Exchange Gain / Loss Account",
- "options": "Account"
- },
- {
- "fieldname": "unrealized_exchange_gain_loss_account",
- "fieldtype": "Link",
- "label": "Unrealized Exchange Gain/Loss Account",
- "options": "Account"
- },
- {
- "fieldname": "column_break0",
- "fieldtype": "Column Break",
- "oldfieldtype": "Column Break",
- "width": "50%"
- },
- {
- "default": "0",
- "depends_on": "eval:doc.parent_company",
- "fieldname": "allow_account_creation_against_child_company",
- "fieldtype": "Check",
- "label": "Allow Account Creation Against Child Company"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_payable_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Payable Account",
- "no_copy": 1,
- "oldfieldname": "payables_group",
- "oldfieldtype": "Link",
- "options": "Account"
- },
- {
- "fieldname": "default_employee_advance_account",
- "fieldtype": "Link",
- "label": "Default Employee Advance Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_expense_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Cost of Goods Sold Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_income_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Income Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_deferred_revenue_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Deferred Revenue Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_deferred_expense_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Deferred Expense Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_payroll_payable_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Payroll Payable Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_expense_claim_payable_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Expense Claim Payable Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "fieldname": "section_break_22",
- "fieldtype": "Section Break"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "cost_center",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Cost Center",
- "no_copy": 1,
- "options": "Cost Center"
- },
- {
- "fieldname": "column_break_26",
- "fieldtype": "Column Break"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "credit_limit",
- "fieldtype": "Currency",
- "label": "Credit Limit",
- "oldfieldname": "credit_limit",
- "oldfieldtype": "Currency",
- "options": "default_currency"
- },
- {
- "fieldname": "payment_terms",
- "fieldtype": "Link",
- "label": "Default Payment Terms Template",
- "options": "Payment Terms Template"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "auto_accounting_for_stock_settings",
- "fieldtype": "Section Break",
- "label": "Stock Settings"
- },
- {
- "default": "1",
- "fieldname": "enable_perpetual_inventory",
- "fieldtype": "Check",
- "label": "Enable Perpetual Inventory"
- },
- {
- "fieldname": "default_inventory_account",
- "fieldtype": "Link",
- "label": "Default Inventory Account",
- "options": "Account"
- },
- {
- "fieldname": "stock_adjustment_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Stock Adjustment Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "fieldname": "column_break_32",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "stock_received_but_not_billed",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Stock Received But Not Billed",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "fieldname": "expenses_included_in_valuation",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Expenses Included In Valuation",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "collapsible": 1,
- "fieldname": "fixed_asset_depreciation_settings",
- "fieldtype": "Section Break",
- "label": "Fixed Asset Depreciation Settings"
- },
- {
- "fieldname": "accumulated_depreciation_account",
- "fieldtype": "Link",
- "label": "Accumulated Depreciation Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "fieldname": "depreciation_expense_account",
- "fieldtype": "Link",
- "label": "Depreciation Expense Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "fieldname": "series_for_depreciation_entry",
- "fieldtype": "Data",
- "label": "Series for Asset Depreciation Entry (Journal Entry)"
- },
- {
- "fieldname": "expenses_included_in_asset_valuation",
- "fieldtype": "Link",
- "label": "Expenses Included In Asset Valuation",
- "options": "Account"
- },
- {
- "fieldname": "column_break_40",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "disposal_account",
- "fieldtype": "Link",
- "label": "Gain/Loss Account on Asset Disposal",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "fieldname": "depreciation_cost_center",
- "fieldtype": "Link",
- "label": "Asset Depreciation Cost Center",
- "no_copy": 1,
- "options": "Cost Center"
- },
- {
- "fieldname": "capital_work_in_progress_account",
- "fieldtype": "Link",
- "label": "Capital Work In Progress Account",
- "options": "Account"
- },
- {
- "fieldname": "asset_received_but_not_billed",
- "fieldtype": "Link",
- "label": "Asset Received But Not Billed",
- "options": "Account"
- },
- {
- "collapsible": 1,
- "fieldname": "budget_detail",
- "fieldtype": "Section Break",
- "label": "Budget Detail"
- },
- {
- "fieldname": "exception_budget_approver_role",
- "fieldtype": "Link",
- "label": "Exception Budget Approver Role",
- "options": "Role"
- },
- {
- "collapsible": 1,
- "description": "For reference only.",
- "fieldname": "company_info",
- "fieldtype": "Section Break",
- "label": "Company Info"
- },
- {
- "fieldname": "date_of_incorporation",
- "fieldtype": "Date",
- "label": "Date of Incorporation"
- },
- {
- "fieldname": "address_html",
- "fieldtype": "HTML"
- },
- {
- "fieldname": "column_break1",
- "fieldtype": "Column Break",
- "oldfieldtype": "Column Break",
- "width": "50%"
- },
- {
- "depends_on": "eval:doc.date_of_incorporation",
- "fieldname": "date_of_commencement",
- "fieldtype": "Date",
- "label": "Date of Commencement"
- },
- {
- "fieldname": "phone_no",
- "fieldtype": "Data",
- "label": "Phone No",
- "oldfieldname": "phone_no",
- "oldfieldtype": "Data",
- "options": "Phone"
- },
- {
- "fieldname": "fax",
- "fieldtype": "Data",
- "label": "Fax",
- "oldfieldname": "fax",
- "oldfieldtype": "Data",
- "options": "Phone"
- },
- {
- "fieldname": "email",
- "fieldtype": "Data",
- "label": "Email",
- "oldfieldname": "email",
- "oldfieldtype": "Data",
- "options": "Email"
- },
- {
- "fieldname": "website",
- "fieldtype": "Data",
- "label": "Website",
- "oldfieldname": "website",
- "oldfieldtype": "Data"
- },
- {
- "fieldname": "registration_info",
- "fieldtype": "Section Break",
- "oldfieldtype": "Section Break",
- "width": "50%"
- },
- {
- "description": "Company registration numbers for your reference. Tax numbers etc.",
- "fieldname": "registration_details",
- "fieldtype": "Code",
- "label": "Registration Details",
- "oldfieldname": "registration_details",
- "oldfieldtype": "Code"
- },
- {
- "fieldname": "delete_company_transactions",
- "fieldtype": "Button",
- "label": "Delete Company Transactions"
- },
- {
- "fieldname": "lft",
- "fieldtype": "Int",
- "hidden": 1,
- "label": "Lft",
- "print_hide": 1,
- "read_only": 1,
- "search_index": 1
- },
- {
- "fieldname": "rgt",
- "fieldtype": "Int",
- "hidden": 1,
- "label": "Rgt",
- "print_hide": 1,
- "read_only": 1,
- "search_index": 1
- },
- {
- "fieldname": "old_parent",
- "fieldtype": "Data",
- "hidden": 1,
- "label": "old_parent",
- "print_hide": 1,
- "read_only": 1
- }
- ],
- "icon": "fa fa-building",
- "idx": 1,
- "image_field": "company_logo",
- "modified": "2019-06-14 14:36:11.363309",
- "modified_by": "Administrator",
- "module": "Setup",
- "name": "Company",
- "owner": "Administrator",
- "permissions": [
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "System Manager",
- "share": 1,
- "write": 1
- },
- {
- "email": 1,
- "print": 1,
- "read": 1,
- "role": "Accounts User"
- },
- {
- "read": 1,
- "role": "Employee"
- },
- {
- "read": 1,
- "role": "Sales User"
- },
- {
- "read": 1,
- "role": "Purchase User"
- },
- {
- "read": 1,
- "role": "Stock User"
- },
- {
- "read": 1,
- "role": "Projects User"
- }
- ],
- "show_name_in_global_search": 1,
- "sort_field": "modified",
- "sort_order": "ASC",
- "track_changes": 1
- }
\ No newline at end of file
+ "allow_import": 1,
+ "allow_rename": 1,
+ "autoname": "field:company_name",
+ "creation": "2013-04-10 08:35:39",
+ "description": "Legal Entity / Subsidiary with a separate Chart of Accounts belonging to the Organization.",
+ "doctype": "DocType",
+ "document_type": "Setup",
+ "engine": "InnoDB",
+ "field_order": [
+ "details",
+ "company_name",
+ "abbr",
+ "change_abbr",
+ "is_group",
+ "cb0",
+ "domain",
+ "parent_company",
+ "charts_section",
+ "default_currency",
+ "default_letter_head",
+ "default_holiday_list",
+ "default_finance_book",
+ "standard_working_hours",
+ "default_selling_terms",
+ "default_buying_terms",
+ "default_warehouse_for_sales_return",
+ "column_break_10",
+ "country",
+ "create_chart_of_accounts_based_on",
+ "chart_of_accounts",
+ "existing_company",
+ "tax_id",
+ "date_of_establishment",
+ "sales_settings",
+ "monthly_sales_target",
+ "sales_monthly_history",
+ "column_break_goals",
+ "transactions_annual_history",
+ "total_monthly_sales",
+ "default_settings",
+ "default_bank_account",
+ "default_cash_account",
+ "default_receivable_account",
+ "round_off_account",
+ "round_off_cost_center",
+ "write_off_account",
+ "discount_allowed_account",
+ "discount_received_account",
+ "exchange_gain_loss_account",
+ "unrealized_exchange_gain_loss_account",
+ "column_break0",
+ "allow_account_creation_against_child_company",
+ "default_payable_account",
+ "default_employee_advance_account",
+ "default_expense_account",
+ "default_income_account",
+ "default_deferred_revenue_account",
+ "default_deferred_expense_account",
+ "default_payroll_payable_account",
+ "default_expense_claim_payable_account",
+ "section_break_22",
+ "cost_center",
+ "column_break_26",
+ "credit_limit",
+ "payment_terms",
+ "auto_accounting_for_stock_settings",
+ "enable_perpetual_inventory",
+ "default_inventory_account",
+ "stock_adjustment_account",
+ "column_break_32",
+ "stock_received_but_not_billed",
+ "expenses_included_in_valuation",
+ "fixed_asset_depreciation_settings",
+ "accumulated_depreciation_account",
+ "depreciation_expense_account",
+ "series_for_depreciation_entry",
+ "expenses_included_in_asset_valuation",
+ "column_break_40",
+ "disposal_account",
+ "depreciation_cost_center",
+ "capital_work_in_progress_account",
+ "asset_received_but_not_billed",
+ "budget_detail",
+ "exception_budget_approver_role",
+ "company_info",
+ "company_logo",
+ "date_of_incorporation",
+ "address_html",
+ "date_of_commencement",
+ "phone_no",
+ "fax",
+ "email",
+ "website",
+ "column_break1",
+ "company_description",
+ "registration_info",
+ "registration_details",
+ "delete_company_transactions",
+ "lft",
+ "rgt",
+ "old_parent"
+ ],
+ "fields": [
+ {
+ "fieldname": "details",
+ "fieldtype": "Section Break",
+ "oldfieldtype": "Section Break"
+ },
+ {
+ "fieldname": "company_name",
+ "fieldtype": "Data",
+ "label": "Company",
+ "oldfieldname": "company_name",
+ "oldfieldtype": "Data",
+ "reqd": 1,
+ "unique": 1
+ },
+ {
+ "fieldname": "abbr",
+ "fieldtype": "Data",
+ "label": "Abbr",
+ "oldfieldname": "abbr",
+ "oldfieldtype": "Data",
+ "reqd": 1
+ },
+ {
+ "depends_on": "eval:!doc.__islocal && in_list(frappe.user_roles, \"System Manager\")",
+ "fieldname": "change_abbr",
+ "fieldtype": "Button",
+ "label": "Change Abbreviation"
+ },
+ {
+ "bold": 1,
+ "default": "0",
+ "fieldname": "is_group",
+ "fieldtype": "Check",
+ "label": "Is Group"
+ },
+ {
+ "fieldname": "default_finance_book",
+ "fieldtype": "Link",
+ "label": "Default Finance Book",
+ "options": "Finance Book"
+ },
+ {
+ "fieldname": "cb0",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "domain",
+ "fieldtype": "Link",
+ "label": "Domain",
+ "options": "Domain"
+ },
+ {
+ "fieldname": "parent_company",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Parent Company",
+ "options": "Company"
+ },
+ {
+ "fieldname": "company_logo",
+ "fieldtype": "Attach Image",
+ "hidden": 1,
+ "label": "Company Logo"
+ },
+ {
+ "fieldname": "company_description",
+ "fieldtype": "Text Editor",
+ "label": "Company Description"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "sales_settings",
+ "fieldtype": "Section Break",
+ "label": "Sales Settings"
+ },
+ {
+ "fieldname": "sales_monthly_history",
+ "fieldtype": "Small Text",
+ "hidden": 1,
+ "label": "Sales Monthly History",
+ "no_copy": 1,
+ "read_only": 1
+ },
+ {
+ "fieldname": "transactions_annual_history",
+ "fieldtype": "Code",
+ "hidden": 1,
+ "label": "Transactions Annual History",
+ "no_copy": 1,
+ "read_only": 1
+ },
+ {
+ "fieldname": "monthly_sales_target",
+ "fieldtype": "Currency",
+ "label": "Monthly Sales Target",
+ "options": "default_currency"
+ },
+ {
+ "fieldname": "column_break_goals",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "total_monthly_sales",
+ "fieldtype": "Currency",
+ "label": "Total Monthly Sales",
+ "no_copy": 1,
+ "options": "default_currency",
+ "read_only": 1
+ },
+ {
+ "fieldname": "charts_section",
+ "fieldtype": "Section Break",
+ "label": "Default Values"
+ },
+ {
+ "fieldname": "default_currency",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Currency",
+ "options": "Currency",
+ "reqd": 1
+ },
+ {
+ "fieldname": "default_letter_head",
+ "fieldtype": "Link",
+ "label": "Default Letter Head",
+ "options": "Letter Head"
+ },
+ {
+ "fieldname": "default_holiday_list",
+ "fieldtype": "Link",
+ "label": "Default Holiday List",
+ "options": "Holiday List"
+ },
+ {
+ "fieldname": "standard_working_hours",
+ "fieldtype": "Float",
+ "label": "Standard Working Hours"
+ },
+ {
+ "fieldname": "default_warehouse_for_sales_return",
+ "fieldtype": "Link",
+ "label": "Default warehouse for Sales Return",
+ "options": "Warehouse"
+ },
+ {
+ "fieldname": "column_break_10",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "country",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Country",
+ "options": "Country",
+ "reqd": 1
+ },
+ {
+ "fieldname": "create_chart_of_accounts_based_on",
+ "fieldtype": "Select",
+ "label": "Create Chart Of Accounts Based On",
+ "options": "\nStandard Template\nExisting Company"
+ },
+ {
+ "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Standard Template\"",
+ "fieldname": "chart_of_accounts",
+ "fieldtype": "Select",
+ "label": "Chart Of Accounts Template",
+ "no_copy": 1
+ },
+ {
+ "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Existing Company\"",
+ "fieldname": "existing_company",
+ "fieldtype": "Link",
+ "label": "Existing Company ",
+ "no_copy": 1,
+ "options": "Company"
+ },
+ {
+ "fieldname": "tax_id",
+ "fieldtype": "Data",
+ "label": "Tax ID"
+ },
+ {
+ "fieldname": "date_of_establishment",
+ "fieldtype": "Date",
+ "label": "Date of Establishment"
+ },
+ {
+ "fieldname": "default_settings",
+ "fieldtype": "Section Break",
+ "label": "Accounts Settings",
+ "oldfieldtype": "Section Break"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_bank_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Bank Account",
+ "no_copy": 1,
+ "oldfieldname": "default_bank_account",
+ "oldfieldtype": "Link",
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_cash_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Cash Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_receivable_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Receivable Account",
+ "no_copy": 1,
+ "oldfieldname": "receivables_group",
+ "oldfieldtype": "Link",
+ "options": "Account"
+ },
+ {
+ "fieldname": "round_off_account",
+ "fieldtype": "Link",
+ "label": "Round Off Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "round_off_cost_center",
+ "fieldtype": "Link",
+ "label": "Round Off Cost Center",
+ "options": "Cost Center"
+ },
+ {
+ "fieldname": "write_off_account",
+ "fieldtype": "Link",
+ "label": "Write Off Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "discount_allowed_account",
+ "fieldtype": "Link",
+ "label": "Discount Allowed Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "discount_received_account",
+ "fieldtype": "Link",
+ "label": "Discount Received Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "exchange_gain_loss_account",
+ "fieldtype": "Link",
+ "label": "Exchange Gain / Loss Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "unrealized_exchange_gain_loss_account",
+ "fieldtype": "Link",
+ "label": "Unrealized Exchange Gain/Loss Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "column_break0",
+ "fieldtype": "Column Break",
+ "oldfieldtype": "Column Break",
+ "width": "50%"
+ },
+ {
+ "default": "0",
+ "depends_on": "eval:doc.parent_company",
+ "fieldname": "allow_account_creation_against_child_company",
+ "fieldtype": "Check",
+ "label": "Allow Account Creation Against Child Company"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_payable_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Payable Account",
+ "no_copy": 1,
+ "oldfieldname": "payables_group",
+ "oldfieldtype": "Link",
+ "options": "Account"
+ },
+ {
+ "fieldname": "default_employee_advance_account",
+ "fieldtype": "Link",
+ "label": "Default Employee Advance Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_expense_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Cost of Goods Sold Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_income_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Income Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_deferred_revenue_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Deferred Revenue Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_deferred_expense_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Deferred Expense Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_payroll_payable_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Payroll Payable Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_expense_claim_payable_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Expense Claim Payable Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "fieldname": "section_break_22",
+ "fieldtype": "Section Break"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "cost_center",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Cost Center",
+ "no_copy": 1,
+ "options": "Cost Center"
+ },
+ {
+ "fieldname": "column_break_26",
+ "fieldtype": "Column Break"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "credit_limit",
+ "fieldtype": "Currency",
+ "label": "Credit Limit",
+ "oldfieldname": "credit_limit",
+ "oldfieldtype": "Currency",
+ "options": "default_currency"
+ },
+ {
+ "fieldname": "payment_terms",
+ "fieldtype": "Link",
+ "label": "Default Payment Terms Template",
+ "options": "Payment Terms Template"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "auto_accounting_for_stock_settings",
+ "fieldtype": "Section Break",
+ "label": "Stock Settings"
+ },
+ {
+ "default": "1",
+ "fieldname": "enable_perpetual_inventory",
+ "fieldtype": "Check",
+ "label": "Enable Perpetual Inventory"
+ },
+ {
+ "fieldname": "default_inventory_account",
+ "fieldtype": "Link",
+ "label": "Default Inventory Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "stock_adjustment_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Stock Adjustment Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "fieldname": "column_break_32",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "stock_received_but_not_billed",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Stock Received But Not Billed",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "fieldname": "expenses_included_in_valuation",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Expenses Included In Valuation",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "fixed_asset_depreciation_settings",
+ "fieldtype": "Section Break",
+ "label": "Fixed Asset Depreciation Settings"
+ },
+ {
+ "fieldname": "accumulated_depreciation_account",
+ "fieldtype": "Link",
+ "label": "Accumulated Depreciation Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "fieldname": "depreciation_expense_account",
+ "fieldtype": "Link",
+ "label": "Depreciation Expense Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "fieldname": "series_for_depreciation_entry",
+ "fieldtype": "Data",
+ "label": "Series for Asset Depreciation Entry (Journal Entry)"
+ },
+ {
+ "fieldname": "expenses_included_in_asset_valuation",
+ "fieldtype": "Link",
+ "label": "Expenses Included In Asset Valuation",
+ "options": "Account"
+ },
+ {
+ "fieldname": "column_break_40",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "disposal_account",
+ "fieldtype": "Link",
+ "label": "Gain/Loss Account on Asset Disposal",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "fieldname": "depreciation_cost_center",
+ "fieldtype": "Link",
+ "label": "Asset Depreciation Cost Center",
+ "no_copy": 1,
+ "options": "Cost Center"
+ },
+ {
+ "fieldname": "capital_work_in_progress_account",
+ "fieldtype": "Link",
+ "label": "Capital Work In Progress Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "asset_received_but_not_billed",
+ "fieldtype": "Link",
+ "label": "Asset Received But Not Billed",
+ "options": "Account"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "budget_detail",
+ "fieldtype": "Section Break",
+ "label": "Budget Detail"
+ },
+ {
+ "fieldname": "exception_budget_approver_role",
+ "fieldtype": "Link",
+ "label": "Exception Budget Approver Role",
+ "options": "Role"
+ },
+ {
+ "collapsible": 1,
+ "description": "For reference only.",
+ "fieldname": "company_info",
+ "fieldtype": "Section Break",
+ "label": "Company Info"
+ },
+ {
+ "fieldname": "date_of_incorporation",
+ "fieldtype": "Date",
+ "label": "Date of Incorporation"
+ },
+ {
+ "fieldname": "address_html",
+ "fieldtype": "HTML"
+ },
+ {
+ "fieldname": "column_break1",
+ "fieldtype": "Column Break",
+ "oldfieldtype": "Column Break",
+ "width": "50%"
+ },
+ {
+ "depends_on": "eval:doc.date_of_incorporation",
+ "fieldname": "date_of_commencement",
+ "fieldtype": "Date",
+ "label": "Date of Commencement"
+ },
+ {
+ "fieldname": "phone_no",
+ "fieldtype": "Data",
+ "label": "Phone No",
+ "oldfieldname": "phone_no",
+ "oldfieldtype": "Data",
+ "options": "Phone"
+ },
+ {
+ "fieldname": "fax",
+ "fieldtype": "Data",
+ "label": "Fax",
+ "oldfieldname": "fax",
+ "oldfieldtype": "Data",
+ "options": "Phone"
+ },
+ {
+ "fieldname": "email",
+ "fieldtype": "Data",
+ "label": "Email",
+ "oldfieldname": "email",
+ "oldfieldtype": "Data",
+ "options": "Email"
+ },
+ {
+ "fieldname": "website",
+ "fieldtype": "Data",
+ "label": "Website",
+ "oldfieldname": "website",
+ "oldfieldtype": "Data"
+ },
+ {
+ "fieldname": "registration_info",
+ "fieldtype": "Section Break",
+ "oldfieldtype": "Section Break",
+ "width": "50%"
+ },
+ {
+ "description": "Company registration numbers for your reference. Tax numbers etc.",
+ "fieldname": "registration_details",
+ "fieldtype": "Code",
+ "label": "Registration Details",
+ "oldfieldname": "registration_details",
+ "oldfieldtype": "Code"
+ },
+ {
+ "fieldname": "delete_company_transactions",
+ "fieldtype": "Button",
+ "label": "Delete Company Transactions"
+ },
+ {
+ "fieldname": "lft",
+ "fieldtype": "Int",
+ "hidden": 1,
+ "label": "Lft",
+ "print_hide": 1,
+ "read_only": 1,
+ "search_index": 1
+ },
+ {
+ "fieldname": "rgt",
+ "fieldtype": "Int",
+ "hidden": 1,
+ "label": "Rgt",
+ "print_hide": 1,
+ "read_only": 1,
+ "search_index": 1
+ },
+ {
+ "fieldname": "old_parent",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "label": "old_parent",
+ "print_hide": 1,
+ "read_only": 1
+ },
+ {
+ "fieldname": "default_selling_terms",
+ "fieldtype": "Link",
+ "label": "Default Selling Terms",
+ "options": "Terms and Conditions"
+ },
+ {
+ "fieldname": "default_buying_terms",
+ "fieldtype": "Link",
+ "label": "Default Buying Terms",
+ "options": "Terms and Conditions"
+ }
+ ],
+ "icon": "fa fa-building",
+ "idx": 1,
+ "image_field": "company_logo",
+ "modified": "2019-07-04 22:20:45.104307",
+ "modified_by": "Administrator",
+ "module": "Setup",
+ "name": "Company",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "System Manager",
+ "share": 1,
+ "write": 1
+ },
+ {
+ "email": 1,
+ "print": 1,
+ "read": 1,
+ "role": "Accounts User"
+ },
+ {
+ "read": 1,
+ "role": "Employee"
+ },
+ {
+ "read": 1,
+ "role": "Sales User"
+ },
+ {
+ "read": 1,
+ "role": "Purchase User"
+ },
+ {
+ "read": 1,
+ "role": "Stock User"
+ },
+ {
+ "read": 1,
+ "role": "Projects User"
+ }
+ ],
+ "show_name_in_global_search": 1,
+ "sort_field": "modified",
+ "sort_order": "ASC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json
index c1d459f..aba6a79 100644
--- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json
+++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json
@@ -1,288 +1,142 @@
{
- "allow_copy": 0,
- "allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:title",
- "beta": 0,
"creation": "2013-01-10 16:34:24",
- "custom": 0,
"description": "Standard Terms and Conditions that can be added to Sales and Purchases.\n\nExamples:\n\n1. Validity of the offer.\n1. Payment Terms (In Advance, On Credit, part advance etc).\n1. What is extra (or payable by the Customer).\n1. Safety / usage warning.\n1. Warranty if any.\n1. Returns Policy.\n1. Terms of shipping, if applicable.\n1. Ways of addressing disputes, indemnity, liability, etc.\n1. Address and Contact of your Company.",
- "docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
- "editable_grid": 0,
+ "engine": "InnoDB",
+ "field_order": [
+ "title",
+ "disabled",
+ "applicable_modules_section",
+ "selling",
+ "buying",
+ "hr",
+ "section_break_7",
+ "terms",
+ "terms_and_conditions_help"
+ ],
"fields": [
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
"fieldname": "title",
"fieldtype": "Data",
- "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": "Title",
- "length": 0,
"no_copy": 1,
"oldfieldname": "title",
"oldfieldtype": "Data",
- "permlevel": 0,
- "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": 1
},
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
+ "default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
"in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Disabled",
- "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
+ "label": "Disabled"
},
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
+ "allow_in_quick_entry": 1,
"fieldname": "terms",
"fieldtype": "Text Editor",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
"in_global_search": 1,
- "in_list_view": 0,
- "in_standard_filter": 0,
"label": "Terms and Conditions",
- "length": 0,
- "no_copy": 0,
"oldfieldname": "terms",
- "oldfieldtype": "Text Editor",
- "permlevel": 0,
- "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
+ "oldfieldtype": "Text Editor"
},
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
"fieldname": "terms_and_conditions_help",
"fieldtype": "HTML",
- "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": "Terms and Conditions Help",
- "length": 0,
- "no_copy": 0,
- "options": "<h4>Standard Terms and Conditions Example</h4>\n\n<pre>Delivery Terms for Order number {{ name }}\n\n-Order Date : {{ transaction_date }} \n-Expected Delivery Date : {{ delivery_date }}\n</pre>\n\n<h4>How to get fieldnames</h4>\n\n<p>The fieldnames you can use in your email template are the fields in the document from which you are sending the email. You can find out the fields of any documents via Setup > Customize Form View and selecting the document type (e.g. Sales Invoice)</p>\n\n<h4>Templating</h4>\n\n<p>Templates are compiled using the Jinja Templating Langauge. To learn more about Jinja, <a class=\"strong\" href=\"http://jinja.pocoo.org/docs/dev/templates/\">read this documentation.</a></p>",
- "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
+ "options": "<h4>Standard Terms and Conditions Example</h4>\n\n<pre>Delivery Terms for Order number {{ name }}\n\n-Order Date : {{ transaction_date }} \n-Expected Delivery Date : {{ delivery_date }}\n</pre>\n\n<h4>How to get fieldnames</h4>\n\n<p>The fieldnames you can use in your email template are the fields in the document from which you are sending the email. You can find out the fields of any documents via Setup > Customize Form View and selecting the document type (e.g. Sales Invoice)</p>\n\n<h4>Templating</h4>\n\n<p>Templates are compiled using the Jinja Templating Langauge. To learn more about Jinja, <a class=\"strong\" href=\"http://jinja.pocoo.org/docs/dev/templates/\">read this documentation.</a></p>"
+ },
+ {
+ "fieldname": "applicable_modules_section",
+ "fieldtype": "Section Break",
+ "label": "Applicable Modules"
+ },
+ {
+ "default": "1",
+ "fieldname": "selling",
+ "fieldtype": "Check",
+ "label": "Selling"
+ },
+ {
+ "default": "1",
+ "fieldname": "buying",
+ "fieldtype": "Check",
+ "label": "Buying"
+ },
+ {
+ "default": "1",
+ "fieldname": "hr",
+ "fieldtype": "Check",
+ "label": "HR"
+ },
+ {
+ "fieldname": "section_break_7",
+ "fieldtype": "Section Break"
}
],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 0,
"icon": "icon-legal",
"idx": 1,
- "image_view": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 0,
- "max_attachments": 0,
- "modified": "2018-08-29 06:36:33.131473",
+ "modified": "2019-07-04 13:31:30.393425",
"modified_by": "Administrator",
"module": "Setup",
"name": "Terms and Conditions",
"owner": "Administrator",
"permissions": [
{
- "amend": 0,
- "cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
- "if_owner": 0,
"import": 1,
- "permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Master Manager",
- "set_user_permissions": 0,
"share": 1,
- "submit": 0,
"write": 1
},
{
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "delete": 0,
- "email": 0,
- "export": 0,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
- "print": 0,
"read": 1,
- "report": 0,
- "role": "Sales User",
- "set_user_permissions": 0,
- "share": 0,
- "submit": 0,
- "write": 0
+ "role": "Sales User"
},
{
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "delete": 0,
- "email": 0,
- "export": 0,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
- "print": 0,
"read": 1,
- "report": 0,
- "role": "Purchase User",
- "set_user_permissions": 0,
- "share": 0,
- "submit": 0,
- "write": 0
+ "role": "Purchase User"
},
{
- "amend": 0,
- "cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
- "export": 0,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
- "set_user_permissions": 0,
"share": 1,
- "submit": 0,
"write": 1
},
{
- "amend": 0,
- "cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
- "export": 0,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
- "set_user_permissions": 0,
"share": 1,
- "submit": 0,
"write": 1
},
{
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "delete": 0,
- "email": 0,
- "export": 0,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
- "print": 0,
"read": 1,
- "report": 0,
- "role": "Stock User",
- "set_user_permissions": 0,
- "share": 0,
- "submit": 0,
- "write": 0
+ "role": "Stock User"
}
],
"quick_entry": 1,
- "read_only": 0,
- "read_only_onload": 0,
"show_name_in_global_search": 1,
- "sort_order": "ASC",
- "track_changes": 0,
- "track_seen": 0,
- "track_views": 0
+ "sort_field": "modified",
+ "sort_order": "ASC"
}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
index a2152a6..372cc6d 100644
--- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
+++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
@@ -3,9 +3,11 @@
from __future__ import unicode_literals
import frappe
+from frappe import _, throw
import json
from frappe.model.document import Document
from frappe.utils.jinja import validate_template
+from frappe.utils import cint
from six import string_types
@@ -13,6 +15,8 @@
def validate(self):
if self.terms:
validate_template(self.terms)
+ if not cint(self.buying) and not cint(self.selling) and not cint(self.hr) and not cint(self.disabled):
+ throw(_("At least one of the Applicable Modules should be selected"))
@frappe.whitelist()
def get_terms_and_conditions(template_name, doc):
diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py
index a5bd93f..4ca43a8 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -33,7 +33,7 @@
FROM `tabCompany`
LIMIT 1""") and 'Yes' or 'No'
- bootinfo.docs += frappe.db.sql("""select name, default_currency, cost_center, default_terms,
+ bootinfo.docs += frappe.db.sql("""select name, default_currency, cost_center, default_selling_terms, default_buying_terms,
default_letter_head, default_bank_account, enable_perpetual_inventory, country from `tabCompany`""",
as_dict=1, update={"doctype":":Company"})