mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-14 01:20:41 +00:00
Warehouse Account Linking (#9292)
* [enhance] Added account in the warehouse * documentation * patch to move account head from account to warehouse * fixed test cases * Fixes in warehouse-account linking * minor fix in test case
This commit is contained in:
@@ -15,7 +15,7 @@ frappe.ui.form.on("Company", {
|
||||
|
||||
frm.toggle_display('address_html', !frm.doc.__islocal);
|
||||
if(!frm.doc.__islocal) {
|
||||
frappe.geo.render_address_and_contact(frm);
|
||||
frappe.contacts.render_address_and_contact(frm);
|
||||
|
||||
frm.toggle_enable("default_currency", (frm.doc.__onload &&
|
||||
!frm.doc.__onload.transactions_exist));
|
||||
@@ -148,6 +148,7 @@ erpnext.company.setup_queries = function(frm) {
|
||||
{"root_type": "Asset", "account_type": "Accumulated Depreciation"}],
|
||||
["depreciation_expense_account", {"root_type": "Expense", "account_type": "Depreciation"}],
|
||||
["disposal_account", {"report_type": "Profit and Loss"}],
|
||||
["default_inventory_account", {"account_type": "Stock"}],
|
||||
["cost_center", {}],
|
||||
["round_off_cost_center", {}],
|
||||
["depreciation_cost_center", {}]
|
||||
|
||||
@@ -1128,20 +1128,21 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "stock_received_but_not_billed",
|
||||
"fieldname": "default_inventory_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Stock Received But Not Billed",
|
||||
"label": "Default Inventory Account",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
@@ -1213,6 +1214,35 @@
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "stock_received_but_not_billed",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Stock Received But Not Billed",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "Account",
|
||||
"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,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
@@ -1747,7 +1777,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2017-05-09 11:06:33.629948",
|
||||
"modified": "2017-06-14 11:06:33.629948",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Company",
|
||||
|
||||
@@ -50,9 +50,11 @@ class Company(Document):
|
||||
frappe.throw(_("Abbreviation already used for another company"))
|
||||
|
||||
def validate_default_accounts(self):
|
||||
for field in ["default_bank_account", "default_cash_account", "default_receivable_account", "default_payable_account",
|
||||
"default_expense_account", "default_income_account", "stock_received_but_not_billed",
|
||||
"stock_adjustment_account", "expenses_included_in_valuation", "default_payroll_payable_account"]:
|
||||
for field in ["default_bank_account", "default_cash_account",
|
||||
"default_receivable_account", "default_payable_account",
|
||||
"default_expense_account", "default_income_account",
|
||||
"stock_received_but_not_billed", "stock_adjustment_account",
|
||||
"expenses_included_in_valuation", "default_payroll_payable_account"]:
|
||||
if self.get(field):
|
||||
for_company = frappe.db.get_value("Account", self.get(field), "company")
|
||||
if for_company != self.name:
|
||||
@@ -111,8 +113,7 @@ class Company(Document):
|
||||
"is_group": wh_detail["is_group"],
|
||||
"company": self.name,
|
||||
"parent_warehouse": "{0} - {1}".format(_("All Warehouses"), self.abbr) \
|
||||
if not wh_detail["is_group"] else "",
|
||||
"create_account_under": stock_group
|
||||
if not wh_detail["is_group"] else ""
|
||||
})
|
||||
warehouse.flags.ignore_permissions = True
|
||||
warehouse.insert()
|
||||
@@ -147,6 +148,7 @@ class Company(Document):
|
||||
|
||||
if cint(frappe.db.get_single_value("Accounts Settings", "auto_accounting_for_stock")):
|
||||
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")
|
||||
self._set_default_account("expenses_included_in_valuation", "Expenses Included In Valuation")
|
||||
self._set_default_account("default_expense_account", "Cost of Goods Sold")
|
||||
|
||||
@@ -74,7 +74,7 @@ class TestCompany(unittest.TestCase):
|
||||
"company": template,
|
||||
"account_type": account_type
|
||||
}
|
||||
if account_type in ["Bank", "Cash", "Stock"]:
|
||||
if account_type in ["Bank", "Cash"]:
|
||||
filters["is_group"] = 1
|
||||
|
||||
self.assertTrue(frappe.get_all("Account", filters))
|
||||
|
||||
Reference in New Issue
Block a user