mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-21 07:38:29 +00:00
fix: add return status for purchase receipt
(cherry picked from commit 3a0e1e8ef9)
This commit is contained in:
committed by
Mergify
parent
6a46045804
commit
8ccb9a5ad2
@@ -93,6 +93,7 @@ status_map = {
|
|||||||
["Draft", None],
|
["Draft", None],
|
||||||
["To Bill", "eval:self.per_billed == 0 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"],
|
["Partly Billed", "eval:self.per_billed > 0 and self.per_billed < 100 and self.docstatus == 1"],
|
||||||
|
["Return", "eval:self.is_return == 1 and self.per_billed == 0 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"],
|
||||||
[
|
[
|
||||||
"Completed",
|
"Completed",
|
||||||
|
|||||||
@@ -893,7 +893,7 @@
|
|||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "status",
|
"oldfieldname": "status",
|
||||||
"oldfieldtype": "Select",
|
"oldfieldtype": "Select",
|
||||||
"options": "\nDraft\nPartly Billed\nTo Bill\nCompleted\nReturn Issued\nCancelled\nClosed",
|
"options": "\nDraft\nPartly Billed\nTo Bill\nCompleted\nReturn\nReturn Issued\nCancelled\nClosed",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"print_width": "150px",
|
"print_width": "150px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
@@ -1300,7 +1300,7 @@
|
|||||||
"idx": 261,
|
"idx": 261,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-08-06 16:41:02.690658",
|
"modified": "2025-11-12 19:53:48.173096",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Purchase Receipt",
|
"name": "Purchase Receipt",
|
||||||
|
|||||||
@@ -117,7 +117,15 @@ class PurchaseReceipt(BuyingController):
|
|||||||
shipping_address_display: DF.SmallText | None
|
shipping_address_display: DF.SmallText | None
|
||||||
shipping_rule: DF.Link | None
|
shipping_rule: DF.Link | None
|
||||||
status: DF.Literal[
|
status: DF.Literal[
|
||||||
"", "Draft", "Partly Billed", "To Bill", "Completed", "Return Issued", "Cancelled", "Closed"
|
"",
|
||||||
|
"Draft",
|
||||||
|
"Partly Billed",
|
||||||
|
"To Bill",
|
||||||
|
"Completed",
|
||||||
|
"Return",
|
||||||
|
"Return Issued",
|
||||||
|
"Cancelled",
|
||||||
|
"Closed",
|
||||||
]
|
]
|
||||||
subcontracting_receipt: DF.Link | None
|
subcontracting_receipt: DF.Link | None
|
||||||
supplied_items: DF.Table[PurchaseReceiptItemSupplied]
|
supplied_items: DF.Table[PurchaseReceiptItemSupplied]
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ frappe.listview_settings["Purchase Receipt"] = {
|
|||||||
"currency",
|
"currency",
|
||||||
],
|
],
|
||||||
get_indicator: function (doc) {
|
get_indicator: function (doc) {
|
||||||
if (cint(doc.is_return) == 1) {
|
if (cint(doc.is_return) == 1 && doc.status == "Return") {
|
||||||
return [__("Return"), "gray", "is_return,=,Yes"];
|
return [__("Return"), "gray", "is_return,=,Yes"];
|
||||||
} else if (doc.status === "Closed") {
|
} else if (doc.status === "Closed") {
|
||||||
return [__("Closed"), "green", "status,=,Closed"];
|
return [__("Closed"), "green", "status,=,Closed"];
|
||||||
|
|||||||
@@ -455,6 +455,7 @@ class TestPurchaseReceipt(FrappeTestCase):
|
|||||||
# Check if Original PR updated
|
# Check if Original PR updated
|
||||||
self.assertEqual(pr.items[0].returned_qty, 2)
|
self.assertEqual(pr.items[0].returned_qty, 2)
|
||||||
self.assertEqual(pr.per_returned, 40)
|
self.assertEqual(pr.per_returned, 40)
|
||||||
|
self.assertEqual(returned.status, "Return")
|
||||||
|
|
||||||
from erpnext.controllers.sales_and_purchase_return import make_return_doc
|
from erpnext.controllers.sales_and_purchase_return import make_return_doc
|
||||||
|
|
||||||
@@ -2128,7 +2129,7 @@ class TestPurchaseReceipt(FrappeTestCase):
|
|||||||
return_pr.items[0].stock_qty = 0.0
|
return_pr.items[0].stock_qty = 0.0
|
||||||
return_pr.submit()
|
return_pr.submit()
|
||||||
|
|
||||||
self.assertEqual(return_pr.status, "To Bill")
|
self.assertEqual(return_pr.status, "Return")
|
||||||
|
|
||||||
pi = make_purchase_invoice(return_pr.name)
|
pi = make_purchase_invoice(return_pr.name)
|
||||||
pi.submit()
|
pi.submit()
|
||||||
|
|||||||
Reference in New Issue
Block a user