mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-20 01:55:01 +00:00
feat(delivery-note): add status indicator when document is partially billed
(cherry picked from commit 7767000ccf)
# Conflicts:
# erpnext/stock/doctype/delivery_note/delivery_note.json
This commit is contained in:
committed by
ruthra kumar
parent
a1b1011555
commit
e5e3b8a6ae
@@ -83,7 +83,8 @@ status_map = {
|
|||||||
],
|
],
|
||||||
"Delivery Note": [
|
"Delivery Note": [
|
||||||
["Draft", None],
|
["Draft", None],
|
||||||
["To Bill", "eval:self.per_billed < 100 and self.docstatus == 1"],
|
["To Bill", "eval:self.per_billed == 0 and self.docstatus == 1"],
|
||||||
|
["Partially Billed", "eval:self.per_billed < 100 and self.per_billed > 0 and self.docstatus == 1"],
|
||||||
["Completed", "eval:self.per_billed == 100 and self.docstatus == 1"],
|
["Completed", "eval:self.per_billed == 100 and self.docstatus == 1"],
|
||||||
["Return Issued", "eval:self.per_returned == 100 and self.docstatus == 1"],
|
["Return Issued", "eval:self.per_returned == 100 and self.docstatus == 1"],
|
||||||
["Return", "eval:self.is_return == 1 and self.per_billed == 0 and self.docstatus == 1"],
|
["Return", "eval:self.is_return == 1 and self.per_billed == 0 and self.docstatus == 1"],
|
||||||
|
|||||||
@@ -1091,7 +1091,7 @@
|
|||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "status",
|
"oldfieldname": "status",
|
||||||
"oldfieldtype": "Select",
|
"oldfieldtype": "Select",
|
||||||
"options": "\nDraft\nTo Bill\nCompleted\nReturn\nReturn Issued\nCancelled\nClosed",
|
"options": "\nDraft\nTo Bill\nPartially Billed\nCompleted\nReturn\nReturn Issued\nCancelled\nClosed",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"print_width": "150px",
|
"print_width": "150px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
@@ -1404,7 +1404,7 @@
|
|||||||
"idx": 146,
|
"idx": 146,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-12-02 23:55:25.415443",
|
"modified": "2026-02-03 12:27:19.055918",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Delivery Note",
|
"name": "Delivery Note",
|
||||||
|
|||||||
@@ -127,7 +127,15 @@ class DeliveryNote(SellingController):
|
|||||||
shipping_rule: DF.Link | None
|
shipping_rule: DF.Link | None
|
||||||
source: DF.Link | None
|
source: DF.Link | None
|
||||||
status: DF.Literal[
|
status: DF.Literal[
|
||||||
"", "Draft", "To Bill", "Completed", "Return", "Return Issued", "Cancelled", "Closed"
|
"",
|
||||||
|
"Draft",
|
||||||
|
"To Bill",
|
||||||
|
"Partially Billed",
|
||||||
|
"Completed",
|
||||||
|
"Return",
|
||||||
|
"Return Issued",
|
||||||
|
"Cancelled",
|
||||||
|
"Closed",
|
||||||
]
|
]
|
||||||
tax_category: DF.Link | None
|
tax_category: DF.Link | None
|
||||||
tax_id: DF.Data | None
|
tax_id: DF.Data | None
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ frappe.listview_settings["Delivery Note"] = {
|
|||||||
return [__("Closed"), "green", "status,=,Closed"];
|
return [__("Closed"), "green", "status,=,Closed"];
|
||||||
} else if (doc.status === "Return Issued") {
|
} else if (doc.status === "Return Issued") {
|
||||||
return [__("Return Issued"), "grey", "status,=,Return Issued"];
|
return [__("Return Issued"), "grey", "status,=,Return Issued"];
|
||||||
} else if (flt(doc.per_billed, 2) < 100) {
|
} else if (flt(doc.per_billed) == 0) {
|
||||||
return [__("To Bill"), "orange", "per_billed,<,100|docstatus,=,1"];
|
return [__("To Bill"), "orange", "per_billed,=,0|docstatus,=,1"];
|
||||||
|
} else if (flt(doc.per_billed, 2) > 0 && flt(doc.per_billed, 2) < 100) {
|
||||||
|
return [__("Partially Billed"), "yellow", "per_billed,<,100|docstatus,=,1"];
|
||||||
} else if (flt(doc.per_billed, 2) === 100) {
|
} else if (flt(doc.per_billed, 2) === 100) {
|
||||||
return [__("Completed"), "green", "per_billed,=,100|docstatus,=,1"];
|
return [__("Completed"), "green", "per_billed,=,100|docstatus,=,1"];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1093,7 +1093,8 @@ class TestDeliveryNote(FrappeTestCase):
|
|||||||
|
|
||||||
self.assertEqual(dn2.get("items")[0].billed_amt, 400)
|
self.assertEqual(dn2.get("items")[0].billed_amt, 400)
|
||||||
self.assertEqual(dn2.per_billed, 80)
|
self.assertEqual(dn2.per_billed, 80)
|
||||||
self.assertEqual(dn2.status, "To Bill")
|
# Since 20% of DN2 is yet to be billed, it should be classified as partially billed.
|
||||||
|
self.assertEqual(dn2.status, "Partially Billed")
|
||||||
|
|
||||||
def test_dn_billing_status_case4(self):
|
def test_dn_billing_status_case4(self):
|
||||||
# SO -> SI -> DN
|
# SO -> SI -> DN
|
||||||
|
|||||||
Reference in New Issue
Block a user