[Enhance] Companywise perpetual inventory setting

This commit is contained in:
Rohit Waghchaure
2017-06-16 15:21:36 +05:30
parent 80ef298519
commit a5f40941ae
32 changed files with 2160 additions and 1980 deletions

View File

@@ -156,7 +156,7 @@ erpnext.company.setup_queries = function(frm) {
erpnext.company.set_custom_query(frm, v);
});
if (frappe.sys_defaults.auto_accounting_for_stock) {
if (frm.doc.enable_perpetual_inventory) {
$.each([
["stock_adjustment_account",
{"root_type": "Expense", "account_type": "Stock Adjustment"}],

View File

@@ -1122,6 +1122,37 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "1",
"fieldname": "enable_perpetual_inventory",
"fieldtype": "Check",
"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": "Enable Perpetual Inventory",
"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_bulk_edit": 0,
"allow_on_submit": 0,
@@ -1243,6 +1274,7 @@
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@@ -1777,7 +1809,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2017-06-14 11:06:33.629948",
"modified": "2017-06-15 19:46:10.875108",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",

View File

@@ -146,7 +146,7 @@ class Company(Document):
self._set_default_account("accumulated_depreciation_account", "Accumulated Depreciation")
self._set_default_account("depreciation_expense_account", "Depreciation")
if cint(frappe.db.get_single_value("Accounts Settings", "auto_accounting_for_stock")):
if self.enable_perpetual_inventory:
self._set_default_account("stock_received_but_not_billed", "Stock Received But Not Billed")
self._set_default_account("default_inventory_account", "Stock")
self._set_default_account("stock_adjustment_account", "Stock Adjustment")

View File

@@ -85,6 +85,7 @@ def create_fiscal_year_and_company(args):
frappe.get_doc({
"doctype":"Company",
'company_name':args.get('company_name').strip(),
'enable_perpetual_inventory': 1,
'abbr':args.get('company_abbr'),
'default_currency':args.get('currency'),
'country': args.get('country'),
@@ -159,10 +160,6 @@ def set_defaults(args):
frappe.db.set_value("System Settings", None, "email_footer_address", args.get("company"))
accounts_settings = frappe.get_doc("Accounts Settings")
accounts_settings.auto_accounting_for_stock = 1
accounts_settings.save()
stock_settings = frappe.get_doc("Stock Settings")
stock_settings.item_naming_by = "Item Code"
stock_settings.valuation_method = "FIFO"