Skip to content

Commit

Permalink
test: Update failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
deepeshgarg007 committed May 3, 2024
1 parent eb31017 commit 42ef957
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 38 deletions.
32 changes: 16 additions & 16 deletions erpnext/accounts/doctype/payment_entry/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1269,27 +1269,27 @@ def add_party_gl_entries(self, gl_entries):
)
gl_entries.append(gle)

if self.unallocated_amount:
dr_or_cr = "credit" if self.payment_type == "Receive" else "debit"
exchange_rate = self.get_exchange_rate()
base_unallocated_amount = self.unallocated_amount * exchange_rate
if self.unallocated_amount:
dr_or_cr = "credit" if self.payment_type == "Receive" else "debit"
exchange_rate = self.get_exchange_rate()
base_unallocated_amount = self.unallocated_amount * exchange_rate

gle = party_gl_dict.copy()
gle.update(
{
dr_or_cr + "_in_account_currency": self.unallocated_amount,
dr_or_cr: base_unallocated_amount,
}
)

gle = party_gl_dict.copy()
if self.book_advance_payments_in_separate_party_account:
gle.update(
{
dr_or_cr + "_in_account_currency": self.unallocated_amount,
dr_or_cr: base_unallocated_amount,
"against_voucher_type": "Payment Entry",
"against_voucher": self.name,
}
)

if self.book_advance_payments_in_separate_party_account:
gle.update(
{
"against_voucher_type": "Payment Entry",
"against_voucher": self.name,
}
)
gl_entries.append(gle)
gl_entries.append(gle)

def make_advance_gl_entries(
self, entry: object | dict = None, cancel: bool = 0, update_outstanding: str = "Yes"
Expand Down
23 changes: 1 addition & 22 deletions erpnext/buying/doctype/purchase_order/test_purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,12 +772,7 @@ def create_account(self, account_name, company, currency, parent):
}
).insert()
else:
account = frappe.db.get_value(
"Account",
filters={"account_name": account_name, "company": company},
fieldname="name",
pluck=True,
)
account = frappe.get_doc("Account", {"account_name": account_name, "company": company})

return account

Expand Down Expand Up @@ -808,22 +803,6 @@ def test_advance_payment_with_separate_party_account_enabled(self):

from erpnext.buying.doctype.purchase_order.purchase_order import make_purchase_invoice

pi = make_purchase_invoice(po_doc.name)
pi.append(
"advances",
{
"reference_type": pe.doctype,
"reference_name": pe.name,
"reference_row": pe.references[0].name,
"advance_amount": 5000,
"allocated_amount": 5000,
},
)
pi.save().submit()
pe.reload()
po_doc.reload()
self.assertEqual(po_doc.advance_paid, 0)

company_doc.book_advance_payments_in_separate_party_account = False
company_doc.save()

Expand Down

0 comments on commit 42ef957

Please sign in to comment.