refactor(company): don't force set service expense account on save (backport #54275) (#54305)

* refactor(company): don't force set service expense account on save

(cherry picked from commit 927f40b296)

* refactor(test): set dependant value in company master

(cherry picked from commit 299e141cee)

---------

Co-authored-by: ruthra kumar <ruthra@erpnext.com>
This commit is contained in:
ruthra kumar
2026-04-15 15:55:53 +05:30
committed by GitHub
2 changed files with 5 additions and 15 deletions

View File

@@ -203,6 +203,11 @@ class TestRepostAccountingLedger(ERPNextTestSuite):
def test_06_repost_purchase_receipt(self):
from erpnext.accounts.doctype.account.test_account import create_account
if not frappe.db.set_value("Company", "_Test Company", "service_expense_account"):
frappe.db.set_value(
"Company", "_Test Company", "service_expense_account", "Marketing Expenses - _TC"
)
provisional_account = create_account(
account_name="Provision Account",
parent_account="Current Liabilities - _TC",

View File

@@ -684,21 +684,6 @@ class Company(NestedSet):
self.db_set("disposal_account", disposal_acct)
if not self.service_expense_account:
service_expense_acct = frappe.db.get_value(
"Account",
{
"account_name": _("Marketing Expenses"),
"company": self.name,
"is_group": 0,
"root_type": "Expense",
},
"name",
)
if service_expense_acct:
self.db_set("service_expense_account", service_expense_acct)
def _set_default_account(self, fieldname, account_type):
if self.get(fieldname):
return