mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-16 16:56:57 +00:00
refactor(test): utility methods for enabling advance in separate acc
(cherry picked from commit a21a406d04)
# Conflicts:
# erpnext/accounts/test/accounts_mixin.py
This commit is contained in:
@@ -87,6 +87,22 @@ class AccountsTestMixin:
|
||||
"parent_account": "Bank Accounts - " + abbr,
|
||||
}
|
||||
),
|
||||
frappe._dict(
|
||||
{
|
||||
"attribute_name": "advance_received",
|
||||
"account_name": "Advance Received",
|
||||
"parent_account": "Current Liabilities - " + abbr,
|
||||
"account_type": "Receivable",
|
||||
}
|
||||
),
|
||||
frappe._dict(
|
||||
{
|
||||
"attribute_name": "advance_paid",
|
||||
"account_name": "Advance Paid",
|
||||
"parent_account": "Current Assets - " + abbr,
|
||||
"account_type": "Payable",
|
||||
}
|
||||
),
|
||||
]
|
||||
for acc in other_accounts:
|
||||
acc_name = acc.account_name + " - " + abbr
|
||||
@@ -101,9 +117,34 @@ class AccountsTestMixin:
|
||||
"company": self.company,
|
||||
}
|
||||
)
|
||||
new_acc.account_type = acc.get("account_type", None)
|
||||
new_acc.save()
|
||||
setattr(self, acc.attribute_name, new_acc.name)
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
self.identify_default_warehouses()
|
||||
|
||||
def enable_advance_as_liability(self):
|
||||
company = frappe.get_doc("Company", self.company)
|
||||
company.book_advance_payments_in_separate_party_account = True
|
||||
company.default_advance_received_account = self.advance_received
|
||||
company.default_advance_paid_account = self.advance_paid
|
||||
company.save()
|
||||
|
||||
def disable_advance_as_liability(self):
|
||||
company = frappe.get_doc("Company", self.company)
|
||||
company.book_advance_payments_in_separate_party_account = False
|
||||
company.default_advance_paid_account = company.default_advance_received_account = None
|
||||
company.save()
|
||||
|
||||
def identify_default_warehouses(self):
|
||||
for w in frappe.db.get_all(
|
||||
"Warehouse", filters={"company": self.company}, fields=["name", "warehouse_name"]
|
||||
):
|
||||
setattr(self, "warehouse_" + w.warehouse_name.lower().strip().replace(" ", "_"), w.name)
|
||||
|
||||
>>>>>>> a21a406d04 (refactor(test): utility methods for enabling advance in separate acc)
|
||||
def create_usd_receivable_account(self):
|
||||
account_name = "Debtors USD"
|
||||
if not frappe.db.get_value(
|
||||
|
||||
Reference in New Issue
Block a user