mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 11:19:09 +00:00
fix company issue
This commit is contained in:
@@ -166,7 +166,7 @@ class Company(Document):
|
|||||||
|
|
||||||
def mode_of_payment(self):
|
def mode_of_payment(self):
|
||||||
cash = frappe.db.get_value('Mode of Payment', {'type': 'Cash'}, 'name')
|
cash = frappe.db.get_value('Mode of Payment', {'type': 'Cash'}, 'name')
|
||||||
if cash:
|
if cash and not frappe.db.get_value('Mode of Payment Account', {'company': self.name}):
|
||||||
mode_of_payment = frappe.get_doc('Mode of Payment', cash)
|
mode_of_payment = frappe.get_doc('Mode of Payment', cash)
|
||||||
mode_of_payment.append('accounts', {
|
mode_of_payment.append('accounts', {
|
||||||
'company': self.name,
|
'company': self.name,
|
||||||
|
|||||||
@@ -40,9 +40,10 @@ class TestCompany(unittest.TestCase):
|
|||||||
acc = frappe.get_doc("Account", account)
|
acc = frappe.get_doc("Account", account)
|
||||||
for prop, val in acc_property.items():
|
for prop, val in acc_property.items():
|
||||||
self.assertEqual(acc.get(prop), val)
|
self.assertEqual(acc.get(prop), val)
|
||||||
|
|
||||||
|
self.delete_mode_of_payment("COA from Existing Company")
|
||||||
frappe.delete_doc("Company", "COA from Existing Company")
|
frappe.delete_doc("Company", "COA from Existing Company")
|
||||||
|
|
||||||
def test_coa_based_on_country_template(self):
|
def test_coa_based_on_country_template(self):
|
||||||
countries = ["India", "Brazil", "United Arab Emirates", "Canada", "Germany", "France",
|
countries = ["India", "Brazil", "United Arab Emirates", "Canada", "Germany", "France",
|
||||||
"Guatemala", "Indonesia", "Mexico", "Nicaragua", "Netherlands", "Singapore"]
|
"Guatemala", "Indonesia", "Mexico", "Nicaragua", "Netherlands", "Singapore"]
|
||||||
@@ -78,4 +79,9 @@ class TestCompany(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertTrue(frappe.get_all("Account", filters))
|
self.assertTrue(frappe.get_all("Account", filters))
|
||||||
finally:
|
finally:
|
||||||
frappe.delete_doc("Company", template)
|
self.delete_mode_of_payment(template)
|
||||||
|
frappe.delete_doc("Company", template)
|
||||||
|
|
||||||
|
def delete_mode_of_payment(self, company):
|
||||||
|
frappe.db.sql(""" delete from `tabMode of Payment Account`
|
||||||
|
where company =%s """, (company))
|
||||||
|
|||||||
Reference in New Issue
Block a user