test: modify test to check posting date
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 7012eac..7a31dc5 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -909,6 +909,7 @@
item=self,
)
for d in self.get("references"):
+ gle = party_dict.copy()
book_advance_payments_as_liability = frappe.get_value(
"Company", {"company_name": self.company}, "book_advance_payments_as_liability"
)
@@ -917,17 +918,27 @@
and book_advance_payments_as_liability
):
self.make_invoice_liability_entry(gl_entries, d)
+ gle.update(
+ {
+ "against_voucher_type": "Payment Entry",
+ "against_voucher": self.name,
+ }
+ )
allocated_amount_in_company_currency = self.calculate_base_allocated_amount_for_reference(d)
- gle = party_dict.copy()
gle.update(
{
dr_or_cr: allocated_amount_in_company_currency,
dr_or_cr + "_in_account_currency": d.allocated_amount,
- "against_voucher_type": "Payment Entry",
- "against_voucher": self.name,
}
)
+ if not gle.get("against_voucher_type"):
+ gle.update(
+ {
+ "against_voucher_type": d.reference_doctype,
+ "against_voucher": d.reference_name,
+ }
+ )
gl_entries.append(gle)
@@ -940,6 +951,8 @@
{
dr_or_cr + "_in_account_currency": self.unallocated_amount,
dr_or_cr: base_unallocated_amount,
+ "against_voucher_type": "Payment Entry",
+ "against_voucher": self.name,
}
)
diff --git a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index c15692b..1ac231b 100644
--- a/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -1694,13 +1694,18 @@
pi.save()
pi.submit()
expected_gle = [
- ["Creditors - _TC", 50, 100],
- ["Debtors - _TC", 0.0, 50],
- ["Stock Received But Not Billed - _TC", 100, 0.0],
+ ["Creditors - _TC", 50, 100, nowdate()],
+ ["Debtors - _TC", 0.0, 50, nowdate()],
+ ["Stock Received But Not Billed - _TC", 100, 0.0, nowdate()],
]
check_gl_entries(self, pi.name, expected_gle, nowdate())
self.assertEqual(pi.outstanding_amount, 200)
+ frappe.db.set_value(
+ "Company",
+ "_Test Company",
+ {"book_advance_payments_as_liability": 0, "default_advance_paid_account": ""},
+ )
def check_gl_entries(doc, voucher_no, expected_gle, posting_date):
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index 54c8b84..8ab7fd7 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -3348,13 +3348,21 @@
si.save()
si.submit()
expected_gle = [
- ["Creditors - _TC", 50, 0.0],
- ["Debtors - _TC", 100, 50],
- ["Sales - _TC", 0.0, 100],
+ ["Creditors - _TC", 50, 0.0, nowdate()],
+ ["Debtors - _TC", 100, 50, nowdate()],
+ ["Sales - _TC", 0.0, 100, nowdate()],
]
check_gl_entries(self, si.name, expected_gle, nowdate())
self.assertEqual(si.outstanding_amount, 50)
+ frappe.db.set_value(
+ "Company",
+ "_Test Company",
+ {
+ "book_advance_payments_as_liability": 0,
+ "default_advance_received_account": "",
+ },
+ )
def get_sales_invoice_for_e_invoice():