Merge pull request #44128 from frappe/mergify/bp/version-14-hotfix/pr-39543

feat: Partly billed status in Purchase Receipt (backport #39543)
This commit is contained in:
ruthra kumar
2024-11-13 18:04:39 +05:30
committed by GitHub
3 changed files with 7 additions and 4 deletions

View File

@@ -91,7 +91,8 @@ status_map = {
],
"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"],

View File

@@ -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"];
}

View File

@@ -595,7 +595,7 @@ class TestPurchaseReceipt(FrappeTestCase):
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 @@ class TestPurchaseReceipt(FrappeTestCase):
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):