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
This commit is contained in:
Rah Yuliantoro 2018-05-07 13:09:35 +07:00 committed by Nabin Hait
parent 338e1b6e91
commit b3882cacd9
3 changed files with 35 additions and 2 deletions

View File

@ -24,7 +24,8 @@ def get():
"account_type": "Cash"
},
_("Loans and Advances (Assets)"): {
"is_group": 1
_("Employee Advances"): {
},
},
_("Securities and Deposits"): {
_("Earnest Money"): {}

View File

@ -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"): {

View File

@ -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