diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py index 19b2ee89d10..84c723f1c31 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py @@ -1644,72 +1644,9 @@ def get_split_invoice_rows(invoice: dict, payment_term_template: str, exc_rates: "payment_term": payment_term.payment_term, } ) -<<<<<<< HEAD - if payment_term_template: - allocate_payment_based_on_payment_terms = frappe.db.get_value( - "Payment Terms Template", payment_term_template, "allocate_payment_based_on_payment_terms" - ) - if allocate_payment_based_on_payment_terms: - payment_schedule = frappe.get_all( - "Payment Schedule", filters={"parent": d.voucher_no}, fields=["*"] - ) - - for payment_term in payment_schedule: - if payment_term.outstanding > 0.1: - doc_details = exc_rates.get(payment_term.parent, None) - is_multi_currency_acc = (doc_details.currency != doc_details.company_currency) and ( - doc_details.party_account_currency != doc_details.company_currency - ) - payment_term_outstanding = flt(payment_term.outstanding) - if not is_multi_currency_acc: - payment_term_outstanding = doc_details.conversion_rate * flt(payment_term.outstanding) - - invoice_ref_based_on_payment_terms.setdefault(idx, []) - invoice_ref_based_on_payment_terms[idx].append( - frappe._dict( - { - "due_date": d.due_date, - "currency": d.currency, - "voucher_no": d.voucher_no, - "voucher_type": d.voucher_type, - "posting_date": d.posting_date, - "invoice_amount": flt(d.invoice_amount), - "outstanding_amount": payment_term_outstanding - if payment_term_outstanding - else d.outstanding_amount, - "payment_term_outstanding": payment_term_outstanding, - "payment_amount": payment_term.payment_amount, - "payment_term": payment_term.payment_term, - } - ) - ) - - outstanding_invoices_after_split = [] - if invoice_ref_based_on_payment_terms: - for idx, ref in invoice_ref_based_on_payment_terms.items(): - voucher_no = ref[0]["voucher_no"] - voucher_type = ref[0]["voucher_type"] - - frappe.msgprint( - _("Spliting {} {} into {} row(s) as per Payment Terms").format( - voucher_type, voucher_no, len(ref) - ), - alert=True, - ) - - outstanding_invoices_after_split += invoice_ref_based_on_payment_terms[idx] - - existing_row = list(filter(lambda x: x.get("voucher_no") == voucher_no, outstanding_invoices)) - index = outstanding_invoices.index(existing_row[0]) - outstanding_invoices.pop(index) - - outstanding_invoices_after_split += outstanding_invoices - return outstanding_invoices_after_split -======= ) return split_rows ->>>>>>> 6bd56d2d5f (refactor: `split_invoices_based_on_payment_terms`) def get_orders_to_be_billed( diff --git a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py index 78d745cc76d..169a077f6a8 100644 --- a/erpnext/accounts/doctype/payment_entry/test_payment_entry.py +++ b/erpnext/accounts/doctype/payment_entry/test_payment_entry.py @@ -1258,42 +1258,6 @@ class TestPaymentEntry(FrappeTestCase): self.assertEqual(references[2].voucher_no, si2.name) self.assertEqual(references[1].payment_term, "Basic Amount Receivable") self.assertEqual(references[2].payment_term, "Tax Receivable") -<<<<<<< HEAD -======= - - def test_receive_payment_from_payable_party_type(self): - pe = create_payment_entry( - party_type="Supplier", - party="_Test Supplier", - payment_type="Receive", - paid_from="Creditors - _TC", - paid_to="_Test Cash - _TC", - save=True, - submit=True, - ) - self.voucher_no = pe.name - self.expected_gle = [ - {"account": "_Test Cash - _TC", "debit": 1000.0, "credit": 0.0}, - {"account": "Creditors - _TC", "debit": 0.0, "credit": 1000.0}, - ] - self.check_gl_entries() - - def check_gl_entries(self): - gle = frappe.qb.DocType("GL Entry") - gl_entries = ( - frappe.qb.from_(gle) - .select( - gle.account, - gle.debit, - gle.credit, - ) - .where((gle.voucher_no == self.voucher_no) & (gle.is_cancelled == 0)) - .orderby(gle.account) - ).run(as_dict=True) - for row in range(len(self.expected_gle)): - for field in ["account", "debit", "credit"]: - self.assertEqual(self.expected_gle[row][field], gl_entries[row][field]) ->>>>>>> 4b4b176fcf (style: Remove spaces introduced via merge conflict) def create_payment_entry(**args):