From 512877ab463af8d46442b95c6a468ca34c0de33b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Tue, 8 Apr 2025 14:34:34 +0530 Subject: [PATCH] chore: resolve conflicts --- .../sales_invoice/test_sales_invoice.py | 89 ++----------------- erpnext/controllers/accounts_controller.py | 17 ---- 2 files changed, 9 insertions(+), 97 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 9917596f8be..9fc3e718f15 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -3860,63 +3860,6 @@ class TestSalesInvoice(FrappeTestCase): doc = frappe.get_doc("Project", project.name) self.assertEqual(doc.total_billed_amount, si.grand_total) - -<<<<<<< HEAD -def check_gl_entries(doc, voucher_no, expected_gle, posting_date): - gl_entries = frappe.db.sql( - """select account, debit, credit, posting_date - from `tabGL Entry` - where voucher_type='Sales Invoice' and voucher_no=%s and posting_date > %s - and is_cancelled = 0 - order by posting_date asc, account asc""", - (voucher_no, posting_date), - as_dict=1, -======= - si = create_sales_invoice(do_not_submit=True) - - project = frappe.new_doc("Project") - project.company = "_Test Company" - project.project_name = "Test Total Billed Amount" - project.save() - - si.project = project.name - si.items.append(copy(si.items[0])) - si.items.append(copy(si.items[0])) - si.items[0].project = project.name - si.items[1].project = project.name - # Not setting project on last item - si.items[1].insert() - si.items[2].insert() - si.submit() - - project.reload() - self.assertIsNone(si.items[2].project) - self.assertEqual(project.total_billed_amount, 300) - - def test_pos_returns_with_party_account_currency(self): - from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_sales_return - - pos_profile = make_pos_profile() - pos_profile.payments = [] - pos_profile.append("payments", {"default": 1, "mode_of_payment": "Cash"}) - pos_profile.save() - - pos = create_sales_invoice( - customer="_Test Customer USD", - currency="USD", - conversion_rate=86.595000000, - qty=2, - do_not_save=True, - ) - pos.is_pos = 1 - pos.pos_profile = pos_profile.name - pos.debit_to = "_Test Receivable USD - _TC" - pos.append("payments", {"mode_of_payment": "Cash", "account": "_Test Bank - _TC", "amount": 20.35}) - pos.save().submit() - - pos_return = make_sales_return(pos.name) - self.assertEqual(abs(pos_return.payments[0].amount), pos.payments[0].amount) - def test_create_return_invoice_for_self_update(self): from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice @@ -3946,30 +3889,16 @@ def check_gl_entries(doc, voucher_no, expected_gle, posting_date): self.assertEqual(invoice.outstanding_amount, 0) - def test_prevents_fully_returned_invoice_with_zero_quantity(self): - from erpnext.controllers.sales_and_purchase_return import StockOverReturnError, make_return_doc - invoice = create_sales_invoice(qty=10) - - return_doc = make_return_doc(invoice.doctype, invoice.name) - return_doc.items[0].qty = -10 - return_doc.save().submit() - - return_doc = make_return_doc(invoice.doctype, invoice.name) - return_doc.items[0].qty = 0 - - self.assertRaises(StockOverReturnError, return_doc.save) - - -def set_advance_flag(company, flag, default_account): - frappe.db.set_value( - "Company", - company, - { - "book_advance_payments_in_separate_party_account": flag, - "default_advance_received_account": default_account, - }, ->>>>>>> 7b0882600a (test: add unit test to validate outstanding amount for update_outstanding_for_self checkbox enabled) +def check_gl_entries(doc, voucher_no, expected_gle, posting_date): + gl_entries = frappe.db.sql( + """select account, debit, credit, posting_date + from `tabGL Entry` + where voucher_type='Sales Invoice' and voucher_no=%s and posting_date > %s + and is_cancelled = 0 + order by posting_date asc, account asc""", + (voucher_no, posting_date), + as_dict=1, ) for i, gle in enumerate(gl_entries): diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index a146628cd25..2ebd5b34ad9 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -252,23 +252,6 @@ class AccountsController(TransactionBase): ) ) -<<<<<<< HEAD - if self.get("is_return") and self.get("return_against") and not self.get("is_pos"): - if self.get("update_outstanding_for_self"): - document_type = "Credit Note" if self.doctype == "Sales Invoice" else "Debit Note" - frappe.msgprint( - _( - "We can see {0} is made against {1}. If you want {1}'s outstanding to be updated, uncheck '{2}' checkbox.

Or you can use {3} tool to reconcile against {1} later." - ).format( - frappe.bold(document_type), - get_link_to_form(self.doctype, self.get("return_against")), - frappe.bold("Update Outstanding for Self"), - get_link_to_form("Payment Reconciliation", "Payment Reconciliation"), - ) - ) - -======= ->>>>>>> 222f1834f1 (fix(accounting): update outstanding amount based on update_outstanding_for_self) pos_check_field = "is_pos" if self.doctype == "Sales Invoice" else "is_paid" if cint(self.allocate_advances_automatically) and not cint(self.get(pos_check_field)): self.set_advances()