From 3e2fa16d84efb7ababdcd242a33310574b60dad6 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 29 Jan 2024 19:56:46 +0530 Subject: [PATCH] feat: Partly billed status in Purchase Receipt (#39543) (cherry picked from commit a673220feb91419f7d9949926fa4b3dd67d63682) --- erpnext/controllers/status_updater.py | 3 ++- .../stock/doctype/purchase_receipt/purchase_receipt_list.js | 4 +++- .../stock/doctype/purchase_receipt/test_purchase_receipt.py | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py index dd3fab05ce68..e04618c857fa 100644 --- a/erpnext/controllers/status_updater.py +++ b/erpnext/controllers/status_updater.py @@ -91,7 +91,8 @@ def validate_status(status, options): ], "Purchase Receipt": [ ["Draft", None], - ["To Bill", "eval:self.per_billed < 100 and self.docstatus == 1"], + ["To Bill", "eval:self.per_billed == 0 and self.docstatus == 1"], + ["Partly Billed", "eval:self.per_billed > 0 and self.per_billed < 100 and self.docstatus == 1"], ["Return Issued", "eval:self.per_returned == 100 and self.docstatus == 1"], ["Completed", "eval:self.per_billed == 100 and self.docstatus == 1"], ["Cancelled", "eval:self.docstatus==2"], diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js index ddc9bb026fbb..fc4aabdaa184 100644 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt_list.js @@ -17,8 +17,10 @@ frappe.listview_settings["Purchase Receipt"] = { return [__("Closed"), "green", "status,=,Closed"]; } else if (flt(doc.per_returned, 2) === 100) { return [__("Return Issued"), "grey", "per_returned,=,100"]; - } else if (flt(doc.grand_total) !== 0 && flt(doc.per_billed, 2) < 100) { + } else if (flt(doc.grand_total) !== 0 && flt(doc.per_billed, 2) == 0) { return [__("To Bill"), "orange", "per_billed,<,100"]; + } else if (flt(doc.per_billed, 2) > 0 && flt(doc.per_billed, 2) < 100) { + return [__("Partly Billed"), "yellow", "per_billed,<,100"]; } else if (flt(doc.grand_total) === 0 || flt(doc.per_billed, 2) === 100) { return [__("Completed"), "green", "per_billed,=,100"]; } diff --git a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py index 1c4feedbcfb0..2525120cefd8 100644 --- a/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py +++ b/erpnext/stock/doctype/purchase_receipt/test_purchase_receipt.py @@ -595,7 +595,7 @@ def test_pr_billing_status(self): pr2.load_from_db() self.assertEqual(pr2.get("items")[0].billed_amt, 2000) self.assertEqual(pr2.per_billed, 80) - self.assertEqual(pr2.status, "To Bill") + self.assertEqual(pr2.status, "Partly Billed") pr2.cancel() pi2.reload() @@ -1006,7 +1006,7 @@ def test_po_to_pi_and_po_to_pr_worflow_partial(self): pi.load_from_db() pr.load_from_db() - self.assertEqual(pr.status, "To Bill") + self.assertEqual(pr.status, "Partly Billed") self.assertAlmostEqual(pr.per_billed, 50.0, places=2) def test_purchase_receipt_with_exchange_rate_difference(self):