Merge pull request #18154 from netchampfaris/fix-price-list-on-website-d
fix: Honor price list in Shopping Cart Settings
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js
index 10f127a..5e94118 100755
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.js
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js
@@ -8,6 +8,10 @@
return { filters: { selling: 1 } };
});
+ frm.set_query("tc_name", function() {
+ return { filters: { selling: 1 } };
+ });
+
erpnext.queries.setup_queries(frm, "Warehouse", function() {
return erpnext.queries.warehouse(frm.doc);
});
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index a6f6ace..1b03896 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -484,9 +484,13 @@
"credit": flt(item.rm_supp_cost)
}, warehouse_account[self.supplier_warehouse]["account_currency"], item=item))
elif not item.is_fixed_asset or (item.is_fixed_asset and is_cwip_accounting_disabled()):
+
+ expense_account = (item.expense_account
+ if (not item.enable_deferred_expense or self.is_return) else item.deferred_expense_account)
+
gl_entries.append(
self.get_gl_dict({
- "account": item.expense_account if not item.enable_deferred_expense else item.deferred_expense_account,
+ "account": expense_account,
"against": self.supplier,
"debit": flt(item.base_net_amount, item.precision("base_net_amount")),
"debit_in_account_currency": (flt(item.base_net_amount,
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index b725c73..71bdc2a 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -783,10 +783,13 @@
asset.db_set("disposal_date", self.posting_date)
asset.set_status("Sold" if self.docstatus==1 else None)
else:
- account_currency = get_account_currency(item.income_account)
+ income_account = (item.income_account
+ if (not item.enable_deferred_revenue or self.is_return) else item.deferred_revenue_account)
+
+ account_currency = get_account_currency(income_account)
gl_entries.append(
self.get_gl_dict({
- "account": item.income_account if not item.enable_deferred_revenue else item.deferred_revenue_account,
+ "account": income_account,
"against": self.customer,
"credit": flt(item.base_net_amount, item.precision("base_net_amount")),
"credit_in_account_currency": (flt(item.base_net_amount, item.precision("base_net_amount"))
diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
index 4cba978..2973748 100755
--- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
+++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py
@@ -599,9 +599,12 @@
rows = []
for d in data:
+ values = d[self.ageing_col_idx_start : self.ageing_col_idx_start+5]
+ precision = cint(frappe.db.get_default("float_precision")) or 2
+ formatted_values = [frappe.utils.rounded(val, precision) for val in values]
rows.append(
{
- 'values': d[self.ageing_col_idx_start : self.ageing_col_idx_start+5]
+ 'values': formatted_values
}
)
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.js b/erpnext/accounts/report/trial_balance/trial_balance.js
index cdc7745..8bc7280 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.js
+++ b/erpnext/accounts/report/trial_balance/trial_balance.js
@@ -96,3 +96,16 @@
}
});
+let dimension_filters = erpnext.get_dimension_filters();
+
+dimension_filters.then((dimensions) => {
+ dimensions.forEach((dimension) => {
+ frappe.query_reports["Trial Balance"].filters.splice(5, 0 ,{
+ "fieldname": dimension["fieldname"],
+ "label": __(dimension["label"]),
+ "fieldtype": "Link",
+ "options": dimension["document_type"]
+ });
+ });
+});
+
diff --git a/erpnext/accounts/report/trial_balance/trial_balance.py b/erpnext/accounts/report/trial_balance/trial_balance.py
index 5758b0b..b6ddaa8 100644
--- a/erpnext/accounts/report/trial_balance/trial_balance.py
+++ b/erpnext/accounts/report/trial_balance/trial_balance.py
@@ -7,6 +7,7 @@
from frappe.utils import flt, getdate, formatdate, cstr
from erpnext.accounts.report.financial_statements \
import filter_accounts, set_gl_entries_by_account, filter_out_zero_value_rows
+from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions
value_fields = ("opening_debit", "opening_credit", "debit", "credit", "closing_debit", "closing_credit")
@@ -109,6 +110,25 @@
additional_conditions += fb_conditions
+ accounting_dimensions = get_accounting_dimensions()
+
+ query_filters = {
+ "company": filters.company,
+ "from_date": filters.from_date,
+ "report_type": report_type,
+ "year_start_date": filters.year_start_date,
+ "finance_book": filters.finance_book,
+ "company_fb": frappe.db.get_value("Company", filters.company, 'default_finance_book')
+ }
+
+ if accounting_dimensions:
+ for dimension in accounting_dimensions:
+ additional_conditions += """ and {0} in (%({0})s) """.format(dimension)
+
+ query_filters.update({
+ dimension: filters.get(dimension)
+ })
+
gle = frappe.db.sql("""
select
account, sum(debit) as opening_debit, sum(credit) as opening_credit
@@ -118,16 +138,7 @@
{additional_conditions}
and (posting_date < %(from_date)s or ifnull(is_opening, 'No') = 'Yes')
and account in (select name from `tabAccount` where report_type=%(report_type)s)
- group by account""".format(additional_conditions=additional_conditions),
- {
- "company": filters.company,
- "from_date": filters.from_date,
- "report_type": report_type,
- "year_start_date": filters.year_start_date,
- "finance_book": filters.finance_book,
- "company_fb": frappe.db.get_value("Company", filters.company, 'default_finance_book')
- },
- as_dict=True)
+ group by account""".format(additional_conditions=additional_conditions), query_filters , as_dict=True)
opening = frappe._dict()
for d in gle:
diff --git a/erpnext/config/manufacturing.py b/erpnext/config/manufacturing.py
index da60550..c79c5b8 100644
--- a/erpnext/config/manufacturing.py
+++ b/erpnext/config/manufacturing.py
@@ -4,43 +4,6 @@
def get_data():
return [
{
- "label": _("Production"),
- "icon": "fa fa-star",
- "items": [
- {
- "type": "doctype",
- "name": "Work Order",
- "description": _("Orders released for production."),
- "onboard": 1,
- "dependencies": ["Item", "BOM"]
- },
- {
- "type": "doctype",
- "name": "Production Plan",
- "description": _("Generate Material Requests (MRP) and Work Orders."),
- "onboard": 1,
- "dependencies": ["Item", "BOM"]
- },
- {
- "type": "doctype",
- "name": "Stock Entry",
- "onboard": 1,
- "dependencies": ["Item"]
- },
- {
- "type": "doctype",
- "name": "Timesheet",
- "description": _("Time Sheet for manufacturing."),
- "onboard": 1,
- "dependencies": ["Activity Type"]
- },
- {
- "type": "doctype",
- "name": "Job Card"
- }
- ]
- },
- {
"label": _("Bill of Materials"),
"items": [
{
@@ -86,6 +49,43 @@
]
},
{
+ "label": _("Production"),
+ "icon": "fa fa-star",
+ "items": [
+ {
+ "type": "doctype",
+ "name": "Work Order",
+ "description": _("Orders released for production."),
+ "onboard": 1,
+ "dependencies": ["Item", "BOM"]
+ },
+ {
+ "type": "doctype",
+ "name": "Production Plan",
+ "description": _("Generate Material Requests (MRP) and Work Orders."),
+ "onboard": 1,
+ "dependencies": ["Item", "BOM"]
+ },
+ {
+ "type": "doctype",
+ "name": "Stock Entry",
+ "onboard": 1,
+ "dependencies": ["Item"]
+ },
+ {
+ "type": "doctype",
+ "name": "Timesheet",
+ "description": _("Time Sheet for manufacturing."),
+ "onboard": 1,
+ "dependencies": ["Activity Type"]
+ },
+ {
+ "type": "doctype",
+ "name": "Job Card"
+ }
+ ]
+ },
+ {
"label": _("Tools"),
"icon": "fa fa-wrench",
"items": [
diff --git a/erpnext/hr/doctype/job_offer/job_offer.js b/erpnext/hr/doctype/job_offer/job_offer.js
index 1ee35af..c3d83c4 100755
--- a/erpnext/hr/doctype/job_offer/job_offer.js
+++ b/erpnext/hr/doctype/job_offer/job_offer.js
@@ -4,6 +4,12 @@
frappe.provide("erpnext.job_offer");
frappe.ui.form.on("Job Offer", {
+ onload: function (frm) {
+ frm.set_query("select_terms", function() {
+ return { filters: { hr: 1 } };
+ });
+ },
+
select_terms: function (frm) {
erpnext.utils.get_terms(frm.doc.select_terms, frm.doc, function (r) {
if (!r.exc) {
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index db0a3a5..6d25c06 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -618,7 +618,7 @@
elif not self.payment_days and not self.salary_slip_based_on_timesheet and cint(row.depends_on_payment_days):
amount, additional_amount = 0, 0
elif not row.amount:
- amount = row.default_amount + row.additional_amount
+ amount = flt(row.default_amount) + flt(row.additional_amount)
# apply rounding
if frappe.get_cached_value("Salary Component", row.salary_component, "round_to_the_nearest_integer"):
diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order.js b/erpnext/manufacturing/doctype/blanket_order/blanket_order.js
index 89efb93..0bbf689 100644
--- a/erpnext/manufacturing/doctype/blanket_order/blanket_order.js
+++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order.js
@@ -2,6 +2,10 @@
// For license information, please see license.txt
frappe.ui.form.on('Blanket Order', {
+ onload: function(frm) {
+ frm.trigger('set_tc_name_filter');
+ },
+
setup: function(frm) {
frm.add_fetch("customer", "customer_name", "customer_name");
frm.add_fetch("supplier", "supplier_name", "supplier_name");
@@ -44,4 +48,23 @@
}
});
},
+
+ set_tc_name_filter: function(frm) {
+ if (frm.doc.blanket_order_type === 'Selling') {
+ frm.set_query("tc_name", function() {
+ return { filters: { selling: 1 } };
+ });
+ }
+ if (frm.doc.blanket_order_type === 'Purchasing') {
+ frm.set_query("tc_name", function() {
+ return { filters: { buying: 1 } };
+ });
+ }
+ },
+
+ blanket_order_type: function (frm) {
+ frm.trigger('set_tc_name_filter');
+ }
});
+
+
diff --git a/erpnext/manufacturing/doctype/blanket_order/blanket_order_dashboard.py b/erpnext/manufacturing/doctype/blanket_order/blanket_order_dashboard.py
new file mode 100644
index 0000000..ed319a0
--- /dev/null
+++ b/erpnext/manufacturing/doctype/blanket_order/blanket_order_dashboard.py
@@ -0,0 +1,12 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+ return {
+ 'fieldname': 'blanket_order',
+ 'transactions': [
+ {
+ 'items': ['Purchase Order', 'Sales Order']
+ }
+ ]
+ }
diff --git a/erpnext/manufacturing/doctype/bom/bom_dashboard.py b/erpnext/manufacturing/doctype/bom/bom_dashboard.py
new file mode 100644
index 0000000..803ece7
--- /dev/null
+++ b/erpnext/manufacturing/doctype/bom/bom_dashboard.py
@@ -0,0 +1,27 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+ return {
+ 'fieldname': 'bom_no',
+ 'non_standard_fieldnames': {
+ 'Item': 'default_bom',
+ 'Purchase Order': 'bom',
+ 'Purchase Receipt': 'bom',
+ 'Purchase Invoice': 'bom'
+ },
+ 'transactions': [
+ {
+ 'label': _('Stock'),
+ 'items': ['Item', 'Stock Entry', 'Quality Inspection']
+ },
+ {
+ 'label': _('Manufacture'),
+ 'items': ['BOM', 'Work Order', 'Job Card', 'Production Plan']
+ },
+ {
+ 'label': _('Purchase'),
+ 'items': ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice']
+ }
+ ]
+ }
diff --git a/erpnext/manufacturing/doctype/job_card/job_card_dashboard.py b/erpnext/manufacturing/doctype/job_card/job_card_dashboard.py
index d48bccf..c2aa2bd 100644
--- a/erpnext/manufacturing/doctype/job_card/job_card_dashboard.py
+++ b/erpnext/manufacturing/doctype/job_card/job_card_dashboard.py
@@ -10,4 +10,4 @@
'items': ['Material Request', 'Stock Entry']
}
]
- }
\ No newline at end of file
+ }
diff --git a/erpnext/manufacturing/doctype/operation/operation_dashboard.py b/erpnext/manufacturing/doctype/operation/operation_dashboard.py
new file mode 100644
index 0000000..8deb9ec
--- /dev/null
+++ b/erpnext/manufacturing/doctype/operation/operation_dashboard.py
@@ -0,0 +1,13 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+ return {
+ 'fieldname': 'operation',
+ 'transactions': [
+ {
+ 'label': _('Manufacture'),
+ 'items': ['BOM', 'Work Order', 'Job Card', 'Timesheet']
+ }
+ ]
+ }
diff --git a/erpnext/manufacturing/doctype/routing/routing_dashboard.py b/erpnext/manufacturing/doctype/routing/routing_dashboard.py
new file mode 100644
index 0000000..ab309cc
--- /dev/null
+++ b/erpnext/manufacturing/doctype/routing/routing_dashboard.py
@@ -0,0 +1,12 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+ return {
+ 'fieldname': 'routing',
+ 'transactions': [
+ {
+ 'items': ['BOM']
+ }
+ ]
+ }
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/workstation/workstation_dashboard.py b/erpnext/manufacturing/doctype/workstation/workstation_dashboard.py
new file mode 100644
index 0000000..9e0d1d1
--- /dev/null
+++ b/erpnext/manufacturing/doctype/workstation/workstation_dashboard.py
@@ -0,0 +1,13 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+ return {
+ 'fieldname': 'workstation',
+ 'transactions': [
+ {
+ 'label': _('Manufacture'),
+ 'items': ['BOM', 'Routing', 'Work Order', 'Job Card', 'Operation', 'Timesheet']
+ }
+ ]
+ }
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 3b94720..bd41c7e 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -533,7 +533,7 @@
erpnext.patches.v11_0.make_location_from_warehouse
erpnext.patches.v11_0.make_asset_finance_book_against_old_entries
erpnext.patches.v11_0.check_buying_selling_in_currency_exchange
-erpnext.patches.v11_0.move_item_defaults_to_child_table_for_multicompany #02-07-2018
+erpnext.patches.v11_0.move_item_defaults_to_child_table_for_multicompany #02-07-2018 #19-06-2019
erpnext.patches.v11_0.refactor_erpnext_shopify #2018-09-07
erpnext.patches.v11_0.rename_overproduction_percent_field
erpnext.patches.v11_0.update_backflush_subcontract_rm_based_on_bom
@@ -615,3 +615,4 @@
erpnext.patches.v12_0.set_quotation_status
erpnext.patches.v12_0.set_priority_for_support
erpnext.patches.v12_0.delete_priority_property_setter
+erpnext.patches.v12_0.add_default_buying_selling_terms_in_company
diff --git a/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py b/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py
index 01f84a0..c7c7635 100644
--- a/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py
+++ b/erpnext/patches/v11_0/move_item_defaults_to_child_table_for_multicompany.py
@@ -17,10 +17,8 @@
frappe.reload_doc('stock', 'doctype', 'item_default')
frappe.reload_doc('stock', 'doctype', 'item')
- if frappe.db.a_row_exists('Item Default'): return
-
companies = frappe.get_all("Company")
- if len(companies) == 1:
+ if len(companies) == 1 and not frappe.get_all("Item Default", limit=1):
try:
frappe.db.sql('''
INSERT INTO `tabItem Default`
@@ -35,32 +33,64 @@
except:
pass
else:
- item_details = frappe.get_all("Item", fields=["name", "default_warehouse", "buying_cost_center",
- "expense_account", "selling_cost_center", "income_account"], limit=100)
+ item_details = frappe.db.sql(""" SELECT name, default_warehouse,
+ buying_cost_center, expense_account, selling_cost_center, income_account
+ FROM tabItem
+ WHERE
+ name not in (select distinct parent from `tabItem Default`) and ifnull(disabled, 0) = 0"""
+ , as_dict=1)
- for item in item_details:
- item_defaults = []
+ items_default_data = {}
+ for item_data in item_details:
+ for d in [["default_warehouse", "Warehouse"], ["expense_account", "Account"],
+ ["income_account", "Account"], ["buying_cost_center", "Cost Center"],
+ ["selling_cost_center", "Cost Center"]]:
+ if item_data.get(d[0]):
+ company = frappe.get_value(d[1], item_data.get(d[0]), "company", cache=True)
- def insert_into_item_defaults(doc_field_name, doc_field_value, company):
- for d in item_defaults:
- if d.get("company") == company:
- d[doc_field_name] = doc_field_value
- return
- item_defaults.append({
- "company": company,
- doc_field_name: doc_field_value
- })
+ if item_data.name not in items_default_data:
+ items_default_data[item_data.name] = {}
- for d in [
- ["default_warehouse", "Warehouse"], ["expense_account", "Account"], ["income_account", "Account"],
- ["buying_cost_center", "Cost Center"], ["selling_cost_center", "Cost Center"]
- ]:
- if item.get(d[0]):
- company = frappe.get_value(d[1], item.get(d[0]), "company", cache=True)
- insert_into_item_defaults(d[0], item.get(d[0]), company)
+ company_wise_data = items_default_data[item_data.name]
- doc = frappe.get_doc("Item", item.name)
- doc.extend("item_defaults", item_defaults)
+ if company not in company_wise_data:
+ company_wise_data[company] = {}
- for child_doc in doc.item_defaults:
- child_doc.db_insert()
\ No newline at end of file
+ default_data = company_wise_data[company]
+ default_data[d[0]] = item_data.get(d[0])
+
+ to_insert_data = []
+
+ # items_default_data data structure will be as follow
+ # {
+ # 'item_code 1': {'company 1': {'default_warehouse': 'Test Warehouse 1'}},
+ # 'item_code 2': {
+ # 'company 1': {'default_warehouse': 'Test Warehouse 1'},
+ # 'company 2': {'default_warehouse': 'Test Warehouse 1'}
+ # }
+ # }
+
+ for item_code, companywise_item_data in items_default_data.items():
+ for company, item_default_data in companywise_item_data.items():
+ to_insert_data.append((
+ frappe.generate_hash("", 10),
+ item_code,
+ 'Item',
+ 'item_defaults',
+ company,
+ item_default_data.get('default_warehouse'),
+ item_default_data.get('expense_account'),
+ item_default_data.get('income_account'),
+ item_default_data.get('buying_cost_center'),
+ item_default_data.get('selling_cost_center'),
+ ))
+
+ if to_insert_data:
+ frappe.db.sql('''
+ INSERT INTO `tabItem Default`
+ (
+ `name`, `parent`, `parenttype`, `parentfield`, `company`, `default_warehouse`,
+ `expense_account`, `income_account`, `buying_cost_center`, `selling_cost_center`
+ )
+ VALUES {}
+ '''.format(', '.join(['%s'] * len(to_insert_data))), tuple(to_insert_data))
\ No newline at end of file
diff --git a/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py b/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py
new file mode 100644
index 0000000..484f81a
--- /dev/null
+++ b/erpnext/patches/v12_0/add_default_buying_selling_terms_in_company.py
@@ -0,0 +1,19 @@
+# Copyright (c) 2019, Frappe and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+
+import frappe
+from frappe.model.utils.rename_field import rename_field
+
+def execute():
+ frappe.reload_doc("setup", "doctype", "company")
+ if frappe.db.has_column('Company', 'default_terms'):
+ rename_field('Company', "default_terms", "default_selling_terms")
+
+ for company in frappe.get_all("Company", ["name", "default_selling_terms", "default_buying_terms"]):
+ if company.default_selling_terms and not company.default_buying_terms:
+ frappe.db.set_value("Company", company.name, "default_buying_terms", company.default_selling_terms)
+
+ frappe.reload_doc("setup", "doctype", "terms_and_conditions")
+ frappe.db.sql("update `tabTerms and Conditions` set selling=1, buying=1, hr=1")
diff --git a/erpnext/patches/v12_0/make_custom_fields_for_bank_remittance.py b/erpnext/patches/v12_0/make_custom_fields_for_bank_remittance.py
index 9925b70..3d4a995 100644
--- a/erpnext/patches/v12_0/make_custom_fields_for_bank_remittance.py
+++ b/erpnext/patches/v12_0/make_custom_fields_for_bank_remittance.py
@@ -3,6 +3,8 @@
from erpnext.regional.india.setup import make_custom_fields
def execute():
+ frappe.reload_doc("accounts", "doctype", "tax_category")
+ frappe.reload_doc("stock", "doctype", "item_manufacturer")
company = frappe.get_all('Company', filters = {'country': 'India'})
if not company:
return
diff --git a/erpnext/portal/product_configurator/item_variants_cache.py b/erpnext/portal/product_configurator/item_variants_cache.py
index f33c8d6..fc294ce 100644
--- a/erpnext/portal/product_configurator/item_variants_cache.py
+++ b/erpnext/portal/product_configurator/item_variants_cache.py
@@ -110,4 +110,4 @@
def enqueue_build_cache(item_code):
if frappe.cache().hget('item_cache_build_in_progress', item_code):
return
- frappe.enqueue(build_cache, item_code=item_code, queue='short')
+ frappe.enqueue(build_cache, item_code=item_code, queue='long')
diff --git a/erpnext/public/js/controllers/buying.js b/erpnext/public/js/controllers/buying.js
index 97c823d..824b8d9 100644
--- a/erpnext/public/js/controllers/buying.js
+++ b/erpnext/public/js/controllers/buying.js
@@ -61,6 +61,14 @@
});
}
+ if(this.frm.fields_dict.tc_name) {
+ this.frm.set_query("tc_name", function() {
+ return{
+ filters: { 'buying': 1 }
+ }
+ });
+ }
+
me.frm.set_query('supplier', erpnext.queries.supplier);
me.frm.set_query('contact_person', erpnext.queries.contact_query);
me.frm.set_query('supplier_address', erpnext.queries.address_query);
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 8fb21bc..11fdb8b 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -383,8 +383,9 @@
setup_sms: function() {
var me = this;
+ let blacklist = ['Purchase Invoice', 'BOM'];
if(this.frm.doc.docstatus===1 && !in_list(["Lost", "Stopped", "Closed"], this.frm.doc.status)
- && this.frm.doctype != "Purchase Invoice") {
+ && !blacklist.includes(this.frm.doctype)) {
this.frm.page.add_menu_item(__('Send SMS'), function() { me.send_sms(); });
}
},
@@ -584,8 +585,17 @@
me.frm.set_value("letter_head", company_doc.default_letter_head);
}
}
- if (company_doc.default_terms && me.frm.doc.doctype != "Purchase Invoice" && frappe.meta.has_field(me.frm.doc.doctype, "tc_name")) {
- me.frm.set_value("tc_name", company_doc.default_terms);
+ let selling_doctypes_for_tc = ["Sales Invoice", "Quotation", "Sales Order", "Delivery Note"];
+ if (company_doc.default_selling_terms && frappe.meta.has_field(me.frm.doc.doctype, "tc_name") &&
+ selling_doctypes_for_tc.indexOf(me.frm.doc.doctype) != -1) {
+ me.frm.set_value("tc_name", company_doc.default_selling_terms);
+ }
+ let buying_doctypes_for_tc = ["Request for Quotation", "Supplier Quotation", "Purchase Order",
+ "Material Request", "Purchase Receipt"];
+ // Purchase Invoice is excluded as per issue #3345
+ if (company_doc.default_buying_terms && frappe.meta.has_field(me.frm.doc.doctype, "tc_name") &&
+ buying_doctypes_for_tc.indexOf(me.frm.doc.doctype) != -1) {
+ me.frm.set_value("tc_name", company_doc.default_buying_terms);
}
frappe.run_serially([
diff --git a/erpnext/regional/italy/utils.py b/erpnext/regional/italy/utils.py
index 2d7ffa6..407677f 100644
--- a/erpnext/regional/italy/utils.py
+++ b/erpnext/regional/italy/utils.py
@@ -326,6 +326,9 @@
return frappe.get_cached_value('Company', company, 'country')
def get_e_invoice_attachments(invoice):
+ if not invoice.company_tax_id:
+ return []
+
out = []
attachments = get_attachments(invoice.doctype, invoice.name)
company_tax_id = invoice.company_tax_id if invoice.company_tax_id.startswith("IT") else "IT" + invoice.company_tax_id
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index f4bb070..26ca7c6 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -107,7 +107,6 @@
refresh: function(doc, dt, dn) {
var me = this;
this._super();
- var allow_purchase = false;
var allow_delivery = false;
if(doc.docstatus==1) {
@@ -129,28 +128,9 @@
me.frm.cscript.update_status('Re-open', 'Draft')
}, __("Status"));
}
- }
+ }
if(doc.status !== 'Closed') {
if(doc.status !== 'On Hold') {
- for (var i in this.frm.doc.items) {
- var item = this.frm.doc.items[i];
- if(item.delivered_by_supplier === 1 || item.supplier){
- if(item.qty > flt(item.ordered_qty)
- && item.qty > flt(item.delivered_qty)) {
- allow_purchase = true;
- }
- }
-
- if (item.delivered_by_supplier===0) {
- if(item.qty > flt(item.delivered_qty)) {
- allow_delivery = true;
- }
- }
-
- if (allow_delivery && allow_purchase) {
- break;
- }
- }
if (this.frm.has_perm("submit")) {
if(flt(doc.per_delivered, 6) < 100 || flt(doc.per_billed) < 100) {
@@ -180,9 +160,8 @@
}
// make purchase order
- if(flt(doc.per_delivered, 6) < 100 && allow_purchase) {
this.frm.add_custom_button(__('Purchase Order'), () => this.make_purchase_order(), __('Create'));
- }
+
// maintenance
if(flt(doc.per_delivered, 2) < 100 &&
["Sales", "Shopping Cart"].indexOf(doc.order_type)===-1) {
@@ -543,6 +522,42 @@
filters: {'parent': me.frm.doc.name}
}
}},
+ {fieldname: 'items_for_po', fieldtype: 'Table', label: 'Select Items',
+ fields: [
+ {
+ fieldtype:'Data',
+ fieldname:'item_code',
+ label: __('Item'),
+ read_only:1,
+ in_list_view:1
+ },
+ {
+ fieldtype:'Data',
+ fieldname:'item_name',
+ label: __('Item name'),
+ read_only:1,
+ in_list_view:1
+ },
+ {
+ fieldtype:'Float',
+ fieldname:'qty',
+ label: __('Quantity'),
+ read_only: 1,
+ in_list_view:1
+ },
+ {
+ fieldtype:'Link',
+ read_only:1,
+ fieldname:'uom',
+ label: __('UOM'),
+ in_list_view:1
+ }
+ ],
+ data: cur_frm.doc.items,
+ get_data: function() {
+ return cur_frm.doc.items
+ }
+ },
{"fieldtype": "Button", "label": __('Create Purchase Order'), "fieldname": "make_purchase_order", "cssClass": "btn-primary"},
]
@@ -550,13 +565,22 @@
dialog.fields_dict.make_purchase_order.$input.click(function() {
var args = dialog.get_values();
+ let selected_items = dialog.fields_dict.items_for_po.grid.get_selected_children()
+ if(selected_items.length == 0) {
+ frappe.throw({message: 'Please select Item form Table', title: __('Message'), indicator:'blue'})
+ }
+ let selected_items_list = []
+ for(let i in selected_items){
+ selected_items_list.push(selected_items[i].item_code)
+ }
dialog.hide();
return frappe.call({
type: "GET",
- method: "erpnext.selling.doctype.sales_order.sales_order.make_purchase_order_for_drop_shipment",
+ method: "erpnext.selling.doctype.sales_order.sales_order.make_purchase_order",
args: {
"source_name": me.frm.doc.name,
- "for_supplier": args.supplier
+ "for_supplier": args.supplier,
+ "selected_items": selected_items_list
},
freeze: true,
callback: function(r) {
@@ -576,6 +600,8 @@
}
})
});
+ dialog.get_field("items_for_po").grid.only_sortable()
+ dialog.get_field("items_for_po").refresh()
dialog.show();
},
hold_sales_order: function(){
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 493da99..8ad3bf0 100755
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -764,7 +764,10 @@
return data
@frappe.whitelist()
-def make_purchase_order_for_drop_shipment(source_name, for_supplier=None, target_doc=None):
+def make_purchase_order(source_name, for_supplier=None, selected_items=[], target_doc=None):
+ if isinstance(selected_items, string_types):
+ selected_items = json.loads(selected_items)
+
def set_missing_values(source, target):
target.supplier = supplier
target.apply_discount_on = ""
@@ -843,7 +846,7 @@
"price_list_rate"
],
"postprocess": update_item,
- "condition": lambda doc: doc.ordered_qty < doc.qty and doc.supplier == supplier
+ "condition": lambda doc: doc.ordered_qty < doc.qty and doc.supplier == supplier and doc.item_code in selected_items
}
}, target_doc, set_missing_values)
if not for_supplier:
diff --git a/erpnext/selling/doctype/sales_order/test_sales_order.py b/erpnext/selling/doctype/sales_order/test_sales_order.py
index e7697e2..569c53f 100644
--- a/erpnext/selling/doctype/sales_order/test_sales_order.py
+++ b/erpnext/selling/doctype/sales_order/test_sales_order.py
@@ -449,7 +449,7 @@
frappe.db.set_value("Stock Settings", None, "auto_insert_price_list_rate_if_missing", 1)
def test_drop_shipping(self):
- from erpnext.selling.doctype.sales_order.sales_order import make_purchase_order_for_drop_shipment
+ from erpnext.selling.doctype.sales_order.sales_order import make_purchase_order
from erpnext.buying.doctype.purchase_order.purchase_order import update_status
make_stock_entry(target="_Test Warehouse - _TC", qty=10, rate=100)
@@ -495,7 +495,7 @@
so = make_sales_order(item_list=so_items, do_not_submit=True)
so.submit()
- po = make_purchase_order_for_drop_shipment(so.name, '_Test Supplier')
+ po = make_purchase_order(so.name, '_Test Supplier', selected_items=[so_items[0]['item_code']])
po.submit()
dn = create_dn_against_so(so.name, delivered_qty=1)
diff --git a/erpnext/selling/sales_common.js b/erpnext/selling/sales_common.js
index 9bae58b..a2bae56 100644
--- a/erpnext/selling/sales_common.js
+++ b/erpnext/selling/sales_common.js
@@ -59,6 +59,12 @@
});
}
+ if(this.frm.fields_dict.tc_name) {
+ this.frm.set_query("tc_name", function() {
+ return { filters: { selling: 1 } };
+ });
+ }
+
if(!this.frm.fields_dict["items"]) {
return;
}
@@ -145,6 +151,11 @@
},
discount_amount: function(doc, cdt, cdn) {
+
+ if(doc.name === cdn) {
+ return;
+ }
+
var item = frappe.get_doc(cdt, cdn);
item.discount_percentage = 0.0;
this.apply_discount_on_item(doc, cdt, cdn, 'discount_amount');
diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js
index 1e6056e..313de67 100644
--- a/erpnext/setup/doctype/company/company.js
+++ b/erpnext/setup/doctype/company/company.js
@@ -17,6 +17,14 @@
filters: {"is_group": 1}
}
});
+
+ frm.set_query("default_selling_terms", function() {
+ return { filters: { selling: 1 } };
+ });
+
+ frm.set_query("default_buying_terms", function() {
+ return { filters: { buying: 1 } };
+ });
},
company_name: function(frm) {
diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json
index bb652ca..bc34189 100644
--- a/erpnext/setup/doctype/company/company.json
+++ b/erpnext/setup/doctype/company/company.json
@@ -1,769 +1,776 @@
{
- "allow_import": 1,
- "allow_rename": 1,
- "autoname": "field:company_name",
- "creation": "2013-04-10 08:35:39",
- "description": "Legal Entity / Subsidiary with a separate Chart of Accounts belonging to the Organization.",
- "doctype": "DocType",
- "document_type": "Setup",
- "engine": "InnoDB",
- "field_order": [
- "details",
- "company_name",
- "abbr",
- "change_abbr",
- "is_group",
- "cb0",
- "domain",
- "parent_company",
- "charts_section",
- "default_currency",
- "default_letter_head",
- "default_holiday_list",
- "default_finance_book",
- "standard_working_hours",
- "default_terms",
- "default_warehouse_for_sales_return",
- "column_break_10",
- "country",
- "create_chart_of_accounts_based_on",
- "chart_of_accounts",
- "existing_company",
- "tax_id",
- "date_of_establishment",
- "sales_settings",
- "monthly_sales_target",
- "sales_monthly_history",
- "column_break_goals",
- "transactions_annual_history",
- "total_monthly_sales",
- "default_settings",
- "default_bank_account",
- "default_cash_account",
- "default_receivable_account",
- "round_off_account",
- "round_off_cost_center",
- "write_off_account",
- "discount_allowed_account",
- "discount_received_account",
- "exchange_gain_loss_account",
- "unrealized_exchange_gain_loss_account",
- "column_break0",
- "allow_account_creation_against_child_company",
- "default_payable_account",
- "default_employee_advance_account",
- "default_expense_account",
- "default_income_account",
- "default_deferred_revenue_account",
- "default_deferred_expense_account",
- "default_payroll_payable_account",
- "default_expense_claim_payable_account",
- "section_break_22",
- "cost_center",
- "column_break_26",
- "credit_limit",
- "payment_terms",
- "auto_accounting_for_stock_settings",
- "enable_perpetual_inventory",
- "default_inventory_account",
- "stock_adjustment_account",
- "column_break_32",
- "stock_received_but_not_billed",
- "expenses_included_in_valuation",
- "fixed_asset_depreciation_settings",
- "accumulated_depreciation_account",
- "depreciation_expense_account",
- "series_for_depreciation_entry",
- "expenses_included_in_asset_valuation",
- "column_break_40",
- "disposal_account",
- "depreciation_cost_center",
- "capital_work_in_progress_account",
- "asset_received_but_not_billed",
- "budget_detail",
- "exception_budget_approver_role",
- "company_info",
- "company_logo",
- "date_of_incorporation",
- "address_html",
- "date_of_commencement",
- "phone_no",
- "fax",
- "email",
- "website",
- "column_break1",
- "company_description",
- "registration_info",
- "registration_details",
- "delete_company_transactions",
- "lft",
- "rgt",
- "old_parent"
- ],
- "fields": [
- {
- "fieldname": "details",
- "fieldtype": "Section Break",
- "oldfieldtype": "Section Break"
- },
- {
- "fieldname": "company_name",
- "fieldtype": "Data",
- "label": "Company",
- "oldfieldname": "company_name",
- "oldfieldtype": "Data",
- "reqd": 1,
- "unique": 1
- },
- {
- "fieldname": "abbr",
- "fieldtype": "Data",
- "label": "Abbr",
- "oldfieldname": "abbr",
- "oldfieldtype": "Data",
- "reqd": 1
- },
- {
- "depends_on": "eval:!doc.__islocal && in_list(frappe.user_roles, \"System Manager\")",
- "fieldname": "change_abbr",
- "fieldtype": "Button",
- "label": "Change Abbreviation"
- },
- {
- "bold": 1,
- "default": "0",
- "fieldname": "is_group",
- "fieldtype": "Check",
- "label": "Is Group"
- },
- {
- "fieldname": "default_finance_book",
- "fieldtype": "Link",
- "label": "Default Finance Book",
- "options": "Finance Book"
- },
- {
- "fieldname": "cb0",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "domain",
- "fieldtype": "Link",
- "label": "Domain",
- "options": "Domain"
- },
- {
- "fieldname": "parent_company",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Parent Company",
- "options": "Company"
- },
- {
- "fieldname": "company_logo",
- "fieldtype": "Attach Image",
- "hidden": 1,
- "label": "Company Logo"
- },
- {
- "fieldname": "company_description",
- "fieldtype": "Text Editor",
- "label": "Company Description"
- },
- {
- "collapsible": 1,
- "fieldname": "sales_settings",
- "fieldtype": "Section Break",
- "label": "Sales Settings"
- },
- {
- "fieldname": "sales_monthly_history",
- "fieldtype": "Small Text",
- "hidden": 1,
- "label": "Sales Monthly History",
- "no_copy": 1,
- "read_only": 1
- },
- {
- "fieldname": "transactions_annual_history",
- "fieldtype": "Code",
- "hidden": 1,
- "label": "Transactions Annual History",
- "no_copy": 1,
- "read_only": 1
- },
- {
- "fieldname": "monthly_sales_target",
- "fieldtype": "Currency",
- "label": "Monthly Sales Target",
- "options": "default_currency"
- },
- {
- "fieldname": "column_break_goals",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "total_monthly_sales",
- "fieldtype": "Currency",
- "label": "Total Monthly Sales",
- "no_copy": 1,
- "options": "default_currency",
- "read_only": 1
- },
- {
- "fieldname": "charts_section",
- "fieldtype": "Section Break",
- "label": "Default Values"
- },
- {
- "fieldname": "default_currency",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Currency",
- "options": "Currency",
- "reqd": 1
- },
- {
- "fieldname": "default_letter_head",
- "fieldtype": "Link",
- "label": "Default Letter Head",
- "options": "Letter Head"
- },
- {
- "fieldname": "default_holiday_list",
- "fieldtype": "Link",
- "label": "Default Holiday List",
- "options": "Holiday List"
- },
- {
- "fieldname": "standard_working_hours",
- "fieldtype": "Float",
- "label": "Standard Working Hours"
- },
- {
- "fieldname": "default_terms",
- "fieldtype": "Link",
- "label": "Default Terms",
- "options": "Terms and Conditions"
- },
- {
- "fieldname": "default_warehouse_for_sales_return",
- "fieldtype": "Link",
- "label": "Default warehouse for Sales Return",
- "options": "Warehouse"
- },
- {
- "fieldname": "column_break_10",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "country",
- "fieldtype": "Link",
- "in_list_view": 1,
- "label": "Country",
- "options": "Country",
- "reqd": 1
- },
- {
- "fieldname": "create_chart_of_accounts_based_on",
- "fieldtype": "Select",
- "label": "Create Chart Of Accounts Based On",
- "options": "\nStandard Template\nExisting Company"
- },
- {
- "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Standard Template\"",
- "fieldname": "chart_of_accounts",
- "fieldtype": "Select",
- "label": "Chart Of Accounts Template",
- "no_copy": 1
- },
- {
- "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Existing Company\"",
- "fieldname": "existing_company",
- "fieldtype": "Link",
- "label": "Existing Company ",
- "no_copy": 1,
- "options": "Company"
- },
- {
- "fieldname": "tax_id",
- "fieldtype": "Data",
- "label": "Tax ID"
- },
- {
- "fieldname": "date_of_establishment",
- "fieldtype": "Date",
- "label": "Date of Establishment"
- },
- {
- "fieldname": "default_settings",
- "fieldtype": "Section Break",
- "label": "Accounts Settings",
- "oldfieldtype": "Section Break"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_bank_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Bank Account",
- "no_copy": 1,
- "oldfieldname": "default_bank_account",
- "oldfieldtype": "Link",
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_cash_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Cash Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_receivable_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Receivable Account",
- "no_copy": 1,
- "oldfieldname": "receivables_group",
- "oldfieldtype": "Link",
- "options": "Account"
- },
- {
- "fieldname": "round_off_account",
- "fieldtype": "Link",
- "label": "Round Off Account",
- "options": "Account"
- },
- {
- "fieldname": "round_off_cost_center",
- "fieldtype": "Link",
- "label": "Round Off Cost Center",
- "options": "Cost Center"
- },
- {
- "fieldname": "write_off_account",
- "fieldtype": "Link",
- "label": "Write Off Account",
- "options": "Account"
- },
- {
- "fieldname": "discount_allowed_account",
- "fieldtype": "Link",
- "label": "Discount Allowed Account",
- "options": "Account"
- },
- {
- "fieldname": "discount_received_account",
- "fieldtype": "Link",
- "label": "Discount Received Account",
- "options": "Account"
- },
- {
- "fieldname": "exchange_gain_loss_account",
- "fieldtype": "Link",
- "label": "Exchange Gain / Loss Account",
- "options": "Account"
- },
- {
- "fieldname": "unrealized_exchange_gain_loss_account",
- "fieldtype": "Link",
- "label": "Unrealized Exchange Gain/Loss Account",
- "options": "Account"
- },
- {
- "fieldname": "column_break0",
- "fieldtype": "Column Break",
- "oldfieldtype": "Column Break",
- "width": "50%"
- },
- {
- "default": "0",
- "depends_on": "eval:doc.parent_company",
- "fieldname": "allow_account_creation_against_child_company",
- "fieldtype": "Check",
- "label": "Allow Account Creation Against Child Company"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_payable_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Payable Account",
- "no_copy": 1,
- "oldfieldname": "payables_group",
- "oldfieldtype": "Link",
- "options": "Account"
- },
- {
- "fieldname": "default_employee_advance_account",
- "fieldtype": "Link",
- "label": "Default Employee Advance Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_expense_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Cost of Goods Sold Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_income_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Income Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_deferred_revenue_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Deferred Revenue Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_deferred_expense_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Deferred Expense Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_payroll_payable_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Payroll Payable Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "default_expense_claim_payable_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Expense Claim Payable Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "fieldname": "section_break_22",
- "fieldtype": "Section Break"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "cost_center",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Default Cost Center",
- "no_copy": 1,
- "options": "Cost Center"
- },
- {
- "fieldname": "column_break_26",
- "fieldtype": "Column Break"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "credit_limit",
- "fieldtype": "Currency",
- "label": "Credit Limit",
- "oldfieldname": "credit_limit",
- "oldfieldtype": "Currency",
- "options": "default_currency"
- },
- {
- "fieldname": "payment_terms",
- "fieldtype": "Link",
- "label": "Default Payment Terms Template",
- "options": "Payment Terms Template"
- },
- {
- "depends_on": "eval:!doc.__islocal",
- "fieldname": "auto_accounting_for_stock_settings",
- "fieldtype": "Section Break",
- "label": "Stock Settings"
- },
- {
- "default": "1",
- "fieldname": "enable_perpetual_inventory",
- "fieldtype": "Check",
- "label": "Enable Perpetual Inventory"
- },
- {
- "fieldname": "default_inventory_account",
- "fieldtype": "Link",
- "label": "Default Inventory Account",
- "options": "Account"
- },
- {
- "fieldname": "stock_adjustment_account",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Stock Adjustment Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "fieldname": "column_break_32",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "stock_received_but_not_billed",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Stock Received But Not Billed",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "fieldname": "expenses_included_in_valuation",
- "fieldtype": "Link",
- "ignore_user_permissions": 1,
- "label": "Expenses Included In Valuation",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "collapsible": 1,
- "fieldname": "fixed_asset_depreciation_settings",
- "fieldtype": "Section Break",
- "label": "Fixed Asset Depreciation Settings"
- },
- {
- "fieldname": "accumulated_depreciation_account",
- "fieldtype": "Link",
- "label": "Accumulated Depreciation Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "fieldname": "depreciation_expense_account",
- "fieldtype": "Link",
- "label": "Depreciation Expense Account",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "fieldname": "series_for_depreciation_entry",
- "fieldtype": "Data",
- "label": "Series for Asset Depreciation Entry (Journal Entry)"
- },
- {
- "fieldname": "expenses_included_in_asset_valuation",
- "fieldtype": "Link",
- "label": "Expenses Included In Asset Valuation",
- "options": "Account"
- },
- {
- "fieldname": "column_break_40",
- "fieldtype": "Column Break"
- },
- {
- "fieldname": "disposal_account",
- "fieldtype": "Link",
- "label": "Gain/Loss Account on Asset Disposal",
- "no_copy": 1,
- "options": "Account"
- },
- {
- "fieldname": "depreciation_cost_center",
- "fieldtype": "Link",
- "label": "Asset Depreciation Cost Center",
- "no_copy": 1,
- "options": "Cost Center"
- },
- {
- "fieldname": "capital_work_in_progress_account",
- "fieldtype": "Link",
- "label": "Capital Work In Progress Account",
- "options": "Account"
- },
- {
- "fieldname": "asset_received_but_not_billed",
- "fieldtype": "Link",
- "label": "Asset Received But Not Billed",
- "options": "Account"
- },
- {
- "collapsible": 1,
- "fieldname": "budget_detail",
- "fieldtype": "Section Break",
- "label": "Budget Detail"
- },
- {
- "fieldname": "exception_budget_approver_role",
- "fieldtype": "Link",
- "label": "Exception Budget Approver Role",
- "options": "Role"
- },
- {
- "collapsible": 1,
- "description": "For reference only.",
- "fieldname": "company_info",
- "fieldtype": "Section Break",
- "label": "Company Info"
- },
- {
- "fieldname": "date_of_incorporation",
- "fieldtype": "Date",
- "label": "Date of Incorporation"
- },
- {
- "fieldname": "address_html",
- "fieldtype": "HTML"
- },
- {
- "fieldname": "column_break1",
- "fieldtype": "Column Break",
- "oldfieldtype": "Column Break",
- "width": "50%"
- },
- {
- "depends_on": "eval:doc.date_of_incorporation",
- "fieldname": "date_of_commencement",
- "fieldtype": "Date",
- "label": "Date of Commencement"
- },
- {
- "fieldname": "phone_no",
- "fieldtype": "Data",
- "label": "Phone No",
- "oldfieldname": "phone_no",
- "oldfieldtype": "Data",
- "options": "Phone"
- },
- {
- "fieldname": "fax",
- "fieldtype": "Data",
- "label": "Fax",
- "oldfieldname": "fax",
- "oldfieldtype": "Data",
- "options": "Phone"
- },
- {
- "fieldname": "email",
- "fieldtype": "Data",
- "label": "Email",
- "oldfieldname": "email",
- "oldfieldtype": "Data",
- "options": "Email"
- },
- {
- "fieldname": "website",
- "fieldtype": "Data",
- "label": "Website",
- "oldfieldname": "website",
- "oldfieldtype": "Data"
- },
- {
- "fieldname": "registration_info",
- "fieldtype": "Section Break",
- "oldfieldtype": "Section Break",
- "width": "50%"
- },
- {
- "description": "Company registration numbers for your reference. Tax numbers etc.",
- "fieldname": "registration_details",
- "fieldtype": "Code",
- "label": "Registration Details",
- "oldfieldname": "registration_details",
- "oldfieldtype": "Code"
- },
- {
- "fieldname": "delete_company_transactions",
- "fieldtype": "Button",
- "label": "Delete Company Transactions"
- },
- {
- "fieldname": "lft",
- "fieldtype": "Int",
- "hidden": 1,
- "label": "Lft",
- "print_hide": 1,
- "read_only": 1,
- "search_index": 1
- },
- {
- "fieldname": "rgt",
- "fieldtype": "Int",
- "hidden": 1,
- "label": "Rgt",
- "print_hide": 1,
- "read_only": 1,
- "search_index": 1
- },
- {
- "fieldname": "old_parent",
- "fieldtype": "Data",
- "hidden": 1,
- "label": "old_parent",
- "print_hide": 1,
- "read_only": 1
- }
- ],
- "icon": "fa fa-building",
- "idx": 1,
- "image_field": "company_logo",
- "modified": "2019-06-14 14:36:11.363309",
- "modified_by": "Administrator",
- "module": "Setup",
- "name": "Company",
- "owner": "Administrator",
- "permissions": [
- {
- "create": 1,
- "delete": 1,
- "email": 1,
- "print": 1,
- "read": 1,
- "report": 1,
- "role": "System Manager",
- "share": 1,
- "write": 1
- },
- {
- "email": 1,
- "print": 1,
- "read": 1,
- "role": "Accounts User"
- },
- {
- "read": 1,
- "role": "Employee"
- },
- {
- "read": 1,
- "role": "Sales User"
- },
- {
- "read": 1,
- "role": "Purchase User"
- },
- {
- "read": 1,
- "role": "Stock User"
- },
- {
- "read": 1,
- "role": "Projects User"
- }
- ],
- "show_name_in_global_search": 1,
- "sort_field": "modified",
- "sort_order": "ASC",
- "track_changes": 1
- }
\ No newline at end of file
+ "allow_import": 1,
+ "allow_rename": 1,
+ "autoname": "field:company_name",
+ "creation": "2013-04-10 08:35:39",
+ "description": "Legal Entity / Subsidiary with a separate Chart of Accounts belonging to the Organization.",
+ "doctype": "DocType",
+ "document_type": "Setup",
+ "engine": "InnoDB",
+ "field_order": [
+ "details",
+ "company_name",
+ "abbr",
+ "change_abbr",
+ "is_group",
+ "cb0",
+ "domain",
+ "parent_company",
+ "charts_section",
+ "default_currency",
+ "default_letter_head",
+ "default_holiday_list",
+ "default_finance_book",
+ "standard_working_hours",
+ "default_selling_terms",
+ "default_buying_terms",
+ "default_warehouse_for_sales_return",
+ "column_break_10",
+ "country",
+ "create_chart_of_accounts_based_on",
+ "chart_of_accounts",
+ "existing_company",
+ "tax_id",
+ "date_of_establishment",
+ "sales_settings",
+ "monthly_sales_target",
+ "sales_monthly_history",
+ "column_break_goals",
+ "transactions_annual_history",
+ "total_monthly_sales",
+ "default_settings",
+ "default_bank_account",
+ "default_cash_account",
+ "default_receivable_account",
+ "round_off_account",
+ "round_off_cost_center",
+ "write_off_account",
+ "discount_allowed_account",
+ "discount_received_account",
+ "exchange_gain_loss_account",
+ "unrealized_exchange_gain_loss_account",
+ "column_break0",
+ "allow_account_creation_against_child_company",
+ "default_payable_account",
+ "default_employee_advance_account",
+ "default_expense_account",
+ "default_income_account",
+ "default_deferred_revenue_account",
+ "default_deferred_expense_account",
+ "default_payroll_payable_account",
+ "default_expense_claim_payable_account",
+ "section_break_22",
+ "cost_center",
+ "column_break_26",
+ "credit_limit",
+ "payment_terms",
+ "auto_accounting_for_stock_settings",
+ "enable_perpetual_inventory",
+ "default_inventory_account",
+ "stock_adjustment_account",
+ "column_break_32",
+ "stock_received_but_not_billed",
+ "expenses_included_in_valuation",
+ "fixed_asset_depreciation_settings",
+ "accumulated_depreciation_account",
+ "depreciation_expense_account",
+ "series_for_depreciation_entry",
+ "expenses_included_in_asset_valuation",
+ "column_break_40",
+ "disposal_account",
+ "depreciation_cost_center",
+ "capital_work_in_progress_account",
+ "asset_received_but_not_billed",
+ "budget_detail",
+ "exception_budget_approver_role",
+ "company_info",
+ "company_logo",
+ "date_of_incorporation",
+ "address_html",
+ "date_of_commencement",
+ "phone_no",
+ "fax",
+ "email",
+ "website",
+ "column_break1",
+ "company_description",
+ "registration_info",
+ "registration_details",
+ "delete_company_transactions",
+ "lft",
+ "rgt",
+ "old_parent"
+ ],
+ "fields": [
+ {
+ "fieldname": "details",
+ "fieldtype": "Section Break",
+ "oldfieldtype": "Section Break"
+ },
+ {
+ "fieldname": "company_name",
+ "fieldtype": "Data",
+ "label": "Company",
+ "oldfieldname": "company_name",
+ "oldfieldtype": "Data",
+ "reqd": 1,
+ "unique": 1
+ },
+ {
+ "fieldname": "abbr",
+ "fieldtype": "Data",
+ "label": "Abbr",
+ "oldfieldname": "abbr",
+ "oldfieldtype": "Data",
+ "reqd": 1
+ },
+ {
+ "depends_on": "eval:!doc.__islocal && in_list(frappe.user_roles, \"System Manager\")",
+ "fieldname": "change_abbr",
+ "fieldtype": "Button",
+ "label": "Change Abbreviation"
+ },
+ {
+ "bold": 1,
+ "default": "0",
+ "fieldname": "is_group",
+ "fieldtype": "Check",
+ "label": "Is Group"
+ },
+ {
+ "fieldname": "default_finance_book",
+ "fieldtype": "Link",
+ "label": "Default Finance Book",
+ "options": "Finance Book"
+ },
+ {
+ "fieldname": "cb0",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "domain",
+ "fieldtype": "Link",
+ "label": "Domain",
+ "options": "Domain"
+ },
+ {
+ "fieldname": "parent_company",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Parent Company",
+ "options": "Company"
+ },
+ {
+ "fieldname": "company_logo",
+ "fieldtype": "Attach Image",
+ "hidden": 1,
+ "label": "Company Logo"
+ },
+ {
+ "fieldname": "company_description",
+ "fieldtype": "Text Editor",
+ "label": "Company Description"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "sales_settings",
+ "fieldtype": "Section Break",
+ "label": "Sales Settings"
+ },
+ {
+ "fieldname": "sales_monthly_history",
+ "fieldtype": "Small Text",
+ "hidden": 1,
+ "label": "Sales Monthly History",
+ "no_copy": 1,
+ "read_only": 1
+ },
+ {
+ "fieldname": "transactions_annual_history",
+ "fieldtype": "Code",
+ "hidden": 1,
+ "label": "Transactions Annual History",
+ "no_copy": 1,
+ "read_only": 1
+ },
+ {
+ "fieldname": "monthly_sales_target",
+ "fieldtype": "Currency",
+ "label": "Monthly Sales Target",
+ "options": "default_currency"
+ },
+ {
+ "fieldname": "column_break_goals",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "total_monthly_sales",
+ "fieldtype": "Currency",
+ "label": "Total Monthly Sales",
+ "no_copy": 1,
+ "options": "default_currency",
+ "read_only": 1
+ },
+ {
+ "fieldname": "charts_section",
+ "fieldtype": "Section Break",
+ "label": "Default Values"
+ },
+ {
+ "fieldname": "default_currency",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Currency",
+ "options": "Currency",
+ "reqd": 1
+ },
+ {
+ "fieldname": "default_letter_head",
+ "fieldtype": "Link",
+ "label": "Default Letter Head",
+ "options": "Letter Head"
+ },
+ {
+ "fieldname": "default_holiday_list",
+ "fieldtype": "Link",
+ "label": "Default Holiday List",
+ "options": "Holiday List"
+ },
+ {
+ "fieldname": "standard_working_hours",
+ "fieldtype": "Float",
+ "label": "Standard Working Hours"
+ },
+ {
+ "fieldname": "default_warehouse_for_sales_return",
+ "fieldtype": "Link",
+ "label": "Default warehouse for Sales Return",
+ "options": "Warehouse"
+ },
+ {
+ "fieldname": "column_break_10",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "country",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Country",
+ "options": "Country",
+ "reqd": 1
+ },
+ {
+ "fieldname": "create_chart_of_accounts_based_on",
+ "fieldtype": "Select",
+ "label": "Create Chart Of Accounts Based On",
+ "options": "\nStandard Template\nExisting Company"
+ },
+ {
+ "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Standard Template\"",
+ "fieldname": "chart_of_accounts",
+ "fieldtype": "Select",
+ "label": "Chart Of Accounts Template",
+ "no_copy": 1
+ },
+ {
+ "depends_on": "eval:doc.create_chart_of_accounts_based_on===\"Existing Company\"",
+ "fieldname": "existing_company",
+ "fieldtype": "Link",
+ "label": "Existing Company ",
+ "no_copy": 1,
+ "options": "Company"
+ },
+ {
+ "fieldname": "tax_id",
+ "fieldtype": "Data",
+ "label": "Tax ID"
+ },
+ {
+ "fieldname": "date_of_establishment",
+ "fieldtype": "Date",
+ "label": "Date of Establishment"
+ },
+ {
+ "fieldname": "default_settings",
+ "fieldtype": "Section Break",
+ "label": "Accounts Settings",
+ "oldfieldtype": "Section Break"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_bank_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Bank Account",
+ "no_copy": 1,
+ "oldfieldname": "default_bank_account",
+ "oldfieldtype": "Link",
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_cash_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Cash Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_receivable_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Receivable Account",
+ "no_copy": 1,
+ "oldfieldname": "receivables_group",
+ "oldfieldtype": "Link",
+ "options": "Account"
+ },
+ {
+ "fieldname": "round_off_account",
+ "fieldtype": "Link",
+ "label": "Round Off Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "round_off_cost_center",
+ "fieldtype": "Link",
+ "label": "Round Off Cost Center",
+ "options": "Cost Center"
+ },
+ {
+ "fieldname": "write_off_account",
+ "fieldtype": "Link",
+ "label": "Write Off Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "discount_allowed_account",
+ "fieldtype": "Link",
+ "label": "Discount Allowed Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "discount_received_account",
+ "fieldtype": "Link",
+ "label": "Discount Received Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "exchange_gain_loss_account",
+ "fieldtype": "Link",
+ "label": "Exchange Gain / Loss Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "unrealized_exchange_gain_loss_account",
+ "fieldtype": "Link",
+ "label": "Unrealized Exchange Gain/Loss Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "column_break0",
+ "fieldtype": "Column Break",
+ "oldfieldtype": "Column Break",
+ "width": "50%"
+ },
+ {
+ "default": "0",
+ "depends_on": "eval:doc.parent_company",
+ "fieldname": "allow_account_creation_against_child_company",
+ "fieldtype": "Check",
+ "label": "Allow Account Creation Against Child Company"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_payable_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Payable Account",
+ "no_copy": 1,
+ "oldfieldname": "payables_group",
+ "oldfieldtype": "Link",
+ "options": "Account"
+ },
+ {
+ "fieldname": "default_employee_advance_account",
+ "fieldtype": "Link",
+ "label": "Default Employee Advance Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_expense_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Cost of Goods Sold Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_income_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Income Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_deferred_revenue_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Deferred Revenue Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_deferred_expense_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Deferred Expense Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_payroll_payable_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Payroll Payable Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "default_expense_claim_payable_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Expense Claim Payable Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "fieldname": "section_break_22",
+ "fieldtype": "Section Break"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "cost_center",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Default Cost Center",
+ "no_copy": 1,
+ "options": "Cost Center"
+ },
+ {
+ "fieldname": "column_break_26",
+ "fieldtype": "Column Break"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "credit_limit",
+ "fieldtype": "Currency",
+ "label": "Credit Limit",
+ "oldfieldname": "credit_limit",
+ "oldfieldtype": "Currency",
+ "options": "default_currency"
+ },
+ {
+ "fieldname": "payment_terms",
+ "fieldtype": "Link",
+ "label": "Default Payment Terms Template",
+ "options": "Payment Terms Template"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "fieldname": "auto_accounting_for_stock_settings",
+ "fieldtype": "Section Break",
+ "label": "Stock Settings"
+ },
+ {
+ "default": "1",
+ "fieldname": "enable_perpetual_inventory",
+ "fieldtype": "Check",
+ "label": "Enable Perpetual Inventory"
+ },
+ {
+ "fieldname": "default_inventory_account",
+ "fieldtype": "Link",
+ "label": "Default Inventory Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "stock_adjustment_account",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Stock Adjustment Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "fieldname": "column_break_32",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "stock_received_but_not_billed",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Stock Received But Not Billed",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "fieldname": "expenses_included_in_valuation",
+ "fieldtype": "Link",
+ "ignore_user_permissions": 1,
+ "label": "Expenses Included In Valuation",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "fixed_asset_depreciation_settings",
+ "fieldtype": "Section Break",
+ "label": "Fixed Asset Depreciation Settings"
+ },
+ {
+ "fieldname": "accumulated_depreciation_account",
+ "fieldtype": "Link",
+ "label": "Accumulated Depreciation Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "fieldname": "depreciation_expense_account",
+ "fieldtype": "Link",
+ "label": "Depreciation Expense Account",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "fieldname": "series_for_depreciation_entry",
+ "fieldtype": "Data",
+ "label": "Series for Asset Depreciation Entry (Journal Entry)"
+ },
+ {
+ "fieldname": "expenses_included_in_asset_valuation",
+ "fieldtype": "Link",
+ "label": "Expenses Included In Asset Valuation",
+ "options": "Account"
+ },
+ {
+ "fieldname": "column_break_40",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "disposal_account",
+ "fieldtype": "Link",
+ "label": "Gain/Loss Account on Asset Disposal",
+ "no_copy": 1,
+ "options": "Account"
+ },
+ {
+ "fieldname": "depreciation_cost_center",
+ "fieldtype": "Link",
+ "label": "Asset Depreciation Cost Center",
+ "no_copy": 1,
+ "options": "Cost Center"
+ },
+ {
+ "fieldname": "capital_work_in_progress_account",
+ "fieldtype": "Link",
+ "label": "Capital Work In Progress Account",
+ "options": "Account"
+ },
+ {
+ "fieldname": "asset_received_but_not_billed",
+ "fieldtype": "Link",
+ "label": "Asset Received But Not Billed",
+ "options": "Account"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "budget_detail",
+ "fieldtype": "Section Break",
+ "label": "Budget Detail"
+ },
+ {
+ "fieldname": "exception_budget_approver_role",
+ "fieldtype": "Link",
+ "label": "Exception Budget Approver Role",
+ "options": "Role"
+ },
+ {
+ "collapsible": 1,
+ "description": "For reference only.",
+ "fieldname": "company_info",
+ "fieldtype": "Section Break",
+ "label": "Company Info"
+ },
+ {
+ "fieldname": "date_of_incorporation",
+ "fieldtype": "Date",
+ "label": "Date of Incorporation"
+ },
+ {
+ "fieldname": "address_html",
+ "fieldtype": "HTML"
+ },
+ {
+ "fieldname": "column_break1",
+ "fieldtype": "Column Break",
+ "oldfieldtype": "Column Break",
+ "width": "50%"
+ },
+ {
+ "depends_on": "eval:doc.date_of_incorporation",
+ "fieldname": "date_of_commencement",
+ "fieldtype": "Date",
+ "label": "Date of Commencement"
+ },
+ {
+ "fieldname": "phone_no",
+ "fieldtype": "Data",
+ "label": "Phone No",
+ "oldfieldname": "phone_no",
+ "oldfieldtype": "Data",
+ "options": "Phone"
+ },
+ {
+ "fieldname": "fax",
+ "fieldtype": "Data",
+ "label": "Fax",
+ "oldfieldname": "fax",
+ "oldfieldtype": "Data",
+ "options": "Phone"
+ },
+ {
+ "fieldname": "email",
+ "fieldtype": "Data",
+ "label": "Email",
+ "oldfieldname": "email",
+ "oldfieldtype": "Data",
+ "options": "Email"
+ },
+ {
+ "fieldname": "website",
+ "fieldtype": "Data",
+ "label": "Website",
+ "oldfieldname": "website",
+ "oldfieldtype": "Data"
+ },
+ {
+ "fieldname": "registration_info",
+ "fieldtype": "Section Break",
+ "oldfieldtype": "Section Break",
+ "width": "50%"
+ },
+ {
+ "description": "Company registration numbers for your reference. Tax numbers etc.",
+ "fieldname": "registration_details",
+ "fieldtype": "Code",
+ "label": "Registration Details",
+ "oldfieldname": "registration_details",
+ "oldfieldtype": "Code"
+ },
+ {
+ "fieldname": "delete_company_transactions",
+ "fieldtype": "Button",
+ "label": "Delete Company Transactions"
+ },
+ {
+ "fieldname": "lft",
+ "fieldtype": "Int",
+ "hidden": 1,
+ "label": "Lft",
+ "print_hide": 1,
+ "read_only": 1,
+ "search_index": 1
+ },
+ {
+ "fieldname": "rgt",
+ "fieldtype": "Int",
+ "hidden": 1,
+ "label": "Rgt",
+ "print_hide": 1,
+ "read_only": 1,
+ "search_index": 1
+ },
+ {
+ "fieldname": "old_parent",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "label": "old_parent",
+ "print_hide": 1,
+ "read_only": 1
+ },
+ {
+ "fieldname": "default_selling_terms",
+ "fieldtype": "Link",
+ "label": "Default Selling Terms",
+ "options": "Terms and Conditions"
+ },
+ {
+ "fieldname": "default_buying_terms",
+ "fieldtype": "Link",
+ "label": "Default Buying Terms",
+ "options": "Terms and Conditions"
+ }
+ ],
+ "icon": "fa fa-building",
+ "idx": 1,
+ "image_field": "company_logo",
+ "modified": "2019-07-04 22:20:45.104307",
+ "modified_by": "Administrator",
+ "module": "Setup",
+ "name": "Company",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "System Manager",
+ "share": 1,
+ "write": 1
+ },
+ {
+ "email": 1,
+ "print": 1,
+ "read": 1,
+ "role": "Accounts User"
+ },
+ {
+ "read": 1,
+ "role": "Employee"
+ },
+ {
+ "read": 1,
+ "role": "Sales User"
+ },
+ {
+ "read": 1,
+ "role": "Purchase User"
+ },
+ {
+ "read": 1,
+ "role": "Stock User"
+ },
+ {
+ "read": 1,
+ "role": "Projects User"
+ }
+ ],
+ "show_name_in_global_search": 1,
+ "sort_field": "modified",
+ "sort_order": "ASC",
+ "track_changes": 1
+}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json
index c1d459f..aba6a79 100644
--- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json
+++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json
@@ -1,288 +1,142 @@
{
- "allow_copy": 0,
- "allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:title",
- "beta": 0,
"creation": "2013-01-10 16:34:24",
- "custom": 0,
"description": "Standard Terms and Conditions that can be added to Sales and Purchases.\n\nExamples:\n\n1. Validity of the offer.\n1. Payment Terms (In Advance, On Credit, part advance etc).\n1. What is extra (or payable by the Customer).\n1. Safety / usage warning.\n1. Warranty if any.\n1. Returns Policy.\n1. Terms of shipping, if applicable.\n1. Ways of addressing disputes, indemnity, liability, etc.\n1. Address and Contact of your Company.",
- "docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
- "editable_grid": 0,
+ "engine": "InnoDB",
+ "field_order": [
+ "title",
+ "disabled",
+ "applicable_modules_section",
+ "selling",
+ "buying",
+ "hr",
+ "section_break_7",
+ "terms",
+ "terms_and_conditions_help"
+ ],
"fields": [
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
"fieldname": "title",
"fieldtype": "Data",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
"label": "Title",
- "length": 0,
"no_copy": 1,
"oldfieldname": "title",
"oldfieldtype": "Data",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
"reqd": 1,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
"unique": 1
},
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
+ "default": "0",
"fieldname": "disabled",
"fieldtype": "Check",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
"in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Disabled",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
+ "label": "Disabled"
},
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
+ "allow_in_quick_entry": 1,
"fieldname": "terms",
"fieldtype": "Text Editor",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
"in_global_search": 1,
- "in_list_view": 0,
- "in_standard_filter": 0,
"label": "Terms and Conditions",
- "length": 0,
- "no_copy": 0,
"oldfieldname": "terms",
- "oldfieldtype": "Text Editor",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
+ "oldfieldtype": "Text Editor"
},
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
"fieldname": "terms_and_conditions_help",
"fieldtype": "HTML",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
"label": "Terms and Conditions Help",
- "length": 0,
- "no_copy": 0,
- "options": "<h4>Standard Terms and Conditions Example</h4>\n\n<pre>Delivery Terms for Order number {{ name }}\n\n-Order Date : {{ transaction_date }} \n-Expected Delivery Date : {{ delivery_date }}\n</pre>\n\n<h4>How to get fieldnames</h4>\n\n<p>The fieldnames you can use in your email template are the fields in the document from which you are sending the email. You can find out the fields of any documents via Setup > Customize Form View and selecting the document type (e.g. Sales Invoice)</p>\n\n<h4>Templating</h4>\n\n<p>Templates are compiled using the Jinja Templating Langauge. To learn more about Jinja, <a class=\"strong\" href=\"http://jinja.pocoo.org/docs/dev/templates/\">read this documentation.</a></p>",
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
+ "options": "<h4>Standard Terms and Conditions Example</h4>\n\n<pre>Delivery Terms for Order number {{ name }}\n\n-Order Date : {{ transaction_date }} \n-Expected Delivery Date : {{ delivery_date }}\n</pre>\n\n<h4>How to get fieldnames</h4>\n\n<p>The fieldnames you can use in your email template are the fields in the document from which you are sending the email. You can find out the fields of any documents via Setup > Customize Form View and selecting the document type (e.g. Sales Invoice)</p>\n\n<h4>Templating</h4>\n\n<p>Templates are compiled using the Jinja Templating Langauge. To learn more about Jinja, <a class=\"strong\" href=\"http://jinja.pocoo.org/docs/dev/templates/\">read this documentation.</a></p>"
+ },
+ {
+ "fieldname": "applicable_modules_section",
+ "fieldtype": "Section Break",
+ "label": "Applicable Modules"
+ },
+ {
+ "default": "1",
+ "fieldname": "selling",
+ "fieldtype": "Check",
+ "label": "Selling"
+ },
+ {
+ "default": "1",
+ "fieldname": "buying",
+ "fieldtype": "Check",
+ "label": "Buying"
+ },
+ {
+ "default": "1",
+ "fieldname": "hr",
+ "fieldtype": "Check",
+ "label": "HR"
+ },
+ {
+ "fieldname": "section_break_7",
+ "fieldtype": "Section Break"
}
],
- "has_web_view": 0,
- "hide_heading": 0,
- "hide_toolbar": 0,
"icon": "icon-legal",
"idx": 1,
- "image_view": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 0,
- "max_attachments": 0,
- "modified": "2018-08-29 06:36:33.131473",
+ "modified": "2019-07-04 13:31:30.393425",
"modified_by": "Administrator",
"module": "Setup",
"name": "Terms and Conditions",
"owner": "Administrator",
"permissions": [
{
- "amend": 0,
- "cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
- "if_owner": 0,
"import": 1,
- "permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Master Manager",
- "set_user_permissions": 0,
"share": 1,
- "submit": 0,
"write": 1
},
{
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "delete": 0,
- "email": 0,
- "export": 0,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
- "print": 0,
"read": 1,
- "report": 0,
- "role": "Sales User",
- "set_user_permissions": 0,
- "share": 0,
- "submit": 0,
- "write": 0
+ "role": "Sales User"
},
{
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "delete": 0,
- "email": 0,
- "export": 0,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
- "print": 0,
"read": 1,
- "report": 0,
- "role": "Purchase User",
- "set_user_permissions": 0,
- "share": 0,
- "submit": 0,
- "write": 0
+ "role": "Purchase User"
},
{
- "amend": 0,
- "cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
- "export": 0,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
- "set_user_permissions": 0,
"share": 1,
- "submit": 0,
"write": 1
},
{
- "amend": 0,
- "cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
- "export": 0,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
- "set_user_permissions": 0,
"share": 1,
- "submit": 0,
"write": 1
},
{
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "delete": 0,
- "email": 0,
- "export": 0,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
- "print": 0,
"read": 1,
- "report": 0,
- "role": "Stock User",
- "set_user_permissions": 0,
- "share": 0,
- "submit": 0,
- "write": 0
+ "role": "Stock User"
}
],
"quick_entry": 1,
- "read_only": 0,
- "read_only_onload": 0,
"show_name_in_global_search": 1,
- "sort_order": "ASC",
- "track_changes": 0,
- "track_seen": 0,
- "track_views": 0
+ "sort_field": "modified",
+ "sort_order": "ASC"
}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
index a2152a6..372cc6d 100644
--- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
+++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
@@ -3,9 +3,11 @@
from __future__ import unicode_literals
import frappe
+from frappe import _, throw
import json
from frappe.model.document import Document
from frappe.utils.jinja import validate_template
+from frappe.utils import cint
from six import string_types
@@ -13,6 +15,8 @@
def validate(self):
if self.terms:
validate_template(self.terms)
+ if not cint(self.buying) and not cint(self.selling) and not cint(self.hr) and not cint(self.disabled):
+ throw(_("At least one of the Applicable Modules should be selected"))
@frappe.whitelist()
def get_terms_and_conditions(template_name, doc):
diff --git a/erpnext/startup/boot.py b/erpnext/startup/boot.py
index a5bd93f..4ca43a8 100644
--- a/erpnext/startup/boot.py
+++ b/erpnext/startup/boot.py
@@ -33,7 +33,7 @@
FROM `tabCompany`
LIMIT 1""") and 'Yes' or 'No'
- bootinfo.docs += frappe.db.sql("""select name, default_currency, cost_center, default_terms,
+ bootinfo.docs += frappe.db.sql("""select name, default_currency, cost_center, default_selling_terms, default_buying_terms,
default_letter_head, default_bank_account, enable_perpetual_inventory, country from `tabCompany`""",
as_dict=1, update={"doctype":":Company"})
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index 3936bf7..164ffa4 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -76,7 +76,6 @@
"is_customer_provided_item",
"customer",
"supplier_details",
- "manufacturers",
"delivered_by_supplier",
"column_break2",
"supplier_items",
@@ -1022,12 +1021,6 @@
"fieldtype": "Check",
"label": "Synced With Hub",
"read_only": 1
- },
- {
- "fieldname": "manufacturers",
- "fieldtype": "Table",
- "label": "Manufacturers",
- "options": "Item Manufacturer"
}
],
"has_web_view": 1,
@@ -1035,7 +1028,7 @@
"idx": 2,
"image_field": "image",
"max_attachments": 1,
- "modified": "2019-06-02 04:45:59.911507",
+ "modified": "2019-07-05 12:18:13.977931",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",
@@ -1097,4 +1090,4 @@
"sort_order": "DESC",
"title_field": "item_name",
"track_changes": 1
- }
\ No newline at end of file
+ }
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 80d4e17..6484b93 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -122,6 +122,7 @@
self.validate_item_defaults()
self.validate_customer_provided_part()
self.update_defaults_from_item_group()
+ self.validate_auto_reorder_enabled_in_stock_settings()
self.cant_change()
if not self.get("__islocal"):
@@ -859,6 +860,12 @@
filters={"production_item": self.name, "docstatus": 1}):
return True
+ def validate_auto_reorder_enabled_in_stock_settings(self):
+ if self.reorder_levels:
+ enabled = frappe.db.get_single_value('Stock Settings', 'auto_indent')
+ if not enabled:
+ frappe.msgprint(msg=_("You have to enable auto re-order in Stock Settings to maintain re-order levels."), title=_("Enable Auto Re-Order"), indicator="orange")
+
def get_timeline_data(doctype, name):
'''returns timeline data based on stock ledger entry'''
out = {}
diff --git a/erpnext/stock/doctype/item/item_dashboard.py b/erpnext/stock/doctype/item/item_dashboard.py
index b3733d3..dd4676a 100644
--- a/erpnext/stock/doctype/item/item_dashboard.py
+++ b/erpnext/stock/doctype/item/item_dashboard.py
@@ -41,7 +41,7 @@
},
{
'label': _('Manufacture'),
- 'items': ['Work Order', 'Item Manufacturer']
+ 'items': ['Production Plan', 'Work Order', 'Item Manufacturer']
}
]
- }
\ No newline at end of file
+ }
diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py
index ef5f24e..2b079e7 100644
--- a/erpnext/stock/doctype/material_request/material_request.py
+++ b/erpnext/stock/doctype/material_request/material_request.py
@@ -370,19 +370,20 @@
def get_material_requests_based_on_supplier(supplier):
supplier_items = [d.parent for d in frappe.db.get_all("Item Default",
{"default_supplier": supplier}, 'parent')]
- if supplier_items:
- material_requests = frappe.db.sql_list("""select distinct mr.name
- from `tabMaterial Request` mr, `tabMaterial Request Item` mr_item
- where mr.name = mr_item.parent
- and mr_item.item_code in (%s)
- and mr.material_request_type = 'Purchase'
- and mr.per_ordered < 99.99
- and mr.docstatus = 1
- and mr.status != 'Stopped'
- order by mr_item.item_code ASC""" % ', '.join(['%s']*len(supplier_items)),
- tuple(supplier_items))
- else:
- material_requests = []
+ if not supplier_items:
+ frappe.throw(_("{0} is not the default supplier for any items.".format(supplier)))
+
+ material_requests = frappe.db.sql_list("""select distinct mr.name
+ from `tabMaterial Request` mr, `tabMaterial Request Item` mr_item
+ where mr.name = mr_item.parent
+ and mr_item.item_code in (%s)
+ and mr.material_request_type = 'Purchase'
+ and mr.per_ordered < 99.99
+ and mr.docstatus = 1
+ and mr.status != 'Stopped'
+ order by mr_item.item_code ASC""" % ', '.join(['%s']*len(supplier_items)),
+ tuple(supplier_items))
+
return material_requests, supplier_items
@frappe.whitelist()
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 464101e..0abcbb3 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -324,8 +324,10 @@
completed_qty = d.completed_qty + (allowance_percentage/100 * d.completed_qty)
if total_completed_qty > flt(completed_qty):
job_card = frappe.db.get_value('Job Card', {'operation_id': d.name}, 'name')
- frappe.throw(_("Row #{0}: Operation {1} is not completed for {2} qty of finished goods in Work Order # {3}. Please update operation status via Job Card # {4}")
- .format(d.idx, d.operation, total_completed_qty, self.work_order, job_card), OperationsNotCompleteError)
+ work_order_link = frappe.utils.get_link_to_form('Work Order', self.work_order)
+ job_card_link = frappe.utils.get_link_to_form('Job Card', job_card)
+ frappe.throw(_("Row #{0}: Operation {1} is not completed for {2} qty of finished goods in Work Order {3}. Please update operation status via Job Card {4}.")
+ .format(d.idx, frappe.bold(d.operation), frappe.bold(total_completed_qty), work_order_link, job_card_link), OperationsNotCompleteError)
def check_duplicate_entry_for_work_order(self):
other_ste = [t[0] for t in frappe.db.get_values("Stock Entry", {