mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-29 22:58:25 +00:00
fixed conflict
This commit is contained in:
@@ -78,6 +78,8 @@ class Company(Document):
|
||||
|
||||
if not frappe.local.flags.ignore_chart_of_accounts:
|
||||
self.set_default_accounts()
|
||||
if self.default_cash_account:
|
||||
self.mode_of_payment()
|
||||
|
||||
if self.default_currency:
|
||||
frappe.db.set_value("Currency", self.default_currency, "enabled", 1)
|
||||
@@ -162,6 +164,16 @@ class Company(Document):
|
||||
if account:
|
||||
self.db_set(fieldname, account)
|
||||
|
||||
def mode_of_payment(self):
|
||||
cash = frappe.db.get_value('Mode of Payment', {'type': 'Cash'}, 'name')
|
||||
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.append('accounts', {
|
||||
'company': self.name,
|
||||
'default_account': self.default_cash_account
|
||||
})
|
||||
mode_of_payment.save(ignore_permissions=True)
|
||||
|
||||
def create_default_cost_center(self):
|
||||
cc_list = [
|
||||
{
|
||||
|
||||
@@ -40,9 +40,10 @@ class TestCompany(unittest.TestCase):
|
||||
acc = frappe.get_doc("Account", account)
|
||||
for prop, val in acc_property.items():
|
||||
self.assertEqual(acc.get(prop), val)
|
||||
|
||||
|
||||
self.delete_mode_of_payment("COA from Existing Company")
|
||||
frappe.delete_doc("Company", "COA from Existing Company")
|
||||
|
||||
|
||||
def test_coa_based_on_country_template(self):
|
||||
countries = ["India", "Brazil", "United Arab Emirates", "Canada", "Germany", "France",
|
||||
"Guatemala", "Indonesia", "Mexico", "Nicaragua", "Netherlands", "Singapore"]
|
||||
@@ -78,4 +79,9 @@ class TestCompany(unittest.TestCase):
|
||||
|
||||
self.assertTrue(frappe.get_all("Account", filters))
|
||||
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))
|
||||
|
||||
@@ -134,7 +134,7 @@ class NamingSeries(Document):
|
||||
"""get series current"""
|
||||
if self.prefix:
|
||||
self.current_value = frappe.db.get_value("Series",
|
||||
self.prefix.split('.')[0], "current")
|
||||
self.prefix.split('.')[0], "current", order_by = "name")
|
||||
|
||||
def insert_series(self, series):
|
||||
"""insert series if missing"""
|
||||
|
||||
@@ -18,4 +18,6 @@ def get_terms_and_conditions(template_name, doc):
|
||||
doc = json.loads(doc)
|
||||
|
||||
terms_and_conditions = frappe.get_doc("Terms and Conditions", template_name)
|
||||
return frappe.render_template(terms_and_conditions.terms, doc)
|
||||
|
||||
if terms_and_conditions.terms:
|
||||
return frappe.render_template(terms_and_conditions.terms, doc)
|
||||
Reference in New Issue
Block a user