fix: Test Cases
This commit is contained in:
parent
8a4dc521cd
commit
c96bf870e4
@ -3,7 +3,7 @@
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe, json
|
||||
import frappe, json, erpnext
|
||||
from frappe import _
|
||||
from frappe.utils import flt, getdate, nowdate, add_days
|
||||
from erpnext.controllers.accounts_controller import AccountsController
|
||||
@ -134,16 +134,19 @@ class InvoiceDiscounting(AccountsController):
|
||||
je.append("accounts", {
|
||||
"account": self.bank_account,
|
||||
"debit_in_account_currency": flt(self.total_amount) - flt(self.bank_charges),
|
||||
"cost_center": erpnext.get_default_cost_center(self.company)
|
||||
})
|
||||
|
||||
je.append("accounts", {
|
||||
"account": self.bank_charges_account,
|
||||
"debit_in_account_currency": flt(self.bank_charges)
|
||||
"debit_in_account_currency": flt(self.bank_charges),
|
||||
"cost_center": erpnext.get_default_cost_center(self.company)
|
||||
})
|
||||
|
||||
je.append("accounts", {
|
||||
"account": self.short_term_loan,
|
||||
"credit_in_account_currency": flt(self.total_amount),
|
||||
"cost_center": erpnext.get_default_cost_center(self.company),
|
||||
"reference_type": "Invoice Discounting",
|
||||
"reference_name": self.name
|
||||
})
|
||||
@ -151,6 +154,7 @@ class InvoiceDiscounting(AccountsController):
|
||||
je.append("accounts", {
|
||||
"account": self.accounts_receivable_discounted,
|
||||
"debit_in_account_currency": flt(d.outstanding_amount),
|
||||
"cost_center": erpnext.get_default_cost_center(self.company),
|
||||
"reference_type": "Invoice Discounting",
|
||||
"reference_name": self.name,
|
||||
"party_type": "Customer",
|
||||
@ -160,6 +164,7 @@ class InvoiceDiscounting(AccountsController):
|
||||
je.append("accounts", {
|
||||
"account": self.accounts_receivable_credit,
|
||||
"credit_in_account_currency": flt(d.outstanding_amount),
|
||||
"cost_center": erpnext.get_default_cost_center(self.company),
|
||||
"reference_type": "Invoice Discounting",
|
||||
"reference_name": self.name,
|
||||
"party_type": "Customer",
|
||||
@ -177,13 +182,15 @@ class InvoiceDiscounting(AccountsController):
|
||||
je.append("accounts", {
|
||||
"account": self.short_term_loan,
|
||||
"debit_in_account_currency": flt(self.total_amount),
|
||||
"cost_center": erpnext.get_default_cost_center(self.company),
|
||||
"reference_type": "Invoice Discounting",
|
||||
"reference_name": self.name,
|
||||
})
|
||||
|
||||
je.append("accounts", {
|
||||
"account": self.bank_account,
|
||||
"credit_in_account_currency": flt(self.total_amount)
|
||||
"credit_in_account_currency": flt(self.total_amount),
|
||||
"cost_center": erpnext.get_default_cost_center(self.company)
|
||||
})
|
||||
|
||||
if getdate(self.loan_end_date) > getdate(nowdate()):
|
||||
@ -193,6 +200,7 @@ class InvoiceDiscounting(AccountsController):
|
||||
je.append("accounts", {
|
||||
"account": self.accounts_receivable_discounted,
|
||||
"credit_in_account_currency": flt(outstanding_amount),
|
||||
"cost_center": erpnext.get_default_cost_center(self.company),
|
||||
"reference_type": "Invoice Discounting",
|
||||
"reference_name": self.name,
|
||||
"party_type": "Customer",
|
||||
@ -202,6 +210,7 @@ class InvoiceDiscounting(AccountsController):
|
||||
je.append("accounts", {
|
||||
"account": self.accounts_receivable_unpaid,
|
||||
"debit_in_account_currency": flt(outstanding_amount),
|
||||
"cost_center": erpnext.get_default_cost_center(self.company),
|
||||
"reference_type": "Invoice Discounting",
|
||||
"reference_name": self.name,
|
||||
"party_type": "Customer",
|
||||
|
@ -822,7 +822,7 @@ class TestPurchaseInvoice(unittest.TestCase):
|
||||
"Creditors - _TC": {
|
||||
"cost_center": cost_center
|
||||
},
|
||||
"Cost of Goods Sold - _TC": {
|
||||
"_Test Account Cost for Goods Sold - _TC": {
|
||||
"cost_center": cost_center
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
import frappe, erpnext
|
||||
from frappe import _
|
||||
from frappe.utils import flt, today, getdate, cint
|
||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_checks_for_pl_and_bs_accounts
|
||||
@ -197,12 +197,14 @@ def get_gl_entries_on_asset_disposal(asset, selling_amount=0, finance_book=None)
|
||||
{
|
||||
"account": fixed_asset_account,
|
||||
"credit_in_account_currency": asset.gross_purchase_amount,
|
||||
"credit": asset.gross_purchase_amount
|
||||
"credit": asset.gross_purchase_amount,
|
||||
"cost_center": depreciation_cost_center
|
||||
},
|
||||
{
|
||||
"account": accumulated_depr_account,
|
||||
"debit_in_account_currency": accumulated_depr_amount,
|
||||
"debit": accumulated_depr_amount
|
||||
"debit": accumulated_depr_amount,
|
||||
"cost_center": depreciation_cost_center
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -39,6 +39,7 @@ class TestProcurementTracker(unittest.TestCase):
|
||||
po.get("items")[0].cost_center = "_Test Cost Center - _TC"
|
||||
po.submit()
|
||||
pr = make_purchase_receipt(po.name)
|
||||
pr.get("items")[0].cost_center = "_Test Cost Center - _TC"
|
||||
pr.submit()
|
||||
frappe.db.commit()
|
||||
date_obj = datetime.date(datetime.now())
|
||||
|
@ -119,12 +119,14 @@ def make_bank_entry(dt, dn):
|
||||
"reference_type": "Employee Advance",
|
||||
"reference_name": doc.name,
|
||||
"party_type": "Employee",
|
||||
"cost_center": erpnext.get_default_cost_center(doc.company),
|
||||
"party": doc.employee,
|
||||
"is_advance": "Yes"
|
||||
})
|
||||
|
||||
je.append("accounts", {
|
||||
"account": payment_account.account,
|
||||
"cost_center": erpnext.get_default_cost_center(doc.company),
|
||||
"credit_in_account_currency": flt(doc.advance_amount),
|
||||
"account_currency": payment_account.account_currency,
|
||||
"account_type": payment_account.account_type
|
||||
|
@ -295,7 +295,7 @@ def make_bank_entry(dt, dn):
|
||||
je = frappe.new_doc("Journal Entry")
|
||||
je.voucher_type = 'Bank Entry'
|
||||
je.company = expense_claim.company
|
||||
je.remark = 'Payment against Expense Claim: ' + dn;
|
||||
je.remark = 'Payment against Expense Claim: ' + dn
|
||||
|
||||
je.append("accounts", {
|
||||
"account": expense_claim.payable_account,
|
||||
@ -303,6 +303,7 @@ def make_bank_entry(dt, dn):
|
||||
"reference_type": "Expense Claim",
|
||||
"party_type": "Employee",
|
||||
"party": expense_claim.employee,
|
||||
"cost_center": erpnext.get_default_cost_center(expense_claim.company),
|
||||
"reference_name": expense_claim.name
|
||||
})
|
||||
|
||||
@ -313,6 +314,7 @@ def make_bank_entry(dt, dn):
|
||||
"reference_name": expense_claim.name,
|
||||
"balance": default_bank_cash_account.balance,
|
||||
"account_currency": default_bank_cash_account.account_currency,
|
||||
"cost_center": erpnext.get_default_cost_center(expense_claim.company),
|
||||
"account_type": default_bank_cash_account.account_type
|
||||
})
|
||||
|
||||
|
@ -565,7 +565,7 @@ class TestDeliveryNote(unittest.TestCase):
|
||||
for i, gle in enumerate(gl_entries):
|
||||
self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center)
|
||||
|
||||
def test_delivery_note_without_cost_center(self):
|
||||
def test_delivery_note_cost_center_with_balance_sheet_account(self):
|
||||
cost_center = "Main - TCP1"
|
||||
|
||||
company = frappe.db.get_value('Warehouse', 'Stores - TCP1', 'company')
|
||||
@ -575,7 +575,11 @@ class TestDeliveryNote(unittest.TestCase):
|
||||
make_stock_entry(target="Stores - TCP1", qty=5, basic_rate=100)
|
||||
|
||||
stock_in_hand_account = get_inventory_account('_Test Company with perpetual inventory')
|
||||
dn = create_delivery_note(company='_Test Company with perpetual inventory', warehouse='Stores - TCP1', cost_center = 'Main - TCP1', expense_account = "Cost of Goods Sold - TCP1")
|
||||
dn = create_delivery_note(company='_Test Company with perpetual inventory', warehouse='Stores - TCP1', cost_center = 'Main - TCP1', expense_account = "Cost of Goods Sold - TCP1",
|
||||
do_not_submit=1)
|
||||
|
||||
dn.get('items')[0].cost_center = None
|
||||
dn.submit()
|
||||
|
||||
gl_entries = get_gl_entries("Delivery Note", dn.name)
|
||||
|
||||
@ -585,7 +589,7 @@ class TestDeliveryNote(unittest.TestCase):
|
||||
"cost_center": cost_center
|
||||
},
|
||||
stock_in_hand_account: {
|
||||
"cost_center": None
|
||||
"cost_center": cost_center
|
||||
}
|
||||
}
|
||||
for i, gle in enumerate(gl_entries):
|
||||
|
@ -432,7 +432,7 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
for i, gle in enumerate(gl_entries):
|
||||
self.assertEqual(expected_values[gle.account]["cost_center"], gle.cost_center)
|
||||
|
||||
def test_purchase_receipt_without_cost_center(self):
|
||||
def test_purchase_receipt_cost_center_with_balance_sheet_account(self):
|
||||
if not frappe.db.exists('Location', 'Test Location'):
|
||||
frappe.get_doc({
|
||||
'doctype': 'Location',
|
||||
@ -444,13 +444,14 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
gl_entries = get_gl_entries("Purchase Receipt", pr.name)
|
||||
|
||||
self.assertTrue(gl_entries)
|
||||
cost_center = pr.get('items')[0].cost_center
|
||||
|
||||
expected_values = {
|
||||
"Stock Received But Not Billed - TCP1": {
|
||||
"cost_center": None
|
||||
"cost_center": cost_center
|
||||
},
|
||||
stock_in_hand_account: {
|
||||
"cost_center": None
|
||||
"cost_center": cost_center
|
||||
}
|
||||
}
|
||||
for i, gle in enumerate(gl_entries):
|
||||
|
Loading…
x
Reference in New Issue
Block a user