From 1657a83151fb002e0606c36923e722aa638cc6f2 Mon Sep 17 00:00:00 2001 From: Smit Vora Date: Thu, 12 Sep 2024 10:36:32 +0530 Subject: [PATCH] fix: typo with po_date when creating remarks (cherry picked from commit a55502e0f14133d8e6dfca9e0741c07d20056b08) --- .../accounts/doctype/sales_invoice/sales_invoice.py | 2 +- .../doctype/sales_invoice/test_sales_invoice.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 12e26623ad00..1214ddee8cd2 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -951,7 +951,7 @@ def add_remarks(self): if self.po_no: self.remarks = _("Against Customer Order {0}").format(self.po_no) if self.po_date: - self.remarks += " " + _("dated {0}").format(formatdate(self.po_data)) + self.remarks += " " + _("dated {0}").format(formatdate(self.po_date)) else: self.remarks = _("No Remarks") diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index beb347e07dba..7ac0d34e671c 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -8,7 +8,7 @@ from frappe import qb from frappe.model.dynamic_links import get_dynamic_link_map from frappe.tests.utils import FrappeTestCase, change_settings -from frappe.utils import add_days, flt, getdate, nowdate, today +from frappe.utils import add_days, flt, format_date, getdate, nowdate, today import erpnext from erpnext.accounts.doctype.account.test_account import create_account, get_inventory_account @@ -3997,6 +3997,14 @@ def test_common_party_with_foreign_currency_jv(self): self.assertTrue(jv) self.assertEqual(jv[0], si.grand_total) + def test_invoice_remarks(self): + si = frappe.copy_doc(test_records[0]) + si.po_no = "Test PO" + si.po_date = nowdate() + si.save() + si.submit() + self.assertEqual(si.remarks, f"Against Customer Order Test PO dated {format_date(nowdate())}") + def set_advance_flag(company, flag, default_account): frappe.db.set_value(