Merge pull request #7052 from saurabh6790/integration_service_document
[documentaion] Documentaion for setting up Integration Service
diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js
index 4cf9a67..fc6a1b4 100644
--- a/erpnext/accounts/doctype/account/account_tree.js
+++ b/erpnext/accounts/doctype/account/account_tree.js
@@ -30,7 +30,9 @@
options: ['Asset', 'Liability', 'Equity', 'Income', 'Expense'].join('\n'),
depends_on: 'eval:doc.is_group && !doc.parent_account'},
{fieldtype:'Select', fieldname:'account_type', label:__('Account Type'),
- options: ['', 'Bank', 'Cash', 'Stock', 'Tax', 'Chargeable', 'Fixed Asset'].join('\n'),
+ options: ['', 'Accumulated Depreciation', 'Bank', 'Cash', 'Chargeable', 'Cost of Goods Sold', 'Depreciation',
+ 'Equity', 'Expense Account', 'Expenses Included In Valuation', 'Fixed Asset', 'Income Account', 'Payable', 'Receivable',
+ 'Round Off', 'Stock', 'Stock Adjustment', 'Stock Received But Not Billed', 'Tax', 'Temporary'].join('\n'),
description: __("Optional. This setting will be used to filter in various transactions.")
},
{fieldtype:'Float', fieldname:'tax_rate', label:__('Tax Rate'),
diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
index 5c82142..e26e354 100644
--- a/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
+++ b/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
@@ -6,9 +6,8 @@
from frappe.utils import cstr
from unidecode import unidecode
-def create_charts(chart_name, company):
- chart = get_chart(chart_name)
-
+def create_charts(company, chart_template=None, existing_company=None):
+ chart = get_chart(chart_template, existing_company)
if chart:
accounts = []
@@ -17,7 +16,7 @@
if root_account:
root_type = child.get("root_type")
- if account_name not in ["account_type", "root_type", "is_group"]:
+ if account_name not in ["account_type", "root_type", "is_group", "tax_rate"]:
account_name_in_db = unidecode(account_name.strip().lower())
if account_name_in_db in accounts:
@@ -57,16 +56,19 @@
def identify_is_group(child):
if child.get("is_group"):
is_group = child.get("is_group")
- elif len(set(child.keys()) - set(["account_type", "root_type", "is_group"])):
+ elif len(set(child.keys()) - set(["account_type", "root_type", "is_group", "tax_rate"])):
is_group = 1
else:
is_group = 0
return is_group
-def get_chart(chart_name):
+def get_chart(chart_template, existing_company=None):
chart = {}
- if chart_name == "Standard":
+ if existing_company:
+ return get_account_tree_from_existing_company(existing_company)
+
+ elif chart_template == "Standard":
from erpnext.accounts.doctype.account.chart_of_accounts.verified import standard_chart_of_accounts
return standard_chart_of_accounts.get()
else:
@@ -79,7 +81,7 @@
if fname.endswith(".json"):
with open(os.path.join(path, fname), "r") as f:
chart = f.read()
- if chart and json.loads(chart).get("name") == chart_name:
+ if chart and json.loads(chart).get("name") == chart_template:
return json.loads(chart).get("tree")
@frappe.whitelist()
@@ -111,3 +113,47 @@
charts.append("Standard")
return charts
+
+
+def get_account_tree_from_existing_company(existing_company):
+ all_accounts = frappe.get_all('Account',
+ filters={'company': existing_company},
+ fields = ["name", "account_name", "parent_account", "account_type",
+ "is_group", "root_type", "tax_rate"],
+ order_by="lft, rgt")
+
+ account_tree = {}
+
+ # fill in tree starting with root accounts (those with no parent)
+ build_account_tree(account_tree, None, all_accounts)
+
+ return account_tree
+
+def build_account_tree(tree, parent, all_accounts):
+ # find children
+ parent_account = parent.name if parent else None
+ children = [acc for acc in all_accounts if acc.parent_account == parent_account]
+
+ # if no children, but a group account
+ if not children and parent.is_group:
+ tree["is_group"] = 1
+
+ # build a subtree for each child
+ for child in children:
+ if child.account_type == "Stock" and not child.is_group:
+ tree["is_group"] = 1
+ continue
+
+ # start new subtree
+ tree[child.account_name] = {}
+
+ # assign account_type and root_type
+ if child.account_type:
+ tree[child.account_name]["account_type"] = child.account_type
+ if child.tax_rate:
+ tree[child.account_name]["tax_rate"] = child.tax_rate
+ if not parent:
+ tree[child.account_name]["root_type"] = child.root_type
+
+ # call recursively to build a subtree for current account
+ build_account_tree(tree[child.account_name], child, all_accounts)
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js
index ce0cb50..ea1a2e3 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.js
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js
@@ -120,50 +120,21 @@
set_dynamic_labels: function(frm) {
var company_currency = frappe.get_doc(":Company", frm.doc.company).default_currency;
- var field_label_map = {};
- var grid_field_label_map = {};
-
- var setup_field_label_map = function(fields_list, currency, parentfield) {
- var doctype = parentfield ? frm.fields_dict[parentfield].grid.doctype : frm.doc.doctype;
- $.each(fields_list, function(i, fname) {
- var docfield = frappe.meta.docfield_map[doctype][fname];
- if(docfield) {
- var label = __(docfield.label || "").replace(/\([^\)]*\)/g, "");
- if(parentfield) {
- grid_field_label_map[doctype + "-" + fname] =
- label.trim() + " (" + __(currency) + ")";
- } else {
- field_label_map[fname] = label.trim() + " (" + currency + ")";
- }
- }
- });
- }
-
- setup_field_label_map(["base_paid_amount", "base_received_amount", "base_total_allocated_amount",
+ frm.set_currency_labels(["base_paid_amount", "base_received_amount", "base_total_allocated_amount",
"difference_amount"], company_currency);
- setup_field_label_map(["paid_amount"], frm.doc.paid_from_account_currency);
- setup_field_label_map(["received_amount"], frm.doc.paid_to_account_currency);
+ frm.set_currency_labels(["paid_amount"], frm.doc.paid_from_account_currency);
+ frm.set_currency_labels(["received_amount"], frm.doc.paid_to_account_currency);
var party_account_currency = frm.doc.payment_type=="Receive" ?
frm.doc.paid_from_account_currency : frm.doc.paid_to_account_currency;
- setup_field_label_map(["total_allocated_amount", "unallocated_amount"], party_account_currency);
+ frm.set_currency_labels(["total_allocated_amount", "unallocated_amount"], party_account_currency);
- $.each(field_label_map, function(fname, label) {
- me.frm.fields_dict[fname].set_label(label);
- });
-
- setup_field_label_map(["total_amount", "outstanding_amount", "allocated_amount"],
+ frm.set_currency_labels(["total_amount", "outstanding_amount", "allocated_amount"],
party_account_currency, "references");
- setup_field_label_map(["amount"], company_currency, "deductions");
-
- $.each(grid_field_label_map, function(fname, label) {
- fname = fname.split("-");
- var df = frappe.meta.get_docfield(fname[0], fname[1], me.frm.doc.name);
- if(df) df.label = label;
- });
+ frm.set_currency_labels(["amount"], company_currency, "deductions");
cur_frm.set_df_property("source_exchange_rate", "description",
("1 " + frm.doc.paid_from_account_currency + " = [?] " + company_currency));
diff --git a/erpnext/controllers/tests/test_recurring_document.py b/erpnext/controllers/tests/test_recurring_document.py
index 58558c4..d47c5c7 100644
--- a/erpnext/controllers/tests/test_recurring_document.py
+++ b/erpnext/controllers/tests/test_recurring_document.py
@@ -110,7 +110,7 @@
no_of_months = ({"Monthly": 1, "Quarterly": 3, "Yearly": 12})[base_doc.recurring_type]
def _test(i):
- obj.assertEquals(i+1, frappe.db.sql("""select count(name) from `tab%s`
+ obj.assertEquals(i+1, frappe.db.sql("""select count(*) from `tab%s`
where recurring_id=%s and (docstatus=1 or docstatus=0)""" % (base_doc.doctype, '%s'),
(base_doc.recurring_id))[0][0])
diff --git a/erpnext/docs/assets/img/manufacturing/price-list-based-currency-bom.png b/erpnext/docs/assets/img/manufacturing/price-list-based-currency-bom.png
new file mode 100644
index 0000000..c8eca6a
--- /dev/null
+++ b/erpnext/docs/assets/img/manufacturing/price-list-based-currency-bom.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/data-import/data-import-tool-template.gif b/erpnext/docs/assets/img/setup/data-import/data-import-tool-template.gif
new file mode 100644
index 0000000..c4d28f4
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/data-import/data-import-tool-template.gif
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/data-import/import-csv.png b/erpnext/docs/assets/img/setup/data-import/import-csv.png
new file mode 100644
index 0000000..3b9bc9f
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/data-import/import-csv.png
Binary files differ
diff --git a/erpnext/docs/assets/img/setup/data-import/import-file.png b/erpnext/docs/assets/img/setup/data-import/import-file.png
new file mode 100644
index 0000000..c99e015
--- /dev/null
+++ b/erpnext/docs/assets/img/setup/data-import/import-file.png
Binary files differ
diff --git a/erpnext/docs/assets/old_images/erpnext/import-3.png b/erpnext/docs/assets/old_images/erpnext/import-3.png
deleted file mode 100644
index 9387dd5..0000000
--- a/erpnext/docs/assets/old_images/erpnext/import-3.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/assets/old_images/erpnext/import-4.png b/erpnext/docs/assets/old_images/erpnext/import-4.png
deleted file mode 100644
index fce1f51..0000000
--- a/erpnext/docs/assets/old_images/erpnext/import-4.png
+++ /dev/null
Binary files differ
diff --git a/erpnext/docs/user/manual/en/manufacturing/bill-of-materials.md b/erpnext/docs/user/manual/en/manufacturing/bill-of-materials.md
index 34d8530..91bf7ed 100644
--- a/erpnext/docs/user/manual/en/manufacturing/bill-of-materials.md
+++ b/erpnext/docs/user/manual/en/manufacturing/bill-of-materials.md
@@ -31,6 +31,11 @@
<img class="screenshot" alt="Update Cost" src="{{docs_base_url}}/assets/img/manufacturing/bom-update-cost.png">
+* User can select the currency in the BOM
+* System calculates the costing based on the price list currency
+
+<img class="screenshot" alt="Update Cost" src="{{docs_base_url}}/assets/img/manufacturing/price-list-based-currency-bom.png">
+
### Materials Required(exploded)
This table lists down all the Material required for the Item to be Manufactured.
diff --git a/erpnext/docs/user/manual/en/setting-up/data/data-import-tool.md b/erpnext/docs/user/manual/en/setting-up/data/data-import-tool.md
index e59ed21..563568a 100644
--- a/erpnext/docs/user/manual/en/setting-up/data/data-import-tool.md
+++ b/erpnext/docs/user/manual/en/setting-up/data/data-import-tool.md
@@ -1,8 +1,6 @@
-The Data Import Tool is a great way to upload (or edit) bulk data, specially
-master data, into the system.
+The Data Import Tool is a great way to upload (or edit) bulk data, specially master data, into the system.
-To Open the data import tool, you either go to Setup or go to the Transaction
-you want to Import. If Data Import is allowed, you will see an Import Button:
+To Open the data import tool, you either go to Setup or go to the Transaction you want to Import. If Data Import is allowed, you will see an Import Button:
<img alt="Start Import" class="screenshot" src="{{docs_base_url}}/assets/img/setup/data-import/data-import-1.png">
@@ -20,22 +18,24 @@
implemented where there are multiple values for any property. For example an
Item can have multiple prices, An Invoice has multiple Items and so on.
-<img alt="Download Template" class="screenshot" src="{{docs_base_url}}/assets/img/setup/data-import/data-import-2.png">
-
- * Click on the table you want to download or "All Tables"
- * For bulk editing, you can click on "Download With Data"
+ * Select Doctype for which template should be downloaded.
+ * Check fields to be included in the template.
+ * Click on "Download Blank Template".
+ * For bulk editing, you can click on "Download With Data".
+
+<img alt="Download Template" class="screenshot" src="{{docs_base_url}}/assets/img/setup/data-import/data-import-tool-template.gif">
### 2\. Fill in the Template
After downloading the template, open it in a spreadsheet application and fill
in the data below the column headings.
-
+<img alt="Download Template" class="screenshot" src="{{docs_base_url}}/assets/img/setup/data-import/import-file.png">
Then export your template or save it as a **Comma Separated Values** (CSV)
file.
-
+<img alt="Download Template" class="screenshot" src="{{docs_base_url}}/assets/img/setup/data-import/import-csv.png">
### 3\. Upload the .csv File
@@ -49,7 +49,7 @@
1. Make sure that if your application allows, use encoding as UTF-8.
1. Keep the ID column blank for new records.
-### 4\. Uploading All Tables (Main + Child)
+### 4. Uploading All Tables (Main + Child)
If you select all tables, you will get columns belonging to all the tables in
one row separated by `~` columns.
@@ -67,7 +67,7 @@
> To see how its done, enter a few records manually using forms and export
"All Tables" with "Download with Data"
-### 5\. Overwriting
+### 5. Overwriting
ERPNext also allows you to overwrite all / certain columns. If you want to
update certain columns, you can download the template with data. Remember to
@@ -76,7 +76,7 @@
> Note: For child records, if you select Overwrite, it will delete all the
child records of that parent.
-### 6\. Upload Limitations
+### 6. Upload Limitations
ERPNext restricts the amount of data you can upload in one file. Though the
number may vary based on the type of data. It is usually safe to upload around
@@ -107,4 +107,10 @@
clear way of saving as UTF-8. So save your file as a CSV, then open it in
Notepad, and save as “UTF-8”. (Sorry blame Microsoft for this!)
+####Help Video on Importing Data in ERPNext from Spreadsheet file
+
+
+
+<iframe width="660" height="371" src="https://www.youtube.com/embed/Ta2Xx3QoK3E" frameborder="0" allowfullscreen></iframe>
+
{next}
diff --git a/erpnext/docs/user/manual/en/setting-up/print/multi-lingual-print-format.md b/erpnext/docs/user/manual/en/setting-up/print/custom-translations.md
similarity index 98%
rename from erpnext/docs/user/manual/en/setting-up/print/multi-lingual-print-format.md
rename to erpnext/docs/user/manual/en/setting-up/print/custom-translations.md
index a15834c..1dab1c1 100644
--- a/erpnext/docs/user/manual/en/setting-up/print/multi-lingual-print-format.md
+++ b/erpnext/docs/user/manual/en/setting-up/print/custom-translations.md
@@ -1,4 +1,4 @@
-#Multi-lngual Print Formats
+#Custom Translations
User can print the customer's and supplier's document in their local language. For an example if I have customers from germany, france who want quotation in german, french language will be possible with these feature.
diff --git a/erpnext/docs/user/manual/en/setting-up/print/index.txt b/erpnext/docs/user/manual/en/setting-up/print/index.txt
index 80b5946..fa23652 100644
--- a/erpnext/docs/user/manual/en/setting-up/print/index.txt
+++ b/erpnext/docs/user/manual/en/setting-up/print/index.txt
@@ -5,4 +5,4 @@
address-template
terms-and-conditions
cheque-print-template
-multi-lingual-print-format
\ No newline at end of file
+custom-translations
\ No newline at end of file
diff --git a/erpnext/docs/user/manual/en/website/articles/index.txt b/erpnext/docs/user/manual/en/website/articles/index.txt
index a89040a..97c24d5 100644
--- a/erpnext/docs/user/manual/en/website/articles/index.txt
+++ b/erpnext/docs/user/manual/en/website/articles/index.txt
@@ -1,3 +1,3 @@
managing-user-sign-up-via-website
website-security
-wesite-home-page
\ No newline at end of file
+website-home-page
diff --git a/erpnext/docs/user/manual/en/website/articles/wesite-home-page.md b/erpnext/docs/user/manual/en/website/articles/website-home-page.md
similarity index 97%
rename from erpnext/docs/user/manual/en/website/articles/wesite-home-page.md
rename to erpnext/docs/user/manual/en/website/articles/website-home-page.md
index 0cf5fdc..9212643 100644
--- a/erpnext/docs/user/manual/en/website/articles/wesite-home-page.md
+++ b/erpnext/docs/user/manual/en/website/articles/website-home-page.md
@@ -1,4 +1,4 @@
-<h1>Wesite Home Page</h1>
+<h1>Website Home Page</h1>
It is very much possible in ERPNext to setup certain standard page as default website Home Page. Following are steps to setup default website home page.
diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js
index ce4c4cb..5181cf4 100644
--- a/erpnext/manufacturing/doctype/bom/bom.js
+++ b/erpnext/manufacturing/doctype/bom/bom.js
@@ -4,9 +4,19 @@
frappe.provide("erpnext.bom");
frappe.ui.form.on("BOM", {
+ setup: function(frm) {
+ frm.add_fetch('buying_price_list', 'currency', 'currency')
+ frm.fields_dict["items"].grid.get_field("bom_no").get_query = function(doc, cdt, cdn){
+ return {
+ filters: {'currency': frm.doc.currency}
+ }
+ }
+ },
+
onload_post_render: function(frm) {
frm.get_field("items").grid.set_multiple_add("item_code", "qty");
},
+
refresh: function(frm) {
frm.toggle_enable("item", frm.doc.__islocal);
toggle_operations(frm);
@@ -31,6 +41,7 @@
});
}
},
+
update_cost: function(frm) {
return frappe.call({
doc: frm.doc,
@@ -43,6 +54,28 @@
}
});
+erpnext.bom.BomController = erpnext.TransactionController.extend({
+ conversion_rate: function(doc, cdt, cdn) {
+ if(this.frm.doc.currency === this.get_company_currency()) {
+ this.frm.set_value("conversion_rate", 1.0);
+ } else {
+ erpnext.bom.update_cost(doc);
+ }
+ },
+
+ item_code: function(doc, cdt, cdn){
+ var scrap_items = false;
+ child = locals[cdt][cdn];
+ if(child.doctype == 'BOM Scrap Item') {
+ scrap_items = true;
+ }
+
+ get_bom_material_detail(doc, cdt, cdn, scrap_items);
+ },
+})
+
+$.extend(cur_frm.cscript, new erpnext.bom.BomController({frm: cur_frm}));
+
cur_frm.add_fetch("item", "description", "description");
cur_frm.add_fetch("item", "image", "image");
cur_frm.add_fetch("item", "item_name", "item_name");
@@ -56,19 +89,15 @@
cur_frm.cscript.time_in_mins = cur_frm.cscript.hour_rate;
-cur_frm.cscript.item_code = function(doc, cdt, cdn) {
- get_bom_material_detail(doc, cdt, cdn);
-}
-
cur_frm.cscript.bom_no = function(doc, cdt, cdn) {
- get_bom_material_detail(doc, cdt, cdn);
+ get_bom_material_detail(doc, cdt, cdn, false);
}
cur_frm.cscript.is_default = function(doc) {
if (doc.is_default) cur_frm.set_value("is_active", 1);
}
-var get_bom_material_detail= function(doc, cdt, cdn) {
+var get_bom_material_detail= function(doc, cdt, cdn, scrap_items) {
var d = locals[cdt][cdn];
if (d.item_code) {
return frappe.call({
@@ -77,6 +106,7 @@
args: {
'item_code': d.item_code,
'bom_no': d.bom_no != null ? d.bom_no: '',
+ "scrap_items": scrap_items,
'qty': d.qty
},
callback: function(r) {
@@ -96,60 +126,99 @@
cur_frm.cscript.qty = function(doc, cdt, cdn) {
erpnext.bom.calculate_rm_cost(doc);
+ erpnext.bom.calculate_scrap_materials_cost(doc);
erpnext.bom.calculate_total(doc);
}
cur_frm.cscript.rate = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
+ var scrap_items = false;
+
+ if(child.doctype == 'BOM Scrap Item') {
+ scrap_items = true;
+ }
+
if (d.bom_no) {
msgprint(__("You can not change rate if BOM mentioned agianst any item"));
- get_bom_material_detail(doc, cdt, cdn);
+ get_bom_material_detail(doc, cdt, cdn, scrap_items);
} else {
erpnext.bom.calculate_rm_cost(doc);
+ erpnext.bom.calculate_scrap_materials_cost(doc);
erpnext.bom.calculate_total(doc);
}
}
+erpnext.bom.update_cost = function(doc) {
+ erpnext.bom.calculate_op_cost(doc);
+ erpnext.bom.calculate_rm_cost(doc);
+ erpnext.bom.calculate_scrap_materials_cost(doc);
+ erpnext.bom.calculate_total(doc);
+}
+
erpnext.bom.calculate_op_cost = function(doc) {
var op = doc.operations || [];
doc.operating_cost = 0.0;
+ doc.base_operating_cost = 0.0;
+
for(var i=0;i<op.length;i++) {
operating_cost = flt(flt(op[i].hour_rate) * flt(op[i].time_in_mins) / 60, 2);
+ base_operating_cost = flt(flt(op[i].base_hour_rate) * flt(op[i].time_in_mins) / 60, 2);
frappe.model.set_value('BOM Operation',op[i].name, "operating_cost", operating_cost);
+ frappe.model.set_value('BOM Operation',op[i].name, "base_operating_cost", base_operating_cost);
doc.operating_cost += operating_cost;
+ doc.base_operating_cost += base_operating_cost;
}
- refresh_field('operating_cost');
+ refresh_field(['operating_cost', 'base_operating_cost']);
}
// rm : raw material
erpnext.bom.calculate_rm_cost = function(doc) {
var rm = doc.items || [];
total_rm_cost = 0;
+ base_total_rm_cost = 0;
for(var i=0;i<rm.length;i++) {
- amt = flt(rm[i].rate) * flt(rm[i].qty);
- set_multiple('BOM Item',rm[i].name, {'amount': amt}, 'items');
- set_multiple('BOM Item',rm[i].name,
- {'qty_consumed_per_unit': flt(rm[i].qty)/flt(doc.quantity)}, 'items');
- total_rm_cost += amt;
+ amount = flt(rm[i].rate) * flt(rm[i].qty);
+ base_amount = flt(rm[i].rate) * flt(doc.conversion_rate) * flt(rm[i].qty);
+ frappe.model.set_value('BOM Item', rm[i].name, 'base_rate', flt(rm[i].rate) * flt(doc.conversion_rate))
+ frappe.model.set_value('BOM Item', rm[i].name, 'amount', amount)
+ frappe.model.set_value('BOM Item', rm[i].name, 'qty_consumed_per_unit', flt(rm[i].qty)/flt(doc.quantity))
+ frappe.model.set_value('BOM Item', rm[i].name, 'base_amount', base_amount)
+ total_rm_cost += amount;
+ base_total_rm_cost += base_amount;
}
cur_frm.set_value("raw_material_cost", total_rm_cost);
+ cur_frm.set_value("base_raw_material_cost", base_total_rm_cost);
}
//sm : scrap material
erpnext.bom.calculate_scrap_materials_cost = function(doc) {
var sm = doc.scrap_items || [];
total_sm_cost = 0;
+ base_total_sm_cost = 0;
+
for(var i=0;i<sm.length;i++) {
- amt = flt(sm[i].rate) * flt(sm[i].qty);
- set_multiple('BOM Scrap Item',sm[i].name, {'amount': amt}, 'scrap_items');
+ base_rate = flt(sm[i].rate) * flt(doc.conversion_rate);
+ amount = flt(sm[i].rate) * flt(sm[i].qty);
+ base_amount = flt(sm[i].rate) * flt(sm[i].qty) * flt(doc.conversion_rate);
+ frappe.model.set_value('BOM Scrap Item',sm[i].name, 'base_rate', base_rate);
+ frappe.model.set_value('BOM Scrap Item',sm[i].name, 'amount', amount);
+ frappe.model.set_value('BOM Scrap Item',sm[i].name, 'base_amount', base_amount);
+
+ total_sm_cost += amount;
+ base_total_sm_cost += base_amount;
}
+
+ cur_frm.set_value("scrap_material_cost", total_sm_cost);
+ cur_frm.set_value("base_scrap_material_cost", base_total_sm_cost);
}
// Calculate Total Cost
erpnext.bom.calculate_total = function(doc) {
- total_cost = flt(doc.operating_cost) + flt(doc.raw_material_cost);
- frappe.model.set_value(doc.doctype, doc.name, "total_cost", total_cost);
+ total_cost = flt(doc.operating_cost) + flt(doc.raw_material_cost) - flt(doc.scrap_material_cost);
+ base_total_cost = flt(doc.base_operating_cost) + flt(doc.base_raw_material_cost) - flt(doc.base_scrap_material_cost);
+ cur_frm.set_value("total_cost", total_cost);
+ cur_frm.set_value("base_total_cost", base_total_cost);
}
@@ -186,10 +255,7 @@
}
cur_frm.cscript.validate = function(doc, dt, dn) {
- erpnext.bom.calculate_op_cost(doc);
- erpnext.bom.calculate_rm_cost(doc);
- erpnext.bom.calculate_scrap_materials_cost(doc);
- erpnext.bom.calculate_total(doc);
+ erpnext.bom.update_cost(doc)
}
frappe.ui.form.on("BOM Operation", "operation", function(frm, cdt, cdn) {
@@ -225,6 +291,7 @@
},
callback: function (data) {
frappe.model.set_value(d.doctype, d.name, "hour_rate", data.message.hour_rate);
+ frappe.model.set_value(d.doctype, d.name, "base_hour_rate", flt(data.message.hour_rate) * flt(frm.doc.conversion_rate));
erpnext.bom.calculate_op_cost(frm.doc);
erpnext.bom.calculate_total(frm.doc);
}
@@ -252,7 +319,6 @@
toggle_operations(frm);
});
-
cur_frm.cscript.image = function() {
refresh_field("image_view");
}
diff --git a/erpnext/manufacturing/doctype/bom/bom.json b/erpnext/manufacturing/doctype/bom/bom.json
index ea43090..193f920 100644
--- a/erpnext/manufacturing/doctype/bom/bom.json
+++ b/erpnext/manufacturing/doctype/bom/bom.json
@@ -276,6 +276,118 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "currency_detail",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "",
+ "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,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "currency",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Currency",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Currency",
+ "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,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_12",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "conversion_rate",
+ "fieldtype": "Float",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Conversion Rate",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "9",
+ "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,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"depends_on": "",
"description": "Specify the operations, operating cost and give a unique Operation no to your operations.",
"fieldname": "operations_section",
@@ -490,7 +602,7 @@
"label": "Operating Cost",
"length": 0,
"no_copy": 0,
- "options": "Company:company:default_currency",
+ "options": "currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -518,7 +630,7 @@
"label": "Raw Material Cost",
"length": 0,
"no_copy": 0,
- "options": "Company:company:default_currency",
+ "options": "currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -535,6 +647,35 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "scrap_material_cost",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Scrap Material Cost",
+ "length": 0,
+ "no_copy": 0,
+ "options": "currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "cb1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -561,6 +702,120 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "base_operating_cost",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Operating Cost (Company Currency)",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Company:company:default_currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "base_raw_material_cost",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Raw Material Cost(Company Currency)",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Company:company:default_currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "base_scrap_material_cost",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Scrap Material Cost(Company Currency)",
+ "length": 0,
+ "no_copy": 1,
+ "options": "Company:company:default_currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "total_cost_of_bom",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "total_cost",
"fieldtype": "Currency",
"hidden": 0,
@@ -572,7 +827,7 @@
"label": "Total Cost",
"length": 0,
"no_copy": 0,
- "options": "Company:company:default_currency",
+ "options": "currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -589,6 +844,62 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "column_break_26",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "base_total_cost",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Total Cost(Company Currency)",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Company:company:default_currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "more_info_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -960,8 +1271,8 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-11-07 05:13:12.904755",
- "modified_by": "Administrator",
+ "modified": "2016-11-21 17:06:49.349654",
+ "modified_by": "rohit@erpnext.com",
"module": "Manufacturing",
"name": "BOM",
"owner": "Administrator",
@@ -969,6 +1280,27 @@
{
"amend": 0,
"apply_user_permissions": 0,
+ "cancel": 0,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "is_custom": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "All",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 0,
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "apply_user_permissions": 0,
"cancel": 1,
"create": 1,
"delete": 1,
@@ -1016,4 +1348,4 @@
"sort_field": "modified",
"sort_order": "DESC",
"track_seen": 0
-}
+}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/bom/bom.py b/erpnext/manufacturing/doctype/bom/bom.py
index c6a3f1f..2a27922 100644
--- a/erpnext/manufacturing/doctype/bom/bom.py
+++ b/erpnext/manufacturing/doctype/bom/bom.py
@@ -5,6 +5,7 @@
import frappe
from frappe.utils import cint, cstr, flt
from frappe import _
+from erpnext.setup.utils import get_exchange_rate
from frappe.model.document import Document
from operator import itemgetter
@@ -35,6 +36,8 @@
def validate(self):
self.clear_operations()
self.validate_main_item()
+ self.validate_currency()
+ self.set_conversion_rate()
from erpnext.utilities.transaction_base import validate_uom_is_integer
validate_uom_is_integer(self, "stock_uom", "qty", "BOM Item")
@@ -84,6 +87,8 @@
for r in ret:
if not item.get(r):
item.set(r, ret[r])
+
+ self.validate_bom_currecny(item)
def get_bom_material_detail(self, args=None):
""" Get raw material details like uom, desc and rate"""
@@ -102,19 +107,27 @@
rate = self.get_rm_rate(args)
ret_item = {
- 'item_name' : item and args['item_name'] or '',
- 'description' : item and args['description'] or '',
- 'image' : item and args['image'] or '',
- 'stock_uom' : item and args['stock_uom'] or '',
- 'bom_no' : args['bom_no'],
- 'rate' : rate
+ 'item_name' : item and args['item_name'] or '',
+ 'description' : item and args['description'] or '',
+ 'image' : item and args['image'] or '',
+ 'stock_uom' : item and args['stock_uom'] or '',
+ 'bom_no' : args['bom_no'],
+ 'rate' : rate,
+ 'base_rate' : rate if self.company_currency() == self.currency else rate * self.conversion_rate
}
return ret_item
+ def validate_bom_currecny(self, item):
+ if item.get('bom_no') and frappe.db.get_value('BOM', item.get('bom_no'), 'currency') != self.currency:
+ frappe.throw(_("Row {0}: Currency of the BOM #{1} should be equal to the selected currency {2}").format(item.idx, item.bom_no, self.currency))
+
def get_rm_rate(self, arg):
""" Get raw material rate as per selected method, if bom exists takes bom cost """
rate = 0
- if arg['bom_no']:
+
+ if arg.get('scrap_items'):
+ rate = self.get_valuation_rate(arg)
+ elif arg['bom_no']:
rate = self.get_bom_unitcost(arg['bom_no'])
elif arg:
if self.rm_cost_as_per == 'Valuation Rate':
@@ -209,6 +222,14 @@
if not self.quantity:
frappe.throw(_("Quantity should be greater than 0"))
+
+ def validate_currency(self):
+ if self.rm_cost_as_per == 'Price List' and \
+ frappe.db.get_value('Price List', self.buying_price_list, 'currency') != self.currency:
+ frappe.throw(_("Currency of the price list {0} is not similar with the selected currency {1}").format(self.buying_price_list, self.currency))
+
+ def set_conversion_rate(self):
+ self.conversion_rate = get_exchange_rate(self.currency, self.company_currency())
def validate_materials(self):
""" Validate raw material entries """
@@ -270,11 +291,14 @@
"""Calculate bom totals"""
self.calculate_op_cost()
self.calculate_rm_cost()
- self.total_cost = self.operating_cost + self.raw_material_cost
+ self.calculate_sm_cost()
+ self.total_cost = self.operating_cost + self.raw_material_cost - self.scrap_material_cost
+ self.base_total_cost = self.base_operating_cost + self.base_raw_material_cost - self.base_scrap_material_cost
def calculate_op_cost(self):
"""Update workstation rate and calculates totals"""
self.operating_cost = 0
+ self.base_operating_cost = 0
for d in self.get('operations'):
if d.workstation:
if not d.hour_rate:
@@ -282,20 +306,45 @@
if d.hour_rate and d.time_in_mins:
d.operating_cost = flt(d.hour_rate) * flt(d.time_in_mins) / 60.0
+ d.base_hour_rate = flt(d.hour_rate) * flt(self.conversion_rate)
+ d.base_operating_cost = flt(d.base_hour_rate) * flt(d.time_in_mins) / 60.0
self.operating_cost += flt(d.operating_cost)
+ self.base_operating_cost += flt(d.base_operating_cost)
def calculate_rm_cost(self):
"""Fetch RM rate as per today's valuation rate and calculate totals"""
total_rm_cost = 0
+ base_total_rm_cost = 0
+
for d in self.get('items'):
if d.bom_no:
d.rate = self.get_bom_unitcost(d.bom_no)
+
+ d.base_rate = d.rate * self.conversion_rate
d.amount = flt(d.rate, self.precision("rate", d)) * flt(d.qty, self.precision("qty", d))
+ d.base_amount = d.amount * self.conversion_rate
d.qty_consumed_per_unit = flt(d.qty, self.precision("qty", d)) / flt(self.quantity, self.precision("quantity"))
total_rm_cost += d.amount
+ base_total_rm_cost += d.base_amount
self.raw_material_cost = total_rm_cost
+ self.base_raw_material_cost = base_total_rm_cost
+
+ def calculate_sm_cost(self):
+ """Fetch RM rate as per today's valuation rate and calculate totals"""
+ total_sm_cost = 0
+ base_total_sm_cost = 0
+
+ for d in self.get('scrap_items'):
+ d.base_rate = d.rate * self.conversion_rate
+ d.amount = flt(d.rate, self.precision("rate", d)) * flt(d.qty, self.precision("qty", d))
+ d.base_amount = d.amount * self.conversion_rate
+ total_sm_cost += d.amount
+ base_total_sm_cost += d.base_amount
+
+ self.scrap_material_cost = total_sm_cost
+ self.base_scrap_material_cost = base_total_sm_cost
def update_exploded_items(self):
""" Update Flat BOM, following will be correct data"""
@@ -316,8 +365,11 @@
'image' : d.image,
'stock_uom' : d.stock_uom,
'qty' : flt(d.qty),
- 'rate' : flt(d.rate),
+ 'rate' : d.base_rate,
}))
+
+ def company_currency(self):
+ return frappe.db.get_value('Company', self.company, 'default_currency')
def add_to_cur_exploded_items(self, args):
if self.cur_exploded_items.get(args.item_code):
diff --git a/erpnext/manufacturing/doctype/bom/test_records.json b/erpnext/manufacturing/doctype/bom/test_records.json
index da8d67b..5baa0cb 100644
--- a/erpnext/manufacturing/doctype/bom/test_records.json
+++ b/erpnext/manufacturing/doctype/bom/test_records.json
@@ -22,6 +22,7 @@
],
"docstatus": 1,
"doctype": "BOM",
+ "currency": "USD",
"is_active": 1,
"is_default": 1,
"item": "_Test Item Home Desktop Manufactured",
@@ -63,6 +64,7 @@
"doctype": "BOM",
"is_active": 1,
"is_default": 1,
+ "currency": "USD",
"item": "_Test FG Item",
"quantity": 1.0
},
@@ -101,6 +103,7 @@
"doctype": "BOM",
"is_active": 1,
"is_default": 1,
+ "currency": "USD",
"item": "_Test FG Item 2",
"quantity": 1.0,
"with_operations": 1
@@ -130,6 +133,7 @@
"doctype": "BOM",
"is_active": 1,
"is_default": 1,
+ "currency": "USD",
"item": "_Test Variant Item",
"quantity": 1.0,
"with_operations": 1
diff --git a/erpnext/manufacturing/doctype/bom_item/bom_item.json b/erpnext/manufacturing/doctype/bom_item/bom_item.json
index d485abc..bb55c73 100644
--- a/erpnext/manufacturing/doctype/bom_item/bom_item.json
+++ b/erpnext/manufacturing/doctype/bom_item/bom_item.json
@@ -7,6 +7,7 @@
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
+ "document_type": "Setup",
"editable_grid": 1,
"fields": [
{
@@ -317,7 +318,7 @@
"label": "Rate",
"length": 0,
"no_copy": 0,
- "options": "Company:company:default_currency",
+ "options": "currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -333,6 +334,36 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "amount",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 1,
+ "label": "Amount",
+ "length": 0,
+ "no_copy": 0,
+ "oldfieldname": "amount_as_per_mar",
+ "oldfieldtype": "Currency",
+ "options": "currency",
+ "permlevel": 0,
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "print_width": "150px",
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0,
+ "width": "150px"
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -385,30 +416,79 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "amount",
+ "fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
- "in_list_view": 1,
- "label": "Amount",
+ "in_list_view": 0,
+ "label": "Basic Rate (Company Currency)",
"length": 0,
"no_copy": 0,
- "oldfieldname": "amount_as_per_mar",
- "oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
- "print_hide": 0,
+ "precision": "",
+ "print_hide": 1,
"print_hide_if_no_value": 0,
- "print_width": "150px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
- "unique": 0,
- "width": "150px"
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "base_amount",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Amount (Company Currency)",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Company:company:default_currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_18",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
},
{
"allow_on_submit": 0,
@@ -475,7 +555,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-08-26 02:42:40.468812",
+ "modified": "2016-10-21 15:57:22.521537",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Item",
diff --git a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json
index 8b6406e..50f1c6c 100644
--- a/erpnext/manufacturing/doctype/bom_operation/bom_operation.json
+++ b/erpnext/manufacturing/doctype/bom_operation/bom_operation.json
@@ -9,11 +9,13 @@
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 1,
+ "engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "operation",
"fieldtype": "Link",
"hidden": 0,
@@ -41,6 +43,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "workstation",
"fieldtype": "Link",
"hidden": 0,
@@ -68,6 +71,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@@ -94,6 +98,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -117,8 +122,9 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "hour_rate",
- "fieldtype": "Float",
+ "fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -129,6 +135,7 @@
"no_copy": 0,
"oldfieldname": "hour_rate",
"oldfieldtype": "Currency",
+ "options": "currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -143,6 +150,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "In minutes",
"fieldname": "time_in_mins",
"fieldtype": "Float",
@@ -171,6 +179,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "operating_cost",
"fieldtype": "Currency",
"hidden": 0,
@@ -183,6 +192,7 @@
"no_copy": 0,
"oldfieldname": "operating_cost",
"oldfieldtype": "Currency",
+ "options": "currency",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -192,6 +202,61 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "base_hour_rate",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Base Hour Rate(Company Currency)",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Company:company:default_currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "5",
+ "fieldname": "base_operating_cost",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Operating Cost(Company Currency)",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Company:company:default_currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
}
],
"hide_heading": 0,
@@ -204,7 +269,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-07-11 03:27:58.625909",
+ "modified": "2016-10-21 18:38:14.700637",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Operation",
diff --git a/erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.json b/erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.json
index ea5e6c1..fe81592 100644
--- a/erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.json
+++ b/erpnext/manufacturing/doctype/bom_scrap_item/bom_scrap_item.json
@@ -130,7 +130,7 @@
"label": "Rate",
"length": 0,
"no_copy": 0,
- "options": "Company:company:default_currency",
+ "options": "currency",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -147,6 +147,33 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "fieldname": "amount",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Amount",
+ "length": 0,
+ "no_copy": 0,
+ "options": "currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_6",
"fieldtype": "Column Break",
"hidden": 0,
@@ -199,20 +226,47 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "amount",
+ "fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Amount",
+ "label": "Basic Rate (Company Currency)",
"length": 0,
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"precision": "",
- "print_hide": 0,
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "base_amount",
+ "fieldtype": "Currency",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "label": "Basic Amount (Company Currency)",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Company:company:default_currency",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
@@ -232,7 +286,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-09-26 02:58:58.433348",
+ "modified": "2016-10-25 00:27:53.712140",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM Scrap Item",
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index fc3c92c..aa69342 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -217,7 +217,7 @@
return
self.set('operations', [])
operations = frappe.db.sql("""select operation, description, workstation, idx,
- hour_rate, time_in_mins, "Pending" as status from `tabBOM Operation`
+ base_hour_rate as hour_rate, time_in_mins, "Pending" as status from `tabBOM Operation`
where parent = %s order by idx""", self.bom_no, as_dict=1)
self.set('operations', operations)
self.calculate_time()
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 2c6f912..1ab2dd0 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -352,3 +352,4 @@
erpnext.patches.v7_1.update_missing_salary_component_type
erpnext.patches.v7_1.rename_quality_inspection_field
erpnext.patches.v7_0.update_autoname_field
+erpnext.patches.v7_1.update_bom_base_currency
diff --git a/erpnext/patches/v4_0/fix_employee_user_id.py b/erpnext/patches/v4_0/fix_employee_user_id.py
index 2a8f76b..6f449f9 100644
--- a/erpnext/patches/v4_0/fix_employee_user_id.py
+++ b/erpnext/patches/v4_0/fix_employee_user_id.py
@@ -18,6 +18,6 @@
frappe.db.sql("""update `tabEmployee` set user_id=null
where user_id=%s and name!=%s""", (user_id, employee))
else:
- count = frappe.db.sql("""select count(name) from `tabEmployee` where user_id=%s""", user_id)[0][0]
+ count = frappe.db.sql("""select count(*) from `tabEmployee` where user_id=%s""", user_id)[0][0]
frappe.db.sql("""update `tabEmployee` set user_id=null
where user_id=%s limit %s""", (user_id, count - 1))
diff --git a/erpnext/patches/v7_1/update_bom_base_currency.py b/erpnext/patches/v7_1/update_bom_base_currency.py
new file mode 100644
index 0000000..c8af033
--- /dev/null
+++ b/erpnext/patches/v7_1/update_bom_base_currency.py
@@ -0,0 +1,19 @@
+import frappe
+from erpnext import get_default_currency
+
+def execute():
+ frappe.reload_doc("manufacturing", "doctype", "bom")
+ frappe.reload_doc("manufacturing", "doctype", "bom_item")
+ frappe.reload_doc("manufacturing", "doctype", "bom_explosion_item")
+ frappe.reload_doc("manufacturing", "doctype", "bom_operation")
+ frappe.reload_doc("manufacturing", "doctype", "bom_scrap_item")
+
+ frappe.db.sql(""" update `tabBOM Operation` set base_hour_rate = hour_rate,
+ base_operating_cost = operating_cost """)
+
+ frappe.db.sql(""" update `tabBOM Item` set base_rate = rate, base_amount = amount """)
+ frappe.db.sql(""" update `tabBOM Scrap Item` set base_rate = rate, base_amount = amount """)
+
+ frappe.db.sql(""" update `tabBOM` set `tabBOM`.base_operating_cost = `tabBOM`.operating_cost,
+ `tabBOM`.base_raw_material_cost = `tabBOM`.raw_material_cost,
+ `tabBOM`.currency = (select default_currency from `tabCompany` where name = `tabBOM`.company)""")
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index b529f0f..6c03706 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -550,28 +550,20 @@
change_form_labels: function(company_currency) {
var me = this;
- var field_label_map = {};
- var setup_field_label_map = function(fields_list, currency) {
- $.each(fields_list, function(i, fname) {
- var docfield = frappe.meta.docfield_map[me.frm.doc.doctype][fname];
- if(docfield) {
- var label = __(docfield.label || "").replace(/\([^\)]*\)/g, "");
- field_label_map[fname] = label.trim() + " (" + currency + ")";
- }
- });
- };
- setup_field_label_map(["base_total", "base_net_total", "base_total_taxes_and_charges",
+ this.frm.set_currency_labels(["base_total", "base_net_total", "base_total_taxes_and_charges",
"base_discount_amount", "base_grand_total", "base_rounded_total", "base_in_words",
"base_taxes_and_charges_added", "base_taxes_and_charges_deducted", "total_amount_to_pay",
- "base_paid_amount", "base_write_off_amount", "base_change_amount"
+ "base_paid_amount", "base_write_off_amount", "base_change_amount", "base_operating_cost",
+ "base_raw_material_cost", "base_total_cost", "base_scrap_material_cost"
], company_currency);
- setup_field_label_map(["total", "net_total", "total_taxes_and_charges", "discount_amount",
+ this.frm.set_currency_labels(["total", "net_total", "total_taxes_and_charges", "discount_amount",
"grand_total", "taxes_and_charges_added", "taxes_and_charges_deducted",
- "rounded_total", "in_words", "paid_amount", "write_off_amount"], this.frm.doc.currency);
+ "rounded_total", "in_words", "paid_amount", "write_off_amount", "operating_cost", "scrap_material_cost",
+ "raw_material_cost", "total_cost"], this.frm.doc.currency);
- setup_field_label_map(["outstanding_amount", "total_advance"], this.frm.doc.party_account_currency);
+ this.frm.set_currency_labels(["outstanding_amount", "total_advance"], this.frm.doc.party_account_currency);
cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency
+ " = [?] " + company_currency)
@@ -585,17 +577,13 @@
this.frm.toggle_display(["conversion_rate", "base_total", "base_net_total", "base_total_taxes_and_charges",
"base_taxes_and_charges_added", "base_taxes_and_charges_deducted",
"base_grand_total", "base_rounded_total", "base_in_words", "base_discount_amount",
- "base_paid_amount", "base_write_off_amount"],
+ "base_paid_amount", "base_write_off_amount", "base_operating_cost",
+ "base_raw_material_cost", "base_total_cost", "base_scrap_material_cost"],
this.frm.doc.currency != company_currency);
this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"],
this.frm.doc.price_list_currency != company_currency);
- // set labels
- $.each(field_label_map, function(fname, label) {
- me.frm.fields_dict[fname].set_label(label);
- });
-
var show =cint(cur_frm.doc.discount_amount) ||
((cur_frm.doc.taxes || []).filter(function(d) {return d.included_in_print_rate===1}).length);
@@ -609,34 +597,43 @@
change_grid_labels: function(company_currency) {
var me = this;
- var field_label_map = {};
- var setup_field_label_map = function(fields_list, currency, parentfield) {
- var grid_doctype = me.frm.fields_dict[parentfield].grid.doctype;
- $.each(fields_list, function(i, fname) {
- var docfield = frappe.meta.docfield_map[grid_doctype][fname];
- if(docfield) {
- var label = __(docfield.label || "").replace(/\([^\)]*\)/g, "");
- field_label_map[grid_doctype + "-" + fname] =
- label.trim() + " (" + __(currency) + ")";
- }
+ this.frm.set_currency_labels(["base_rate", "base_net_rate", "base_price_list_rate", "base_amount", "base_net_amount"],
+ company_currency, "items");
+
+ this.frm.set_currency_labels(["rate", "net_rate", "price_list_rate", "amount", "net_amount"],
+ this.frm.doc.currency, "items");
+
+ if(this.frm.fields_dict["operations"]) {
+ this.frm.set_currency_labels(["operating_cost", "hour_rate"], this.frm.doc.currency, "operations");
+ this.frm.set_currency_labels(["base_operating_cost", "base_hour_rate"], company_currency, "operations");
+
+ var item_grid = this.frm.fields_dict["operations"].grid;
+ $.each(["base_operating_cost", "base_hour_rate"], function(i, fname) {
+ if(frappe.meta.get_docfield(item_grid.doctype, fname))
+ item_grid.set_column_disp(fname, me.frm.doc.currency != company_currency);
});
}
- setup_field_label_map(["base_rate", "base_net_rate", "base_price_list_rate", "base_amount", "base_net_amount"],
- company_currency, "items");
+ if(this.frm.fields_dict["scrap_items"]) {
+ this.frm.set_currency_labels(["rate", "amount"], this.frm.doc.currency, "scrap_items");
+ this.frm.set_currency_labels(["base_rate", "base_amount"], company_currency, "scrap_items");
- setup_field_label_map(["rate", "net_rate", "price_list_rate", "amount", "net_amount"],
- this.frm.doc.currency, "items");
+ var item_grid = this.frm.fields_dict["scrap_items"].grid;
+ $.each(["base_rate", "base_amount"], function(i, fname) {
+ if(frappe.meta.get_docfield(item_grid.doctype, fname))
+ item_grid.set_column_disp(fname, me.frm.doc.currency != company_currency);
+ });
+ }
if(this.frm.fields_dict["taxes"]) {
- setup_field_label_map(["tax_amount", "total", "tax_amount_after_discount"], this.frm.doc.currency, "taxes");
+ this.frm.set_currency_labels(["tax_amount", "total", "tax_amount_after_discount"], this.frm.doc.currency, "taxes");
- setup_field_label_map(["base_tax_amount", "base_total", "base_tax_amount_after_discount"], company_currency, "taxes");
+ this.frm.set_currency_labels(["base_tax_amount", "base_total", "base_tax_amount_after_discount"], company_currency, "taxes");
}
if(this.frm.fields_dict["advances"]) {
- setup_field_label_map(["advance_amount", "allocated_amount"],
+ this.frm.set_currency_labels(["advance_amount", "allocated_amount"],
this.frm.doc.party_account_currency, "advances");
}
@@ -662,11 +659,6 @@
// set labels
var $wrapper = $(this.frm.wrapper);
- $.each(field_label_map, function(fname, label) {
- fname = fname.split("-");
- var df = frappe.meta.get_docfield(fname[0], fname[1], me.frm.doc.name);
- if(df) df.label = label;
- });
},
recalculate: function() {
diff --git a/erpnext/selling/page/sales_funnel/sales_funnel.py b/erpnext/selling/page/sales_funnel/sales_funnel.py
index 71dc8bd..4d12efd 100644
--- a/erpnext/selling/page/sales_funnel/sales_funnel.py
+++ b/erpnext/selling/page/sales_funnel/sales_funnel.py
@@ -8,7 +8,7 @@
@frappe.whitelist()
def get_funnel_data(from_date, to_date):
- active_leads = frappe.db.sql("""select count(name) from `tabLead`
+ active_leads = frappe.db.sql("""select count(*) from `tabLead`
where (date(`modified`) between %s and %s)
and status != "Do Not Contact" """, (from_date, to_date))[0][0]
@@ -16,15 +16,15 @@
where (date(`modified`) between %s and %s)
and status != "Passive" """, (from_date, to_date))[0][0]
- opportunities = frappe.db.sql("""select count(name) from `tabOpportunity`
+ opportunities = frappe.db.sql("""select count(*) from `tabOpportunity`
where (date(`creation`) between %s and %s)
and status != "Lost" """, (from_date, to_date))[0][0]
- quotations = frappe.db.sql("""select count(name) from `tabQuotation`
+ quotations = frappe.db.sql("""select count(*) from `tabQuotation`
where docstatus = 1 and (date(`creation`) between %s and %s)
and status != "Lost" """, (from_date, to_date))[0][0]
- sales_orders = frappe.db.sql("""select count(name) from `tabSales Order`
+ sales_orders = frappe.db.sql("""select count(*) from `tabSales Order`
where docstatus = 1 and (date(`creation`) between %s and %s)""", (from_date, to_date))[0][0]
return [
diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json
index a003bde..338d10a 100644
--- a/erpnext/setup/doctype/company/company.json
+++ b/erpnext/setup/doctype/company/company.json
@@ -10,11 +10,13 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
+ "editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "details",
"fieldtype": "Section Break",
"hidden": 0,
@@ -22,6 +24,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "",
"length": 0,
"no_copy": 0,
@@ -30,6 +33,7 @@
"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,
@@ -40,6 +44,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "company_name",
"fieldtype": "Data",
"hidden": 0,
@@ -47,6 +52,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Company",
"length": 0,
"no_copy": 0,
@@ -56,6 +62,7 @@
"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,
@@ -66,6 +73,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "abbr",
"fieldtype": "Data",
@@ -74,6 +82,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Abbr",
"length": 0,
"no_copy": 0,
@@ -83,6 +92,7 @@
"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,
@@ -93,6 +103,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal && in_list(user_roles, \"System Manager\")",
"fieldname": "change_abbr",
"fieldtype": "Button",
@@ -101,6 +112,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Change Abbreviation",
"length": 0,
"no_copy": 0,
@@ -108,6 +120,7 @@
"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,
@@ -118,6 +131,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "cb0",
"fieldtype": "Column Break",
"hidden": 0,
@@ -125,12 +139,14 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"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,
@@ -141,6 +157,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "domain",
"fieldtype": "Select",
"hidden": 0,
@@ -148,6 +165,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Domain",
"length": 0,
"no_copy": 0,
@@ -156,6 +174,7 @@
"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,
@@ -166,6 +185,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "charts_section",
"fieldtype": "Section Break",
"hidden": 0,
@@ -173,6 +193,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Values",
"length": 0,
"no_copy": 0,
@@ -180,6 +201,7 @@
"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,
@@ -190,6 +212,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "default_letter_head",
"fieldtype": "Link",
"hidden": 0,
@@ -197,6 +220,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Letter Head",
"length": 0,
"no_copy": 0,
@@ -206,6 +230,7 @@
"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,
@@ -216,6 +241,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "default_holiday_list",
"fieldtype": "Link",
"hidden": 0,
@@ -223,6 +249,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Holiday List",
"length": 0,
"no_copy": 0,
@@ -232,6 +259,7 @@
"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,
@@ -242,6 +270,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "default_terms",
"fieldtype": "Link",
"hidden": 0,
@@ -249,6 +278,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Terms",
"length": 0,
"no_copy": 0,
@@ -257,6 +287,7 @@
"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,
@@ -267,55 +298,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "fieldname": "column_break_10",
- "fieldtype": "Column Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 0,
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "fieldname": "country",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 1,
- "label": "Country",
- "length": 0,
- "no_copy": 0,
- "options": "Country",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "report_hide": 0,
- "reqd": 1,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
+ "columns": 0,
"fieldname": "default_currency",
"fieldtype": "Link",
"hidden": 0,
@@ -323,6 +306,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Currency",
"length": 0,
"no_copy": 0,
@@ -331,6 +315,7 @@
"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,
@@ -341,21 +326,23 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "fieldname": "chart_of_accounts",
- "fieldtype": "Select",
+ "columns": 0,
+ "fieldname": "column_break_10",
+ "fieldtype": "Column Break",
"hidden": 0,
- "ignore_user_permissions": 1,
+ "ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
- "label": "Chart of Accounts",
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
- "options": "",
"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,
@@ -366,6 +353,124 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
+ "fieldname": "country",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Country",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Country",
+ "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,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "create_chart_of_accounts_based_on",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Create Chart Of Accounts Based On",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Standard Template\nExisting Company",
+ "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,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Standard Template\"",
+ "fieldname": "chart_of_accounts",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Chart Of Accounts Template",
+ "length": 0,
+ "no_copy": 1,
+ "options": "",
+ "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,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Existing Company\"",
+ "fieldname": "existing_company",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Existing Company ",
+ "length": 0,
+ "no_copy": 1,
+ "options": "Company",
+ "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,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "default_settings",
"fieldtype": "Section Break",
"hidden": 0,
@@ -373,6 +478,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Accounts Settings",
"length": 0,
"no_copy": 0,
@@ -381,6 +487,7 @@
"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,
@@ -391,6 +498,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal",
"fieldname": "default_bank_account",
"fieldtype": "Link",
@@ -399,6 +507,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Bank Account",
"length": 0,
"no_copy": 1,
@@ -409,6 +518,7 @@
"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,
@@ -419,6 +529,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal",
"fieldname": "default_cash_account",
"fieldtype": "Link",
@@ -427,6 +538,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Cash Account",
"length": 0,
"no_copy": 1,
@@ -435,6 +547,7 @@
"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,
@@ -445,6 +558,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal",
"fieldname": "default_receivable_account",
"fieldtype": "Link",
@@ -453,6 +567,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Receivable Account",
"length": 0,
"no_copy": 1,
@@ -463,6 +578,7 @@
"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,
@@ -473,6 +589,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "round_off_account",
"fieldtype": "Link",
"hidden": 0,
@@ -480,6 +597,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Round Off Account",
"length": 0,
"no_copy": 0,
@@ -489,6 +607,7 @@
"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,
@@ -499,6 +618,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "write_off_account",
"fieldtype": "Link",
"hidden": 0,
@@ -506,6 +626,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Write Off Account",
"length": 0,
"no_copy": 0,
@@ -515,6 +636,7 @@
"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,
@@ -525,6 +647,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "exchange_gain_loss_account",
"fieldtype": "Link",
"hidden": 0,
@@ -532,6 +655,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Exchange Gain / Loss Account",
"length": 0,
"no_copy": 0,
@@ -541,6 +665,7 @@
"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,
@@ -551,6 +676,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break0",
"fieldtype": "Column Break",
"hidden": 0,
@@ -558,6 +684,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
@@ -565,6 +692,7 @@
"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,
@@ -576,6 +704,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal",
"fieldname": "default_payable_account",
"fieldtype": "Link",
@@ -584,6 +713,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Payable Account",
"length": 0,
"no_copy": 1,
@@ -594,6 +724,7 @@
"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,
@@ -604,6 +735,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal",
"fieldname": "default_expense_account",
"fieldtype": "Link",
@@ -612,6 +744,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Cost of Goods Sold Account",
"length": 0,
"no_copy": 1,
@@ -620,6 +753,7 @@
"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,
@@ -630,6 +764,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal",
"fieldname": "default_income_account",
"fieldtype": "Link",
@@ -638,6 +773,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Income Account",
"length": 0,
"no_copy": 1,
@@ -646,6 +782,7 @@
"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,
@@ -656,6 +793,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "round_off_cost_center",
"fieldtype": "Link",
"hidden": 0,
@@ -663,6 +801,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Round Off Cost Center",
"length": 0,
"no_copy": 0,
@@ -672,6 +811,7 @@
"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,
@@ -682,6 +822,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "section_break_22",
"fieldtype": "Section Break",
"hidden": 0,
@@ -689,6 +830,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -696,6 +838,7 @@
"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,
@@ -706,6 +849,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal",
"fieldname": "cost_center",
"fieldtype": "Link",
@@ -714,6 +858,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Cost Center",
"length": 0,
"no_copy": 1,
@@ -722,6 +867,7 @@
"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,
@@ -732,6 +878,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal",
"fieldname": "credit_limit",
"fieldtype": "Currency",
@@ -740,6 +887,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Credit Limit",
"length": 0,
"no_copy": 0,
@@ -750,6 +898,7 @@
"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,
@@ -760,6 +909,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_26",
"fieldtype": "Column Break",
"hidden": 0,
@@ -767,6 +917,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -774,6 +925,7 @@
"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,
@@ -784,6 +936,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "credit_days_based_on",
"fieldtype": "Select",
"hidden": 0,
@@ -791,6 +944,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Credit Days Based On",
"length": 0,
"no_copy": 0,
@@ -800,6 +954,7 @@
"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,
@@ -810,6 +965,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:(!doc.__islocal && doc.credit_days_based_on=='Fixed Days')",
"fieldname": "credit_days",
"fieldtype": "Int",
@@ -818,6 +974,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Credit Days",
"length": 0,
"no_copy": 0,
@@ -827,6 +984,7 @@
"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,
@@ -837,6 +995,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"depends_on": "eval:!doc.__islocal",
"fieldname": "auto_accounting_for_stock_settings",
"fieldtype": "Section Break",
@@ -845,6 +1004,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Stock Settings",
"length": 0,
"no_copy": 0,
@@ -852,6 +1012,7 @@
"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,
@@ -862,6 +1023,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "stock_received_but_not_billed",
"fieldtype": "Link",
"hidden": 0,
@@ -869,6 +1031,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Stock Received But Not Billed",
"length": 0,
"no_copy": 1,
@@ -877,6 +1040,7 @@
"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,
@@ -887,6 +1051,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "stock_adjustment_account",
"fieldtype": "Link",
"hidden": 0,
@@ -894,6 +1059,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Stock Adjustment Account",
"length": 0,
"no_copy": 1,
@@ -902,6 +1068,7 @@
"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,
@@ -912,6 +1079,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_32",
"fieldtype": "Column Break",
"hidden": 0,
@@ -919,6 +1087,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -926,6 +1095,7 @@
"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,
@@ -936,6 +1106,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "expenses_included_in_valuation",
"fieldtype": "Link",
"hidden": 0,
@@ -943,6 +1114,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Expenses Included In Valuation",
"length": 0,
"no_copy": 1,
@@ -951,6 +1123,7 @@
"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,
@@ -961,6 +1134,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "fixed_asset_depreciation_settings",
"fieldtype": "Section Break",
"hidden": 0,
@@ -968,6 +1142,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Fixed Asset Depreciation Settings",
"length": 0,
"no_copy": 0,
@@ -976,6 +1151,7 @@
"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,
@@ -986,6 +1162,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "accumulated_depreciation_account",
"fieldtype": "Link",
"hidden": 0,
@@ -993,6 +1170,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Accumulated Depreciation Account",
"length": 0,
"no_copy": 1,
@@ -1002,6 +1180,7 @@
"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,
@@ -1012,6 +1191,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "depreciation_expense_account",
"fieldtype": "Link",
"hidden": 0,
@@ -1019,6 +1199,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Depreciation Expense Account",
"length": 0,
"no_copy": 1,
@@ -1028,6 +1209,7 @@
"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,
@@ -1038,6 +1220,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_40",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1045,6 +1228,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -1052,6 +1236,7 @@
"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,
@@ -1062,6 +1247,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "disposal_account",
"fieldtype": "Link",
"hidden": 0,
@@ -1069,6 +1255,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Gain/Loss Account on Asset Disposal",
"length": 0,
"no_copy": 1,
@@ -1078,6 +1265,7 @@
"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,
@@ -1088,6 +1276,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "depreciation_cost_center",
"fieldtype": "Link",
"hidden": 0,
@@ -1095,6 +1284,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Asset Depreciation Cost Center",
"length": 0,
"no_copy": 1,
@@ -1104,6 +1294,7 @@
"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,
@@ -1114,6 +1305,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "For reference only.",
"fieldname": "company_info",
"fieldtype": "Section Break",
@@ -1122,6 +1314,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Company Info",
"length": 0,
"no_copy": 0,
@@ -1129,6 +1322,7 @@
"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,
@@ -1139,6 +1333,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "address",
"fieldtype": "Small Text",
"hidden": 0,
@@ -1146,6 +1341,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Address",
"length": 0,
"no_copy": 0,
@@ -1155,6 +1351,7 @@
"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,
@@ -1165,6 +1362,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
@@ -1172,6 +1370,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
@@ -1179,6 +1378,7 @@
"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,
@@ -1190,6 +1390,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "phone_no",
"fieldtype": "Data",
"hidden": 0,
@@ -1197,6 +1398,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Phone No",
"length": 0,
"no_copy": 0,
@@ -1207,6 +1409,7 @@
"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,
@@ -1217,6 +1420,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "fax",
"fieldtype": "Data",
"hidden": 0,
@@ -1224,6 +1428,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Fax",
"length": 0,
"no_copy": 0,
@@ -1234,6 +1439,7 @@
"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,
@@ -1244,6 +1450,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "email",
"fieldtype": "Data",
"hidden": 0,
@@ -1251,6 +1458,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Email",
"length": 0,
"no_copy": 0,
@@ -1261,6 +1469,7 @@
"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,
@@ -1271,6 +1480,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "website",
"fieldtype": "Data",
"hidden": 0,
@@ -1278,6 +1488,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Website",
"length": 0,
"no_copy": 0,
@@ -1287,6 +1498,7 @@
"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,
@@ -1297,6 +1509,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "",
"fieldname": "registration_info",
"fieldtype": "Section Break",
@@ -1305,6 +1518,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "",
"length": 0,
"no_copy": 0,
@@ -1313,6 +1527,7 @@
"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,
@@ -1324,6 +1539,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "Company registration numbers for your reference. Tax numbers etc.",
"fieldname": "registration_details",
"fieldtype": "Code",
@@ -1332,6 +1548,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Registration Details",
"length": 0,
"no_copy": 0,
@@ -1341,6 +1558,7 @@
"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,
@@ -1351,6 +1569,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "delete_company_transactions",
"fieldtype": "Button",
"hidden": 0,
@@ -1358,6 +1577,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Delete Company Transactions",
"length": 0,
"no_copy": 0,
@@ -1366,6 +1586,7 @@
"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,
@@ -1385,7 +1606,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2016-10-26 09:08:50.476200",
+ "modified": "2016-11-23 16:32:04.893315",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",
@@ -1401,6 +1622,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -1421,6 +1643,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -1441,6 +1664,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 0,
"read": 1,
@@ -1461,6 +1685,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 0,
"read": 1,
@@ -1481,6 +1706,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 0,
"read": 1,
@@ -1501,6 +1727,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 0,
"read": 1,
@@ -1521,6 +1748,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 0,
"read": 1,
diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py
index 00538cd..7f506d5 100644
--- a/erpnext/setup/doctype/company/company.py
+++ b/erpnext/setup/doctype/company/company.py
@@ -30,6 +30,7 @@
self.validate_abbr()
self.validate_default_accounts()
self.validate_currency()
+ self.validate_coa_input()
def validate_abbr(self):
if not self.abbr:
@@ -113,16 +114,25 @@
warehouse.insert()
def create_default_accounts(self):
- if not self.chart_of_accounts:
- self.chart_of_accounts = "Standard"
-
from erpnext.accounts.doctype.account.chart_of_accounts.chart_of_accounts import create_charts
- create_charts(self.chart_of_accounts, self.name)
+ create_charts(self.name, self.chart_of_accounts, self.existing_company)
frappe.db.set(self, "default_receivable_account", frappe.db.get_value("Account",
{"company": self.name, "account_type": "Receivable", "is_group": 0}))
frappe.db.set(self, "default_payable_account", frappe.db.get_value("Account",
{"company": self.name, "account_type": "Payable", "is_group": 0}))
+
+ def validate_coa_input(self):
+ if self.create_chart_of_accounts_based_on == "Existing Company":
+ self.chart_of_accounts = None
+ if not self.existing_company:
+ frappe.throw(_("Please select Existing Company for creating Chart of Accounts"))
+
+ else:
+ self.existing_company = None
+ self.create_chart_of_accounts_based_on = "Standard Template"
+ if not self.chart_of_accounts:
+ self.chart_of_accounts = "Standard"
def set_default_accounts(self):
self._set_default_account("default_cash_account", "Cash")
diff --git a/erpnext/setup/doctype/company/test_company.py b/erpnext/setup/doctype/company/test_company.py
index afcc3b1..52836a6 100644
--- a/erpnext/setup/doctype/company/test_company.py
+++ b/erpnext/setup/doctype/company/test_company.py
@@ -7,8 +7,40 @@
import frappe
import unittest
-class TestCompany(unittest.TestCase):
- pass
-
-
test_records = frappe.get_test_records('Company')
+
+class TestCompany(unittest.TestCase):
+ def test_coa_based_on_existing_company(self):
+ make_company()
+
+ expected_results = {
+ "Debtors - CFEC": {
+ "account_type": "Receivable",
+ "is_group": 0,
+ "root_type": "Asset",
+ "parent_account": "Accounts Receivable - CFEC",
+ },
+ "_Test Cash - CFEC": {
+ "account_type": "Cash",
+ "is_group": 0,
+ "root_type": "Asset",
+ "parent_account": "Cash In Hand - CFEC"
+ }
+ }
+
+ for account, acc_property in expected_results.items():
+ acc = frappe.get_doc("Account", account)
+ for prop, val in acc_property.items():
+ self.assertEqual(acc.get(prop), val)
+
+
+def make_company():
+ company = frappe.new_doc("Company")
+ company.company_name = "COA from Existing Company"
+ company.abbr = "CFEC"
+ company.default_currency = "INR"
+ company.create_chart_of_accounts_based_on = "Existing Company"
+ company.existing_company = "_Test Company"
+ company.save()
+
+
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index 791e54e..ac999ed 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -177,7 +177,7 @@
if not user_id:
user_id = frappe.session.user
- return frappe.db.sql("""select count(name) from `tabToDo`
+ return frappe.db.sql("""select count(*) from `tabToDo`
where status='Open' and (owner=%s or assigned_by=%s)""",
(user_id, user_id))[0][0]
@@ -202,7 +202,7 @@
def get_issue_count(self):
"""Get count of Issue"""
- return frappe.db.sql("""select count(name) from `tabIssue`
+ return frappe.db.sql("""select count(*) from `tabIssue`
where status in ('Open','Replied') """)[0][0]
def get_project_list(self, user_id=None):
@@ -221,7 +221,7 @@
def get_project_count(self):
"""Get count of Project"""
- return frappe.db.sql("""select count(name) from `tabProject`
+ return frappe.db.sql("""select count(*) from `tabProject`
where status='Open' and project_type='External'""")[0][0]
def set_accounting_cards(self, context):
diff --git a/erpnext/setup/doctype/item_group/item_group.py b/erpnext/setup/doctype/item_group/item_group.py
index e638161..12899cd 100644
--- a/erpnext/setup/doctype/item_group/item_group.py
+++ b/erpnext/setup/doctype/item_group/item_group.py
@@ -127,7 +127,7 @@
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(name) from `tabItem`
+ 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`
diff --git a/erpnext/setup/setup_wizard/setup_wizard.py b/erpnext/setup/setup_wizard/setup_wizard.py
index 646aef1..395ea51 100644
--- a/erpnext/setup/setup_wizard/setup_wizard.py
+++ b/erpnext/setup/setup_wizard/setup_wizard.py
@@ -88,6 +88,7 @@
'abbr':args.get('company_abbr'),
'default_currency':args.get('currency'),
'country': args.get('country'),
+ 'create_chart_of_accounts_based_on': 'Standard Template',
'chart_of_accounts': args.get(('chart_of_accounts')),
'domain': args.get('domain')
}).insert()
diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py
index 9b16ad7..97ef329 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -23,7 +23,7 @@
"Notification Control")
# if no company, show a dialog box to create a new company
- bootinfo.customer_count = frappe.db.sql("""select count(name) from tabCustomer""")[0][0]
+ bootinfo.customer_count = frappe.db.sql("""select count(*) from tabCustomer""")[0][0]
if not bootinfo.customer_count:
bootinfo.setup_complete = frappe.db.sql("""select name from
diff --git a/erpnext/support/page/support_analytics/support_analytics.js b/erpnext/support/page/support_analytics/support_analytics.js
index 79a7fd6..01b7b48 100644
--- a/erpnext/support/page/support_analytics/support_analytics.js
+++ b/erpnext/support/page/support_analytics/support_analytics.js
@@ -27,11 +27,11 @@
},
filters: [
- {fieldtype:"Select", label: __("Fiscal Year"), link:"Fiscal Year",
+ {fieldname: "fiscal_year", fieldtype:"Select", label: __("Fiscal Year"), link:"Fiscal Year",
default_value: __("Select Fiscal Year") + "..."},
- {fieldtype:"Date", label: __("From Date")},
- {fieldtype:"Date", label: __("To Date")},
- {fieldtype:"Select", label: __("Range"),
+ {fieldname: "from_date", fieldtype:"Date", label: __("From Date")},
+ {fieldname: "to_date", fieldtype:"Date", label: __("To Date")},
+ {fieldname: "range", fieldtype:"Select", label: __("Range"),
options:["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"], default_value: "Monthly"}
],