From b3882cacd9f7a7c18db79b0dc9e843d6cc2d0987 Mon Sep 17 00:00:00 2001 From: Rah Yuliantoro Date: Mon, 7 May 2018 13:09:35 +0700 Subject: [PATCH] update coa and company default (#13937) * Update standard_chart_of_accounts.py adding account for employee advances * Update standard_chart_of_accounts_with_account_number.py adding account for employee advances * Update company.py adding accounts for default fields in company doctypes * Update company.py Missing some default accounts for fields in company doctype --- .../verified/standard_chart_of_accounts.py | 3 +- ...d_chart_of_accounts_with_account_number.py | 4 ++- erpnext/setup/doctype/company/company.py | 30 +++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py index 5452040fb6..e0d81491be 100644 --- a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py +++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts.py @@ -24,7 +24,8 @@ def get(): "account_type": "Cash" }, _("Loans and Advances (Assets)"): { - "is_group": 1 + _("Employee Advances"): { + }, }, _("Securities and Deposits"): { _("Earnest Money"): {} diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py index bad84533a5..df7853ff44 100644 --- a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py +++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py @@ -29,7 +29,9 @@ def get(): "account_number": "1100" }, _("Loans and Advances (Assets)"): { - "is_group": 1, + _("Employee Advances"): { + "account_number": "1610" + }, "account_number": "1600" }, _("Securities and Deposits"): { diff --git a/erpnext/setup/doctype/company/company.py b/erpnext/setup/doctype/company/company.py index fdea1b162a..776dad5bce 100644 --- a/erpnext/setup/doctype/company/company.py +++ b/erpnext/setup/doctype/company/company.py @@ -186,6 +186,36 @@ class Company(Document): if not self.default_payable_account: self.db_set("default_payable_account", self.default_payable_account) + if not self.default_payroll_payable_account: + payroll_payable_account = frappe.db.get_value("Account", + {"account_name": _("Payroll Payable"), "company": self.name, "is_group": 0}) + + self.db_set("default_payroll_payable_account", payroll_payable_account) + + if not self.default_employee_advance_account: + employe_advance_account = frappe.db.get_value("Account", + {"account_name": _("Employee Advances"), "company": self.name, "is_group": 0}) + + self.db_set("default_employee_advance_account", employe_advance_account) + + if not self.write_off_account: + write_off_acct = frappe.db.get_value("Account", + {"account_name": _("Write Off"), "company": self.name, "is_group": 0}) + + self.db_set("write_off_account", write_off_acct) + + if not self.exchange_gain_loss_account: + exchange_gain_loss_acct = frappe.db.get_value("Account", + {"account_name": _("Exchange Gain/Loss"), "company": self.name, "is_group": 0}) + + self.db_set("exchange_gain_loss_account", exchange_gain_loss_acct) + + if not self.disposal_account: + disposal_acct = frappe.db.get_value("Account", + {"account_name": _("Gain/Loss on Asset Disposal"), "company": self.name, "is_group": 0}) + + self.db_set("disposal_account", disposal_acct) + def _set_default_account(self, fieldname, account_type): if self.get(fieldname): return